aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32/mach-at32ap')
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c51
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h10
2 files changed, 38 insertions, 23 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 1bc6389b20b..62501d64322 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -27,6 +27,7 @@
27#include <mach/sram.h> 27#include <mach/sram.h>
28 28
29#include <sound/atmel-abdac.h> 29#include <sound/atmel-abdac.h>
30#include <sound/atmel-ac97c.h>
30 31
31#include <video/atmel_lcdc.h> 32#include <video/atmel_lcdc.h>
32 33
@@ -1982,11 +1983,14 @@ static struct clk atmel_ac97c0_pclk = {
1982}; 1983};
1983 1984
1984struct platform_device *__init 1985struct platform_device *__init
1985at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data) 1986at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
1987 unsigned int flags)
1986{ 1988{
1987 struct platform_device *pdev; 1989 struct platform_device *pdev;
1988 struct ac97c_platform_data _data; 1990 struct dw_dma_slave *rx_dws;
1989 u32 pin_mask; 1991 struct dw_dma_slave *tx_dws;
1992 struct ac97c_platform_data _data;
1993 u32 pin_mask;
1990 1994
1991 if (id != 0) 1995 if (id != 0)
1992 return NULL; 1996 return NULL;
@@ -1997,37 +2001,52 @@ at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
1997 2001
1998 if (platform_device_add_resources(pdev, atmel_ac97c0_resource, 2002 if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
1999 ARRAY_SIZE(atmel_ac97c0_resource))) 2003 ARRAY_SIZE(atmel_ac97c0_resource)))
2000 goto fail; 2004 goto out_free_resources;
2001 2005
2002 if (!data) { 2006 if (!data) {
2003 data = &_data; 2007 data = &_data;
2004 memset(data, 0, sizeof(struct ac97c_platform_data)); 2008 memset(data, 0, sizeof(struct ac97c_platform_data));
2005 data->reset_pin = GPIO_PIN_NONE; 2009 data->reset_pin = -ENODEV;
2006 } 2010 }
2007 2011
2008 data->dma_rx_periph_id = 3; 2012 rx_dws = &data->rx_dws;
2009 data->dma_tx_periph_id = 4; 2013 tx_dws = &data->tx_dws;
2010 data->dma_controller_id = 0; 2014
2015 /* Check if DMA slave interface for capture should be configured. */
2016 if (flags & AC97C_CAPTURE) {
2017 rx_dws->dma_dev = &dw_dmac0_device.dev;
2018 rx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
2019 rx_dws->cfg_hi = DWC_CFGH_SRC_PER(3);
2020 rx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2021 }
2022
2023 /* Check if DMA slave interface for playback should be configured. */
2024 if (flags & AC97C_PLAYBACK) {
2025 tx_dws->dma_dev = &dw_dmac0_device.dev;
2026 tx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
2027 tx_dws->cfg_hi = DWC_CFGH_DST_PER(4);
2028 tx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2029 }
2011 2030
2012 if (platform_device_add_data(pdev, data, 2031 if (platform_device_add_data(pdev, data,
2013 sizeof(struct ac97c_platform_data))) 2032 sizeof(struct ac97c_platform_data)))
2014 goto fail; 2033 goto out_free_resources;
2015 2034
2016 pin_mask = (1 << 20) | (1 << 21); /* SDO & SYNC */ 2035 /* SDO | SYNC | SCLK | SDI */
2017 pin_mask |= (1 << 22) | (1 << 23); /* SCLK & SDI */ 2036 pin_mask = (1 << 20) | (1 << 21) | (1 << 22) | (1 << 23);
2018 2037
2019 select_peripheral(PIOB, pin_mask, PERIPH_B, 0); 2038 select_peripheral(PIOB, pin_mask, PERIPH_B, 0);
2020 2039
2021 /* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */ 2040 if (gpio_is_valid(data->reset_pin))
2022 if (data->reset_pin != GPIO_PIN_NONE) 2041 at32_select_gpio(data->reset_pin, AT32_GPIOF_OUTPUT
2023 at32_select_gpio(data->reset_pin, 0); 2042 | AT32_GPIOF_HIGH);
2024 2043
2025 atmel_ac97c0_pclk.dev = &pdev->dev; 2044 atmel_ac97c0_pclk.dev = &pdev->dev;
2026 2045
2027 platform_device_add(pdev); 2046 platform_device_add(pdev);
2028 return pdev; 2047 return pdev;
2029 2048
2030fail: 2049out_free_resources:
2031 platform_device_put(pdev); 2050 platform_device_put(pdev);
2032 return NULL; 2051 return NULL;
2033} 2052}
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index 63ec4008b25..b363b067b0a 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -88,14 +88,10 @@ struct mci_platform_data;
88struct platform_device * 88struct platform_device *
89at32_add_device_mci(unsigned int id, struct mci_platform_data *data); 89at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
90 90
91struct ac97c_platform_data { 91struct ac97c_platform_data;
92 unsigned short dma_rx_periph_id;
93 unsigned short dma_tx_periph_id;
94 unsigned short dma_controller_id;
95 int reset_pin;
96};
97struct platform_device * 92struct platform_device *
98at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data); 93at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
94 unsigned int flags);
99 95
100struct atmel_abdac_pdata; 96struct atmel_abdac_pdata;
101struct platform_device * 97struct platform_device *