diff options
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 309 |
1 files changed, 238 insertions, 71 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index b65d3e0667a8..351e1b42f937 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #include <linux/clk.h> | 8 | #include <linux/clk.h> |
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | #include <linux/dw_dmac.h> | ||
10 | #include <linux/fb.h> | 11 | #include <linux/fb.h> |
11 | #include <linux/init.h> | 12 | #include <linux/init.h> |
12 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
@@ -14,12 +15,14 @@ | |||
14 | #include <linux/spi/spi.h> | 15 | #include <linux/spi/spi.h> |
15 | #include <linux/usb/atmel_usba_udc.h> | 16 | #include <linux/usb/atmel_usba_udc.h> |
16 | 17 | ||
18 | #include <asm/atmel-mci.h> | ||
17 | #include <asm/io.h> | 19 | #include <asm/io.h> |
18 | #include <asm/irq.h> | 20 | #include <asm/irq.h> |
19 | 21 | ||
20 | #include <asm/arch/at32ap700x.h> | 22 | #include <asm/arch/at32ap700x.h> |
21 | #include <asm/arch/board.h> | 23 | #include <asm/arch/board.h> |
22 | #include <asm/arch/portmux.h> | 24 | #include <asm/arch/portmux.h> |
25 | #include <asm/arch/sram.h> | ||
23 | 26 | ||
24 | #include <video/atmel_lcdc.h> | 27 | #include <video/atmel_lcdc.h> |
25 | 28 | ||
@@ -93,19 +96,12 @@ static struct clk devname##_##_name = { \ | |||
93 | 96 | ||
94 | static DEFINE_SPINLOCK(pm_lock); | 97 | static DEFINE_SPINLOCK(pm_lock); |
95 | 98 | ||
96 | unsigned long at32ap7000_osc_rates[3] = { | ||
97 | [0] = 32768, | ||
98 | /* FIXME: these are ATSTK1002-specific */ | ||
99 | [1] = 20000000, | ||
100 | [2] = 12000000, | ||
101 | }; | ||
102 | |||
103 | static struct clk osc0; | 99 | static struct clk osc0; |
104 | static struct clk osc1; | 100 | static struct clk osc1; |
105 | 101 | ||
106 | static unsigned long osc_get_rate(struct clk *clk) | 102 | static unsigned long osc_get_rate(struct clk *clk) |
107 | { | 103 | { |
108 | return at32ap7000_osc_rates[clk->index]; | 104 | return at32_board_osc_rates[clk->index]; |
109 | } | 105 | } |
110 | 106 | ||
111 | static unsigned long pll_get_rate(struct clk *clk, unsigned long control) | 107 | static unsigned long pll_get_rate(struct clk *clk, unsigned long control) |
@@ -599,6 +595,17 @@ static void __init genclk_init_parent(struct clk *clk) | |||
599 | clk->parent = parent; | 595 | clk->parent = parent; |
600 | } | 596 | } |
601 | 597 | ||
598 | static struct dw_dma_platform_data dw_dmac0_data = { | ||
599 | .nr_channels = 3, | ||
600 | }; | ||
601 | |||
602 | static struct resource dw_dmac0_resource[] = { | ||
603 | PBMEM(0xff200000), | ||
604 | IRQ(2), | ||
605 | }; | ||
606 | DEFINE_DEV_DATA(dw_dmac, 0); | ||
607 | DEV_CLK(hclk, dw_dmac0, hsb, 10); | ||
608 | |||
602 | /* -------------------------------------------------------------------- | 609 | /* -------------------------------------------------------------------- |
603 | * System peripherals | 610 | * System peripherals |
604 | * -------------------------------------------------------------------- */ | 611 | * -------------------------------------------------------------------- */ |
@@ -682,6 +689,14 @@ static struct clk hramc_clk = { | |||
682 | .users = 1, | 689 | .users = 1, |
683 | .index = 3, | 690 | .index = 3, |
684 | }; | 691 | }; |
692 | static struct clk sdramc_clk = { | ||
693 | .name = "sdramc_clk", | ||
694 | .parent = &pbb_clk, | ||
695 | .mode = pbb_clk_mode, | ||
696 | .get_rate = pbb_clk_get_rate, | ||
697 | .users = 1, | ||
698 | .index = 14, | ||
699 | }; | ||
685 | 700 | ||
686 | static struct resource smc0_resource[] = { | 701 | static struct resource smc0_resource[] = { |
687 | PBMEM(0xfff03400), | 702 | PBMEM(0xfff03400), |
@@ -705,17 +720,6 @@ static struct clk pico_clk = { | |||
705 | .users = 1, | 720 | .users = 1, |
706 | }; | 721 | }; |
707 | 722 | ||
708 | static struct resource dmaca0_resource[] = { | ||
709 | { | ||
710 | .start = 0xff200000, | ||
711 | .end = 0xff20ffff, | ||
712 | .flags = IORESOURCE_MEM, | ||
713 | }, | ||
714 | IRQ(2), | ||
715 | }; | ||
716 | DEFINE_DEV(dmaca, 0); | ||
717 | DEV_CLK(hclk, dmaca0, hsb, 10); | ||
718 | |||
719 | /* -------------------------------------------------------------------- | 723 | /* -------------------------------------------------------------------- |
720 | * HMATRIX | 724 | * HMATRIX |
721 | * -------------------------------------------------------------------- */ | 725 | * -------------------------------------------------------------------- */ |
@@ -828,7 +832,7 @@ void __init at32_add_system_devices(void) | |||
828 | platform_device_register(&at32_eic0_device); | 832 | platform_device_register(&at32_eic0_device); |
829 | platform_device_register(&smc0_device); | 833 | platform_device_register(&smc0_device); |
830 | platform_device_register(&pdc_device); | 834 | platform_device_register(&pdc_device); |
831 | platform_device_register(&dmaca0_device); | 835 | platform_device_register(&dw_dmac0_device); |
832 | 836 | ||
833 | platform_device_register(&at32_tcb0_device); | 837 | platform_device_register(&at32_tcb0_device); |
834 | platform_device_register(&at32_tcb1_device); | 838 | platform_device_register(&at32_tcb1_device); |
@@ -841,6 +845,81 @@ void __init at32_add_system_devices(void) | |||
841 | } | 845 | } |
842 | 846 | ||
843 | /* -------------------------------------------------------------------- | 847 | /* -------------------------------------------------------------------- |
848 | * PSIF | ||
849 | * -------------------------------------------------------------------- */ | ||
850 | static struct resource atmel_psif0_resource[] __initdata = { | ||
851 | { | ||
852 | .start = 0xffe03c00, | ||
853 | .end = 0xffe03cff, | ||
854 | .flags = IORESOURCE_MEM, | ||
855 | }, | ||
856 | IRQ(18), | ||
857 | }; | ||
858 | static struct clk atmel_psif0_pclk = { | ||
859 | .name = "pclk", | ||
860 | .parent = &pba_clk, | ||
861 | .mode = pba_clk_mode, | ||
862 | .get_rate = pba_clk_get_rate, | ||
863 | .index = 15, | ||
864 | }; | ||
865 | |||
866 | static struct resource atmel_psif1_resource[] __initdata = { | ||
867 | { | ||
868 | .start = 0xffe03d00, | ||
869 | .end = 0xffe03dff, | ||
870 | .flags = IORESOURCE_MEM, | ||
871 | }, | ||
872 | IRQ(18), | ||
873 | }; | ||
874 | static struct clk atmel_psif1_pclk = { | ||
875 | .name = "pclk", | ||
876 | .parent = &pba_clk, | ||
877 | .mode = pba_clk_mode, | ||
878 | .get_rate = pba_clk_get_rate, | ||
879 | .index = 15, | ||
880 | }; | ||
881 | |||
882 | struct platform_device *__init at32_add_device_psif(unsigned int id) | ||
883 | { | ||
884 | struct platform_device *pdev; | ||
885 | |||
886 | if (!(id == 0 || id == 1)) | ||
887 | return NULL; | ||
888 | |||
889 | pdev = platform_device_alloc("atmel_psif", id); | ||
890 | if (!pdev) | ||
891 | return NULL; | ||
892 | |||
893 | switch (id) { | ||
894 | case 0: | ||
895 | if (platform_device_add_resources(pdev, atmel_psif0_resource, | ||
896 | ARRAY_SIZE(atmel_psif0_resource))) | ||
897 | goto err_add_resources; | ||
898 | atmel_psif0_pclk.dev = &pdev->dev; | ||
899 | select_peripheral(PA(8), PERIPH_A, 0); /* CLOCK */ | ||
900 | select_peripheral(PA(9), PERIPH_A, 0); /* DATA */ | ||
901 | break; | ||
902 | case 1: | ||
903 | if (platform_device_add_resources(pdev, atmel_psif1_resource, | ||
904 | ARRAY_SIZE(atmel_psif1_resource))) | ||
905 | goto err_add_resources; | ||
906 | atmel_psif1_pclk.dev = &pdev->dev; | ||
907 | select_peripheral(PB(11), PERIPH_A, 0); /* CLOCK */ | ||
908 | select_peripheral(PB(12), PERIPH_A, 0); /* DATA */ | ||
909 | break; | ||
910 | default: | ||
911 | return NULL; | ||
912 | } | ||
913 | |||
914 | platform_device_add(pdev); | ||
915 | return pdev; | ||
916 | |||
917 | err_add_resources: | ||
918 | platform_device_put(pdev); | ||
919 | return NULL; | ||
920 | } | ||
921 | |||
922 | /* -------------------------------------------------------------------- | ||
844 | * USART | 923 | * USART |
845 | * -------------------------------------------------------------------- */ | 924 | * -------------------------------------------------------------------- */ |
846 | 925 | ||
@@ -1113,7 +1192,8 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n) | |||
1113 | switch (id) { | 1192 | switch (id) { |
1114 | case 0: | 1193 | case 0: |
1115 | pdev = &atmel_spi0_device; | 1194 | pdev = &atmel_spi0_device; |
1116 | select_peripheral(PA(0), PERIPH_A, 0); /* MISO */ | 1195 | /* pullup MISO so a level is always defined */ |
1196 | select_peripheral(PA(0), PERIPH_A, AT32_GPIOF_PULLUP); | ||
1117 | select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */ | 1197 | select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */ |
1118 | select_peripheral(PA(2), PERIPH_A, 0); /* SCK */ | 1198 | select_peripheral(PA(2), PERIPH_A, 0); /* SCK */ |
1119 | at32_spi_setup_slaves(0, b, n, spi0_pins); | 1199 | at32_spi_setup_slaves(0, b, n, spi0_pins); |
@@ -1121,7 +1201,8 @@ at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n) | |||
1121 | 1201 | ||
1122 | case 1: | 1202 | case 1: |
1123 | pdev = &atmel_spi1_device; | 1203 | pdev = &atmel_spi1_device; |
1124 | select_peripheral(PB(0), PERIPH_B, 0); /* MISO */ | 1204 | /* pullup MISO so a level is always defined */ |
1205 | select_peripheral(PB(0), PERIPH_B, AT32_GPIOF_PULLUP); | ||
1125 | select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */ | 1206 | select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */ |
1126 | select_peripheral(PB(5), PERIPH_B, 0); /* SCK */ | 1207 | select_peripheral(PB(5), PERIPH_B, 0); /* SCK */ |
1127 | at32_spi_setup_slaves(1, b, n, spi1_pins); | 1208 | at32_spi_setup_slaves(1, b, n, spi1_pins); |
@@ -1199,20 +1280,32 @@ static struct clk atmel_mci0_pclk = { | |||
1199 | .index = 9, | 1280 | .index = 9, |
1200 | }; | 1281 | }; |
1201 | 1282 | ||
1202 | struct platform_device *__init at32_add_device_mci(unsigned int id) | 1283 | struct platform_device *__init |
1284 | at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | ||
1203 | { | 1285 | { |
1204 | struct platform_device *pdev; | 1286 | struct mci_platform_data _data; |
1287 | struct platform_device *pdev; | ||
1288 | struct dw_dma_slave *dws; | ||
1205 | 1289 | ||
1206 | if (id != 0) | 1290 | if (id != 0) |
1207 | return NULL; | 1291 | return NULL; |
1208 | 1292 | ||
1209 | pdev = platform_device_alloc("atmel_mci", id); | 1293 | pdev = platform_device_alloc("atmel_mci", id); |
1210 | if (!pdev) | 1294 | if (!pdev) |
1211 | return NULL; | 1295 | goto fail; |
1212 | 1296 | ||
1213 | if (platform_device_add_resources(pdev, atmel_mci0_resource, | 1297 | if (platform_device_add_resources(pdev, atmel_mci0_resource, |
1214 | ARRAY_SIZE(atmel_mci0_resource))) | 1298 | ARRAY_SIZE(atmel_mci0_resource))) |
1215 | goto err_add_resources; | 1299 | goto fail; |
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, | ||
1307 | sizeof(struct mci_platform_data))) | ||
1308 | goto fail; | ||
1216 | 1309 | ||
1217 | select_peripheral(PA(10), PERIPH_A, 0); /* CLK */ | 1310 | select_peripheral(PA(10), PERIPH_A, 0); /* CLK */ |
1218 | select_peripheral(PA(11), PERIPH_A, 0); /* CMD */ | 1311 | select_peripheral(PA(11), PERIPH_A, 0); /* CMD */ |
@@ -1221,12 +1314,19 @@ struct platform_device *__init at32_add_device_mci(unsigned int id) | |||
1221 | select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */ | 1314 | select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */ |
1222 | select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */ | 1315 | select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */ |
1223 | 1316 | ||
1317 | if (data) { | ||
1318 | if (data->detect_pin != GPIO_PIN_NONE) | ||
1319 | at32_select_gpio(data->detect_pin, 0); | ||
1320 | if (data->wp_pin != GPIO_PIN_NONE) | ||
1321 | at32_select_gpio(data->wp_pin, 0); | ||
1322 | } | ||
1323 | |||
1224 | atmel_mci0_pclk.dev = &pdev->dev; | 1324 | atmel_mci0_pclk.dev = &pdev->dev; |
1225 | 1325 | ||
1226 | platform_device_add(pdev); | 1326 | platform_device_add(pdev); |
1227 | return pdev; | 1327 | return pdev; |
1228 | 1328 | ||
1229 | err_add_resources: | 1329 | fail: |
1230 | platform_device_put(pdev); | 1330 | platform_device_put(pdev); |
1231 | return NULL; | 1331 | return NULL; |
1232 | } | 1332 | } |
@@ -1264,7 +1364,8 @@ static struct clk atmel_lcdfb0_pixclk = { | |||
1264 | 1364 | ||
1265 | struct platform_device *__init | 1365 | struct platform_device *__init |
1266 | at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, | 1366 | at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, |
1267 | unsigned long fbmem_start, unsigned long fbmem_len) | 1367 | unsigned long fbmem_start, unsigned long fbmem_len, |
1368 | unsigned int pin_config) | ||
1268 | { | 1369 | { |
1269 | struct platform_device *pdev; | 1370 | struct platform_device *pdev; |
1270 | struct atmel_lcdfb_info *info; | 1371 | struct atmel_lcdfb_info *info; |
@@ -1291,37 +1392,77 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, | |||
1291 | switch (id) { | 1392 | switch (id) { |
1292 | case 0: | 1393 | case 0: |
1293 | pdev = &atmel_lcdfb0_device; | 1394 | pdev = &atmel_lcdfb0_device; |
1294 | select_peripheral(PC(19), PERIPH_A, 0); /* CC */ | 1395 | |
1295 | select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ | 1396 | switch (pin_config) { |
1296 | select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ | 1397 | case 0: |
1297 | select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */ | 1398 | select_peripheral(PC(19), PERIPH_A, 0); /* CC */ |
1298 | select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */ | 1399 | select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ |
1299 | select_peripheral(PC(24), PERIPH_A, 0); /* MODE */ | 1400 | select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ |
1300 | select_peripheral(PC(25), PERIPH_A, 0); /* PWR */ | 1401 | select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */ |
1301 | select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */ | 1402 | select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */ |
1302 | select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */ | 1403 | select_peripheral(PC(24), PERIPH_A, 0); /* MODE */ |
1303 | select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */ | 1404 | select_peripheral(PC(25), PERIPH_A, 0); /* PWR */ |
1304 | select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */ | 1405 | select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */ |
1305 | select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */ | 1406 | select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */ |
1306 | select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */ | 1407 | select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */ |
1307 | select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */ | 1408 | select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */ |
1308 | select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */ | 1409 | select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */ |
1309 | select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */ | 1410 | select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */ |
1310 | select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */ | 1411 | select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */ |
1311 | select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */ | 1412 | select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */ |
1312 | select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */ | 1413 | select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */ |
1313 | select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */ | 1414 | select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */ |
1314 | select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */ | 1415 | select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */ |
1315 | select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */ | 1416 | select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */ |
1316 | select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */ | 1417 | select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */ |
1317 | select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */ | 1418 | select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */ |
1318 | select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */ | 1419 | select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */ |
1319 | select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */ | 1420 | select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */ |
1320 | select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */ | 1421 | select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */ |
1321 | select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */ | 1422 | select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */ |
1322 | select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */ | 1423 | select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */ |
1323 | select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ | 1424 | select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */ |
1324 | select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ | 1425 | select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */ |
1426 | select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */ | ||
1427 | select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ | ||
1428 | select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ | ||
1429 | break; | ||
1430 | case 1: | ||
1431 | select_peripheral(PE(0), PERIPH_B, 0); /* CC */ | ||
1432 | select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ | ||
1433 | select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ | ||
1434 | select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */ | ||
1435 | select_peripheral(PE(1), PERIPH_B, 0); /* DVAL */ | ||
1436 | select_peripheral(PE(2), PERIPH_B, 0); /* MODE */ | ||
1437 | select_peripheral(PC(25), PERIPH_A, 0); /* PWR */ | ||
1438 | select_peripheral(PE(3), PERIPH_B, 0); /* DATA0 */ | ||
1439 | select_peripheral(PE(4), PERIPH_B, 0); /* DATA1 */ | ||
1440 | select_peripheral(PE(5), PERIPH_B, 0); /* DATA2 */ | ||
1441 | select_peripheral(PE(6), PERIPH_B, 0); /* DATA3 */ | ||
1442 | select_peripheral(PE(7), PERIPH_B, 0); /* DATA4 */ | ||
1443 | select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */ | ||
1444 | select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */ | ||
1445 | select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */ | ||
1446 | select_peripheral(PE(8), PERIPH_B, 0); /* DATA8 */ | ||
1447 | select_peripheral(PE(9), PERIPH_B, 0); /* DATA9 */ | ||
1448 | select_peripheral(PE(10), PERIPH_B, 0); /* DATA10 */ | ||
1449 | select_peripheral(PE(11), PERIPH_B, 0); /* DATA11 */ | ||
1450 | select_peripheral(PE(12), PERIPH_B, 0); /* DATA12 */ | ||
1451 | select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */ | ||
1452 | select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */ | ||
1453 | select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */ | ||
1454 | select_peripheral(PE(13), PERIPH_B, 0); /* DATA16 */ | ||
1455 | select_peripheral(PE(14), PERIPH_B, 0); /* DATA17 */ | ||
1456 | select_peripheral(PE(15), PERIPH_B, 0); /* DATA18 */ | ||
1457 | select_peripheral(PE(16), PERIPH_B, 0); /* DATA19 */ | ||
1458 | select_peripheral(PE(17), PERIPH_B, 0); /* DATA20 */ | ||
1459 | select_peripheral(PE(18), PERIPH_B, 0); /* DATA21 */ | ||
1460 | select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ | ||
1461 | select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ | ||
1462 | break; | ||
1463 | default: | ||
1464 | goto err_invalid_id; | ||
1465 | } | ||
1325 | 1466 | ||
1326 | clk_set_parent(&atmel_lcdfb0_pixclk, &pll0); | 1467 | clk_set_parent(&atmel_lcdfb0_pixclk, &pll0); |
1327 | clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0)); | 1468 | clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0)); |
@@ -1360,7 +1501,7 @@ static struct resource atmel_pwm0_resource[] __initdata = { | |||
1360 | IRQ(24), | 1501 | IRQ(24), |
1361 | }; | 1502 | }; |
1362 | static struct clk atmel_pwm0_mck = { | 1503 | static struct clk atmel_pwm0_mck = { |
1363 | .name = "mck", | 1504 | .name = "pwm_clk", |
1364 | .parent = &pbb_clk, | 1505 | .parent = &pbb_clk, |
1365 | .mode = pbb_clk_mode, | 1506 | .mode = pbb_clk_mode, |
1366 | .get_rate = pbb_clk_get_rate, | 1507 | .get_rate = pbb_clk_get_rate, |
@@ -1939,11 +2080,12 @@ struct clk *at32_clock_list[] = { | |||
1939 | &hmatrix_clk, | 2080 | &hmatrix_clk, |
1940 | &ebi_clk, | 2081 | &ebi_clk, |
1941 | &hramc_clk, | 2082 | &hramc_clk, |
2083 | &sdramc_clk, | ||
1942 | &smc0_pclk, | 2084 | &smc0_pclk, |
1943 | &smc0_mck, | 2085 | &smc0_mck, |
1944 | &pdc_hclk, | 2086 | &pdc_hclk, |
1945 | &pdc_pclk, | 2087 | &pdc_pclk, |
1946 | &dmaca0_hclk, | 2088 | &dw_dmac0_hclk, |
1947 | &pico_clk, | 2089 | &pico_clk, |
1948 | &pio0_mck, | 2090 | &pio0_mck, |
1949 | &pio1_mck, | 2091 | &pio1_mck, |
@@ -1952,6 +2094,8 @@ struct clk *at32_clock_list[] = { | |||
1952 | &pio4_mck, | 2094 | &pio4_mck, |
1953 | &at32_tcb0_t0_clk, | 2095 | &at32_tcb0_t0_clk, |
1954 | &at32_tcb1_t0_clk, | 2096 | &at32_tcb1_t0_clk, |
2097 | &atmel_psif0_pclk, | ||
2098 | &atmel_psif1_pclk, | ||
1955 | &atmel_usart0_usart, | 2099 | &atmel_usart0_usart, |
1956 | &atmel_usart1_usart, | 2100 | &atmel_usart1_usart, |
1957 | &atmel_usart2_usart, | 2101 | &atmel_usart2_usart, |
@@ -1987,16 +2131,7 @@ struct clk *at32_clock_list[] = { | |||
1987 | }; | 2131 | }; |
1988 | unsigned int at32_nr_clocks = ARRAY_SIZE(at32_clock_list); | 2132 | unsigned int at32_nr_clocks = ARRAY_SIZE(at32_clock_list); |
1989 | 2133 | ||
1990 | void __init at32_portmux_init(void) | 2134 | void __init setup_platform(void) |
1991 | { | ||
1992 | at32_init_pio(&pio0_device); | ||
1993 | at32_init_pio(&pio1_device); | ||
1994 | at32_init_pio(&pio2_device); | ||
1995 | at32_init_pio(&pio3_device); | ||
1996 | at32_init_pio(&pio4_device); | ||
1997 | } | ||
1998 | |||
1999 | void __init at32_clock_init(void) | ||
2000 | { | 2135 | { |
2001 | u32 cpu_mask = 0, hsb_mask = 0, pba_mask = 0, pbb_mask = 0; | 2136 | u32 cpu_mask = 0, hsb_mask = 0, pba_mask = 0, pbb_mask = 0; |
2002 | int i; | 2137 | int i; |
@@ -2051,4 +2186,36 @@ void __init at32_clock_init(void) | |||
2051 | pm_writel(HSB_MASK, hsb_mask); | 2186 | pm_writel(HSB_MASK, hsb_mask); |
2052 | pm_writel(PBA_MASK, pba_mask); | 2187 | pm_writel(PBA_MASK, pba_mask); |
2053 | pm_writel(PBB_MASK, pbb_mask); | 2188 | pm_writel(PBB_MASK, pbb_mask); |
2189 | |||
2190 | /* Initialize the port muxes */ | ||
2191 | at32_init_pio(&pio0_device); | ||
2192 | at32_init_pio(&pio1_device); | ||
2193 | at32_init_pio(&pio2_device); | ||
2194 | at32_init_pio(&pio3_device); | ||
2195 | at32_init_pio(&pio4_device); | ||
2196 | } | ||
2197 | |||
2198 | struct gen_pool *sram_pool; | ||
2199 | |||
2200 | static int __init sram_init(void) | ||
2201 | { | ||
2202 | struct gen_pool *pool; | ||
2203 | |||
2204 | /* 1KiB granularity */ | ||
2205 | pool = gen_pool_create(10, -1); | ||
2206 | if (!pool) | ||
2207 | goto fail; | ||
2208 | |||
2209 | if (gen_pool_add(pool, 0x24000000, 0x8000, -1)) | ||
2210 | goto err_pool_add; | ||
2211 | |||
2212 | sram_pool = pool; | ||
2213 | return 0; | ||
2214 | |||
2215 | err_pool_add: | ||
2216 | gen_pool_destroy(pool); | ||
2217 | fail: | ||
2218 | pr_err("Failed to create SRAM pool\n"); | ||
2219 | return -ENOMEM; | ||
2054 | } | 2220 | } |
2221 | core_initcall(sram_init); | ||