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>
This commit is contained in:
parent
6b0c935142
commit
2f47c8c555
|
@ -23,10 +23,9 @@
|
||||||
#include <mach/portmux.h>
|
#include <mach/portmux.h>
|
||||||
#include <mach/board.h>
|
#include <mach/board.h>
|
||||||
|
|
||||||
|
#include <sound/atmel-ac97c.h>
|
||||||
|
|
||||||
static struct ac97c_platform_data __initdata ac97c0_data = {
|
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),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -167,7 +166,7 @@ static int __init atevklcd10x_init(void)
|
||||||
fbmem_start, fbmem_size,
|
fbmem_start, fbmem_size,
|
||||||
ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include <mach/init.h>
|
#include <mach/init.h>
|
||||||
#include <mach/portmux.h>
|
#include <mach/portmux.h>
|
||||||
|
|
||||||
|
#include <sound/atmel-ac97c.h>
|
||||||
|
|
||||||
#include "../../mach-at32ap/clock.h"
|
#include "../../mach-at32ap/clock.h"
|
||||||
#include "flash.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));
|
i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
|
||||||
|
|
||||||
#ifdef CONFIG_BOARD_HAMMERHEAD_SND
|
#ifdef CONFIG_BOARD_HAMMERHEAD_SND
|
||||||
at32_add_device_ac97c(0, &ac97c_data);
|
at32_add_device_ac97c(0, &ac97c_data, AC97C_BOTH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Select the Touchscreen interrupt pin mode */
|
/* Select the Touchscreen interrupt pin mode */
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <mach/sram.h>
|
#include <mach/sram.h>
|
||||||
|
|
||||||
#include <sound/atmel-abdac.h>
|
#include <sound/atmel-abdac.h>
|
||||||
|
#include <sound/atmel-ac97c.h>
|
||||||
|
|
||||||
#include <video/atmel_lcdc.h>
|
#include <video/atmel_lcdc.h>
|
||||||
|
|
||||||
|
@ -1982,9 +1983,12 @@ static struct clk atmel_ac97c0_pclk = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct platform_device *__init
|
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 platform_device *pdev;
|
||||||
|
struct dw_dma_slave *rx_dws;
|
||||||
|
struct dw_dma_slave *tx_dws;
|
||||||
struct ac97c_platform_data _data;
|
struct ac97c_platform_data _data;
|
||||||
u32 pin_mask;
|
u32 pin_mask;
|
||||||
|
|
||||||
|
@ -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,
|
if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
|
||||||
ARRAY_SIZE(atmel_ac97c0_resource)))
|
ARRAY_SIZE(atmel_ac97c0_resource)))
|
||||||
goto fail;
|
goto out_free_resources;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = &_data;
|
data = &_data;
|
||||||
memset(data, 0, sizeof(struct ac97c_platform_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;
|
rx_dws = &data->rx_dws;
|
||||||
data->dma_tx_periph_id = 4;
|
tx_dws = &data->tx_dws;
|
||||||
data->dma_controller_id = 0;
|
|
||||||
|
/* 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,
|
if (platform_device_add_data(pdev, data,
|
||||||
sizeof(struct ac97c_platform_data)))
|
sizeof(struct ac97c_platform_data)))
|
||||||
goto fail;
|
goto out_free_resources;
|
||||||
|
|
||||||
pin_mask = (1 << 20) | (1 << 21); /* SDO & SYNC */
|
/* SDO | SYNC | SCLK | SDI */
|
||||||
pin_mask |= (1 << 22) | (1 << 23); /* SCLK & SDI */
|
pin_mask = (1 << 20) | (1 << 21) | (1 << 22) | (1 << 23);
|
||||||
|
|
||||||
select_peripheral(PIOB, pin_mask, PERIPH_B, 0);
|
select_peripheral(PIOB, pin_mask, PERIPH_B, 0);
|
||||||
|
|
||||||
/* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */
|
if (gpio_is_valid(data->reset_pin))
|
||||||
if (data->reset_pin != GPIO_PIN_NONE)
|
at32_select_gpio(data->reset_pin, AT32_GPIOF_OUTPUT
|
||||||
at32_select_gpio(data->reset_pin, 0);
|
| AT32_GPIOF_HIGH);
|
||||||
|
|
||||||
atmel_ac97c0_pclk.dev = &pdev->dev;
|
atmel_ac97c0_pclk.dev = &pdev->dev;
|
||||||
|
|
||||||
platform_device_add(pdev);
|
platform_device_add(pdev);
|
||||||
return pdev;
|
return pdev;
|
||||||
|
|
||||||
fail:
|
out_free_resources:
|
||||||
platform_device_put(pdev);
|
platform_device_put(pdev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,14 +88,10 @@ struct mci_platform_data;
|
||||||
struct platform_device *
|
struct platform_device *
|
||||||
at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
|
at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
|
||||||
|
|
||||||
struct ac97c_platform_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 platform_device *
|
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 atmel_abdac_pdata;
|
||||||
struct platform_device *
|
struct platform_device *
|
||||||
|
|
Loading…
Reference in New Issue