aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap/at32ap700x.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-28 15:14:43 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-28 15:14:43 -0400
commit414f746d232d41ed6ae8632c4495ae795373c44b (patch)
tree167f9bc8f139c6e82e6732b38c7a938b8a9d31cd /arch/avr32/mach-at32ap/at32ap700x.c
parent5a7a201c51c324876d00a54e7208af6af12d1ca4 (diff)
parentc9272c4f9fbe2087beb3392f526dc5b19efaa56b (diff)
Merge branch 'linus' into cpus4096
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c108
1 files changed, 90 insertions, 18 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 604f44f5dd16..1617048c86c5 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/gpio.h>
15#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
16#include <linux/usb/atmel_usba_udc.h> 17#include <linux/usb/atmel_usba_udc.h>
17 18
@@ -1285,7 +1286,6 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
1285{ 1286{
1286 struct mci_platform_data _data; 1287 struct mci_platform_data _data;
1287 struct platform_device *pdev; 1288 struct platform_device *pdev;
1288 struct dw_dma_slave *dws;
1289 1289
1290 if (id != 0) 1290 if (id != 0)
1291 return NULL; 1291 return NULL;
@@ -1300,7 +1300,9 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
1300 1300
1301 if (!data) { 1301 if (!data) {
1302 data = &_data; 1302 data = &_data;
1303 memset(data, 0, sizeof(struct mci_platform_data)); 1303 memset(data, -1, sizeof(struct mci_platform_data));
1304 data->detect_pin = GPIO_PIN_NONE;
1305 data->wp_pin = GPIO_PIN_NONE;
1304 } 1306 }
1305 1307
1306 if (platform_device_add_data(pdev, data, 1308 if (platform_device_add_data(pdev, data,
@@ -1314,12 +1316,10 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
1314 select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */ 1316 select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */
1315 select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */ 1317 select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */
1316 1318
1317 if (data) { 1319 if (gpio_is_valid(data->detect_pin))
1318 if (data->detect_pin != GPIO_PIN_NONE) 1320 at32_select_gpio(data->detect_pin, 0);
1319 at32_select_gpio(data->detect_pin, 0); 1321 if (gpio_is_valid(data->wp_pin))
1320 if (data->wp_pin != GPIO_PIN_NONE) 1322 at32_select_gpio(data->wp_pin, 0);
1321 at32_select_gpio(data->wp_pin, 0);
1322 }
1323 1323
1324 atmel_mci0_pclk.dev = &pdev->dev; 1324 atmel_mci0_pclk.dev = &pdev->dev;
1325 1325
@@ -1853,11 +1853,11 @@ at32_add_device_cf(unsigned int id, unsigned int extint,
1853 if (at32_init_ide_or_cf(pdev, data->cs, extint)) 1853 if (at32_init_ide_or_cf(pdev, data->cs, extint))
1854 goto fail; 1854 goto fail;
1855 1855
1856 if (data->detect_pin != GPIO_PIN_NONE) 1856 if (gpio_is_valid(data->detect_pin))
1857 at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH); 1857 at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH);
1858 if (data->reset_pin != GPIO_PIN_NONE) 1858 if (gpio_is_valid(data->reset_pin))
1859 at32_select_gpio(data->reset_pin, 0); 1859 at32_select_gpio(data->reset_pin, 0);
1860 if (data->vcc_pin != GPIO_PIN_NONE) 1860 if (gpio_is_valid(data->vcc_pin))
1861 at32_select_gpio(data->vcc_pin, 0); 1861 at32_select_gpio(data->vcc_pin, 0);
1862 /* READY is used as extint, so we can't select it as gpio */ 1862 /* READY is used as extint, so we can't select it as gpio */
1863 1863
@@ -1871,6 +1871,58 @@ fail:
1871#endif 1871#endif
1872 1872
1873/* -------------------------------------------------------------------- 1873/* --------------------------------------------------------------------
1874 * NAND Flash / SmartMedia
1875 * -------------------------------------------------------------------- */
1876static struct resource smc_cs3_resource[] __initdata = {
1877 {
1878 .start = 0x0c000000,
1879 .end = 0x0fffffff,
1880 .flags = IORESOURCE_MEM,
1881 }, {
1882 .start = 0xfff03c00,
1883 .end = 0xfff03fff,
1884 .flags = IORESOURCE_MEM,
1885 },
1886};
1887
1888struct platform_device *__init
1889at32_add_device_nand(unsigned int id, struct atmel_nand_data *data)
1890{
1891 struct platform_device *pdev;
1892
1893 if (id != 0 || !data)
1894 return NULL;
1895
1896 pdev = platform_device_alloc("atmel_nand", id);
1897 if (!pdev)
1898 goto fail;
1899
1900 if (platform_device_add_resources(pdev, smc_cs3_resource,
1901 ARRAY_SIZE(smc_cs3_resource)))
1902 goto fail;
1903
1904 if (platform_device_add_data(pdev, data,
1905 sizeof(struct atmel_nand_data)))
1906 goto fail;
1907
1908 set_ebi_sfr_bits(HMATRIX_BIT(CS3A));
1909 if (data->enable_pin)
1910 at32_select_gpio(data->enable_pin,
1911 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
1912 if (data->rdy_pin)
1913 at32_select_gpio(data->rdy_pin, 0);
1914 if (data->det_pin)
1915 at32_select_gpio(data->det_pin, 0);
1916
1917 platform_device_add(pdev);
1918 return pdev;
1919
1920fail:
1921 platform_device_put(pdev);
1922 return NULL;
1923}
1924
1925/* --------------------------------------------------------------------
1874 * AC97C 1926 * AC97C
1875 * -------------------------------------------------------------------- */ 1927 * -------------------------------------------------------------------- */
1876static struct resource atmel_ac97c0_resource[] __initdata = { 1928static struct resource atmel_ac97c0_resource[] __initdata = {
@@ -1885,9 +1937,11 @@ static struct clk atmel_ac97c0_pclk = {
1885 .index = 10, 1937 .index = 10,
1886}; 1938};
1887 1939
1888struct platform_device *__init at32_add_device_ac97c(unsigned int id) 1940struct platform_device *__init
1941at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
1889{ 1942{
1890 struct platform_device *pdev; 1943 struct platform_device *pdev;
1944 struct ac97c_platform_data _data;
1891 1945
1892 if (id != 0) 1946 if (id != 0)
1893 return NULL; 1947 return NULL;
@@ -1898,19 +1952,37 @@ struct platform_device *__init at32_add_device_ac97c(unsigned int id)
1898 1952
1899 if (platform_device_add_resources(pdev, atmel_ac97c0_resource, 1953 if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
1900 ARRAY_SIZE(atmel_ac97c0_resource))) 1954 ARRAY_SIZE(atmel_ac97c0_resource)))
1901 goto err_add_resources; 1955 goto fail;
1902 1956
1903 select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */ 1957 if (!data) {
1904 select_peripheral(PB(21), PERIPH_B, 0); /* SDO */ 1958 data = &_data;
1905 select_peripheral(PB(22), PERIPH_B, 0); /* SDI */ 1959 memset(data, 0, sizeof(struct ac97c_platform_data));
1906 select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */ 1960 data->reset_pin = GPIO_PIN_NONE;
1961 }
1962
1963 data->dma_rx_periph_id = 3;
1964 data->dma_tx_periph_id = 4;
1965 data->dma_controller_id = 0;
1966
1967 if (platform_device_add_data(pdev, data,
1968 sizeof(struct ac97c_platform_data)))
1969 goto fail;
1970
1971 select_peripheral(PB(20), PERIPH_B, 0); /* SDO */
1972 select_peripheral(PB(21), PERIPH_B, 0); /* SYNC */
1973 select_peripheral(PB(22), PERIPH_B, 0); /* SCLK */
1974 select_peripheral(PB(23), PERIPH_B, 0); /* SDI */
1975
1976 /* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */
1977 if (data->reset_pin != GPIO_PIN_NONE)
1978 at32_select_gpio(data->reset_pin, 0);
1907 1979
1908 atmel_ac97c0_pclk.dev = &pdev->dev; 1980 atmel_ac97c0_pclk.dev = &pdev->dev;
1909 1981
1910 platform_device_add(pdev); 1982 platform_device_add(pdev);
1911 return pdev; 1983 return pdev;
1912 1984
1913err_add_resources: 1985fail:
1914 platform_device_put(pdev); 1986 platform_device_put(pdev);
1915 return NULL; 1987 return NULL;
1916} 1988}