Merge git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6:
avr32: some mmc/sd cleanups
include/video/atmel_lcdc.h must #include <linux/workqueue.h>
avr32: allow system timer to share interrupt to make OProfile work
drivers/misc/atmel-ssc.c: Removed duplicated include
avr32: Add platform data for AC97C platform device
avr32: clean up mci platform code
fix avr32 build errors

+81 -32
+18 -1
arch/avr32/boards/atstk1000/atstk1002.c
··· 21 22 #include <asm/io.h> 23 #include <asm/setup.h> 24 #include <asm/arch/at32ap700x.h> 25 #include <asm/arch/board.h> 26 #include <asm/arch/init.h> ··· 262 at32_setup_serial_console(0); 263 } 264 265 static int __init atstk1002_init(void) 266 { 267 /* ··· 326 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 327 #endif 328 #ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 329 - at32_add_device_mci(0, NULL); 330 #endif 331 #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM 332 set_hw_addr(at32_add_device_eth(1, &eth_data[1]));
··· 21 22 #include <asm/io.h> 23 #include <asm/setup.h> 24 + #include <asm/atmel-mci.h> 25 + 26 #include <asm/arch/at32ap700x.h> 27 #include <asm/arch/board.h> 28 #include <asm/arch/init.h> ··· 260 at32_setup_serial_console(0); 261 } 262 263 + #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 264 + 265 + /* MMC card detect requires MACB0 *NOT* be used */ 266 + #ifdef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM 267 + static struct mci_platform_data __initdata mci0_data = { 268 + .detect_pin = GPIO_PIN_PC(14), /* gpio30/sdcd */ 269 + .wp_pin = GPIO_PIN_PC(15), /* gpio31/sdwp */ 270 + }; 271 + #define MCI_PDATA &mci0_data 272 + #else 273 + #define MCI_PDATA NULL 274 + #endif /* SW6 for sd{cd,wp} routing */ 275 + 276 + #endif /* SW2 for MMC signal routing */ 277 + 278 static int __init atstk1002_init(void) 279 { 280 /* ··· 309 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 310 #endif 311 #ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 312 + at32_add_device_mci(0, MCI_PDATA); 313 #endif 314 #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM 315 set_hw_addr(at32_add_device_eth(1, &eth_data[1]));
+1 -1
arch/avr32/boards/atstk1000/atstk1003.c
··· 154 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 155 #endif 156 #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 157 - at32_add_device_mci(0); 158 #endif 159 at32_add_device_usba(0, NULL); 160 #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
··· 154 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 155 #endif 156 #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 157 + at32_add_device_mci(0, NULL); 158 #endif 159 at32_add_device_usba(0, NULL); 160 #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
+1 -1
arch/avr32/boards/atstk1000/atstk1004.c
··· 137 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 138 #endif 139 #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 140 - at32_add_device_mci(0); 141 #endif 142 at32_add_device_lcdc(0, &atstk1000_lcdc_data, 143 fbmem_start, fbmem_size, 0);
··· 137 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 138 #endif 139 #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 140 + at32_add_device_mci(0, NULL); 141 #endif 142 at32_add_device_lcdc(0, &atstk1000_lcdc_data, 143 fbmem_start, fbmem_size, 0);
+5 -1
arch/avr32/kernel/time.c
··· 43 { 44 struct clock_event_device *evdev = dev_id; 45 46 /* 47 * Disable the interrupt until the clockevent subsystem 48 * reprograms it. ··· 58 59 static struct irqaction timer_irqaction = { 60 .handler = timer_interrupt, 61 - .flags = IRQF_TIMER | IRQF_DISABLED, 62 .name = "avr32_comparator", 63 }; 64
··· 43 { 44 struct clock_event_device *evdev = dev_id; 45 46 + if (unlikely(!(intc_get_pending(0) & 1))) 47 + return IRQ_NONE; 48 + 49 /* 50 * Disable the interrupt until the clockevent subsystem 51 * reprograms it. ··· 55 56 static struct irqaction timer_irqaction = { 57 .handler = timer_interrupt, 58 + /* Oprofile uses the same irq as the timer, so allow it to be shared */ 59 + .flags = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED, 60 .name = "avr32_comparator", 61 }; 62
+38 -18
arch/avr32/mach-at32ap/at32ap700x.c
··· 12 #include <linux/init.h> 13 #include <linux/platform_device.h> 14 #include <linux/dma-mapping.h> 15 #include <linux/spi/spi.h> 16 #include <linux/usb/atmel_usba_udc.h> 17 ··· 1286 { 1287 struct mci_platform_data _data; 1288 struct platform_device *pdev; 1289 - struct dw_dma_slave *dws; 1290 1291 if (id != 0) 1292 return NULL; ··· 1300 1301 if (!data) { 1302 data = &_data; 1303 - memset(data, 0, sizeof(struct mci_platform_data)); 1304 } 1305 1306 if (platform_device_add_data(pdev, data, ··· 1316 select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */ 1317 select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */ 1318 1319 - if (data) { 1320 - if (data->detect_pin != GPIO_PIN_NONE) 1321 - at32_select_gpio(data->detect_pin, 0); 1322 - if (data->wp_pin != GPIO_PIN_NONE) 1323 - at32_select_gpio(data->wp_pin, 0); 1324 - } 1325 1326 atmel_mci0_pclk.dev = &pdev->dev; 1327 ··· 1853 if (at32_init_ide_or_cf(pdev, data->cs, extint)) 1854 goto fail; 1855 1856 - if (data->detect_pin != GPIO_PIN_NONE) 1857 at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH); 1858 - if (data->reset_pin != GPIO_PIN_NONE) 1859 at32_select_gpio(data->reset_pin, 0); 1860 - if (data->vcc_pin != GPIO_PIN_NONE) 1861 at32_select_gpio(data->vcc_pin, 0); 1862 /* READY is used as extint, so we can't select it as gpio */ 1863 ··· 1937 .index = 10, 1938 }; 1939 1940 - struct platform_device *__init at32_add_device_ac97c(unsigned int id) 1941 { 1942 struct platform_device *pdev; 1943 1944 if (id != 0) 1945 return NULL; ··· 1952 1953 if (platform_device_add_resources(pdev, atmel_ac97c0_resource, 1954 ARRAY_SIZE(atmel_ac97c0_resource))) 1955 - goto err_add_resources; 1956 1957 - select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */ 1958 - select_peripheral(PB(21), PERIPH_B, 0); /* SDO */ 1959 - select_peripheral(PB(22), PERIPH_B, 0); /* SDI */ 1960 - select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */ 1961 1962 atmel_ac97c0_pclk.dev = &pdev->dev; 1963 1964 platform_device_add(pdev); 1965 return pdev; 1966 1967 - err_add_resources: 1968 platform_device_put(pdev); 1969 return NULL; 1970 }
··· 12 #include <linux/init.h> 13 #include <linux/platform_device.h> 14 #include <linux/dma-mapping.h> 15 + #include <linux/gpio.h> 16 #include <linux/spi/spi.h> 17 #include <linux/usb/atmel_usba_udc.h> 18 ··· 1285 { 1286 struct mci_platform_data _data; 1287 struct platform_device *pdev; 1288 1289 if (id != 0) 1290 return NULL; ··· 1300 1301 if (!data) { 1302 data = &_data; 1303 + memset(data, -1, sizeof(struct mci_platform_data)); 1304 + data->detect_pin = GPIO_PIN_NONE; 1305 + data->wp_pin = GPIO_PIN_NONE; 1306 } 1307 1308 if (platform_device_add_data(pdev, data, ··· 1314 select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */ 1315 select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */ 1316 1317 + if (gpio_is_valid(data->detect_pin)) 1318 + at32_select_gpio(data->detect_pin, 0); 1319 + if (gpio_is_valid(data->wp_pin)) 1320 + at32_select_gpio(data->wp_pin, 0); 1321 1322 atmel_mci0_pclk.dev = &pdev->dev; 1323 ··· 1853 if (at32_init_ide_or_cf(pdev, data->cs, extint)) 1854 goto fail; 1855 1856 + if (gpio_is_valid(data->detect_pin)) 1857 at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH); 1858 + if (gpio_is_valid(data->reset_pin)) 1859 at32_select_gpio(data->reset_pin, 0); 1860 + if (gpio_is_valid(data->vcc_pin)) 1861 at32_select_gpio(data->vcc_pin, 0); 1862 /* READY is used as extint, so we can't select it as gpio */ 1863 ··· 1937 .index = 10, 1938 }; 1939 1940 + struct platform_device *__init 1941 + at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data) 1942 { 1943 struct platform_device *pdev; 1944 + struct ac97c_platform_data _data; 1945 1946 if (id != 0) 1947 return NULL; ··· 1950 1951 if (platform_device_add_resources(pdev, atmel_ac97c0_resource, 1952 ARRAY_SIZE(atmel_ac97c0_resource))) 1953 + goto fail; 1954 1955 + if (!data) { 1956 + data = &_data; 1957 + memset(data, 0, sizeof(struct ac97c_platform_data)); 1958 + data->reset_pin = GPIO_PIN_NONE; 1959 + } 1960 + 1961 + data->dma_rx_periph_id = 3; 1962 + data->dma_tx_periph_id = 4; 1963 + data->dma_controller_id = 0; 1964 + 1965 + if (platform_device_add_data(pdev, data, 1966 + sizeof(struct ac97c_platform_data))) 1967 + goto fail; 1968 + 1969 + select_peripheral(PB(20), PERIPH_B, 0); /* SDO */ 1970 + select_peripheral(PB(21), PERIPH_B, 0); /* SYNC */ 1971 + select_peripheral(PB(22), PERIPH_B, 0); /* SCLK */ 1972 + select_peripheral(PB(23), PERIPH_B, 0); /* SDI */ 1973 + 1974 + /* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */ 1975 + if (data->reset_pin != GPIO_PIN_NONE) 1976 + at32_select_gpio(data->reset_pin, 0); 1977 1978 atmel_ac97c0_pclk.dev = &pdev->dev; 1979 1980 platform_device_add(pdev); 1981 return pdev; 1982 1983 + fail: 1984 platform_device_put(pdev); 1985 return NULL; 1986 }
-1
drivers/misc/atmel-ssc.c
··· 13 #include <linux/clk.h> 14 #include <linux/err.h> 15 #include <linux/io.h> 16 - #include <linux/list.h> 17 #include <linux/spinlock.h> 18 #include <linux/atmel-ssc.h> 19
··· 13 #include <linux/clk.h> 14 #include <linux/err.h> 15 #include <linux/io.h> 16 #include <linux/spinlock.h> 17 #include <linux/atmel-ssc.h> 18
+9 -8
drivers/mmc/host/atmel-mci.c
··· 11 #include <linux/clk.h> 12 #include <linux/debugfs.h> 13 #include <linux/device.h> 14 #include <linux/init.h> 15 #include <linux/interrupt.h> 16 #include <linux/ioport.h> ··· 29 #include <asm/unaligned.h> 30 31 #include <asm/arch/board.h> 32 - #include <asm/arch/gpio.h> 33 34 #include "atmel-mci-regs.h" 35 ··· 574 int read_only = 0; 575 struct atmel_mci *host = mmc_priv(mmc); 576 577 - if (host->wp_pin >= 0) { 578 read_only = gpio_get_value(host->wp_pin); 579 dev_dbg(&mmc->class_dev, "card is %s\n", 580 read_only ? "read-only" : "read-write"); ··· 636 * been freed. 637 */ 638 smp_rmb(); 639 - if (host->detect_pin < 0) 640 return; 641 642 enable_irq(gpio_to_irq(host->detect_pin)); ··· 1051 1052 /* Assume card is present if we don't have a detect pin */ 1053 host->present = 1; 1054 - if (host->detect_pin >= 0) { 1055 if (gpio_request(host->detect_pin, "mmc_detect")) { 1056 dev_dbg(&mmc->class_dev, "no detect pin available\n"); 1057 host->detect_pin = -1; ··· 1059 host->present = !gpio_get_value(host->detect_pin); 1060 } 1061 } 1062 - if (host->wp_pin >= 0) { 1063 if (gpio_request(host->wp_pin, "mmc_wp")) { 1064 dev_dbg(&mmc->class_dev, "no WP pin available\n"); 1065 host->wp_pin = -1; ··· 1070 1071 mmc_add_host(mmc); 1072 1073 - if (host->detect_pin >= 0) { 1074 setup_timer(&host->detect_timer, atmci_detect_change, 1075 (unsigned long)host); 1076 ··· 1113 if (host) { 1114 /* Debugfs stuff is cleaned up by mmc core */ 1115 1116 - if (host->detect_pin >= 0) { 1117 int pin = host->detect_pin; 1118 1119 /* Make sure the timer doesn't enable the interrupt */ ··· 1133 mci_readl(host, SR); 1134 clk_disable(host->mck); 1135 1136 - if (host->wp_pin >= 0) 1137 gpio_free(host->wp_pin); 1138 1139 free_irq(platform_get_irq(pdev, 0), host->mmc);
··· 11 #include <linux/clk.h> 12 #include <linux/debugfs.h> 13 #include <linux/device.h> 14 + #include <linux/err.h> 15 + #include <linux/gpio.h> 16 #include <linux/init.h> 17 #include <linux/interrupt.h> 18 #include <linux/ioport.h> ··· 27 #include <asm/unaligned.h> 28 29 #include <asm/arch/board.h> 30 31 #include "atmel-mci-regs.h" 32 ··· 573 int read_only = 0; 574 struct atmel_mci *host = mmc_priv(mmc); 575 576 + if (gpio_is_valid(host->wp_pin)) { 577 read_only = gpio_get_value(host->wp_pin); 578 dev_dbg(&mmc->class_dev, "card is %s\n", 579 read_only ? "read-only" : "read-write"); ··· 635 * been freed. 636 */ 637 smp_rmb(); 638 + if (!gpio_is_valid(host->detect_pin)) 639 return; 640 641 enable_irq(gpio_to_irq(host->detect_pin)); ··· 1050 1051 /* Assume card is present if we don't have a detect pin */ 1052 host->present = 1; 1053 + if (gpio_is_valid(host->detect_pin)) { 1054 if (gpio_request(host->detect_pin, "mmc_detect")) { 1055 dev_dbg(&mmc->class_dev, "no detect pin available\n"); 1056 host->detect_pin = -1; ··· 1058 host->present = !gpio_get_value(host->detect_pin); 1059 } 1060 } 1061 + if (gpio_is_valid(host->wp_pin)) { 1062 if (gpio_request(host->wp_pin, "mmc_wp")) { 1063 dev_dbg(&mmc->class_dev, "no WP pin available\n"); 1064 host->wp_pin = -1; ··· 1069 1070 mmc_add_host(mmc); 1071 1072 + if (gpio_is_valid(host->detect_pin)) { 1073 setup_timer(&host->detect_timer, atmci_detect_change, 1074 (unsigned long)host); 1075 ··· 1112 if (host) { 1113 /* Debugfs stuff is cleaned up by mmc core */ 1114 1115 + if (gpio_is_valid(host->detect_pin)) { 1116 int pin = host->detect_pin; 1117 1118 /* Make sure the timer doesn't enable the interrupt */ ··· 1132 mci_readl(host, SR); 1133 clk_disable(host->mck); 1134 1135 + if (gpio_is_valid(host->wp_pin)) 1136 gpio_free(host->wp_pin); 1137 1138 free_irq(platform_get_irq(pdev, 0), host->mmc);
+9 -1
include/asm-avr32/arch-at32ap/board.h
··· 82 struct platform_device * 83 at32_add_device_mci(unsigned int id, struct mci_platform_data *data); 84 85 - struct platform_device *at32_add_device_ac97c(unsigned int id); 86 struct platform_device *at32_add_device_abdac(unsigned int id); 87 struct platform_device *at32_add_device_psif(unsigned int id); 88
··· 82 struct platform_device * 83 at32_add_device_mci(unsigned int id, struct mci_platform_data *data); 84 85 + struct 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 + }; 91 + struct platform_device * 92 + at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data); 93 + 94 struct platform_device *at32_add_device_abdac(unsigned int id); 95 struct platform_device *at32_add_device_psif(unsigned int id); 96