Merge branch 'for-linus' of ssh://master.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6

* 'for-linus' of ssh://master.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6:
[AVR32] ARRAY_SIZE() cleanup
[AVR32] Implement at32_add_device_cf()
[AVR32] Implement more at32_add_device_foo() functions
[AVR32] Fix a couple of sparse warnings
[AVR32] Wire up AT73C213 sound driver on ATSTK1000 board
[AVR32] Platform code for pata_at32

+429 -4
+58
arch/avr32/boards/atstk1000/atstk1002.c
··· 16 #include <linux/string.h> 17 #include <linux/types.h> 18 #include <linux/spi/spi.h> 19 20 #include <video/atmel_lcdc.h> 21 ··· 50 }; 51 52 #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 53 static struct spi_board_info spi0_board_info[] __initdata = { 54 { 55 /* QVGA display */ 56 .modalias = "ltv350qv", ··· 200 } 201 #endif 202 203 void __init setup_board(void) 204 { 205 #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM ··· 299 #endif 300 301 setup_j2_leds(); 302 303 return 0; 304 }
··· 16 #include <linux/string.h> 17 #include <linux/types.h> 18 #include <linux/spi/spi.h> 19 + #include <linux/spi/at73c213.h> 20 21 #include <video/atmel_lcdc.h> 22 ··· 49 }; 50 51 #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 52 + #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM 53 + static struct at73c213_board_info at73c213_data = { 54 + .ssc_id = 0, 55 + .shortname = "AVR32 STK1000 external DAC", 56 + }; 57 + #endif 58 + #endif 59 + 60 + #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 61 static struct spi_board_info spi0_board_info[] __initdata = { 62 + #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM 63 + { 64 + /* AT73C213 */ 65 + .modalias = "at73c213", 66 + .max_speed_hz = 200000, 67 + .chip_select = 0, 68 + .mode = SPI_MODE_1, 69 + .platform_data = &at73c213_data, 70 + }, 71 + #endif 72 { 73 /* QVGA display */ 74 .modalias = "ltv350qv", ··· 180 } 181 #endif 182 183 + #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 184 + #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM 185 + static void __init at73c213_set_clk(struct at73c213_board_info *info) 186 + { 187 + struct clk *gclk; 188 + struct clk *pll; 189 + 190 + gclk = clk_get(NULL, "gclk0"); 191 + if (IS_ERR(gclk)) 192 + goto err_gclk; 193 + pll = clk_get(NULL, "pll0"); 194 + if (IS_ERR(pll)) 195 + goto err_pll; 196 + 197 + if (clk_set_parent(gclk, pll)) { 198 + pr_debug("STK1000: failed to set pll0 as parent for DAC clock\n"); 199 + goto err_set_clk; 200 + } 201 + 202 + at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); 203 + info->dac_clk = gclk; 204 + 205 + err_set_clk: 206 + clk_put(pll); 207 + err_pll: 208 + clk_put(gclk); 209 + err_gclk: 210 + return; 211 + } 212 + #endif 213 + #endif 214 + 215 void __init setup_board(void) 216 { 217 #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM ··· 247 #endif 248 249 setup_j2_leds(); 250 + 251 + #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM 252 + #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 253 + at73c213_set_clk(&at73c213_data); 254 + #endif 255 + #endif 256 257 return 0; 258 }
+344
arch/avr32/mach-at32ap/at32ap7000.c
··· 556 .users = 1, 557 }; 558 559 /* -------------------------------------------------------------------- 560 * HMATRIX 561 * -------------------------------------------------------------------- */ ··· 666 platform_device_register(&at32_eic0_device); 667 platform_device_register(&smc0_device); 668 platform_device_register(&pdc_device); 669 670 platform_device_register(&at32_systc0_device); 671 ··· 972 } 973 974 /* -------------------------------------------------------------------- 975 * LCDC 976 * -------------------------------------------------------------------- */ 977 static struct atmel_lcdfb_info atmel_lcdfb0_data; ··· 1330 } 1331 1332 /* -------------------------------------------------------------------- 1333 * GCLK 1334 * -------------------------------------------------------------------- */ 1335 static struct clk gclk0 = { ··· 1627 &smc0_mck, 1628 &pdc_hclk, 1629 &pdc_pclk, 1630 &pico_clk, 1631 &pio0_mck, 1632 &pio1_mck, ··· 1645 &macb1_pclk, 1646 &atmel_spi0_spi_clk, 1647 &atmel_spi1_spi_clk, 1648 &atmel_lcdfb0_hck1, 1649 &atmel_lcdfb0_pixclk, 1650 &ssc0_pclk, ··· 1654 &ssc2_pclk, 1655 &usba0_hclk, 1656 &usba0_pclk, 1657 &gclk0, 1658 &gclk1, 1659 &gclk2, ··· 1698 genclk_init_parent(&gclk3); 1699 genclk_init_parent(&gclk4); 1700 genclk_init_parent(&atmel_lcdfb0_pixclk); 1701 1702 /* 1703 * Turn on all clocks that have at least one user already, and
··· 556 .users = 1, 557 }; 558 559 + static struct resource dmaca0_resource[] = { 560 + { 561 + .start = 0xff200000, 562 + .end = 0xff20ffff, 563 + .flags = IORESOURCE_MEM, 564 + }, 565 + IRQ(2), 566 + }; 567 + DEFINE_DEV(dmaca, 0); 568 + DEV_CLK(hclk, dmaca0, hsb, 10); 569 + 570 /* -------------------------------------------------------------------- 571 * HMATRIX 572 * -------------------------------------------------------------------- */ ··· 655 platform_device_register(&at32_eic0_device); 656 platform_device_register(&smc0_device); 657 platform_device_register(&pdc_device); 658 + platform_device_register(&dmaca0_device); 659 660 platform_device_register(&at32_systc0_device); 661 ··· 960 } 961 962 /* -------------------------------------------------------------------- 963 + * TWI 964 + * -------------------------------------------------------------------- */ 965 + static struct resource atmel_twi0_resource[] __initdata = { 966 + PBMEM(0xffe00800), 967 + IRQ(5), 968 + }; 969 + static struct clk atmel_twi0_pclk = { 970 + .name = "twi_pclk", 971 + .parent = &pba_clk, 972 + .mode = pba_clk_mode, 973 + .get_rate = pba_clk_get_rate, 974 + .index = 2, 975 + }; 976 + 977 + struct platform_device *__init at32_add_device_twi(unsigned int id) 978 + { 979 + struct platform_device *pdev; 980 + 981 + if (id != 0) 982 + return NULL; 983 + 984 + pdev = platform_device_alloc("atmel_twi", id); 985 + if (!pdev) 986 + return NULL; 987 + 988 + if (platform_device_add_resources(pdev, atmel_twi0_resource, 989 + ARRAY_SIZE(atmel_twi0_resource))) 990 + goto err_add_resources; 991 + 992 + select_peripheral(PA(6), PERIPH_A, 0); /* SDA */ 993 + select_peripheral(PA(7), PERIPH_A, 0); /* SDL */ 994 + 995 + atmel_twi0_pclk.dev = &pdev->dev; 996 + 997 + platform_device_add(pdev); 998 + return pdev; 999 + 1000 + err_add_resources: 1001 + platform_device_put(pdev); 1002 + return NULL; 1003 + } 1004 + 1005 + /* -------------------------------------------------------------------- 1006 + * MMC 1007 + * -------------------------------------------------------------------- */ 1008 + static struct resource atmel_mci0_resource[] __initdata = { 1009 + PBMEM(0xfff02400), 1010 + IRQ(28), 1011 + }; 1012 + static struct clk atmel_mci0_pclk = { 1013 + .name = "mci_clk", 1014 + .parent = &pbb_clk, 1015 + .mode = pbb_clk_mode, 1016 + .get_rate = pbb_clk_get_rate, 1017 + .index = 9, 1018 + }; 1019 + 1020 + struct platform_device *__init at32_add_device_mci(unsigned int id) 1021 + { 1022 + struct platform_device *pdev; 1023 + 1024 + if (id != 0) 1025 + return NULL; 1026 + 1027 + pdev = platform_device_alloc("atmel_mci", id); 1028 + if (!pdev) 1029 + return NULL; 1030 + 1031 + if (platform_device_add_resources(pdev, atmel_mci0_resource, 1032 + ARRAY_SIZE(atmel_mci0_resource))) 1033 + goto err_add_resources; 1034 + 1035 + select_peripheral(PA(10), PERIPH_A, 0); /* CLK */ 1036 + select_peripheral(PA(11), PERIPH_A, 0); /* CMD */ 1037 + select_peripheral(PA(12), PERIPH_A, 0); /* DATA0 */ 1038 + select_peripheral(PA(13), PERIPH_A, 0); /* DATA1 */ 1039 + select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */ 1040 + select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */ 1041 + 1042 + atmel_mci0_pclk.dev = &pdev->dev; 1043 + 1044 + platform_device_add(pdev); 1045 + return pdev; 1046 + 1047 + err_add_resources: 1048 + platform_device_put(pdev); 1049 + return NULL; 1050 + } 1051 + 1052 + /* -------------------------------------------------------------------- 1053 * LCDC 1054 * -------------------------------------------------------------------- */ 1055 static struct atmel_lcdfb_info atmel_lcdfb0_data; ··· 1228 } 1229 1230 /* -------------------------------------------------------------------- 1231 + * IDE / CompactFlash 1232 + * -------------------------------------------------------------------- */ 1233 + static struct resource at32_smc_cs4_resource[] __initdata = { 1234 + { 1235 + .start = 0x04000000, 1236 + .end = 0x07ffffff, 1237 + .flags = IORESOURCE_MEM, 1238 + }, 1239 + IRQ(~0UL), /* Magic IRQ will be overridden */ 1240 + }; 1241 + static struct resource at32_smc_cs5_resource[] __initdata = { 1242 + { 1243 + .start = 0x20000000, 1244 + .end = 0x23ffffff, 1245 + .flags = IORESOURCE_MEM, 1246 + }, 1247 + IRQ(~0UL), /* Magic IRQ will be overridden */ 1248 + }; 1249 + 1250 + static int __init at32_init_ide_or_cf(struct platform_device *pdev, 1251 + unsigned int cs, unsigned int extint) 1252 + { 1253 + static unsigned int extint_pin_map[4] __initdata = { 1254 + GPIO_PIN_PB(25), 1255 + GPIO_PIN_PB(26), 1256 + GPIO_PIN_PB(27), 1257 + GPIO_PIN_PB(28), 1258 + }; 1259 + static bool common_pins_initialized __initdata = false; 1260 + unsigned int extint_pin; 1261 + int ret; 1262 + 1263 + if (extint >= ARRAY_SIZE(extint_pin_map)) 1264 + return -EINVAL; 1265 + extint_pin = extint_pin_map[extint]; 1266 + 1267 + switch (cs) { 1268 + case 4: 1269 + ret = platform_device_add_resources(pdev, 1270 + at32_smc_cs4_resource, 1271 + ARRAY_SIZE(at32_smc_cs4_resource)); 1272 + if (ret) 1273 + return ret; 1274 + 1275 + select_peripheral(PE(21), PERIPH_A, 0); /* NCS4 -> OE_N */ 1276 + set_ebi_sfr_bits(HMATRIX_BIT(CS4A)); 1277 + break; 1278 + case 5: 1279 + ret = platform_device_add_resources(pdev, 1280 + at32_smc_cs5_resource, 1281 + ARRAY_SIZE(at32_smc_cs5_resource)); 1282 + if (ret) 1283 + return ret; 1284 + 1285 + select_peripheral(PE(22), PERIPH_A, 0); /* NCS5 -> OE_N */ 1286 + set_ebi_sfr_bits(HMATRIX_BIT(CS5A)); 1287 + break; 1288 + default: 1289 + return -EINVAL; 1290 + } 1291 + 1292 + if (!common_pins_initialized) { 1293 + select_peripheral(PE(19), PERIPH_A, 0); /* CFCE1 -> CS0_N */ 1294 + select_peripheral(PE(20), PERIPH_A, 0); /* CFCE2 -> CS1_N */ 1295 + select_peripheral(PE(23), PERIPH_A, 0); /* CFRNW -> DIR */ 1296 + select_peripheral(PE(24), PERIPH_A, 0); /* NWAIT <- IORDY */ 1297 + common_pins_initialized = true; 1298 + } 1299 + 1300 + at32_select_periph(extint_pin, GPIO_PERIPH_A, AT32_GPIOF_DEGLITCH); 1301 + 1302 + pdev->resource[1].start = EIM_IRQ_BASE + extint; 1303 + pdev->resource[1].end = pdev->resource[1].start; 1304 + 1305 + return 0; 1306 + } 1307 + 1308 + struct platform_device *__init 1309 + at32_add_device_ide(unsigned int id, unsigned int extint, 1310 + struct ide_platform_data *data) 1311 + { 1312 + struct platform_device *pdev; 1313 + 1314 + pdev = platform_device_alloc("at32_ide", id); 1315 + if (!pdev) 1316 + goto fail; 1317 + 1318 + if (platform_device_add_data(pdev, data, 1319 + sizeof(struct ide_platform_data))) 1320 + goto fail; 1321 + 1322 + if (at32_init_ide_or_cf(pdev, data->cs, extint)) 1323 + goto fail; 1324 + 1325 + platform_device_add(pdev); 1326 + return pdev; 1327 + 1328 + fail: 1329 + platform_device_put(pdev); 1330 + return NULL; 1331 + } 1332 + 1333 + struct platform_device *__init 1334 + at32_add_device_cf(unsigned int id, unsigned int extint, 1335 + struct cf_platform_data *data) 1336 + { 1337 + struct platform_device *pdev; 1338 + 1339 + pdev = platform_device_alloc("at32_cf", id); 1340 + if (!pdev) 1341 + goto fail; 1342 + 1343 + if (platform_device_add_data(pdev, data, 1344 + sizeof(struct cf_platform_data))) 1345 + goto fail; 1346 + 1347 + if (at32_init_ide_or_cf(pdev, data->cs, extint)) 1348 + goto fail; 1349 + 1350 + if (data->detect_pin != GPIO_PIN_NONE) 1351 + at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH); 1352 + if (data->reset_pin != GPIO_PIN_NONE) 1353 + at32_select_gpio(data->reset_pin, 0); 1354 + if (data->vcc_pin != GPIO_PIN_NONE) 1355 + at32_select_gpio(data->vcc_pin, 0); 1356 + /* READY is used as extint, so we can't select it as gpio */ 1357 + 1358 + platform_device_add(pdev); 1359 + return pdev; 1360 + 1361 + fail: 1362 + platform_device_put(pdev); 1363 + return NULL; 1364 + } 1365 + 1366 + /* -------------------------------------------------------------------- 1367 + * AC97C 1368 + * -------------------------------------------------------------------- */ 1369 + static struct resource atmel_ac97c0_resource[] __initdata = { 1370 + PBMEM(0xfff02800), 1371 + IRQ(29), 1372 + }; 1373 + static struct clk atmel_ac97c0_pclk = { 1374 + .name = "pclk", 1375 + .parent = &pbb_clk, 1376 + .mode = pbb_clk_mode, 1377 + .get_rate = pbb_clk_get_rate, 1378 + .index = 10, 1379 + }; 1380 + 1381 + struct platform_device *__init at32_add_device_ac97c(unsigned int id) 1382 + { 1383 + struct platform_device *pdev; 1384 + 1385 + if (id != 0) 1386 + return NULL; 1387 + 1388 + pdev = platform_device_alloc("atmel_ac97c", id); 1389 + if (!pdev) 1390 + return NULL; 1391 + 1392 + if (platform_device_add_resources(pdev, atmel_ac97c0_resource, 1393 + ARRAY_SIZE(atmel_ac97c0_resource))) 1394 + goto err_add_resources; 1395 + 1396 + select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */ 1397 + select_peripheral(PB(21), PERIPH_B, 0); /* SDO */ 1398 + select_peripheral(PB(22), PERIPH_B, 0); /* SDI */ 1399 + select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */ 1400 + 1401 + atmel_ac97c0_pclk.dev = &pdev->dev; 1402 + 1403 + platform_device_add(pdev); 1404 + return pdev; 1405 + 1406 + err_add_resources: 1407 + platform_device_put(pdev); 1408 + return NULL; 1409 + } 1410 + 1411 + /* -------------------------------------------------------------------- 1412 + * ABDAC 1413 + * -------------------------------------------------------------------- */ 1414 + static struct resource abdac0_resource[] __initdata = { 1415 + PBMEM(0xfff02000), 1416 + IRQ(27), 1417 + }; 1418 + static struct clk abdac0_pclk = { 1419 + .name = "pclk", 1420 + .parent = &pbb_clk, 1421 + .mode = pbb_clk_mode, 1422 + .get_rate = pbb_clk_get_rate, 1423 + .index = 8, 1424 + }; 1425 + static struct clk abdac0_sample_clk = { 1426 + .name = "sample_clk", 1427 + .mode = genclk_mode, 1428 + .get_rate = genclk_get_rate, 1429 + .set_rate = genclk_set_rate, 1430 + .set_parent = genclk_set_parent, 1431 + .index = 6, 1432 + }; 1433 + 1434 + struct platform_device *__init at32_add_device_abdac(unsigned int id) 1435 + { 1436 + struct platform_device *pdev; 1437 + 1438 + if (id != 0) 1439 + return NULL; 1440 + 1441 + pdev = platform_device_alloc("abdac", id); 1442 + if (!pdev) 1443 + return NULL; 1444 + 1445 + if (platform_device_add_resources(pdev, abdac0_resource, 1446 + ARRAY_SIZE(abdac0_resource))) 1447 + goto err_add_resources; 1448 + 1449 + select_peripheral(PB(20), PERIPH_A, 0); /* DATA1 */ 1450 + select_peripheral(PB(21), PERIPH_A, 0); /* DATA0 */ 1451 + select_peripheral(PB(22), PERIPH_A, 0); /* DATAN1 */ 1452 + select_peripheral(PB(23), PERIPH_A, 0); /* DATAN0 */ 1453 + 1454 + abdac0_pclk.dev = &pdev->dev; 1455 + abdac0_sample_clk.dev = &pdev->dev; 1456 + 1457 + platform_device_add(pdev); 1458 + return pdev; 1459 + 1460 + err_add_resources: 1461 + platform_device_put(pdev); 1462 + return NULL; 1463 + } 1464 + 1465 + /* -------------------------------------------------------------------- 1466 * GCLK 1467 * -------------------------------------------------------------------- */ 1468 static struct clk gclk0 = { ··· 1290 &smc0_mck, 1291 &pdc_hclk, 1292 &pdc_pclk, 1293 + &dmaca0_hclk, 1294 &pico_clk, 1295 &pio0_mck, 1296 &pio1_mck, ··· 1307 &macb1_pclk, 1308 &atmel_spi0_spi_clk, 1309 &atmel_spi1_spi_clk, 1310 + &atmel_twi0_pclk, 1311 + &atmel_mci0_pclk, 1312 &atmel_lcdfb0_hck1, 1313 &atmel_lcdfb0_pixclk, 1314 &ssc0_pclk, ··· 1314 &ssc2_pclk, 1315 &usba0_hclk, 1316 &usba0_pclk, 1317 + &atmel_ac97c0_pclk, 1318 + &abdac0_pclk, 1319 + &abdac0_sample_clk, 1320 &gclk0, 1321 &gclk1, 1322 &gclk2, ··· 1355 genclk_init_parent(&gclk3); 1356 genclk_init_parent(&gclk4); 1357 genclk_init_parent(&atmel_lcdfb0_pixclk); 1358 + genclk_init_parent(&abdac0_sample_clk); 1359 1360 /* 1361 * Turn on all clocks that have at least one user already, and
+1 -1
arch/avr32/mach-at32ap/extint.c
··· 142 return ret; 143 } 144 145 - struct irq_chip eic_chip = { 146 .name = "eic", 147 .ack = eic_ack_irq, 148 .mask = eic_mask_irq,
··· 142 return ret; 143 } 144 145 + static struct irq_chip eic_chip = { 146 .name = "eic", 147 .ack = eic_ack_irq, 148 .mask = eic_mask_irq,
+2 -2
arch/avr32/mach-at32ap/pm.h
··· 113 114 /* Register access macros */ 115 #define pm_readl(reg) \ 116 - __raw_readl((void __iomem *)AT32_PM_BASE + PM_##reg) 117 #define pm_writel(reg,value) \ 118 - __raw_writel((value), (void __iomem *)AT32_PM_BASE + PM_##reg) 119 120 #endif /* __ARCH_AVR32_MACH_AT32AP_PM_H__ */
··· 113 114 /* Register access macros */ 115 #define pm_readl(reg) \ 116 + __raw_readl((void __iomem __force *)AT32_PM_BASE + PM_##reg) 117 #define pm_writel(reg,value) \ 118 + __raw_writel((value), (void __iomem __force *)AT32_PM_BASE + PM_##reg) 119 120 #endif /* __ARCH_AVR32_MACH_AT32AP_PM_H__ */
+1 -1
arch/avr32/mach-at32ap/time-tc.c
··· 79 { 80 unsigned int cycles_max = (clocksource_avr32.mask + 1) / 2; 81 unsigned int divs[] = { 4, 8, 16, 32 }; 82 - int divs_size = sizeof(divs) / sizeof(*divs); 83 int i = 0; 84 unsigned long count_hz; 85 unsigned long shift;
··· 79 { 80 unsigned int cycles_max = (clocksource_avr32.mask + 1) / 2; 81 unsigned int divs[] = { 4, 8, 16, 32 }; 82 + int divs_size = ARRAY_SIZE(divs); 83 int i = 0; 84 unsigned long count_hz; 85 unsigned long shift;
+23
include/asm-avr32/arch-at32ap/board.h
··· 44 struct platform_device * 45 at32_add_device_usba(unsigned int id, struct usba_platform_data *data); 46 47 /* depending on what's hooked up, not all SSC pins will be used */ 48 #define ATMEL_SSC_TK 0x01 49 #define ATMEL_SSC_TF 0x02 ··· 64 65 struct platform_device * 66 at32_add_device_ssc(unsigned int id, unsigned int flags); 67 68 #endif /* __ASM_ARCH_BOARD_H */
··· 44 struct platform_device * 45 at32_add_device_usba(unsigned int id, struct usba_platform_data *data); 46 47 + struct ide_platform_data { 48 + u8 cs; 49 + }; 50 + struct platform_device * 51 + at32_add_device_ide(unsigned int id, unsigned int extint, 52 + struct ide_platform_data *data); 53 + 54 /* depending on what's hooked up, not all SSC pins will be used */ 55 #define ATMEL_SSC_TK 0x01 56 #define ATMEL_SSC_TF 0x02 ··· 57 58 struct platform_device * 59 at32_add_device_ssc(unsigned int id, unsigned int flags); 60 + 61 + struct platform_device *at32_add_device_twi(unsigned int id); 62 + struct platform_device *at32_add_device_mci(unsigned int id); 63 + struct platform_device *at32_add_device_ac97c(unsigned int id); 64 + struct platform_device *at32_add_device_abdac(unsigned int id); 65 + 66 + struct cf_platform_data { 67 + int detect_pin; 68 + int reset_pin; 69 + int vcc_pin; 70 + int ready_pin; 71 + u8 cs; 72 + }; 73 + struct platform_device * 74 + at32_add_device_cf(unsigned int id, unsigned int extint, 75 + struct cf_platform_data *data); 76 77 #endif /* __ASM_ARCH_BOARD_H */