aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c19
-rw-r--r--arch/avr32/boards/atstk1000/atstk1003.c2
-rw-r--r--arch/avr32/boards/atstk1000/atstk1004.c2
-rw-r--r--arch/avr32/kernel/time.c6
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c56
-rw-r--r--drivers/misc/atmel-ssc.c1
-rw-r--r--drivers/mmc/host/atmel-mci.c17
-rw-r--r--include/asm-avr32/arch-at32ap/board.h10
8 files changed, 81 insertions, 32 deletions
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 14dc5a143695..8538ba75ef92 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -21,6 +21,8 @@
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/atmel-mci.h>
25
24#include <asm/arch/at32ap700x.h> 26#include <asm/arch/at32ap700x.h>
25#include <asm/arch/board.h> 27#include <asm/arch/board.h>
26#include <asm/arch/init.h> 28#include <asm/arch/init.h>
@@ -260,6 +262,21 @@ void __init setup_board(void)
260 at32_setup_serial_console(0); 262 at32_setup_serial_console(0);
261} 263}
262 264
265#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
266
267/* MMC card detect requires MACB0 *NOT* be used */
268#ifdef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM
269static struct mci_platform_data __initdata mci0_data = {
270 .detect_pin = GPIO_PIN_PC(14), /* gpio30/sdcd */
271 .wp_pin = GPIO_PIN_PC(15), /* gpio31/sdwp */
272};
273#define MCI_PDATA &mci0_data
274#else
275#define MCI_PDATA NULL
276#endif /* SW6 for sd{cd,wp} routing */
277
278#endif /* SW2 for MMC signal routing */
279
263static int __init atstk1002_init(void) 280static int __init atstk1002_init(void)
264{ 281{
265 /* 282 /*
@@ -309,7 +326,7 @@ static int __init atstk1002_init(void)
309 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 326 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
310#endif 327#endif
311#ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 328#ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
312 at32_add_device_mci(0, NULL); 329 at32_add_device_mci(0, MCI_PDATA);
313#endif 330#endif
314#ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM 331#ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM
315 set_hw_addr(at32_add_device_eth(1, &eth_data[1])); 332 set_hw_addr(at32_add_device_eth(1, &eth_data[1]));
diff --git a/arch/avr32/boards/atstk1000/atstk1003.c b/arch/avr32/boards/atstk1000/atstk1003.c
index ea109f435a83..591fc73b554a 100644
--- a/arch/avr32/boards/atstk1000/atstk1003.c
+++ b/arch/avr32/boards/atstk1000/atstk1003.c
@@ -154,7 +154,7 @@ static int __init atstk1003_init(void)
154 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 154 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
155#endif 155#endif
156#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 156#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
157 at32_add_device_mci(0); 157 at32_add_device_mci(0, NULL);
158#endif 158#endif
159 at32_add_device_usba(0, NULL); 159 at32_add_device_usba(0, NULL);
160#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM 160#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c
index c7236df74d74..d9c5e0a21256 100644
--- a/arch/avr32/boards/atstk1000/atstk1004.c
+++ b/arch/avr32/boards/atstk1000/atstk1004.c
@@ -137,7 +137,7 @@ static int __init atstk1004_init(void)
137 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 137 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
138#endif 138#endif
139#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 139#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
140 at32_add_device_mci(0); 140 at32_add_device_mci(0, NULL);
141#endif 141#endif
142 at32_add_device_lcdc(0, &atstk1000_lcdc_data, 142 at32_add_device_lcdc(0, &atstk1000_lcdc_data,
143 fbmem_start, fbmem_size, 0); 143 fbmem_start, fbmem_size, 0);
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index abd954fb7ba0..7e7f32771ae1 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -43,6 +43,9 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
43{ 43{
44 struct clock_event_device *evdev = dev_id; 44 struct clock_event_device *evdev = dev_id;
45 45
46 if (unlikely(!(intc_get_pending(0) & 1)))
47 return IRQ_NONE;
48
46 /* 49 /*
47 * Disable the interrupt until the clockevent subsystem 50 * Disable the interrupt until the clockevent subsystem
48 * reprograms it. 51 * reprograms it.
@@ -55,7 +58,8 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
55 58
56static struct irqaction timer_irqaction = { 59static struct irqaction timer_irqaction = {
57 .handler = timer_interrupt, 60 .handler = timer_interrupt,
58 .flags = IRQF_TIMER | IRQF_DISABLED, 61 /* Oprofile uses the same irq as the timer, so allow it to be shared */
62 .flags = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED,
59 .name = "avr32_comparator", 63 .name = "avr32_comparator",
60}; 64};
61 65
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
1940struct 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)
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
1965err_add_resources: 1985fail:
1966 platform_device_put(pdev); 1986 platform_device_put(pdev);
1967 return NULL; 1987 return NULL;
1968} 1988}
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index e171650766ce..bf5e4d065436 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -13,7 +13,6 @@
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/list.h>
17#include <linux/spinlock.h> 16#include <linux/spinlock.h>
18#include <linux/atmel-ssc.h> 17#include <linux/atmel-ssc.h>
19 18
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index b68381f7bfdd..992b4beb757c 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -11,6 +11,8 @@
11#include <linux/clk.h> 11#include <linux/clk.h>
12#include <linux/debugfs.h> 12#include <linux/debugfs.h>
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/err.h>
15#include <linux/gpio.h>
14#include <linux/init.h> 16#include <linux/init.h>
15#include <linux/interrupt.h> 17#include <linux/interrupt.h>
16#include <linux/ioport.h> 18#include <linux/ioport.h>
@@ -27,7 +29,6 @@
27#include <asm/unaligned.h> 29#include <asm/unaligned.h>
28 30
29#include <asm/arch/board.h> 31#include <asm/arch/board.h>
30#include <asm/arch/gpio.h>
31 32
32#include "atmel-mci-regs.h" 33#include "atmel-mci-regs.h"
33 34
@@ -573,7 +574,7 @@ static int atmci_get_ro(struct mmc_host *mmc)
573 int read_only = 0; 574 int read_only = 0;
574 struct atmel_mci *host = mmc_priv(mmc); 575 struct atmel_mci *host = mmc_priv(mmc);
575 576
576 if (host->wp_pin >= 0) { 577 if (gpio_is_valid(host->wp_pin)) {
577 read_only = gpio_get_value(host->wp_pin); 578 read_only = gpio_get_value(host->wp_pin);
578 dev_dbg(&mmc->class_dev, "card is %s\n", 579 dev_dbg(&mmc->class_dev, "card is %s\n",
579 read_only ? "read-only" : "read-write"); 580 read_only ? "read-only" : "read-write");
@@ -635,7 +636,7 @@ static void atmci_detect_change(unsigned long data)
635 * been freed. 636 * been freed.
636 */ 637 */
637 smp_rmb(); 638 smp_rmb();
638 if (host->detect_pin < 0) 639 if (!gpio_is_valid(host->detect_pin))
639 return; 640 return;
640 641
641 enable_irq(gpio_to_irq(host->detect_pin)); 642 enable_irq(gpio_to_irq(host->detect_pin));
@@ -1050,7 +1051,7 @@ static int __init atmci_probe(struct platform_device *pdev)
1050 1051
1051 /* Assume card is present if we don't have a detect pin */ 1052 /* Assume card is present if we don't have a detect pin */
1052 host->present = 1; 1053 host->present = 1;
1053 if (host->detect_pin >= 0) { 1054 if (gpio_is_valid(host->detect_pin)) {
1054 if (gpio_request(host->detect_pin, "mmc_detect")) { 1055 if (gpio_request(host->detect_pin, "mmc_detect")) {
1055 dev_dbg(&mmc->class_dev, "no detect pin available\n"); 1056 dev_dbg(&mmc->class_dev, "no detect pin available\n");
1056 host->detect_pin = -1; 1057 host->detect_pin = -1;
@@ -1058,7 +1059,7 @@ static int __init atmci_probe(struct platform_device *pdev)
1058 host->present = !gpio_get_value(host->detect_pin); 1059 host->present = !gpio_get_value(host->detect_pin);
1059 } 1060 }
1060 } 1061 }
1061 if (host->wp_pin >= 0) { 1062 if (gpio_is_valid(host->wp_pin)) {
1062 if (gpio_request(host->wp_pin, "mmc_wp")) { 1063 if (gpio_request(host->wp_pin, "mmc_wp")) {
1063 dev_dbg(&mmc->class_dev, "no WP pin available\n"); 1064 dev_dbg(&mmc->class_dev, "no WP pin available\n");
1064 host->wp_pin = -1; 1065 host->wp_pin = -1;
@@ -1069,7 +1070,7 @@ static int __init atmci_probe(struct platform_device *pdev)
1069 1070
1070 mmc_add_host(mmc); 1071 mmc_add_host(mmc);
1071 1072
1072 if (host->detect_pin >= 0) { 1073 if (gpio_is_valid(host->detect_pin)) {
1073 setup_timer(&host->detect_timer, atmci_detect_change, 1074 setup_timer(&host->detect_timer, atmci_detect_change,
1074 (unsigned long)host); 1075 (unsigned long)host);
1075 1076
@@ -1112,7 +1113,7 @@ static int __exit atmci_remove(struct platform_device *pdev)
1112 if (host) { 1113 if (host) {
1113 /* Debugfs stuff is cleaned up by mmc core */ 1114 /* Debugfs stuff is cleaned up by mmc core */
1114 1115
1115 if (host->detect_pin >= 0) { 1116 if (gpio_is_valid(host->detect_pin)) {
1116 int pin = host->detect_pin; 1117 int pin = host->detect_pin;
1117 1118
1118 /* Make sure the timer doesn't enable the interrupt */ 1119 /* Make sure the timer doesn't enable the interrupt */
@@ -1132,7 +1133,7 @@ static int __exit atmci_remove(struct platform_device *pdev)
1132 mci_readl(host, SR); 1133 mci_readl(host, SR);
1133 clk_disable(host->mck); 1134 clk_disable(host->mck);
1134 1135
1135 if (host->wp_pin >= 0) 1136 if (gpio_is_valid(host->wp_pin))
1136 gpio_free(host->wp_pin); 1137 gpio_free(host->wp_pin);
1137 1138
1138 free_irq(platform_get_irq(pdev, 0), host->mmc); 1139 free_irq(platform_get_irq(pdev, 0), host->mmc);
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index 893aa6d0cd11..e60e9076544d 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