diff options
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 351e1b42f937..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 | ||
@@ -1937,9 +1937,11 @@ static struct clk atmel_ac97c0_pclk = { | |||
1937 | .index = 10, | 1937 | .index = 10, |
1938 | }; | 1938 | }; |
1939 | 1939 | ||
1940 | struct platform_device *__init at32_add_device_ac97c(unsigned int id) | 1940 | struct platform_device *__init |
1941 | at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data) | ||
1941 | { | 1942 | { |
1942 | struct platform_device *pdev; | 1943 | struct platform_device *pdev; |
1944 | struct ac97c_platform_data _data; | ||
1943 | 1945 | ||
1944 | if (id != 0) | 1946 | if (id != 0) |
1945 | return NULL; | 1947 | return NULL; |
@@ -1950,19 +1952,37 @@ struct platform_device *__init at32_add_device_ac97c(unsigned int id) | |||
1950 | 1952 | ||
1951 | if (platform_device_add_resources(pdev, atmel_ac97c0_resource, | 1953 | if (platform_device_add_resources(pdev, atmel_ac97c0_resource, |
1952 | ARRAY_SIZE(atmel_ac97c0_resource))) | 1954 | ARRAY_SIZE(atmel_ac97c0_resource))) |
1953 | goto err_add_resources; | 1955 | goto fail; |
1956 | |||
1957 | if (!data) { | ||
1958 | data = &_data; | ||
1959 | memset(data, 0, sizeof(struct ac97c_platform_data)); | ||
1960 | data->reset_pin = GPIO_PIN_NONE; | ||
1961 | } | ||
1954 | 1962 | ||
1955 | select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */ | 1963 | data->dma_rx_periph_id = 3; |
1956 | select_peripheral(PB(21), PERIPH_B, 0); /* SDO */ | 1964 | data->dma_tx_periph_id = 4; |
1957 | select_peripheral(PB(22), PERIPH_B, 0); /* SDI */ | 1965 | data->dma_controller_id = 0; |
1958 | select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */ | 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); | ||
1959 | 1979 | ||
1960 | atmel_ac97c0_pclk.dev = &pdev->dev; | 1980 | atmel_ac97c0_pclk.dev = &pdev->dev; |
1961 | 1981 | ||
1962 | platform_device_add(pdev); | 1982 | platform_device_add(pdev); |
1963 | return pdev; | 1983 | return pdev; |
1964 | 1984 | ||
1965 | err_add_resources: | 1985 | fail: |
1966 | platform_device_put(pdev); | 1986 | platform_device_put(pdev); |
1967 | return NULL; | 1987 | return NULL; |
1968 | } | 1988 | } |