diff options
author | Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> | 2009-03-24 13:59:22 +0100 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2009-03-27 16:15:39 +0100 |
commit | 6b0c9351426bdedcbe8fb81149a072de96991666 (patch) | |
tree | 48b4a924fe375adc3366160a8ca58a73984d5e7c | |
parent | b92efa9abffc4a634cd2e7a0f81f8aa6310d67c9 (diff) | |
download | op-kernel-dev-6b0c9351426bdedcbe8fb81149a072de96991666.zip op-kernel-dev-6b0c9351426bdedcbe8fb81149a072de96991666.tar.gz |
avr32: at32ap700x: setup DMA for ABDAC in the machine code
This patch will adjust the setup the DMA controller for the Audio
Bistream DAC in the at32ap700x machine code. This setup matches the new
ALSA driver for the ABDAC.
Tested on ATSTK1006 + ATSTK1000.
This patch will setup the needed platform data for the Audio Bistream
DAC used by the Favr-32 board.
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
[haavard.skinnemoen@atmel.com: fold board code update]
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
-rw-r--r-- | arch/avr32/boards/favr-32/setup.c | 7 | ||||
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 29 | ||||
-rw-r--r-- | arch/avr32/mach-at32ap/include/mach/board.h | 7 |
3 files changed, 33 insertions, 10 deletions
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c index 745c408..cf6e4e5 100644 --- a/arch/avr32/boards/favr-32/setup.c +++ b/arch/avr32/boards/favr-32/setup.c @@ -22,6 +22,8 @@ #include <linux/spi/spi.h> #include <linux/spi/ads7846.h> +#include <sound/atmel-abdac.h> + #include <video/atmel_lcdc.h> #include <asm/setup.h> @@ -41,6 +43,9 @@ unsigned long at32_board_osc_rates[3] = { /* Initialized by bootloader-specific startup code. */ struct tag *bootloader_tags __initdata; +static struct atmel_abdac_pdata __initdata abdac0_data = { +}; + struct eth_addr { u8 addr[6]; }; @@ -326,7 +331,7 @@ static int __init favr32_init(void) spi1_board_info[0].irq = gpio_to_irq(GPIO_PIN_PB(3)); - set_abdac_rate(at32_add_device_abdac(0)); + set_abdac_rate(at32_add_device_abdac(0, &abdac0_data)); at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel); at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 402cae8..1bc6389 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c @@ -26,6 +26,8 @@ #include <mach/portmux.h> #include <mach/sram.h> +#include <sound/atmel-abdac.h> + #include <video/atmel_lcdc.h> #include "clock.h" @@ -2053,21 +2055,34 @@ static struct clk abdac0_sample_clk = { .index = 6, }; -struct platform_device *__init at32_add_device_abdac(unsigned int id) +struct platform_device *__init +at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data) { - struct platform_device *pdev; - u32 pin_mask; + struct platform_device *pdev; + struct dw_dma_slave *dws; + u32 pin_mask; - if (id != 0) + if (id != 0 || !data) return NULL; - pdev = platform_device_alloc("abdac", id); + pdev = platform_device_alloc("atmel_abdac", id); if (!pdev) return NULL; if (platform_device_add_resources(pdev, abdac0_resource, ARRAY_SIZE(abdac0_resource))) - goto err_add_resources; + goto out_free_resources; + + dws = &data->dws; + + dws->dma_dev = &dw_dmac0_device.dev; + dws->reg_width = DW_DMA_SLAVE_WIDTH_32BIT; + dws->cfg_hi = DWC_CFGH_DST_PER(2); + dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL); + + if (platform_device_add_data(pdev, data, + sizeof(struct atmel_abdac_pdata))) + goto out_free_resources; pin_mask = (1 << 20) | (1 << 22); /* DATA1 & DATAN1 */ pin_mask |= (1 << 21) | (1 << 23); /* DATA0 & DATAN0 */ @@ -2080,7 +2095,7 @@ struct platform_device *__init at32_add_device_abdac(unsigned int id) platform_device_add(pdev); return pdev; -err_add_resources: +out_free_resources: platform_device_put(pdev); return NULL; } diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h index cff8e84f..63ec400 100644 --- a/arch/avr32/mach-at32ap/include/mach/board.h +++ b/arch/avr32/mach-at32ap/include/mach/board.h @@ -13,7 +13,7 @@ * in this array is chip-dependent. */ extern unsigned long at32_board_osc_rates[]; - + /* * This used to add essential system devices, but this is now done * automatically. Please don't use it in new board code. @@ -97,7 +97,10 @@ struct ac97c_platform_data { struct platform_device * at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data); -struct platform_device *at32_add_device_abdac(unsigned int id); +struct atmel_abdac_pdata; +struct platform_device * +at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data); + struct platform_device *at32_add_device_psif(unsigned int id); struct cf_platform_data { |