aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>2009-03-24 13:59:23 +0100
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2009-03-27 16:15:39 +0100
commit2f47c8c5556e91f309e24162263ebacff6973007 (patch)
treec79f2c411793070e9b6ec22048f5cde3ef9f3c7b
parent6b0c9351426bdedcbe8fb81149a072de96991666 (diff)
avr32: at32ap700x: setup DMA for AC97C in the machine code
This patch will adjust the setup the DMA controller for the AC97 Controller in the at32ap700x machine code. This setup matches the new ALSA driver for the AC97C. The struct ac97c_platform_data has been moved into its own header file located in the sound include path. Tested on ATSTK1006 + ATSTK1000. This patch will setup the AC97 controller properly for the adjusted machine code. Both EVKLCD10x and Hammerhead board has been updated. Tested on EVKLCD10x, and copied to Hammerhead board. Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> [haavard.skinnemoen@atmel.com: fold with board code update] Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
-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 @@
#include <mach/portmux.h>
#include <mach/board.h>
+#include <sound/atmel-ac97c.h>
+
static struct ac97c_platform_data __initdata ac97c0_data = {
- .dma_rx_periph_id = 3,
- .dma_tx_periph_id = 4,
- .dma_controller_id = 0,
- .reset_pin = GPIO_PIN_PB(19),
+ .reset_pin = GPIO_PIN_PB(19),
};
#ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
@@ -167,7 +166,7 @@ static int __init atevklcd10x_init(void)
fbmem_start, fbmem_size,
ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL);
- at32_add_device_ac97c(0, &ac97c0_data);
+ at32_add_device_ac97c(0, &ac97c0_data, AC97C_BOTH);
return 0;
}
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 @@
#include <mach/init.h>
#include <mach/portmux.h>
+#include <sound/atmel-ac97c.h>
+
#include "../../mach-at32ap/clock.h"
#include "flash.h"
@@ -233,7 +235,7 @@ static int __init hammerhead_init(void)
i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
#ifdef CONFIG_BOARD_HAMMERHEAD_SND
- at32_add_device_ac97c(0, &ac97c_data);
+ at32_add_device_ac97c(0, &ac97c_data, AC97C_BOTH);
#endif
/* 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 @@
#include <mach/sram.h>
#include <sound/atmel-abdac.h>
+#include <sound/atmel-ac97c.h>
#include <video/atmel_lcdc.h>
@@ -1982,11 +1983,14 @@ static struct clk atmel_ac97c0_pclk = {
};
struct platform_device *__init
-at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
+at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
+ unsigned int flags)
{
- struct platform_device *pdev;
- struct ac97c_platform_data _data;
- u32 pin_mask;
+ struct platform_device *pdev;
+ struct dw_dma_slave *rx_dws;
+ struct dw_dma_slave *tx_dws;
+ struct ac97c_platform_data _data;
+ u32 pin_mask;
if (id != 0)
return NULL;
@@ -1997,37 +2001,52 @@ at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
ARRAY_SIZE(atmel_ac97c0_resource)))
- goto fail;
+ goto out_free_resources;
if (!data) {
data = &_data;
memset(data, 0, sizeof(struct ac97c_platform_data));
- data->reset_pin = GPIO_PIN_NONE;
+ data->reset_pin = -ENODEV;
}
- data->dma_rx_periph_id = 3;
- data->dma_tx_periph_id = 4;
- data->dma_controller_id = 0;
+ rx_dws = &data->rx_dws;
+ tx_dws = &data->tx_dws;
+
+ /* Check if DMA slave interface for capture should be configured. */
+ if (flags & AC97C_CAPTURE) {
+ rx_dws->dma_dev = &dw_dmac0_device.dev;
+ rx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
+ rx_dws->cfg_hi = DWC_CFGH_SRC_PER(3);
+ rx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
+ }
+
+ /* Check if DMA slave interface for playback should be configured. */
+ if (flags & AC97C_PLAYBACK) {
+ tx_dws->dma_dev = &dw_dmac0_device.dev;
+ tx_dws->reg_width = DW_DMA_SLAVE_WIDTH_16BIT;
+ tx_dws->cfg_hi = DWC_CFGH_DST_PER(4);
+ tx_dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | DWC_CFGL_HS_SRC_POL);
+ }
if (platform_device_add_data(pdev, data,
sizeof(struct ac97c_platform_data)))
- goto fail;
+ goto out_free_resources;
- pin_mask = (1 << 20) | (1 << 21); /* SDO & SYNC */
- pin_mask |= (1 << 22) | (1 << 23); /* SCLK & SDI */
+ /* SDO | SYNC | SCLK | SDI */
+ pin_mask = (1 << 20) | (1 << 21) | (1 << 22) | (1 << 23);
select_peripheral(PIOB, pin_mask, PERIPH_B, 0);
- /* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */
- if (data->reset_pin != GPIO_PIN_NONE)
- at32_select_gpio(data->reset_pin, 0);
+ if (gpio_is_valid(data->reset_pin))
+ at32_select_gpio(data->reset_pin, AT32_GPIOF_OUTPUT
+ | AT32_GPIOF_HIGH);
atmel_ac97c0_pclk.dev = &pdev->dev;
platform_device_add(pdev);
return pdev;
-fail:
+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 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;
struct platform_device *
at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
-struct ac97c_platform_data {
- unsigned short dma_rx_periph_id;
- unsigned short dma_tx_periph_id;
- unsigned short dma_controller_id;
- int reset_pin;
-};
+struct ac97c_platform_data;
struct platform_device *
-at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data);
+at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data,
+ unsigned int flags);
struct atmel_abdac_pdata;
struct platform_device *