aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>2009-03-24 08:59:22 -0400
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2009-03-27 11:15:39 -0400
commit6b0c9351426bdedcbe8fb81149a072de96991666 (patch)
tree48b4a924fe375adc3366160a8ca58a73984d5e7c /arch
parentb92efa9abffc4a634cd2e7a0f81f8aa6310d67c9 (diff)
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/avr32/boards/favr-32/setup.c7
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c29
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h7
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 745c408c2ac5..cf6e4e5624d0 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -22,6 +22,8 @@
22#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
23#include <linux/spi/ads7846.h> 23#include <linux/spi/ads7846.h>
24 24
25#include <sound/atmel-abdac.h>
26
25#include <video/atmel_lcdc.h> 27#include <video/atmel_lcdc.h>
26 28
27#include <asm/setup.h> 29#include <asm/setup.h>
@@ -41,6 +43,9 @@ unsigned long at32_board_osc_rates[3] = {
41/* Initialized by bootloader-specific startup code. */ 43/* Initialized by bootloader-specific startup code. */
42struct tag *bootloader_tags __initdata; 44struct tag *bootloader_tags __initdata;
43 45
46static struct atmel_abdac_pdata __initdata abdac0_data = {
47};
48
44struct eth_addr { 49struct eth_addr {
45 u8 addr[6]; 50 u8 addr[6];
46}; 51};
@@ -326,7 +331,7 @@ static int __init favr32_init(void)
326 331
327 spi1_board_info[0].irq = gpio_to_irq(GPIO_PIN_PB(3)); 332 spi1_board_info[0].irq = gpio_to_irq(GPIO_PIN_PB(3));
328 333
329 set_abdac_rate(at32_add_device_abdac(0)); 334 set_abdac_rate(at32_add_device_abdac(0, &abdac0_data));
330 335
331 at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel); 336 at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel);
332 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 337 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 402cae8f9205..1bc6389b20b0 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -26,6 +26,8 @@
26#include <mach/portmux.h> 26#include <mach/portmux.h>
27#include <mach/sram.h> 27#include <mach/sram.h>
28 28
29#include <sound/atmel-abdac.h>
30
29#include <video/atmel_lcdc.h> 31#include <video/atmel_lcdc.h>
30 32
31#include "clock.h" 33#include "clock.h"
@@ -2053,21 +2055,34 @@ static struct clk abdac0_sample_clk = {
2053 .index = 6, 2055 .index = 6,
2054}; 2056};
2055 2057
2056struct platform_device *__init at32_add_device_abdac(unsigned int id) 2058struct platform_device *__init
2059at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data)
2057{ 2060{
2058 struct platform_device *pdev; 2061 struct platform_device *pdev;
2059 u32 pin_mask; 2062 struct dw_dma_slave *dws;
2063 u32 pin_mask;
2060 2064
2061 if (id != 0) 2065 if (id != 0 || !data)
2062 return NULL; 2066 return NULL;
2063 2067
2064 pdev = platform_device_alloc("abdac", id); 2068 pdev = platform_device_alloc("atmel_abdac", id);
2065 if (!pdev) 2069 if (!pdev)
2066 return NULL; 2070 return NULL;
2067 2071
2068 if (platform_device_add_resources(pdev, abdac0_resource, 2072 if (platform_device_add_resources(pdev, abdac0_resource,
2069 ARRAY_SIZE(abdac0_resource))) 2073 ARRAY_SIZE(abdac0_resource)))
2070 goto err_add_resources; 2074 goto out_free_resources;
2075
2076 dws = &data->dws;
2077
2078 dws->dma_dev = &dw_dmac0_device.dev;
2079 dws->reg_width = DW_DMA_SLAVE_WIDTH_32BIT;
2080 dws->cfg_hi = DWC_CFGH_DST_PER(2);
2081 dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
2082
2083 if (platform_device_add_data(pdev, data,
2084 sizeof(struct atmel_abdac_pdata)))
2085 goto out_free_resources;
2071 2086
2072 pin_mask = (1 << 20) | (1 << 22); /* DATA1 & DATAN1 */ 2087 pin_mask = (1 << 20) | (1 << 22); /* DATA1 & DATAN1 */
2073 pin_mask |= (1 << 21) | (1 << 23); /* DATA0 & DATAN0 */ 2088 pin_mask |= (1 << 21) | (1 << 23); /* DATA0 & DATAN0 */
@@ -2080,7 +2095,7 @@ struct platform_device *__init at32_add_device_abdac(unsigned int id)
2080 platform_device_add(pdev); 2095 platform_device_add(pdev);
2081 return pdev; 2096 return pdev;
2082 2097
2083err_add_resources: 2098out_free_resources:
2084 platform_device_put(pdev); 2099 platform_device_put(pdev);
2085 return NULL; 2100 return NULL;
2086} 2101}
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index cff8e84f78f2..63ec4008b253 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -13,7 +13,7 @@
13 * in this array is chip-dependent. 13 * in this array is chip-dependent.
14 */ 14 */
15extern unsigned long at32_board_osc_rates[]; 15extern unsigned long at32_board_osc_rates[];
16 16
17/* 17/*
18 * This used to add essential system devices, but this is now done 18 * This used to add essential system devices, but this is now done
19 * automatically. Please don't use it in new board code. 19 * automatically. Please don't use it in new board code.
@@ -97,7 +97,10 @@ struct ac97c_platform_data {
97struct platform_device * 97struct platform_device *
98at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data); 98at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data);
99 99
100struct platform_device *at32_add_device_abdac(unsigned int id); 100struct atmel_abdac_pdata;
101struct platform_device *
102at32_add_device_abdac(unsigned int id, struct atmel_abdac_pdata *data);
103
101struct platform_device *at32_add_device_psif(unsigned int id); 104struct platform_device *at32_add_device_psif(unsigned int id);
102 105
103struct cf_platform_data { 106struct cf_platform_data {