aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/avr32/boards/atngw100/evklcd10x.c9
-rw-r--r--arch/avr32/boards/hammerhead/setup.c4
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c51
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h10
4 files changed, 45 insertions, 29 deletions
diff --git a/arch/avr32/boards/atngw100/evklcd10x.c b/arch/avr32/boards/atngw100/evklcd10x.c
index ae699120540..00337112c5a 100644
--- a/arch/avr32/boards/atngw100/evklcd10x.c
+++ b/arch/avr32/boards/atngw100/evklcd10x.c
@@ -23,11 +23,10 @@
23#include <mach/portmux.h> 23#include <mach/portmux.h>
24#include <mach/board.h> 24#include <mach/board.h>
25 25
26#include <sound/atmel-ac97c.h>
27
26static struct ac97c_platform_data __initdata ac97c0_data = { 28static struct ac97c_platform_data __initdata ac97c0_data = {
27 .dma_rx_periph_id = 3, 29 .reset_pin = GPIO_PIN_PB(19),
28 .dma_tx_periph_id = 4,
29 .dma_controller_id = 0,
30 .reset_pin = GPIO_PIN_PB(19),
31}; 30};
32 31
33#ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA 32#ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
@@ -167,7 +166,7 @@ static int __init atevklcd10x_init(void)
167 fbmem_start, fbmem_size, 166 fbmem_start, fbmem_size,
168 ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL); 167 ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL);
169 168
170 at32_add_device_ac97c(0, &ac97c0_data); 169 at32_add_device_ac97c(0, &ac97c0_data, AC97C_BOTH);
171 170
172 return 0; 171 return 0;
173} 172}
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
index 4d2fe82b202..a5c2da25c4f 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -29,6 +29,8 @@
29#include <mach/init.h> 29#include <mach/init.h>
30#include <mach/portmux.h> 30#include <mach/portmux.h>
31 31
32#include <sound/atmel-ac97c.h>
33
32#include "../../mach-at32ap/clock.h" 34#include "../../mach-at32ap/clock.h"
33#include "flash.h" 35#include "flash.h"
34 36
@@ -233,7 +235,7 @@ static int __init hammerhead_init(void)
233 i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info)); 235 i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
234 236
235#ifdef CONFIG_BOARD_HAMMERHEAD_SND 237#ifdef CONFIG_BOARD_HAMMERHEAD_SND
236 at32_add_device_ac97c(0, &ac97c_data); 238 at32_add_device_ac97c(0, &ac97c_data, AC97C_BOTH);
237#endif 239#endif
238 240
239 /* Select the Touchscreen interrupt pin mode */ 241 /* Select the Touchscreen interrupt pin mode */
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 *