aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c34
-rw-r--r--include/asm-avr32/arch-at32ap/board.h10
2 files changed, 36 insertions, 8 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 4ac38d28891d..30c7cdab28d0 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1883,9 +1883,11 @@ static struct clk atmel_ac97c0_pclk = {
1883 .index = 10, 1883 .index = 10,
1884}; 1884};
1885 1885
1886struct platform_device *__init at32_add_device_ac97c(unsigned int id) 1886struct platform_device *__init
1887at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
1887{ 1888{
1888 struct platform_device *pdev; 1889 struct platform_device *pdev;
1890 struct ac97c_platform_data _data;
1889 1891
1890 if (id != 0) 1892 if (id != 0)
1891 return NULL; 1893 return NULL;
@@ -1896,19 +1898,37 @@ struct platform_device *__init at32_add_device_ac97c(unsigned int id)
1896 1898
1897 if (platform_device_add_resources(pdev, atmel_ac97c0_resource, 1899 if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
1898 ARRAY_SIZE(atmel_ac97c0_resource))) 1900 ARRAY_SIZE(atmel_ac97c0_resource)))
1899 goto err_add_resources; 1901 goto fail;
1902
1903 if (!data) {
1904 data = &_data;
1905 memset(data, 0, sizeof(struct ac97c_platform_data));
1906 data->reset_pin = GPIO_PIN_NONE;
1907 }
1908
1909 data->dma_rx_periph_id = 3;
1910 data->dma_tx_periph_id = 4;
1911 data->dma_controller_id = 0;
1900 1912
1901 select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */ 1913 if (platform_device_add_data(pdev, data,
1902 select_peripheral(PB(21), PERIPH_B, 0); /* SDO */ 1914 sizeof(struct ac97c_platform_data)))
1903 select_peripheral(PB(22), PERIPH_B, 0); /* SDI */ 1915 goto fail;
1904 select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */ 1916
1917 select_peripheral(PB(20), PERIPH_B, 0); /* SDO */
1918 select_peripheral(PB(21), PERIPH_B, 0); /* SYNC */
1919 select_peripheral(PB(22), PERIPH_B, 0); /* SCLK */
1920 select_peripheral(PB(23), PERIPH_B, 0); /* SDI */
1921
1922 /* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */
1923 if (data->reset_pin != GPIO_PIN_NONE)
1924 at32_select_gpio(data->reset_pin, 0);
1905 1925
1906 atmel_ac97c0_pclk.dev = &pdev->dev; 1926 atmel_ac97c0_pclk.dev = &pdev->dev;
1907 1927
1908 platform_device_add(pdev); 1928 platform_device_add(pdev);
1909 return pdev; 1929 return pdev;
1910 1930
1911err_add_resources: 1931fail:
1912 platform_device_put(pdev); 1932 platform_device_put(pdev);
1913 return NULL; 1933 return NULL;
1914} 1934}
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index a3783861cdd2..203cb4ead2c8 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -82,7 +82,15 @@ struct mci_platform_data;
82struct platform_device * 82struct platform_device *
83at32_add_device_mci(unsigned int id, struct mci_platform_data *data); 83at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
84 84
85struct platform_device *at32_add_device_ac97c(unsigned int id); 85struct ac97c_platform_data {
86 unsigned short dma_rx_periph_id;
87 unsigned short dma_tx_periph_id;
88 unsigned short dma_controller_id;
89 int reset_pin;
90};
91struct platform_device *
92at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data);
93
86struct platform_device *at32_add_device_abdac(unsigned int id); 94struct platform_device *at32_add_device_abdac(unsigned int id);
87struct platform_device *at32_add_device_psif(unsigned int id); 95struct platform_device *at32_add_device_psif(unsigned int id);
88 96