diff options
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r-- | arch/arm/mach-kirkwood/Kconfig | 12 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 96 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/db88f6281-bp-setup.c | 67 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/kirkwood.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/system.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/mpp.c | 97 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/mpp.h | 303 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/rd88f6281-setup.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/sheevaplug-setup.c | 136 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/ts219-setup.c | 220 |
13 files changed, 948 insertions, 27 deletions
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 3600cd9f0519..b5421cccd7e1 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig | |||
@@ -20,6 +20,18 @@ config MACH_RD88F6281 | |||
20 | Say 'Y' here if you want your kernel to support the | 20 | Say 'Y' here if you want your kernel to support the |
21 | Marvell RD-88F6281 Reference Board. | 21 | Marvell RD-88F6281 Reference Board. |
22 | 22 | ||
23 | config MACH_SHEEVAPLUG | ||
24 | bool "Marvell SheevaPlug Reference Board" | ||
25 | help | ||
26 | Say 'Y' here if you want your kernel to support the | ||
27 | Marvell SheevaPlug Reference Board. | ||
28 | |||
29 | config MACH_TS219 | ||
30 | bool "QNAP TS-119 and TS-219 Turbo NAS" | ||
31 | help | ||
32 | Say 'Y' here if you want your kernel to support the | ||
33 | QNAP TS-119 and TS-219 Turbo NAS devices. | ||
34 | |||
23 | endmenu | 35 | endmenu |
24 | 36 | ||
25 | endif | 37 | endif |
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index b96c55dad343..8f03c9b9bdd9 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
@@ -1,5 +1,7 @@ | |||
1 | obj-y += common.o addr-map.o irq.o pcie.o | 1 | obj-y += common.o addr-map.o irq.o pcie.o mpp.o |
2 | 2 | ||
3 | obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o | 3 | obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o |
4 | obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o | 4 | obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o |
5 | obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o | 5 | obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o |
6 | obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o | ||
7 | obj-$(CONFIG_MACH_TS219) += ts219-setup.o | ||
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 0d2074f51a59..3d2fae846512 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/serial_8250.h> | 14 | #include <linux/serial_8250.h> |
15 | #include <linux/mbus.h> | 15 | #include <linux/mbus.h> |
16 | #include <linux/mv643xx_eth.h> | 16 | #include <linux/mv643xx_eth.h> |
17 | #include <linux/mv643xx_i2c.h> | ||
17 | #include <linux/ata_platform.h> | 18 | #include <linux/ata_platform.h> |
18 | #include <linux/spi/orion_spi.h> | 19 | #include <linux/spi/orion_spi.h> |
19 | #include <net/dsa.h> | 20 | #include <net/dsa.h> |
@@ -24,6 +25,7 @@ | |||
24 | #include <mach/kirkwood.h> | 25 | #include <mach/kirkwood.h> |
25 | #include <plat/cache-feroceon-l2.h> | 26 | #include <plat/cache-feroceon-l2.h> |
26 | #include <plat/ehci-orion.h> | 27 | #include <plat/ehci-orion.h> |
28 | #include <plat/mvsdio.h> | ||
27 | #include <plat/mv_xor.h> | 29 | #include <plat/mv_xor.h> |
28 | #include <plat/orion_nand.h> | 30 | #include <plat/orion_nand.h> |
29 | #include <plat/time.h> | 31 | #include <plat/time.h> |
@@ -257,7 +259,7 @@ static struct resource kirkwood_rtc_resource = { | |||
257 | .flags = IORESOURCE_MEM, | 259 | .flags = IORESOURCE_MEM, |
258 | }; | 260 | }; |
259 | 261 | ||
260 | void __init kirkwood_rtc_init(void) | 262 | static void __init kirkwood_rtc_init(void) |
261 | { | 263 | { |
262 | platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1); | 264 | platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1); |
263 | } | 265 | } |
@@ -299,6 +301,50 @@ void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data) | |||
299 | 301 | ||
300 | 302 | ||
301 | /***************************************************************************** | 303 | /***************************************************************************** |
304 | * SD/SDIO/MMC | ||
305 | ****************************************************************************/ | ||
306 | static struct resource mvsdio_resources[] = { | ||
307 | [0] = { | ||
308 | .start = SDIO_PHYS_BASE, | ||
309 | .end = SDIO_PHYS_BASE + SZ_1K - 1, | ||
310 | .flags = IORESOURCE_MEM, | ||
311 | }, | ||
312 | [1] = { | ||
313 | .start = IRQ_KIRKWOOD_SDIO, | ||
314 | .end = IRQ_KIRKWOOD_SDIO, | ||
315 | .flags = IORESOURCE_IRQ, | ||
316 | }, | ||
317 | }; | ||
318 | |||
319 | static u64 mvsdio_dmamask = 0xffffffffUL; | ||
320 | |||
321 | static struct platform_device kirkwood_sdio = { | ||
322 | .name = "mvsdio", | ||
323 | .id = -1, | ||
324 | .dev = { | ||
325 | .dma_mask = &mvsdio_dmamask, | ||
326 | .coherent_dma_mask = 0xffffffff, | ||
327 | }, | ||
328 | .num_resources = ARRAY_SIZE(mvsdio_resources), | ||
329 | .resource = mvsdio_resources, | ||
330 | }; | ||
331 | |||
332 | void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data) | ||
333 | { | ||
334 | u32 dev, rev; | ||
335 | |||
336 | kirkwood_pcie_id(&dev, &rev); | ||
337 | if (rev == 0) /* catch all Kirkwood Z0's */ | ||
338 | mvsdio_data->clock = 100000000; | ||
339 | else | ||
340 | mvsdio_data->clock = 200000000; | ||
341 | mvsdio_data->dram = &kirkwood_mbus_dram_info; | ||
342 | kirkwood_sdio.dev.platform_data = mvsdio_data; | ||
343 | platform_device_register(&kirkwood_sdio); | ||
344 | } | ||
345 | |||
346 | |||
347 | /***************************************************************************** | ||
302 | * SPI | 348 | * SPI |
303 | ****************************************************************************/ | 349 | ****************************************************************************/ |
304 | static struct orion_spi_info kirkwood_spi_plat_data = { | 350 | static struct orion_spi_info kirkwood_spi_plat_data = { |
@@ -329,6 +375,45 @@ void __init kirkwood_spi_init() | |||
329 | 375 | ||
330 | 376 | ||
331 | /***************************************************************************** | 377 | /***************************************************************************** |
378 | * I2C | ||
379 | ****************************************************************************/ | ||
380 | static struct mv64xxx_i2c_pdata kirkwood_i2c_pdata = { | ||
381 | .freq_m = 8, /* assumes 166 MHz TCLK */ | ||
382 | .freq_n = 3, | ||
383 | .timeout = 1000, /* Default timeout of 1 second */ | ||
384 | }; | ||
385 | |||
386 | static struct resource kirkwood_i2c_resources[] = { | ||
387 | { | ||
388 | .name = "i2c", | ||
389 | .start = I2C_PHYS_BASE, | ||
390 | .end = I2C_PHYS_BASE + 0x1f, | ||
391 | .flags = IORESOURCE_MEM, | ||
392 | }, { | ||
393 | .name = "i2c", | ||
394 | .start = IRQ_KIRKWOOD_TWSI, | ||
395 | .end = IRQ_KIRKWOOD_TWSI, | ||
396 | .flags = IORESOURCE_IRQ, | ||
397 | }, | ||
398 | }; | ||
399 | |||
400 | static struct platform_device kirkwood_i2c = { | ||
401 | .name = MV64XXX_I2C_CTLR_NAME, | ||
402 | .id = 0, | ||
403 | .num_resources = ARRAY_SIZE(kirkwood_i2c_resources), | ||
404 | .resource = kirkwood_i2c_resources, | ||
405 | .dev = { | ||
406 | .platform_data = &kirkwood_i2c_pdata, | ||
407 | }, | ||
408 | }; | ||
409 | |||
410 | void __init kirkwood_i2c_init(void) | ||
411 | { | ||
412 | platform_device_register(&kirkwood_i2c); | ||
413 | } | ||
414 | |||
415 | |||
416 | /***************************************************************************** | ||
332 | * UART0 | 417 | * UART0 |
333 | ****************************************************************************/ | 418 | ****************************************************************************/ |
334 | static struct plat_serial8250_port kirkwood_uart0_data[] = { | 419 | static struct plat_serial8250_port kirkwood_uart0_data[] = { |
@@ -505,7 +590,7 @@ static struct platform_device kirkwood_xor01_channel = { | |||
505 | }, | 590 | }, |
506 | }; | 591 | }; |
507 | 592 | ||
508 | void __init kirkwood_xor0_init(void) | 593 | static void __init kirkwood_xor0_init(void) |
509 | { | 594 | { |
510 | platform_device_register(&kirkwood_xor0_shared); | 595 | platform_device_register(&kirkwood_xor0_shared); |
511 | 596 | ||
@@ -603,7 +688,7 @@ static struct platform_device kirkwood_xor11_channel = { | |||
603 | }, | 688 | }, |
604 | }; | 689 | }; |
605 | 690 | ||
606 | void __init kirkwood_xor1_init(void) | 691 | static void __init kirkwood_xor1_init(void) |
607 | { | 692 | { |
608 | platform_device_register(&kirkwood_xor1_shared); | 693 | platform_device_register(&kirkwood_xor1_shared); |
609 | 694 | ||
@@ -711,4 +796,9 @@ void __init kirkwood_init(void) | |||
711 | #ifdef CONFIG_CACHE_FEROCEON_L2 | 796 | #ifdef CONFIG_CACHE_FEROCEON_L2 |
712 | kirkwood_l2_init(); | 797 | kirkwood_l2_init(); |
713 | #endif | 798 | #endif |
799 | |||
800 | /* internal devices that every board has */ | ||
801 | kirkwood_rtc_init(); | ||
802 | kirkwood_xor0_init(); | ||
803 | kirkwood_xor1_init(); | ||
714 | } | 804 | } |
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index fe367c18e722..6ee88406f381 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h | |||
@@ -14,6 +14,7 @@ | |||
14 | struct dsa_platform_data; | 14 | struct dsa_platform_data; |
15 | struct mv643xx_eth_platform_data; | 15 | struct mv643xx_eth_platform_data; |
16 | struct mv_sata_platform_data; | 16 | struct mv_sata_platform_data; |
17 | struct mvsdio_platform_data; | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * Basic Kirkwood init functions used early by machine-setup. | 20 | * Basic Kirkwood init functions used early by machine-setup. |
@@ -33,14 +34,14 @@ void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data); | |||
33 | void kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data); | 34 | void kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data); |
34 | void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq); | 35 | void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq); |
35 | void kirkwood_pcie_init(void); | 36 | void kirkwood_pcie_init(void); |
36 | void kirkwood_rtc_init(void); | ||
37 | void kirkwood_sata_init(struct mv_sata_platform_data *sata_data); | 37 | void kirkwood_sata_init(struct mv_sata_platform_data *sata_data); |
38 | void kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data); | ||
38 | void kirkwood_spi_init(void); | 39 | void kirkwood_spi_init(void); |
40 | void kirkwood_i2c_init(void); | ||
39 | void kirkwood_uart0_init(void); | 41 | void kirkwood_uart0_init(void); |
40 | void kirkwood_uart1_init(void); | 42 | void kirkwood_uart1_init(void); |
41 | void kirkwood_xor0_init(void); | ||
42 | void kirkwood_xor1_init(void); | ||
43 | 43 | ||
44 | extern int kirkwood_tclk; | ||
44 | extern struct sys_timer kirkwood_timer; | 45 | extern struct sys_timer kirkwood_timer; |
45 | 46 | ||
46 | 47 | ||
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c index a14c2948c62a..5505d5837752 100644 --- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c +++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c | |||
@@ -11,18 +11,59 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
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/pci.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/mtd/physmap.h> | ||
17 | #include <linux/mtd/nand.h> | 14 | #include <linux/mtd/nand.h> |
18 | #include <linux/timer.h> | 15 | #include <linux/mtd/partitions.h> |
19 | #include <linux/ata_platform.h> | 16 | #include <linux/ata_platform.h> |
20 | #include <linux/mv643xx_eth.h> | 17 | #include <linux/mv643xx_eth.h> |
21 | #include <asm/mach-types.h> | 18 | #include <asm/mach-types.h> |
22 | #include <asm/mach/arch.h> | 19 | #include <asm/mach/arch.h> |
23 | #include <asm/mach/pci.h> | ||
24 | #include <mach/kirkwood.h> | 20 | #include <mach/kirkwood.h> |
21 | #include <plat/orion_nand.h> | ||
22 | #include <plat/mvsdio.h> | ||
25 | #include "common.h" | 23 | #include "common.h" |
24 | #include "mpp.h" | ||
25 | |||
26 | static struct mtd_partition db88f6281_nand_parts[] = { | ||
27 | { | ||
28 | .name = "u-boot", | ||
29 | .offset = 0, | ||
30 | .size = SZ_1M | ||
31 | }, { | ||
32 | .name = "uImage", | ||
33 | .offset = MTDPART_OFS_NXTBLK, | ||
34 | .size = SZ_4M | ||
35 | }, { | ||
36 | .name = "root", | ||
37 | .offset = MTDPART_OFS_NXTBLK, | ||
38 | .size = MTDPART_SIZ_FULL | ||
39 | }, | ||
40 | }; | ||
41 | |||
42 | static struct resource db88f6281_nand_resource = { | ||
43 | .flags = IORESOURCE_MEM, | ||
44 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
45 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + | ||
46 | KIRKWOOD_NAND_MEM_SIZE - 1, | ||
47 | }; | ||
48 | |||
49 | static struct orion_nand_data db88f6281_nand_data = { | ||
50 | .parts = db88f6281_nand_parts, | ||
51 | .nr_parts = ARRAY_SIZE(db88f6281_nand_parts), | ||
52 | .cle = 0, | ||
53 | .ale = 1, | ||
54 | .width = 8, | ||
55 | .chip_delay = 25, | ||
56 | }; | ||
57 | |||
58 | static struct platform_device db88f6281_nand_flash = { | ||
59 | .name = "orion_nand", | ||
60 | .id = -1, | ||
61 | .dev = { | ||
62 | .platform_data = &db88f6281_nand_data, | ||
63 | }, | ||
64 | .resource = &db88f6281_nand_resource, | ||
65 | .num_resources = 1, | ||
66 | }; | ||
26 | 67 | ||
27 | static struct mv643xx_eth_platform_data db88f6281_ge00_data = { | 68 | static struct mv643xx_eth_platform_data db88f6281_ge00_data = { |
28 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | 69 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
@@ -32,18 +73,32 @@ static struct mv_sata_platform_data db88f6281_sata_data = { | |||
32 | .n_ports = 2, | 73 | .n_ports = 2, |
33 | }; | 74 | }; |
34 | 75 | ||
76 | static struct mvsdio_platform_data db88f6281_mvsdio_data = { | ||
77 | .gpio_write_protect = 37, | ||
78 | .gpio_card_detect = 38, | ||
79 | }; | ||
80 | |||
81 | static unsigned int db88f6281_mpp_config[] __initdata = { | ||
82 | MPP37_GPIO, | ||
83 | MPP38_GPIO, | ||
84 | 0 | ||
85 | }; | ||
86 | |||
35 | static void __init db88f6281_init(void) | 87 | static void __init db88f6281_init(void) |
36 | { | 88 | { |
37 | /* | 89 | /* |
38 | * Basic setup. Needs to be called early. | 90 | * Basic setup. Needs to be called early. |
39 | */ | 91 | */ |
40 | kirkwood_init(); | 92 | kirkwood_init(); |
93 | kirkwood_mpp_conf(db88f6281_mpp_config); | ||
41 | 94 | ||
42 | kirkwood_ehci_init(); | 95 | kirkwood_ehci_init(); |
43 | kirkwood_ge00_init(&db88f6281_ge00_data); | 96 | kirkwood_ge00_init(&db88f6281_ge00_data); |
44 | kirkwood_rtc_init(); | ||
45 | kirkwood_sata_init(&db88f6281_sata_data); | 97 | kirkwood_sata_init(&db88f6281_sata_data); |
46 | kirkwood_uart0_init(); | 98 | kirkwood_uart0_init(); |
99 | kirkwood_sdio_init(&db88f6281_mvsdio_data); | ||
100 | |||
101 | platform_device_register(&db88f6281_nand_flash); | ||
47 | } | 102 | } |
48 | 103 | ||
49 | static int __init db88f6281_pci_init(void) | 104 | static int __init db88f6281_pci_init(void) |
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h index ada480c0e197..38c986853590 100644 --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h | |||
@@ -93,6 +93,7 @@ | |||
93 | #define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034) | 93 | #define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034) |
94 | #define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300) | 94 | #define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300) |
95 | #define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600) | 95 | #define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600) |
96 | #define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000) | ||
96 | #define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000) | 97 | #define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000) |
97 | #define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000) | 98 | #define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000) |
98 | #define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100) | 99 | #define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100) |
@@ -116,5 +117,7 @@ | |||
116 | 117 | ||
117 | #define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000) | 118 | #define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000) |
118 | 119 | ||
120 | #define SDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x90000) | ||
121 | |||
119 | 122 | ||
120 | #endif | 123 | #endif |
diff --git a/arch/arm/mach-kirkwood/include/mach/system.h b/arch/arm/mach-kirkwood/include/mach/system.h index 8510f6cfdabf..23a1914c1da8 100644 --- a/arch/arm/mach-kirkwood/include/mach/system.h +++ b/arch/arm/mach-kirkwood/include/mach/system.h | |||
@@ -17,7 +17,7 @@ static inline void arch_idle(void) | |||
17 | cpu_do_idle(); | 17 | cpu_do_idle(); |
18 | } | 18 | } |
19 | 19 | ||
20 | static inline void arch_reset(char mode) | 20 | static inline void arch_reset(char mode, const char *cmd) |
21 | { | 21 | { |
22 | /* | 22 | /* |
23 | * Enable soft reset to assert RSTOUTn. | 23 | * Enable soft reset to assert RSTOUTn. |
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c new file mode 100644 index 000000000000..63c44934391a --- /dev/null +++ b/arch/arm/mach-kirkwood/mpp.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-kirkwood/mpp.c | ||
3 | * | ||
4 | * MPP functions for Marvell Kirkwood SoCs | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/mbus.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <asm/gpio.h> | ||
16 | #include <mach/hardware.h> | ||
17 | #include "common.h" | ||
18 | #include "mpp.h" | ||
19 | |||
20 | static unsigned int __init kirkwood_variant(void) | ||
21 | { | ||
22 | u32 dev, rev; | ||
23 | |||
24 | kirkwood_pcie_id(&dev, &rev); | ||
25 | |||
26 | if (dev == MV88F6281_DEV_ID && rev >= MV88F6281_REV_A0) | ||
27 | return MPP_F6281_MASK; | ||
28 | if (dev == MV88F6192_DEV_ID && rev >= MV88F6192_REV_A0) | ||
29 | return MPP_F6192_MASK; | ||
30 | if (dev == MV88F6180_DEV_ID) | ||
31 | return MPP_F6180_MASK; | ||
32 | |||
33 | printk(KERN_ERR "MPP setup: unknown kirkwood variant " | ||
34 | "(dev %#x rev %#x)\n", dev, rev); | ||
35 | return 0; | ||
36 | } | ||
37 | |||
38 | #define MPP_CTRL(i) (DEV_BUS_VIRT_BASE + (i) * 4) | ||
39 | #define MPP_NR_REGS (1 + MPP_MAX/8) | ||
40 | |||
41 | void __init kirkwood_mpp_conf(unsigned int *mpp_list) | ||
42 | { | ||
43 | u32 mpp_ctrl[MPP_NR_REGS]; | ||
44 | unsigned int variant_mask; | ||
45 | int i; | ||
46 | |||
47 | variant_mask = kirkwood_variant(); | ||
48 | if (!variant_mask) | ||
49 | return; | ||
50 | |||
51 | printk(KERN_DEBUG "initial MPP regs:"); | ||
52 | for (i = 0; i < MPP_NR_REGS; i++) { | ||
53 | mpp_ctrl[i] = readl(MPP_CTRL(i)); | ||
54 | printk(" %08x", mpp_ctrl[i]); | ||
55 | } | ||
56 | printk("\n"); | ||
57 | |||
58 | while (*mpp_list) { | ||
59 | unsigned int num = MPP_NUM(*mpp_list); | ||
60 | unsigned int sel = MPP_SEL(*mpp_list); | ||
61 | int shift, gpio_mode; | ||
62 | |||
63 | if (num > MPP_MAX) { | ||
64 | printk(KERN_ERR "kirkwood_mpp_conf: invalid MPP " | ||
65 | "number (%u)\n", num); | ||
66 | continue; | ||
67 | } | ||
68 | if (!(*mpp_list & variant_mask)) { | ||
69 | printk(KERN_WARNING | ||
70 | "kirkwood_mpp_conf: requested MPP%u config " | ||
71 | "unavailable on this hardware\n", num); | ||
72 | continue; | ||
73 | } | ||
74 | |||
75 | shift = (num & 7) << 2; | ||
76 | mpp_ctrl[num / 8] &= ~(0xf << shift); | ||
77 | mpp_ctrl[num / 8] |= sel << shift; | ||
78 | |||
79 | gpio_mode = 0; | ||
80 | if (*mpp_list & MPP_INPUT_MASK) | ||
81 | gpio_mode |= GPIO_INPUT_OK; | ||
82 | if (*mpp_list & MPP_OUTPUT_MASK) | ||
83 | gpio_mode |= GPIO_OUTPUT_OK; | ||
84 | if (sel != 0) | ||
85 | gpio_mode = 0; | ||
86 | orion_gpio_set_valid(num, gpio_mode); | ||
87 | |||
88 | mpp_list++; | ||
89 | } | ||
90 | |||
91 | printk(KERN_DEBUG " final MPP regs:"); | ||
92 | for (i = 0; i < MPP_NR_REGS; i++) { | ||
93 | writel(mpp_ctrl[i], MPP_CTRL(i)); | ||
94 | printk(" %08x", mpp_ctrl[i]); | ||
95 | } | ||
96 | printk("\n"); | ||
97 | } | ||
diff --git a/arch/arm/mach-kirkwood/mpp.h b/arch/arm/mach-kirkwood/mpp.h new file mode 100644 index 000000000000..e021a80c2caf --- /dev/null +++ b/arch/arm/mach-kirkwood/mpp.h | |||
@@ -0,0 +1,303 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-kirkwood/mpp.h -- Multi Purpose Pins | ||
3 | * | ||
4 | * Copyright 2009: Marvell Technology Group Ltd. | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #ifndef __KIRKWOOD_MPP_H | ||
12 | #define __KIRKWOOD_MPP_H | ||
13 | |||
14 | #define MPP(_num, _sel, _in, _out, _F6180, _F6190, _F6192, _F6281) ( \ | ||
15 | /* MPP number */ ((_num) & 0xff) | \ | ||
16 | /* MPP select value */ (((_sel) & 0xf) << 8) | \ | ||
17 | /* may be input signal */ ((!!(_in)) << 12) | \ | ||
18 | /* may be output signal */ ((!!(_out)) << 13) | \ | ||
19 | /* available on F6180 */ ((!!(_F6180)) << 14) | \ | ||
20 | /* available on F6190 */ ((!!(_F6190)) << 15) | \ | ||
21 | /* available on F6192 */ ((!!(_F6192)) << 16) | \ | ||
22 | /* available on F6281 */ ((!!(_F6281)) << 17)) | ||
23 | |||
24 | #define MPP_NUM(x) ((x) & 0xff) | ||
25 | #define MPP_SEL(x) (((x) >> 8) & 0xf) | ||
26 | |||
27 | /* num sel i o 6180 6190 6192 6281 */ | ||
28 | |||
29 | #define MPP_INPUT_MASK MPP( 0, 0x0, 1, 0, 0, 0, 0, 0 ) | ||
30 | #define MPP_OUTPUT_MASK MPP( 0, 0x0, 0, 1, 0, 0, 0, 0 ) | ||
31 | |||
32 | #define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0 ) | ||
33 | #define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0 ) | ||
34 | #define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0 ) | ||
35 | #define MPP_F6281_MASK MPP( 0, 0x0, 0, 0, 0, 0, 0, 1 ) | ||
36 | |||
37 | #define MPP0_GPIO MPP( 0, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
38 | #define MPP0_NF_IO2 MPP( 0, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
39 | #define MPP0_SPI_SCn MPP( 0, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
40 | |||
41 | #define MPP1_GPO MPP( 1, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
42 | #define MPP1_NF_IO3 MPP( 1, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
43 | #define MPP1_SPI_MOSI MPP( 1, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
44 | |||
45 | #define MPP2_GPO MPP( 2, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
46 | #define MPP2_NF_IO4 MPP( 2, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
47 | #define MPP2_SPI_SCK MPP( 2, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
48 | |||
49 | #define MPP3_GPO MPP( 3, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
50 | #define MPP3_NF_IO5 MPP( 3, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
51 | #define MPP3_SPI_MISO MPP( 3, 0x2, 1, 0, 1, 1, 1, 1 ) | ||
52 | |||
53 | #define MPP4_GPIO MPP( 4, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
54 | #define MPP4_NF_IO6 MPP( 4, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
55 | #define MPP4_UART0_RXD MPP( 4, 0x2, 1, 0, 1, 1, 1, 1 ) | ||
56 | #define MPP4_SATA1_ACTn MPP( 4, 0x5, 0, 1, 0, 0, 1, 1 ) | ||
57 | #define MPP4_PTP_CLK MPP( 4, 0xd, 1, 0, 1, 1, 1, 1 ) | ||
58 | |||
59 | #define MPP5_GPO MPP( 5, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
60 | #define MPP5_NF_IO7 MPP( 5, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
61 | #define MPP5_UART0_TXD MPP( 5, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
62 | #define MPP5_PTP_TRIG_GEN MPP( 5, 0x4, 0, 1, 1, 1, 1, 1 ) | ||
63 | #define MPP5_SATA0_ACTn MPP( 5, 0x5, 0, 1, 0, 1, 1, 1 ) | ||
64 | |||
65 | #define MPP6_SYSRST_OUTn MPP( 6, 0x1, 0, 1, 1, 1, 1, 1 ) | ||
66 | #define MPP6_SPI_MOSI MPP( 6, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
67 | #define MPP6_PTP_TRIG_GEN MPP( 6, 0x3, 0, 1, 1, 1, 1, 1 ) | ||
68 | |||
69 | #define MPP7_GPO MPP( 7, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
70 | #define MPP7_PEX_RST_OUTn MPP( 7, 0x1, 0, 1, 1, 1, 1, 1 ) | ||
71 | #define MPP7_SPI_SCn MPP( 7, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
72 | #define MPP7_PTP_TRIG_GEN MPP( 7, 0x3, 0, 1, 1, 1, 1, 1 ) | ||
73 | |||
74 | #define MPP8_GPIO MPP( 8, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
75 | #define MPP8_TW_SDA MPP( 8, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
76 | #define MPP8_UART0_RTS MPP( 8, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
77 | #define MPP8_UART1_RTS MPP( 8, 0x3, 0, 1, 1, 1, 1, 1 ) | ||
78 | #define MPP8_MII0_RXERR MPP( 8, 0x4, 1, 0, 0, 1, 1, 1 ) | ||
79 | #define MPP8_SATA1_PRESENTn MPP( 8, 0x5, 0, 1, 0, 0, 1, 1 ) | ||
80 | #define MPP8_PTP_CLK MPP( 8, 0xc, 1, 0, 1, 1, 1, 1 ) | ||
81 | #define MPP8_MII0_COL MPP( 8, 0xd, 1, 0, 1, 1, 1, 1 ) | ||
82 | |||
83 | #define MPP9_GPIO MPP( 9, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
84 | #define MPP9_TW_SCK MPP( 9, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
85 | #define MPP9_UART0_CTS MPP( 9, 0x2, 1, 0, 1, 1, 1, 1 ) | ||
86 | #define MPP9_UART1_CTS MPP( 9, 0x3, 1, 0, 1, 1, 1, 1 ) | ||
87 | #define MPP9_SATA0_PRESENTn MPP( 9, 0x5, 0, 1, 0, 1, 1, 1 ) | ||
88 | #define MPP9_PTP_EVENT_REQ MPP( 9, 0xc, 1, 0, 1, 1, 1, 1 ) | ||
89 | #define MPP9_MII0_CRS MPP( 9, 0xd, 1, 0, 1, 1, 1, 1 ) | ||
90 | |||
91 | #define MPP10_GPO MPP( 10, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
92 | #define MPP10_SPI_SCK MPP( 10, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
93 | #define MPP10_UART0_TXD MPP( 10, 0X3, 0, 1, 1, 1, 1, 1 ) | ||
94 | #define MPP10_SATA1_ACTn MPP( 10, 0x5, 0, 1, 0, 0, 1, 1 ) | ||
95 | #define MPP10_PTP_TRIG_GEN MPP( 10, 0xc, 0, 1, 1, 1, 1, 1 ) | ||
96 | |||
97 | #define MPP11_GPIO MPP( 11, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
98 | #define MPP11_SPI_MISO MPP( 11, 0x2, 1, 0, 1, 1, 1, 1 ) | ||
99 | #define MPP11_UART0_RXD MPP( 11, 0x3, 1, 0, 1, 1, 1, 1 ) | ||
100 | #define MPP11_PTP_EVENT_REQ MPP( 11, 0x4, 1, 0, 1, 1, 1, 1 ) | ||
101 | #define MPP11_PTP_TRIG_GEN MPP( 11, 0xc, 0, 1, 1, 1, 1, 1 ) | ||
102 | #define MPP11_PTP_CLK MPP( 11, 0xd, 1, 0, 1, 1, 1, 1 ) | ||
103 | #define MPP11_SATA0_ACTn MPP( 11, 0x5, 0, 1, 0, 1, 1, 1 ) | ||
104 | |||
105 | #define MPP12_GPO MPP( 12, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
106 | #define MPP12_SD_CLK MPP( 12, 0x1, 0, 1, 1, 1, 1, 1 ) | ||
107 | |||
108 | #define MPP13_GPIO MPP( 13, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
109 | #define MPP13_SD_CMD MPP( 13, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
110 | #define MPP13_UART1_TXD MPP( 13, 0x3, 0, 1, 1, 1, 1, 1 ) | ||
111 | |||
112 | #define MPP14_GPIO MPP( 14, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
113 | #define MPP14_SD_D0 MPP( 14, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
114 | #define MPP14_UART1_RXD MPP( 14, 0x3, 1, 0, 1, 1, 1, 1 ) | ||
115 | #define MPP14_SATA1_PRESENTn MPP( 14, 0x4, 0, 1, 0, 0, 1, 1 ) | ||
116 | #define MPP14_MII0_COL MPP( 14, 0xd, 1, 0, 1, 1, 1, 1 ) | ||
117 | |||
118 | #define MPP15_GPIO MPP( 15, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
119 | #define MPP15_SD_D1 MPP( 15, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
120 | #define MPP15_UART0_RTS MPP( 15, 0x2, 0, 1, 1, 1, 1, 1 ) | ||
121 | #define MPP15_UART1_TXD MPP( 15, 0x3, 0, 1, 1, 1, 1, 1 ) | ||
122 | #define MPP15_SATA0_ACTn MPP( 15, 0x4, 0, 1, 0, 1, 1, 1 ) | ||
123 | |||
124 | #define MPP16_GPIO MPP( 16, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
125 | #define MPP16_SD_D2 MPP( 16, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
126 | #define MPP16_UART0_CTS MPP( 16, 0x2, 1, 0, 1, 1, 1, 1 ) | ||
127 | #define MPP16_UART1_RXD MPP( 16, 0x3, 1, 0, 1, 1, 1, 1 ) | ||
128 | #define MPP16_SATA1_ACTn MPP( 16, 0x4, 0, 1, 0, 0, 1, 1 ) | ||
129 | #define MPP16_MII0_CRS MPP( 16, 0xd, 1, 0, 1, 1, 1, 1 ) | ||
130 | |||
131 | #define MPP17_GPIO MPP( 17, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
132 | #define MPP17_SD_D3 MPP( 17, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
133 | #define MPP17_SATA0_PRESENTn MPP( 17, 0x4, 0, 1, 0, 1, 1, 1 ) | ||
134 | |||
135 | #define MPP18_GPO MPP( 18, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
136 | #define MPP18_NF_IO0 MPP( 18, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
137 | |||
138 | #define MPP19_GPO MPP( 19, 0x0, 0, 1, 1, 1, 1, 1 ) | ||
139 | #define MPP19_NF_IO1 MPP( 19, 0x1, 1, 1, 1, 1, 1, 1 ) | ||
140 | |||
141 | #define MPP20_GPIO MPP( 20, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
142 | #define MPP20_TSMP0 MPP( 20, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
143 | #define MPP20_TDM_CH0_TX_QL MPP( 20, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
144 | #define MPP20_GE1_0 MPP( 20, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
145 | #define MPP20_AUDIO_SPDIFI MPP( 20, 0x4, 1, 0, 0, 0, 1, 1 ) | ||
146 | #define MPP20_SATA1_ACTn MPP( 20, 0x5, 0, 1, 0, 0, 1, 1 ) | ||
147 | |||
148 | #define MPP21_GPIO MPP( 21, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
149 | #define MPP21_TSMP1 MPP( 21, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
150 | #define MPP21_TDM_CH0_RX_QL MPP( 21, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
151 | #define MPP21_GE1_1 MPP( 21, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
152 | #define MPP21_AUDIO_SPDIFO MPP( 21, 0x4, 0, 1, 0, 0, 1, 1 ) | ||
153 | #define MPP21_SATA0_ACTn MPP( 21, 0x5, 0, 1, 0, 1, 1, 1 ) | ||
154 | |||
155 | #define MPP22_GPIO MPP( 22, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
156 | #define MPP22_TSMP2 MPP( 22, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
157 | #define MPP22_TDM_CH2_TX_QL MPP( 22, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
158 | #define MPP22_GE1_2 MPP( 22, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
159 | #define MPP22_AUDIO_SPDIFRMKCLK MPP( 22, 0x4, 0, 1, 0, 0, 1, 1 ) | ||
160 | #define MPP22_SATA1_PRESENTn MPP( 22, 0x5, 0, 1, 0, 0, 1, 1 ) | ||
161 | |||
162 | #define MPP23_GPIO MPP( 23, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
163 | #define MPP23_TSMP3 MPP( 23, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
164 | #define MPP23_TDM_CH2_RX_QL MPP( 23, 0x2, 1, 0, 0, 0, 1, 1 ) | ||
165 | #define MPP23_GE1_3 MPP( 23, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
166 | #define MPP23_AUDIO_I2SBCLK MPP( 23, 0x4, 0, 1, 0, 0, 1, 1 ) | ||
167 | #define MPP23_SATA0_PRESENTn MPP( 23, 0x5, 0, 1, 0, 1, 1, 1 ) | ||
168 | |||
169 | #define MPP24_GPIO MPP( 24, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
170 | #define MPP24_TSMP4 MPP( 24, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
171 | #define MPP24_TDM_SPI_CS0 DEV( 24, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
172 | #define MPP24_GE1_4 MPP( 24, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
173 | #define MPP24_AUDIO_I2SDO MPP( 24, 0x4, 0, 1, 0, 0, 1, 1 ) | ||
174 | |||
175 | #define MPP25_GPIO MPP( 25, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
176 | #define MPP25_TSMP5 MPP( 25, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
177 | #define MPP25_TDM_SPI_SCK MPP( 25, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
178 | #define MPP25_GE1_5 MPP( 25, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
179 | #define MPP25_AUDIO_I2SLRCLK MPP( 25, 0x4, 0, 1, 0, 0, 1, 1 ) | ||
180 | |||
181 | #define MPP26_GPIO MPP( 26, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
182 | #define MPP26_TSMP6 MPP( 26, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
183 | #define MPP26_TDM_SPI_MISO MPP( 26, 0x2, 1, 0, 0, 0, 1, 1 ) | ||
184 | #define MPP26_GE1_6 MPP( 26, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
185 | #define MPP26_AUDIO_I2SMCLK MPP( 26, 0x4, 0, 1, 0, 0, 1, 1 ) | ||
186 | |||
187 | #define MPP27_GPIO MPP( 27, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
188 | #define MPP27_TSMP7 MPP( 27, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
189 | #define MPP27_TDM_SPI_MOSI MPP( 27, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
190 | #define MPP27_GE1_7 MPP( 27, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
191 | #define MPP27_AUDIO_I2SDI MPP( 27, 0x4, 1, 0, 0, 0, 1, 1 ) | ||
192 | |||
193 | #define MPP28_GPIO MPP( 28, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
194 | #define MPP28_TSMP8 MPP( 28, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
195 | #define MPP28_TDM_CODEC_INTn MPP( 28, 0x2, 0, 0, 0, 0, 1, 1 ) | ||
196 | #define MPP28_GE1_8 MPP( 28, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
197 | #define MPP28_AUDIO_EXTCLK MPP( 28, 0x4, 1, 0, 0, 0, 1, 1 ) | ||
198 | |||
199 | #define MPP29_GPIO MPP( 29, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
200 | #define MPP29_TSMP9 MPP( 29, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
201 | #define MPP29_TDM_CODEC_RSTn MPP( 29, 0x2, 0, 0, 0, 0, 1, 1 ) | ||
202 | #define MPP29_GE1_9 MPP( 29, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
203 | |||
204 | #define MPP30_GPIO MPP( 30, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
205 | #define MPP30_TSMP10 MPP( 30, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
206 | #define MPP30_TDM_PCLK MPP( 30, 0x2, 1, 1, 0, 0, 1, 1 ) | ||
207 | #define MPP30_GE1_10 MPP( 30, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
208 | |||
209 | #define MPP31_GPIO MPP( 31, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
210 | #define MPP31_TSMP11 MPP( 31, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
211 | #define MPP31_TDM_FS MPP( 31, 0x2, 1, 1, 0, 0, 1, 1 ) | ||
212 | #define MPP31_GE1_11 MPP( 31, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
213 | |||
214 | #define MPP32_GPIO MPP( 32, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
215 | #define MPP32_TSMP12 MPP( 32, 0x1, 1, 1, 0, 0, 1, 1 ) | ||
216 | #define MPP32_TDM_DRX MPP( 32, 0x2, 1, 0, 0, 0, 1, 1 ) | ||
217 | #define MPP32_GE1_12 MPP( 32, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
218 | |||
219 | #define MPP33_GPIO MPP( 33, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
220 | #define MPP33_TDM_DTX MPP( 33, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
221 | #define MPP33_GE1_13 MPP( 33, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
222 | |||
223 | #define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1 ) | ||
224 | #define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
225 | #define MPP34_GE1_14 MPP( 34, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
226 | |||
227 | #define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1 ) | ||
228 | #define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 1, 0, 0, 1, 1 ) | ||
229 | #define MPP35_GE1_15 MPP( 35, 0x3, 0, 0, 0, 1, 1, 1 ) | ||
230 | #define MPP35_SATA0_ACTn MPP( 35, 0x5, 0, 1, 0, 1, 1, 1 ) | ||
231 | #define MPP35_MII0_RXERR MPP( 35, 0xc, 1, 0, 1, 1, 1, 1 ) | ||
232 | |||
233 | #define MPP36_GPIO MPP( 36, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
234 | #define MPP36_TSMP0 MPP( 36, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
235 | #define MPP36_TDM_SPI_CS1 MPP( 36, 0x2, 0, 1, 0, 0, 0, 1 ) | ||
236 | #define MPP36_AUDIO_SPDIFI MPP( 36, 0x4, 1, 0, 1, 0, 0, 1 ) | ||
237 | |||
238 | #define MPP37_GPIO MPP( 37, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
239 | #define MPP37_TSMP1 MPP( 37, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
240 | #define MPP37_TDM_CH2_TX_QL MPP( 37, 0x2, 0, 1, 0, 0, 0, 1 ) | ||
241 | #define MPP37_AUDIO_SPDIFO MPP( 37, 0x4, 0, 1, 1, 0, 0, 1 ) | ||
242 | |||
243 | #define MPP38_GPIO MPP( 38, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
244 | #define MPP38_TSMP2 MPP( 38, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
245 | #define MPP38_TDM_CH2_RX_QL MPP( 38, 0x2, 0, 1, 0, 0, 0, 1 ) | ||
246 | #define MPP38_AUDIO_SPDIFRMLCLK MPP( 38, 0x4, 0, 1, 1, 0, 0, 1 ) | ||
247 | |||
248 | #define MPP39_GPIO MPP( 39, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
249 | #define MPP39_TSMP3 MPP( 39, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
250 | #define MPP39_TDM_SPI_CS0 MPP( 39, 0x2, 0, 1, 0, 0, 0, 1 ) | ||
251 | #define MPP39_AUDIO_I2SBCLK MPP( 39, 0x4, 0, 1, 1, 0, 0, 1 ) | ||
252 | |||
253 | #define MPP40_GPIO MPP( 40, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
254 | #define MPP40_TSMP4 MPP( 40, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
255 | #define MPP40_TDM_SPI_SCK MPP( 40, 0x2, 0, 1, 0, 0, 0, 1 ) | ||
256 | #define MPP40_AUDIO_I2SDO MPP( 40, 0x4, 0, 1, 1, 0, 0, 1 ) | ||
257 | |||
258 | #define MPP41_GPIO MPP( 41, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
259 | #define MPP41_TSMP5 MPP( 41, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
260 | #define MPP41_TDM_SPI_MISO MPP( 41, 0x2, 1, 0, 0, 0, 0, 1 ) | ||
261 | #define MPP41_AUDIO_I2SLRC MPP( 41, 0x4, 0, 1, 1, 0, 0, 1 ) | ||
262 | |||
263 | #define MPP42_GPIO MPP( 42, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
264 | #define MPP42_TSMP6 MPP( 42, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
265 | #define MPP42_TDM_SPI_MOSI MPP( 42, 0x2, 0, 1, 0, 0, 0, 1 ) | ||
266 | #define MPP42_AUDIO_I2SMCLK MPP( 42, 0x4, 0, 1, 1, 0, 0, 1 ) | ||
267 | |||
268 | #define MPP43_GPIO MPP( 43, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
269 | #define MPP43_TSMP7 MPP( 43, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
270 | #define MPP43_TDM_CODEC_INTn MPP( 43, 0x2, 0, 0, 0, 0, 0, 1 ) | ||
271 | #define MPP43_AUDIO_I2SDI MPP( 43, 0x4, 1, 0, 1, 0, 0, 1 ) | ||
272 | |||
273 | #define MPP44_GPIO MPP( 44, 0x0, 1, 1, 1, 0, 0, 1 ) | ||
274 | #define MPP44_TSMP8 MPP( 44, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
275 | #define MPP44_TDM_CODEC_RSTn MPP( 44, 0x2, 0, 0, 0, 0, 0, 1 ) | ||
276 | #define MPP44_AUDIO_EXTCLK MPP( 44, 0x4, 1, 0, 1, 0, 0, 1 ) | ||
277 | |||
278 | #define MPP45_GPIO MPP( 45, 0x0, 1, 1, 0, 0, 0, 1 ) | ||
279 | #define MPP45_TSMP9 MPP( 45, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
280 | #define MPP45_TDM_PCLK MPP( 45, 0x2, 1, 1, 0, 0, 0, 1 ) | ||
281 | |||
282 | #define MPP46_GPIO MPP( 46, 0x0, 1, 1, 0, 0, 0, 1 ) | ||
283 | #define MPP46_TSMP10 MPP( 46, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
284 | #define MPP46_TDM_FS MPP( 46, 0x2, 1, 1, 0, 0, 0, 1 ) | ||
285 | |||
286 | #define MPP47_GPIO MPP( 47, 0x0, 1, 1, 0, 0, 0, 1 ) | ||
287 | #define MPP47_TSMP11 MPP( 47, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
288 | #define MPP47_TDM_DRX MPP( 47, 0x2, 1, 0, 0, 0, 0, 1 ) | ||
289 | |||
290 | #define MPP48_GPIO MPP( 48, 0x0, 1, 1, 0, 0, 0, 1 ) | ||
291 | #define MPP48_TSMP12 MPP( 48, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
292 | #define MPP48_TDM_DTX MPP( 48. 0x2, 0, 1, 0, 0, 0, 1 ) | ||
293 | |||
294 | #define MPP49_GPIO MPP( 49, 0x0, 1, 1, 0, 0, 0, 1 ) | ||
295 | #define MPP49_TSMP9 MPP( 49, 0x1, 1, 1, 0, 0, 0, 1 ) | ||
296 | #define MPP49_TDM_CH0_RX_QL MPP( 49, 0x2, 0, 1, 0, 0, 0, 1 ) | ||
297 | #define MPP49_PTP_CLK MPP( 49, 0x5, 1, 0, 0, 0, 0, 1 ) | ||
298 | |||
299 | #define MPP_MAX 49 | ||
300 | |||
301 | void kirkwood_mpp_conf(unsigned int *mpp_list); | ||
302 | |||
303 | #endif | ||
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c index b1d1a87a6821..2f0e4ef3db0f 100644 --- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | |||
@@ -11,11 +11,8 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
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/pci.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/mtd/physmap.h> | ||
17 | #include <linux/mtd/nand.h> | 14 | #include <linux/mtd/nand.h> |
18 | #include <linux/timer.h> | 15 | #include <linux/mtd/partitions.h> |
19 | #include <linux/ata_platform.h> | 16 | #include <linux/ata_platform.h> |
20 | #include <linux/mv643xx_eth.h> | 17 | #include <linux/mv643xx_eth.h> |
21 | #include <linux/spi/flash.h> | 18 | #include <linux/spi/flash.h> |
@@ -23,7 +20,6 @@ | |||
23 | #include <linux/spi/orion_spi.h> | 20 | #include <linux/spi/orion_spi.h> |
24 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
25 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
26 | #include <asm/mach/pci.h> | ||
27 | #include <mach/kirkwood.h> | 23 | #include <mach/kirkwood.h> |
28 | #include "common.h" | 24 | #include "common.h" |
29 | 25 | ||
@@ -61,14 +57,11 @@ static void __init rd88f6192_init(void) | |||
61 | 57 | ||
62 | kirkwood_ehci_init(); | 58 | kirkwood_ehci_init(); |
63 | kirkwood_ge00_init(&rd88f6192_ge00_data); | 59 | kirkwood_ge00_init(&rd88f6192_ge00_data); |
64 | kirkwood_rtc_init(); | ||
65 | kirkwood_sata_init(&rd88f6192_sata_data); | 60 | kirkwood_sata_init(&rd88f6192_sata_data); |
66 | spi_register_board_info(rd88F6192_spi_slave_info, | 61 | spi_register_board_info(rd88F6192_spi_slave_info, |
67 | ARRAY_SIZE(rd88F6192_spi_slave_info)); | 62 | ARRAY_SIZE(rd88F6192_spi_slave_info)); |
68 | kirkwood_spi_init(); | 63 | kirkwood_spi_init(); |
69 | kirkwood_uart0_init(); | 64 | kirkwood_uart0_init(); |
70 | kirkwood_xor0_init(); | ||
71 | kirkwood_xor1_init(); | ||
72 | } | 65 | } |
73 | 66 | ||
74 | static int __init rd88f6192_pci_init(void) | 67 | static int __init rd88f6192_pci_init(void) |
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c index e1c0516c4df3..31e996d65fc4 100644 --- a/arch/arm/mach-kirkwood/rd88f6281-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c | |||
@@ -11,21 +11,20 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
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/pci.h> | ||
15 | #include <linux/irq.h> | 14 | #include <linux/irq.h> |
16 | #include <linux/mtd/physmap.h> | ||
17 | #include <linux/mtd/nand.h> | 15 | #include <linux/mtd/nand.h> |
18 | #include <linux/timer.h> | 16 | #include <linux/mtd/partitions.h> |
19 | #include <linux/ata_platform.h> | 17 | #include <linux/ata_platform.h> |
20 | #include <linux/mv643xx_eth.h> | 18 | #include <linux/mv643xx_eth.h> |
21 | #include <linux/ethtool.h> | 19 | #include <linux/ethtool.h> |
22 | #include <net/dsa.h> | 20 | #include <net/dsa.h> |
23 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
24 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/pci.h> | ||
26 | #include <mach/kirkwood.h> | 23 | #include <mach/kirkwood.h> |
24 | #include <plat/mvsdio.h> | ||
27 | #include <plat/orion_nand.h> | 25 | #include <plat/orion_nand.h> |
28 | #include "common.h" | 26 | #include "common.h" |
27 | #include "mpp.h" | ||
29 | 28 | ||
30 | static struct mtd_partition rd88f6281_nand_parts[] = { | 29 | static struct mtd_partition rd88f6281_nand_parts[] = { |
31 | { | 30 | { |
@@ -96,6 +95,15 @@ static struct mv_sata_platform_data rd88f6281_sata_data = { | |||
96 | .n_ports = 2, | 95 | .n_ports = 2, |
97 | }; | 96 | }; |
98 | 97 | ||
98 | static struct mvsdio_platform_data rd88f6281_mvsdio_data = { | ||
99 | .gpio_card_detect = 28, | ||
100 | }; | ||
101 | |||
102 | static unsigned int rd88f6281_mpp_config[] __initdata = { | ||
103 | MPP28_GPIO, | ||
104 | 0 | ||
105 | }; | ||
106 | |||
99 | static void __init rd88f6281_init(void) | 107 | static void __init rd88f6281_init(void) |
100 | { | 108 | { |
101 | u32 dev, rev; | 109 | u32 dev, rev; |
@@ -104,6 +112,7 @@ static void __init rd88f6281_init(void) | |||
104 | * Basic setup. Needs to be called early. | 112 | * Basic setup. Needs to be called early. |
105 | */ | 113 | */ |
106 | kirkwood_init(); | 114 | kirkwood_init(); |
115 | kirkwood_mpp_conf(rd88f6281_mpp_config); | ||
107 | 116 | ||
108 | kirkwood_ehci_init(); | 117 | kirkwood_ehci_init(); |
109 | 118 | ||
@@ -117,8 +126,8 @@ static void __init rd88f6281_init(void) | |||
117 | } | 126 | } |
118 | kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ); | 127 | kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ); |
119 | 128 | ||
120 | kirkwood_rtc_init(); | ||
121 | kirkwood_sata_init(&rd88f6281_sata_data); | 129 | kirkwood_sata_init(&rd88f6281_sata_data); |
130 | kirkwood_sdio_init(&rd88f6281_mvsdio_data); | ||
122 | kirkwood_uart0_init(); | 131 | kirkwood_uart0_init(); |
123 | 132 | ||
124 | platform_device_register(&rd88f6281_nand_flash); | 133 | platform_device_register(&rd88f6281_nand_flash); |
diff --git a/arch/arm/mach-kirkwood/sheevaplug-setup.c b/arch/arm/mach-kirkwood/sheevaplug-setup.c new file mode 100644 index 000000000000..831e4a56cae1 --- /dev/null +++ b/arch/arm/mach-kirkwood/sheevaplug-setup.c | |||
@@ -0,0 +1,136 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-kirkwood/sheevaplug-setup.c | ||
3 | * | ||
4 | * Marvell SheevaPlug Reference Board Setup | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/mtd/nand.h> | ||
15 | #include <linux/mtd/partitions.h> | ||
16 | #include <linux/mv643xx_eth.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/leds.h> | ||
19 | #include <asm/mach-types.h> | ||
20 | #include <asm/mach/arch.h> | ||
21 | #include <mach/kirkwood.h> | ||
22 | #include <plat/mvsdio.h> | ||
23 | #include <plat/orion_nand.h> | ||
24 | #include "common.h" | ||
25 | #include "mpp.h" | ||
26 | |||
27 | static struct mtd_partition sheevaplug_nand_parts[] = { | ||
28 | { | ||
29 | .name = "u-boot", | ||
30 | .offset = 0, | ||
31 | .size = SZ_1M | ||
32 | }, { | ||
33 | .name = "uImage", | ||
34 | .offset = MTDPART_OFS_NXTBLK, | ||
35 | .size = SZ_4M | ||
36 | }, { | ||
37 | .name = "root", | ||
38 | .offset = MTDPART_OFS_NXTBLK, | ||
39 | .size = MTDPART_SIZ_FULL | ||
40 | }, | ||
41 | }; | ||
42 | |||
43 | static struct resource sheevaplug_nand_resource = { | ||
44 | .flags = IORESOURCE_MEM, | ||
45 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
46 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + | ||
47 | KIRKWOOD_NAND_MEM_SIZE - 1, | ||
48 | }; | ||
49 | |||
50 | static struct orion_nand_data sheevaplug_nand_data = { | ||
51 | .parts = sheevaplug_nand_parts, | ||
52 | .nr_parts = ARRAY_SIZE(sheevaplug_nand_parts), | ||
53 | .cle = 0, | ||
54 | .ale = 1, | ||
55 | .width = 8, | ||
56 | .chip_delay = 25, | ||
57 | }; | ||
58 | |||
59 | static struct platform_device sheevaplug_nand_flash = { | ||
60 | .name = "orion_nand", | ||
61 | .id = -1, | ||
62 | .dev = { | ||
63 | .platform_data = &sheevaplug_nand_data, | ||
64 | }, | ||
65 | .resource = &sheevaplug_nand_resource, | ||
66 | .num_resources = 1, | ||
67 | }; | ||
68 | |||
69 | static struct mv643xx_eth_platform_data sheevaplug_ge00_data = { | ||
70 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), | ||
71 | }; | ||
72 | |||
73 | static struct mvsdio_platform_data sheevaplug_mvsdio_data = { | ||
74 | // unfortunately the CD signal has not been connected */ | ||
75 | }; | ||
76 | |||
77 | static struct gpio_led sheevaplug_led_pins[] = { | ||
78 | { | ||
79 | .name = "plug:green:health", | ||
80 | .default_trigger = "default-on", | ||
81 | .gpio = 49, | ||
82 | .active_low = 1, | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | static struct gpio_led_platform_data sheevaplug_led_data = { | ||
87 | .leds = sheevaplug_led_pins, | ||
88 | .num_leds = ARRAY_SIZE(sheevaplug_led_pins), | ||
89 | }; | ||
90 | |||
91 | static struct platform_device sheevaplug_leds = { | ||
92 | .name = "leds-gpio", | ||
93 | .id = -1, | ||
94 | .dev = { | ||
95 | .platform_data = &sheevaplug_led_data, | ||
96 | } | ||
97 | }; | ||
98 | |||
99 | static unsigned int sheevaplug_mpp_config[] __initdata = { | ||
100 | MPP29_GPIO, /* USB Power Enable */ | ||
101 | MPP49_GPIO, /* LED */ | ||
102 | 0 | ||
103 | }; | ||
104 | |||
105 | static void __init sheevaplug_init(void) | ||
106 | { | ||
107 | /* | ||
108 | * Basic setup. Needs to be called early. | ||
109 | */ | ||
110 | kirkwood_init(); | ||
111 | kirkwood_mpp_conf(sheevaplug_mpp_config); | ||
112 | |||
113 | kirkwood_uart0_init(); | ||
114 | |||
115 | if (gpio_request(29, "USB Power Enable") != 0 || | ||
116 | gpio_direction_output(29, 1) != 0) | ||
117 | printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n"); | ||
118 | kirkwood_ehci_init(); | ||
119 | |||
120 | kirkwood_ge00_init(&sheevaplug_ge00_data); | ||
121 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); | ||
122 | |||
123 | platform_device_register(&sheevaplug_nand_flash); | ||
124 | platform_device_register(&sheevaplug_leds); | ||
125 | } | ||
126 | |||
127 | MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board") | ||
128 | /* Maintainer: shadi Ammouri <shadi@marvell.com> */ | ||
129 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, | ||
130 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, | ||
131 | .boot_params = 0x00000100, | ||
132 | .init_machine = sheevaplug_init, | ||
133 | .map_io = kirkwood_map_io, | ||
134 | .init_irq = kirkwood_init_irq, | ||
135 | .timer = &kirkwood_timer, | ||
136 | MACHINE_END | ||
diff --git a/arch/arm/mach-kirkwood/ts219-setup.c b/arch/arm/mach-kirkwood/ts219-setup.c new file mode 100644 index 000000000000..dda5743cf3e0 --- /dev/null +++ b/arch/arm/mach-kirkwood/ts219-setup.c | |||
@@ -0,0 +1,220 @@ | |||
1 | /* | ||
2 | * | ||
3 | * QNAP TS-119/TS-219 Turbo NAS Board Setup | ||
4 | * | ||
5 | * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com> | ||
6 | * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/mtd/physmap.h> | ||
18 | #include <linux/spi/flash.h> | ||
19 | #include <linux/spi/spi.h> | ||
20 | #include <linux/spi/orion_spi.h> | ||
21 | #include <linux/i2c.h> | ||
22 | #include <linux/mv643xx_eth.h> | ||
23 | #include <linux/ata_platform.h> | ||
24 | #include <linux/gpio_keys.h> | ||
25 | #include <linux/input.h> | ||
26 | #include <linux/timex.h> | ||
27 | #include <linux/serial_reg.h> | ||
28 | #include <linux/pci.h> | ||
29 | #include <asm/mach-types.h> | ||
30 | #include <asm/mach/arch.h> | ||
31 | #include <mach/kirkwood.h> | ||
32 | #include "common.h" | ||
33 | #include "mpp.h" | ||
34 | |||
35 | /**************************************************************************** | ||
36 | * 16 MiB NOR flash. The struct mtd_partition is not in the same order as the | ||
37 | * partitions on the device because we want to keep compatability with | ||
38 | * the QNAP firmware. | ||
39 | * Layout as used by QNAP: | ||
40 | * 0x00000000-0x00080000 : "U-Boot" | ||
41 | * 0x00200000-0x00400000 : "Kernel" | ||
42 | * 0x00400000-0x00d00000 : "RootFS" | ||
43 | * 0x00d00000-0x01000000 : "RootFS2" | ||
44 | * 0x00080000-0x000c0000 : "U-Boot Config" | ||
45 | * 0x000c0000-0x00200000 : "NAS Config" | ||
46 | * | ||
47 | * We'll use "RootFS1" instead of "RootFS" to stay compatible with the layout | ||
48 | * used by the QNAP TS-109/TS-209. | ||
49 | * | ||
50 | ***************************************************************************/ | ||
51 | |||
52 | static struct mtd_partition qnap_ts219_partitions[] = { | ||
53 | { | ||
54 | .name = "U-Boot", | ||
55 | .size = 0x00080000, | ||
56 | .offset = 0, | ||
57 | .mask_flags = MTD_WRITEABLE, | ||
58 | }, { | ||
59 | .name = "Kernel", | ||
60 | .size = 0x00200000, | ||
61 | .offset = 0x00200000, | ||
62 | }, { | ||
63 | .name = "RootFS1", | ||
64 | .size = 0x00900000, | ||
65 | .offset = 0x00400000, | ||
66 | }, { | ||
67 | .name = "RootFS2", | ||
68 | .size = 0x00300000, | ||
69 | .offset = 0x00d00000, | ||
70 | }, { | ||
71 | .name = "U-Boot Config", | ||
72 | .size = 0x00040000, | ||
73 | .offset = 0x00080000, | ||
74 | }, { | ||
75 | .name = "NAS Config", | ||
76 | .size = 0x00140000, | ||
77 | .offset = 0x000c0000, | ||
78 | }, | ||
79 | }; | ||
80 | |||
81 | static const struct flash_platform_data qnap_ts219_flash = { | ||
82 | .type = "m25p128", | ||
83 | .name = "spi_flash", | ||
84 | .parts = qnap_ts219_partitions, | ||
85 | .nr_parts = ARRAY_SIZE(qnap_ts219_partitions), | ||
86 | }; | ||
87 | |||
88 | static struct spi_board_info __initdata qnap_ts219_spi_slave_info[] = { | ||
89 | { | ||
90 | .modalias = "m25p80", | ||
91 | .platform_data = &qnap_ts219_flash, | ||
92 | .irq = -1, | ||
93 | .max_speed_hz = 20000000, | ||
94 | .bus_num = 0, | ||
95 | .chip_select = 0, | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | static struct i2c_board_info __initdata qnap_ts219_i2c_rtc = { | ||
100 | I2C_BOARD_INFO("s35390a", 0x30), | ||
101 | }; | ||
102 | |||
103 | static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = { | ||
104 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | ||
105 | }; | ||
106 | |||
107 | static struct mv_sata_platform_data qnap_ts219_sata_data = { | ||
108 | .n_ports = 2, | ||
109 | }; | ||
110 | |||
111 | static struct gpio_keys_button qnap_ts219_buttons[] = { | ||
112 | { | ||
113 | .code = KEY_COPY, | ||
114 | .gpio = 15, | ||
115 | .desc = "USB Copy", | ||
116 | .active_low = 1, | ||
117 | }, | ||
118 | { | ||
119 | .code = KEY_RESTART, | ||
120 | .gpio = 16, | ||
121 | .desc = "Reset", | ||
122 | .active_low = 1, | ||
123 | }, | ||
124 | }; | ||
125 | |||
126 | static struct gpio_keys_platform_data qnap_ts219_button_data = { | ||
127 | .buttons = qnap_ts219_buttons, | ||
128 | .nbuttons = ARRAY_SIZE(qnap_ts219_buttons), | ||
129 | }; | ||
130 | |||
131 | static struct platform_device qnap_ts219_button_device = { | ||
132 | .name = "gpio-keys", | ||
133 | .id = -1, | ||
134 | .num_resources = 0, | ||
135 | .dev = { | ||
136 | .platform_data = &qnap_ts219_button_data, | ||
137 | } | ||
138 | }; | ||
139 | |||
140 | static unsigned int qnap_ts219_mpp_config[] __initdata = { | ||
141 | MPP0_SPI_SCn, | ||
142 | MPP1_SPI_MOSI, | ||
143 | MPP2_SPI_SCK, | ||
144 | MPP3_SPI_MISO, | ||
145 | MPP8_TW_SDA, | ||
146 | MPP9_TW_SCK, | ||
147 | MPP10_UART0_TXD, | ||
148 | MPP11_UART0_RXD, | ||
149 | MPP13_UART1_TXD, /* PIC controller */ | ||
150 | MPP14_UART1_RXD, /* PIC controller */ | ||
151 | MPP15_GPIO, /* USB Copy button */ | ||
152 | MPP16_GPIO, /* Reset button */ | ||
153 | MPP20_SATA1_ACTn, | ||
154 | MPP21_SATA0_ACTn, | ||
155 | MPP22_SATA1_PRESENTn, | ||
156 | MPP23_SATA0_PRESENTn, | ||
157 | 0 | ||
158 | }; | ||
159 | |||
160 | |||
161 | /***************************************************************************** | ||
162 | * QNAP TS-x19 specific power off method via UART1-attached PIC | ||
163 | ****************************************************************************/ | ||
164 | |||
165 | #define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2)) | ||
166 | |||
167 | void qnap_ts219_power_off(void) | ||
168 | { | ||
169 | /* 19200 baud divisor */ | ||
170 | const unsigned divisor = ((kirkwood_tclk + (8 * 19200)) / (16 * 19200)); | ||
171 | |||
172 | pr_info("%s: triggering power-off...\n", __func__); | ||
173 | |||
174 | /* hijack UART1 and reset into sane state (19200,8n1) */ | ||
175 | writel(0x83, UART1_REG(LCR)); | ||
176 | writel(divisor & 0xff, UART1_REG(DLL)); | ||
177 | writel((divisor >> 8) & 0xff, UART1_REG(DLM)); | ||
178 | writel(0x03, UART1_REG(LCR)); | ||
179 | writel(0x00, UART1_REG(IER)); | ||
180 | writel(0x00, UART1_REG(FCR)); | ||
181 | writel(0x00, UART1_REG(MCR)); | ||
182 | |||
183 | /* send the power-off command 'A' to PIC */ | ||
184 | writel('A', UART1_REG(TX)); | ||
185 | } | ||
186 | |||
187 | static void __init qnap_ts219_init(void) | ||
188 | { | ||
189 | /* | ||
190 | * Basic setup. Needs to be called early. | ||
191 | */ | ||
192 | kirkwood_init(); | ||
193 | kirkwood_mpp_conf(qnap_ts219_mpp_config); | ||
194 | |||
195 | kirkwood_uart0_init(); | ||
196 | kirkwood_uart1_init(); /* A PIC controller is connected here. */ | ||
197 | spi_register_board_info(qnap_ts219_spi_slave_info, | ||
198 | ARRAY_SIZE(qnap_ts219_spi_slave_info)); | ||
199 | kirkwood_spi_init(); | ||
200 | kirkwood_i2c_init(); | ||
201 | i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1); | ||
202 | kirkwood_ge00_init(&qnap_ts219_ge00_data); | ||
203 | kirkwood_sata_init(&qnap_ts219_sata_data); | ||
204 | kirkwood_ehci_init(); | ||
205 | platform_device_register(&qnap_ts219_button_device); | ||
206 | |||
207 | pm_power_off = qnap_ts219_power_off; | ||
208 | |||
209 | } | ||
210 | |||
211 | MACHINE_START(TS219, "QNAP TS-119/TS-219") | ||
212 | /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */ | ||
213 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, | ||
214 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, | ||
215 | .boot_params = 0x00000100, | ||
216 | .init_machine = qnap_ts219_init, | ||
217 | .map_io = kirkwood_map_io, | ||
218 | .init_irq = kirkwood_init_irq, | ||
219 | .timer = &kirkwood_timer, | ||
220 | MACHINE_END | ||