diff options
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r-- | arch/arm/mach-kirkwood/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/addr-map.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 159 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/cpuidle.c | 96 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/db88f6281-bp-setup.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/bridge-regs.h | 21 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/io.h | 25 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/kirkwood.h | 18 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/mpp.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c | 173 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/pcie.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/rd88f6281-setup.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/sheevaplug-setup.c | 32 |
16 files changed, 519 insertions, 103 deletions
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index b5421cccd7e1..25100f7acf4c 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig | |||
@@ -20,6 +20,12 @@ 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_MV88F6281GTW_GE | ||
24 | bool "Marvell 88F6281 GTW GE Board" | ||
25 | help | ||
26 | Say 'Y' here if you want your kernel to support the | ||
27 | Marvell 88F6281 GTW GE Board. | ||
28 | |||
23 | config MACH_SHEEVAPLUG | 29 | config MACH_SHEEVAPLUG |
24 | bool "Marvell SheevaPlug Reference Board" | 30 | bool "Marvell SheevaPlug Reference Board" |
25 | help | 31 | help |
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 8f03c9b9bdd9..9dd680e964d6 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
@@ -3,5 +3,8 @@ obj-y += common.o addr-map.o irq.o pcie.o mpp.o | |||
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_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o | ||
6 | obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o | 7 | obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o |
7 | obj-$(CONFIG_MACH_TS219) += ts219-setup.o | 8 | obj-$(CONFIG_MACH_TS219) += ts219-setup.o |
9 | |||
10 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | ||
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c index 5db4f0bbe5ee..1da5d1c18ecb 100644 --- a/arch/arm/mach-kirkwood/addr-map.c +++ b/arch/arm/mach-kirkwood/addr-map.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | #define TARGET_DDR 0 | 21 | #define TARGET_DDR 0 |
22 | #define TARGET_DEV_BUS 1 | 22 | #define TARGET_DEV_BUS 1 |
23 | #define TARGET_SRAM 3 | ||
23 | #define TARGET_PCIE 4 | 24 | #define TARGET_PCIE 4 |
24 | #define ATTR_DEV_SPI_ROM 0x1e | 25 | #define ATTR_DEV_SPI_ROM 0x1e |
25 | #define ATTR_DEV_BOOT 0x1d | 26 | #define ATTR_DEV_BOOT 0x1d |
@@ -30,6 +31,7 @@ | |||
30 | #define ATTR_DEV_CS0 0x3e | 31 | #define ATTR_DEV_CS0 0x3e |
31 | #define ATTR_PCIE_IO 0xe0 | 32 | #define ATTR_PCIE_IO 0xe0 |
32 | #define ATTR_PCIE_MEM 0xe8 | 33 | #define ATTR_PCIE_MEM 0xe8 |
34 | #define ATTR_SRAM 0x01 | ||
33 | 35 | ||
34 | /* | 36 | /* |
35 | * Helpers to get DDR bank info | 37 | * Helpers to get DDR bank info |
@@ -48,7 +50,6 @@ | |||
48 | 50 | ||
49 | 51 | ||
50 | struct mbus_dram_target_info kirkwood_mbus_dram_info; | 52 | struct mbus_dram_target_info kirkwood_mbus_dram_info; |
51 | static int __initdata win_alloc_count; | ||
52 | 53 | ||
53 | static int __init cpu_win_can_remap(int win) | 54 | static int __init cpu_win_can_remap(int win) |
54 | { | 55 | { |
@@ -112,7 +113,11 @@ void __init kirkwood_setup_cpu_mbus(void) | |||
112 | setup_cpu_win(2, KIRKWOOD_NAND_MEM_PHYS_BASE, KIRKWOOD_NAND_MEM_SIZE, | 113 | setup_cpu_win(2, KIRKWOOD_NAND_MEM_PHYS_BASE, KIRKWOOD_NAND_MEM_SIZE, |
113 | TARGET_DEV_BUS, ATTR_DEV_NAND, -1); | 114 | TARGET_DEV_BUS, ATTR_DEV_NAND, -1); |
114 | 115 | ||
115 | win_alloc_count = 3; | 116 | /* |
117 | * Setup window for SRAM. | ||
118 | */ | ||
119 | setup_cpu_win(3, KIRKWOOD_SRAM_PHYS_BASE, KIRKWOOD_SRAM_SIZE, | ||
120 | TARGET_SRAM, ATTR_SRAM, -1); | ||
116 | 121 | ||
117 | /* | 122 | /* |
118 | * Setup MBUS dram target info. | 123 | * Setup MBUS dram target info. |
@@ -140,8 +145,3 @@ void __init kirkwood_setup_cpu_mbus(void) | |||
140 | } | 145 | } |
141 | kirkwood_mbus_dram_info.num_cs = cs; | 146 | kirkwood_mbus_dram_info.num_cs = cs; |
142 | } | 147 | } |
143 | |||
144 | void __init kirkwood_setup_sram_win(u32 base, u32 size) | ||
145 | { | ||
146 | setup_cpu_win(win_alloc_count++, base, size, 0x03, 0x00, -1); | ||
147 | } | ||
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index be1ca28fed3f..0f6919838011 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mv643xx_eth.h> | 16 | #include <linux/mv643xx_eth.h> |
17 | #include <linux/mv643xx_i2c.h> | 17 | #include <linux/mv643xx_i2c.h> |
18 | #include <linux/ata_platform.h> | 18 | #include <linux/ata_platform.h> |
19 | #include <linux/mtd/nand.h> | ||
19 | #include <linux/spi/orion_spi.h> | 20 | #include <linux/spi/orion_spi.h> |
20 | #include <net/dsa.h> | 21 | #include <net/dsa.h> |
21 | #include <asm/page.h> | 22 | #include <asm/page.h> |
@@ -29,6 +30,7 @@ | |||
29 | #include <plat/mvsdio.h> | 30 | #include <plat/mvsdio.h> |
30 | #include <plat/mv_xor.h> | 31 | #include <plat/mv_xor.h> |
31 | #include <plat/orion_nand.h> | 32 | #include <plat/orion_nand.h> |
33 | #include <plat/orion_wdt.h> | ||
32 | #include <plat/time.h> | 34 | #include <plat/time.h> |
33 | #include "common.h" | 35 | #include "common.h" |
34 | 36 | ||
@@ -54,6 +56,13 @@ void __init kirkwood_map_io(void) | |||
54 | iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc)); | 56 | iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc)); |
55 | } | 57 | } |
56 | 58 | ||
59 | /* | ||
60 | * Default clock control bits. Any bit _not_ set in this variable | ||
61 | * will be cleared from the hardware after platform devices have been | ||
62 | * registered. Some reserved bits must be set to 1. | ||
63 | */ | ||
64 | unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED; | ||
65 | |||
57 | 66 | ||
58 | /***************************************************************************** | 67 | /***************************************************************************** |
59 | * EHCI | 68 | * EHCI |
@@ -95,6 +104,7 @@ static struct platform_device kirkwood_ehci = { | |||
95 | 104 | ||
96 | void __init kirkwood_ehci_init(void) | 105 | void __init kirkwood_ehci_init(void) |
97 | { | 106 | { |
107 | kirkwood_clk_ctrl |= CGC_USB0; | ||
98 | platform_device_register(&kirkwood_ehci); | 108 | platform_device_register(&kirkwood_ehci); |
99 | } | 109 | } |
100 | 110 | ||
@@ -151,6 +161,7 @@ static struct platform_device kirkwood_ge00 = { | |||
151 | 161 | ||
152 | void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data) | 162 | void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data) |
153 | { | 163 | { |
164 | kirkwood_clk_ctrl |= CGC_GE0; | ||
154 | eth_data->shared = &kirkwood_ge00_shared; | 165 | eth_data->shared = &kirkwood_ge00_shared; |
155 | kirkwood_ge00.dev.platform_data = eth_data; | 166 | kirkwood_ge00.dev.platform_data = eth_data; |
156 | 167 | ||
@@ -212,6 +223,7 @@ static struct platform_device kirkwood_ge01 = { | |||
212 | 223 | ||
213 | void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data) | 224 | void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data) |
214 | { | 225 | { |
226 | kirkwood_clk_ctrl |= CGC_GE1; | ||
215 | eth_data->shared = &kirkwood_ge01_shared; | 227 | eth_data->shared = &kirkwood_ge01_shared; |
216 | kirkwood_ge01.dev.platform_data = eth_data; | 228 | kirkwood_ge01.dev.platform_data = eth_data; |
217 | 229 | ||
@@ -258,6 +270,43 @@ void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq) | |||
258 | 270 | ||
259 | 271 | ||
260 | /***************************************************************************** | 272 | /***************************************************************************** |
273 | * NAND flash | ||
274 | ****************************************************************************/ | ||
275 | static struct resource kirkwood_nand_resource = { | ||
276 | .flags = IORESOURCE_MEM, | ||
277 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
278 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + | ||
279 | KIRKWOOD_NAND_MEM_SIZE - 1, | ||
280 | }; | ||
281 | |||
282 | static struct orion_nand_data kirkwood_nand_data = { | ||
283 | .cle = 0, | ||
284 | .ale = 1, | ||
285 | .width = 8, | ||
286 | }; | ||
287 | |||
288 | static struct platform_device kirkwood_nand_flash = { | ||
289 | .name = "orion_nand", | ||
290 | .id = -1, | ||
291 | .dev = { | ||
292 | .platform_data = &kirkwood_nand_data, | ||
293 | }, | ||
294 | .resource = &kirkwood_nand_resource, | ||
295 | .num_resources = 1, | ||
296 | }; | ||
297 | |||
298 | void __init kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, | ||
299 | int chip_delay) | ||
300 | { | ||
301 | kirkwood_clk_ctrl |= CGC_RUNIT; | ||
302 | kirkwood_nand_data.parts = parts; | ||
303 | kirkwood_nand_data.nr_parts = nr_parts; | ||
304 | kirkwood_nand_data.chip_delay = chip_delay; | ||
305 | platform_device_register(&kirkwood_nand_flash); | ||
306 | } | ||
307 | |||
308 | |||
309 | /***************************************************************************** | ||
261 | * SoC RTC | 310 | * SoC RTC |
262 | ****************************************************************************/ | 311 | ****************************************************************************/ |
263 | static struct resource kirkwood_rtc_resource = { | 312 | static struct resource kirkwood_rtc_resource = { |
@@ -301,6 +350,9 @@ static struct platform_device kirkwood_sata = { | |||
301 | 350 | ||
302 | void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data) | 351 | void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data) |
303 | { | 352 | { |
353 | kirkwood_clk_ctrl |= CGC_SATA0; | ||
354 | if (sata_data->n_ports > 1) | ||
355 | kirkwood_clk_ctrl |= CGC_SATA1; | ||
304 | sata_data->dram = &kirkwood_mbus_dram_info; | 356 | sata_data->dram = &kirkwood_mbus_dram_info; |
305 | kirkwood_sata.dev.platform_data = sata_data; | 357 | kirkwood_sata.dev.platform_data = sata_data; |
306 | platform_device_register(&kirkwood_sata); | 358 | platform_device_register(&kirkwood_sata); |
@@ -346,6 +398,7 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data) | |||
346 | else | 398 | else |
347 | mvsdio_data->clock = 200000000; | 399 | mvsdio_data->clock = 200000000; |
348 | mvsdio_data->dram = &kirkwood_mbus_dram_info; | 400 | mvsdio_data->dram = &kirkwood_mbus_dram_info; |
401 | kirkwood_clk_ctrl |= CGC_SDIO; | ||
349 | kirkwood_sdio.dev.platform_data = mvsdio_data; | 402 | kirkwood_sdio.dev.platform_data = mvsdio_data; |
350 | platform_device_register(&kirkwood_sdio); | 403 | platform_device_register(&kirkwood_sdio); |
351 | } | 404 | } |
@@ -377,6 +430,7 @@ static struct platform_device kirkwood_spi = { | |||
377 | 430 | ||
378 | void __init kirkwood_spi_init() | 431 | void __init kirkwood_spi_init() |
379 | { | 432 | { |
433 | kirkwood_clk_ctrl |= CGC_RUNIT; | ||
380 | platform_device_register(&kirkwood_spi); | 434 | platform_device_register(&kirkwood_spi); |
381 | } | 435 | } |
382 | 436 | ||
@@ -507,6 +561,43 @@ void __init kirkwood_uart1_init(void) | |||
507 | 561 | ||
508 | 562 | ||
509 | /***************************************************************************** | 563 | /***************************************************************************** |
564 | * Cryptographic Engines and Security Accelerator (CESA) | ||
565 | ****************************************************************************/ | ||
566 | |||
567 | static struct resource kirkwood_crypto_res[] = { | ||
568 | { | ||
569 | .name = "regs", | ||
570 | .start = CRYPTO_PHYS_BASE, | ||
571 | .end = CRYPTO_PHYS_BASE + 0xffff, | ||
572 | .flags = IORESOURCE_MEM, | ||
573 | }, { | ||
574 | .name = "sram", | ||
575 | .start = KIRKWOOD_SRAM_PHYS_BASE, | ||
576 | .end = KIRKWOOD_SRAM_PHYS_BASE + KIRKWOOD_SRAM_SIZE - 1, | ||
577 | .flags = IORESOURCE_MEM, | ||
578 | }, { | ||
579 | .name = "crypto interrupt", | ||
580 | .start = IRQ_KIRKWOOD_CRYPTO, | ||
581 | .end = IRQ_KIRKWOOD_CRYPTO, | ||
582 | .flags = IORESOURCE_IRQ, | ||
583 | }, | ||
584 | }; | ||
585 | |||
586 | static struct platform_device kirkwood_crypto_device = { | ||
587 | .name = "mv_crypto", | ||
588 | .id = -1, | ||
589 | .num_resources = ARRAY_SIZE(kirkwood_crypto_res), | ||
590 | .resource = kirkwood_crypto_res, | ||
591 | }; | ||
592 | |||
593 | void __init kirkwood_crypto_init(void) | ||
594 | { | ||
595 | kirkwood_clk_ctrl |= CGC_CRYPTO; | ||
596 | platform_device_register(&kirkwood_crypto_device); | ||
597 | } | ||
598 | |||
599 | |||
600 | /***************************************************************************** | ||
510 | * XOR | 601 | * XOR |
511 | ****************************************************************************/ | 602 | ****************************************************************************/ |
512 | static struct mv_xor_platform_shared_data kirkwood_xor_shared_data = { | 603 | static struct mv_xor_platform_shared_data kirkwood_xor_shared_data = { |
@@ -597,6 +688,7 @@ static struct platform_device kirkwood_xor01_channel = { | |||
597 | 688 | ||
598 | static void __init kirkwood_xor0_init(void) | 689 | static void __init kirkwood_xor0_init(void) |
599 | { | 690 | { |
691 | kirkwood_clk_ctrl |= CGC_XOR0; | ||
600 | platform_device_register(&kirkwood_xor0_shared); | 692 | platform_device_register(&kirkwood_xor0_shared); |
601 | 693 | ||
602 | /* | 694 | /* |
@@ -695,6 +787,7 @@ static struct platform_device kirkwood_xor11_channel = { | |||
695 | 787 | ||
696 | static void __init kirkwood_xor1_init(void) | 788 | static void __init kirkwood_xor1_init(void) |
697 | { | 789 | { |
790 | kirkwood_clk_ctrl |= CGC_XOR1; | ||
698 | platform_device_register(&kirkwood_xor1_shared); | 791 | platform_device_register(&kirkwood_xor1_shared); |
699 | 792 | ||
700 | /* | 793 | /* |
@@ -713,6 +806,29 @@ static void __init kirkwood_xor1_init(void) | |||
713 | 806 | ||
714 | 807 | ||
715 | /***************************************************************************** | 808 | /***************************************************************************** |
809 | * Watchdog | ||
810 | ****************************************************************************/ | ||
811 | static struct orion_wdt_platform_data kirkwood_wdt_data = { | ||
812 | .tclk = 0, | ||
813 | }; | ||
814 | |||
815 | static struct platform_device kirkwood_wdt_device = { | ||
816 | .name = "orion_wdt", | ||
817 | .id = -1, | ||
818 | .dev = { | ||
819 | .platform_data = &kirkwood_wdt_data, | ||
820 | }, | ||
821 | .num_resources = 0, | ||
822 | }; | ||
823 | |||
824 | static void __init kirkwood_wdt_init(void) | ||
825 | { | ||
826 | kirkwood_wdt_data.tclk = kirkwood_tclk; | ||
827 | platform_device_register(&kirkwood_wdt_device); | ||
828 | } | ||
829 | |||
830 | |||
831 | /***************************************************************************** | ||
716 | * Time handling | 832 | * Time handling |
717 | ****************************************************************************/ | 833 | ****************************************************************************/ |
718 | int kirkwood_tclk; | 834 | int kirkwood_tclk; |
@@ -804,6 +920,49 @@ void __init kirkwood_init(void) | |||
804 | 920 | ||
805 | /* internal devices that every board has */ | 921 | /* internal devices that every board has */ |
806 | kirkwood_rtc_init(); | 922 | kirkwood_rtc_init(); |
923 | kirkwood_wdt_init(); | ||
807 | kirkwood_xor0_init(); | 924 | kirkwood_xor0_init(); |
808 | kirkwood_xor1_init(); | 925 | kirkwood_xor1_init(); |
926 | kirkwood_crypto_init(); | ||
927 | } | ||
928 | |||
929 | static int __init kirkwood_clock_gate(void) | ||
930 | { | ||
931 | unsigned int curr = readl(CLOCK_GATING_CTRL); | ||
932 | |||
933 | printk(KERN_DEBUG "Gating clock of unused units\n"); | ||
934 | printk(KERN_DEBUG "before: 0x%08x\n", curr); | ||
935 | |||
936 | /* Make sure those units are accessible */ | ||
937 | writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0, CLOCK_GATING_CTRL); | ||
938 | |||
939 | /* For SATA: first shutdown the phy */ | ||
940 | if (!(kirkwood_clk_ctrl & CGC_SATA0)) { | ||
941 | /* Disable PLL and IVREF */ | ||
942 | writel(readl(SATA0_PHY_MODE_2) & ~0xf, SATA0_PHY_MODE_2); | ||
943 | /* Disable PHY */ | ||
944 | writel(readl(SATA0_IF_CTRL) | 0x200, SATA0_IF_CTRL); | ||
945 | } | ||
946 | if (!(kirkwood_clk_ctrl & CGC_SATA1)) { | ||
947 | /* Disable PLL and IVREF */ | ||
948 | writel(readl(SATA1_PHY_MODE_2) & ~0xf, SATA1_PHY_MODE_2); | ||
949 | /* Disable PHY */ | ||
950 | writel(readl(SATA1_IF_CTRL) | 0x200, SATA1_IF_CTRL); | ||
951 | } | ||
952 | |||
953 | /* For PCIe: first shutdown the phy */ | ||
954 | if (!(kirkwood_clk_ctrl & CGC_PEX0)) { | ||
955 | writel(readl(PCIE_LINK_CTRL) | 0x10, PCIE_LINK_CTRL); | ||
956 | while (1) | ||
957 | if (readl(PCIE_STATUS) & 0x1) | ||
958 | break; | ||
959 | writel(readl(PCIE_LINK_CTRL) & ~0x10, PCIE_LINK_CTRL); | ||
960 | } | ||
961 | |||
962 | /* Now gate clock the required units */ | ||
963 | writel(kirkwood_clk_ctrl, CLOCK_GATING_CTRL); | ||
964 | printk(KERN_DEBUG " after: 0x%08x\n", readl(CLOCK_GATING_CTRL)); | ||
965 | |||
966 | return 0; | ||
809 | } | 967 | } |
968 | late_initcall(kirkwood_clock_gate); | ||
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index 6ee88406f381..d7de43464358 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h | |||
@@ -15,6 +15,7 @@ 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 | struct mvsdio_platform_data; |
18 | struct mtd_partition; | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * Basic Kirkwood init functions used early by machine-setup. | 21 | * Basic Kirkwood init functions used early by machine-setup. |
@@ -25,7 +26,6 @@ void kirkwood_init_irq(void); | |||
25 | 26 | ||
26 | extern struct mbus_dram_target_info kirkwood_mbus_dram_info; | 27 | extern struct mbus_dram_target_info kirkwood_mbus_dram_info; |
27 | void kirkwood_setup_cpu_mbus(void); | 28 | void kirkwood_setup_cpu_mbus(void); |
28 | void kirkwood_setup_sram_win(u32 base, u32 size); | ||
29 | 29 | ||
30 | void kirkwood_pcie_id(u32 *dev, u32 *rev); | 30 | void kirkwood_pcie_id(u32 *dev, u32 *rev); |
31 | 31 | ||
@@ -40,9 +40,11 @@ void kirkwood_spi_init(void); | |||
40 | void kirkwood_i2c_init(void); | 40 | void kirkwood_i2c_init(void); |
41 | void kirkwood_uart0_init(void); | 41 | void kirkwood_uart0_init(void); |
42 | void kirkwood_uart1_init(void); | 42 | void kirkwood_uart1_init(void); |
43 | void kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, int delay); | ||
43 | 44 | ||
44 | extern int kirkwood_tclk; | 45 | extern int kirkwood_tclk; |
45 | extern struct sys_timer kirkwood_timer; | 46 | extern struct sys_timer kirkwood_timer; |
46 | 47 | ||
48 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | ||
47 | 49 | ||
48 | #endif | 50 | #endif |
diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c new file mode 100644 index 000000000000..f68d33f1f396 --- /dev/null +++ b/arch/arm/mach-kirkwood/cpuidle.c | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-kirkwood/cpuidle.c | ||
3 | * | ||
4 | * CPU idle 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 | * The cpu idle uses wait-for-interrupt and DDR self refresh in order | ||
11 | * to implement two idle states - | ||
12 | * #1 wait-for-interrupt | ||
13 | * #2 wait-for-interrupt and DDR self refresh | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/cpuidle.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <asm/proc-fns.h> | ||
22 | #include <mach/kirkwood.h> | ||
23 | |||
24 | #define KIRKWOOD_MAX_STATES 2 | ||
25 | |||
26 | static struct cpuidle_driver kirkwood_idle_driver = { | ||
27 | .name = "kirkwood_idle", | ||
28 | .owner = THIS_MODULE, | ||
29 | }; | ||
30 | |||
31 | static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device); | ||
32 | |||
33 | /* Actual code that puts the SoC in different idle states */ | ||
34 | static int kirkwood_enter_idle(struct cpuidle_device *dev, | ||
35 | struct cpuidle_state *state) | ||
36 | { | ||
37 | struct timeval before, after; | ||
38 | int idle_time; | ||
39 | |||
40 | local_irq_disable(); | ||
41 | do_gettimeofday(&before); | ||
42 | if (state == &dev->states[0]) | ||
43 | /* Wait for interrupt state */ | ||
44 | cpu_do_idle(); | ||
45 | else if (state == &dev->states[1]) { | ||
46 | /* | ||
47 | * Following write will put DDR in self refresh. | ||
48 | * Note that we have 256 cycles before DDR puts it | ||
49 | * self in self-refresh, so the wait-for-interrupt | ||
50 | * call afterwards won't get the DDR from self refresh | ||
51 | * mode. | ||
52 | */ | ||
53 | writel(0x7, DDR_OPERATION_BASE); | ||
54 | cpu_do_idle(); | ||
55 | } | ||
56 | do_gettimeofday(&after); | ||
57 | local_irq_enable(); | ||
58 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + | ||
59 | (after.tv_usec - before.tv_usec); | ||
60 | return idle_time; | ||
61 | } | ||
62 | |||
63 | /* Initialize CPU idle by registering the idle states */ | ||
64 | static int kirkwood_init_cpuidle(void) | ||
65 | { | ||
66 | struct cpuidle_device *device; | ||
67 | |||
68 | cpuidle_register_driver(&kirkwood_idle_driver); | ||
69 | |||
70 | device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id()); | ||
71 | device->state_count = KIRKWOOD_MAX_STATES; | ||
72 | |||
73 | /* Wait for interrupt state */ | ||
74 | device->states[0].enter = kirkwood_enter_idle; | ||
75 | device->states[0].exit_latency = 1; | ||
76 | device->states[0].target_residency = 10000; | ||
77 | device->states[0].flags = CPUIDLE_FLAG_TIME_VALID; | ||
78 | strcpy(device->states[0].name, "WFI"); | ||
79 | strcpy(device->states[0].desc, "Wait for interrupt"); | ||
80 | |||
81 | /* Wait for interrupt and DDR self refresh state */ | ||
82 | device->states[1].enter = kirkwood_enter_idle; | ||
83 | device->states[1].exit_latency = 10; | ||
84 | device->states[1].target_residency = 10000; | ||
85 | device->states[1].flags = CPUIDLE_FLAG_TIME_VALID; | ||
86 | strcpy(device->states[1].name, "DDR SR"); | ||
87 | strcpy(device->states[1].desc, "WFI and DDR Self Refresh"); | ||
88 | |||
89 | if (cpuidle_register_device(device)) { | ||
90 | printk(KERN_ERR "kirkwood_init_cpuidle: Failed registering\n"); | ||
91 | return -EIO; | ||
92 | } | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | device_initcall(kirkwood_init_cpuidle); | ||
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c index 5505d5837752..39bdf4bcace9 100644 --- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c +++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c | |||
@@ -11,14 +11,12 @@ | |||
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/mtd/nand.h> | ||
15 | #include <linux/mtd/partitions.h> | 14 | #include <linux/mtd/partitions.h> |
16 | #include <linux/ata_platform.h> | 15 | #include <linux/ata_platform.h> |
17 | #include <linux/mv643xx_eth.h> | 16 | #include <linux/mv643xx_eth.h> |
18 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
19 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
20 | #include <mach/kirkwood.h> | 19 | #include <mach/kirkwood.h> |
21 | #include <plat/orion_nand.h> | ||
22 | #include <plat/mvsdio.h> | 20 | #include <plat/mvsdio.h> |
23 | #include "common.h" | 21 | #include "common.h" |
24 | #include "mpp.h" | 22 | #include "mpp.h" |
@@ -39,32 +37,6 @@ static struct mtd_partition db88f6281_nand_parts[] = { | |||
39 | }, | 37 | }, |
40 | }; | 38 | }; |
41 | 39 | ||
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 | }; | ||
67 | |||
68 | static struct mv643xx_eth_platform_data db88f6281_ge00_data = { | 40 | static struct mv643xx_eth_platform_data db88f6281_ge00_data = { |
69 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | 41 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
70 | }; | 42 | }; |
@@ -92,13 +64,12 @@ static void __init db88f6281_init(void) | |||
92 | kirkwood_init(); | 64 | kirkwood_init(); |
93 | kirkwood_mpp_conf(db88f6281_mpp_config); | 65 | kirkwood_mpp_conf(db88f6281_mpp_config); |
94 | 66 | ||
67 | kirkwood_nand_init(ARRAY_AND_SIZE(db88f6281_nand_parts), 25); | ||
95 | kirkwood_ehci_init(); | 68 | kirkwood_ehci_init(); |
96 | kirkwood_ge00_init(&db88f6281_ge00_data); | 69 | kirkwood_ge00_init(&db88f6281_ge00_data); |
97 | kirkwood_sata_init(&db88f6281_sata_data); | 70 | kirkwood_sata_init(&db88f6281_sata_data); |
98 | kirkwood_uart0_init(); | 71 | kirkwood_uart0_init(); |
99 | kirkwood_sdio_init(&db88f6281_mvsdio_data); | 72 | kirkwood_sdio_init(&db88f6281_mvsdio_data); |
100 | |||
101 | platform_device_register(&db88f6281_nand_flash); | ||
102 | } | 73 | } |
103 | 74 | ||
104 | static int __init db88f6281_pci_init(void) | 75 | static int __init db88f6281_pci_init(void) |
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h index 4f7029f521cc..9e80d9232c83 100644 --- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h +++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h | |||
@@ -17,12 +17,15 @@ | |||
17 | #define CPU_RESET 0x00000002 | 17 | #define CPU_RESET 0x00000002 |
18 | 18 | ||
19 | #define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108) | 19 | #define RSTOUTn_MASK (BRIDGE_VIRT_BASE | 0x0108) |
20 | #define WDT_RESET_OUT_EN 0x00000002 | ||
20 | #define SOFT_RESET_OUT_EN 0x00000004 | 21 | #define SOFT_RESET_OUT_EN 0x00000004 |
21 | 22 | ||
22 | #define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c) | 23 | #define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE | 0x010c) |
23 | #define SOFT_RESET 0x00000001 | 24 | #define SOFT_RESET 0x00000001 |
24 | 25 | ||
25 | #define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110) | 26 | #define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110) |
27 | #define WDT_INT_REQ 0x0008 | ||
28 | |||
26 | #define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114) | 29 | #define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114) |
27 | #define BRIDGE_INT_TIMER0 0x0002 | 30 | #define BRIDGE_INT_TIMER0 0x0002 |
28 | #define BRIDGE_INT_TIMER1 0x0004 | 31 | #define BRIDGE_INT_TIMER1 0x0004 |
@@ -39,4 +42,22 @@ | |||
39 | #define L2_CONFIG_REG (BRIDGE_VIRT_BASE | 0x0128) | 42 | #define L2_CONFIG_REG (BRIDGE_VIRT_BASE | 0x0128) |
40 | #define L2_WRITETHROUGH 0x00000010 | 43 | #define L2_WRITETHROUGH 0x00000010 |
41 | 44 | ||
45 | #define CLOCK_GATING_CTRL (BRIDGE_VIRT_BASE | 0x11c) | ||
46 | #define CGC_GE0 (1 << 0) | ||
47 | #define CGC_PEX0 (1 << 2) | ||
48 | #define CGC_USB0 (1 << 3) | ||
49 | #define CGC_SDIO (1 << 4) | ||
50 | #define CGC_TSU (1 << 5) | ||
51 | #define CGC_DUNIT (1 << 6) | ||
52 | #define CGC_RUNIT (1 << 7) | ||
53 | #define CGC_XOR0 (1 << 8) | ||
54 | #define CGC_AUDIO (1 << 9) | ||
55 | #define CGC_SATA0 (1 << 14) | ||
56 | #define CGC_SATA1 (1 << 15) | ||
57 | #define CGC_XOR1 (1 << 16) | ||
58 | #define CGC_CRYPTO (1 << 17) | ||
59 | #define CGC_GE1 (1 << 19) | ||
60 | #define CGC_TDM (1 << 20) | ||
61 | #define CGC_RESERVED ((1 << 18) | (0x6 << 21)) | ||
62 | |||
42 | #endif | 63 | #endif |
diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h index be07be0ef522..a643a846d5fb 100644 --- a/arch/arm/mach-kirkwood/include/mach/io.h +++ b/arch/arm/mach-kirkwood/include/mach/io.h | |||
@@ -19,6 +19,31 @@ static inline void __iomem *__io(unsigned long addr) | |||
19 | + KIRKWOOD_PCIE_IO_VIRT_BASE); | 19 | + KIRKWOOD_PCIE_IO_VIRT_BASE); |
20 | } | 20 | } |
21 | 21 | ||
22 | static inline void __iomem * | ||
23 | __arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype) | ||
24 | { | ||
25 | void __iomem *retval; | ||
26 | unsigned long offs = paddr - KIRKWOOD_REGS_PHYS_BASE; | ||
27 | if (mtype == MT_DEVICE && size && offs < KIRKWOOD_REGS_SIZE && | ||
28 | size <= KIRKWOOD_REGS_SIZE && offs + size <= KIRKWOOD_REGS_SIZE) { | ||
29 | retval = (void __iomem *)KIRKWOOD_REGS_VIRT_BASE + offs; | ||
30 | } else { | ||
31 | retval = __arm_ioremap(paddr, size, mtype); | ||
32 | } | ||
33 | |||
34 | return retval; | ||
35 | } | ||
36 | |||
37 | static inline void | ||
38 | __arch_iounmap(void __iomem *addr) | ||
39 | { | ||
40 | if (addr < (void __iomem *)KIRKWOOD_REGS_VIRT_BASE || | ||
41 | addr >= (void __iomem *)(KIRKWOOD_REGS_VIRT_BASE + KIRKWOOD_REGS_SIZE)) | ||
42 | __iounmap(addr); | ||
43 | } | ||
44 | |||
45 | #define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m) | ||
46 | #define __arch_iounmap(a) __arch_iounmap(a) | ||
22 | #define __io(a) __io(a) | 47 | #define __io(a) __io(a) |
23 | #define __mem_pci(a) (a) | 48 | #define __mem_pci(a) (a) |
24 | 49 | ||
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h index b3e13958821d..07af858814a0 100644 --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h | |||
@@ -20,16 +20,18 @@ | |||
20 | * f1000000 on-chip peripheral registers | 20 | * f1000000 on-chip peripheral registers |
21 | * f2000000 PCIe I/O space | 21 | * f2000000 PCIe I/O space |
22 | * f3000000 NAND controller address window | 22 | * f3000000 NAND controller address window |
23 | * f4000000 Security Accelerator SRAM | ||
23 | * | 24 | * |
24 | * virt phys size | 25 | * virt phys size |
25 | * fee00000 f1000000 1M on-chip peripheral registers | 26 | * fee00000 f1000000 1M on-chip peripheral registers |
26 | * fef00000 f2000000 1M PCIe I/O space | 27 | * fef00000 f2000000 1M PCIe I/O space |
27 | */ | 28 | */ |
28 | 29 | ||
30 | #define KIRKWOOD_SRAM_PHYS_BASE 0xf4000000 | ||
31 | #define KIRKWOOD_SRAM_SIZE SZ_2K | ||
32 | |||
29 | #define KIRKWOOD_NAND_MEM_PHYS_BASE 0xf3000000 | 33 | #define KIRKWOOD_NAND_MEM_PHYS_BASE 0xf3000000 |
30 | #define KIRKWOOD_NAND_MEM_SIZE SZ_64K /* 1K is sufficient, but 64K | 34 | #define KIRKWOOD_NAND_MEM_SIZE SZ_1K |
31 | * is the minimal window size | ||
32 | */ | ||
33 | 35 | ||
34 | #define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000 | 36 | #define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000 |
35 | #define KIRKWOOD_PCIE_IO_VIRT_BASE 0xfef00000 | 37 | #define KIRKWOOD_PCIE_IO_VIRT_BASE 0xfef00000 |
@@ -48,6 +50,7 @@ | |||
48 | */ | 50 | */ |
49 | #define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x00000) | 51 | #define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x00000) |
50 | #define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE | 0x1500) | 52 | #define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE | 0x1500) |
53 | #define DDR_OPERATION_BASE (DDR_VIRT_BASE | 0x1418) | ||
51 | 54 | ||
52 | #define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x10000) | 55 | #define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x10000) |
53 | #define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000) | 56 | #define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000) |
@@ -63,7 +66,11 @@ | |||
63 | 66 | ||
64 | #define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x20000) | 67 | #define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x20000) |
65 | 68 | ||
69 | #define CRYPTO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x30000) | ||
70 | |||
66 | #define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x40000) | 71 | #define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x40000) |
72 | #define PCIE_LINK_CTRL (PCIE_VIRT_BASE | 0x70) | ||
73 | #define PCIE_STATUS (PCIE_VIRT_BASE | 0x1a04) | ||
67 | 74 | ||
68 | #define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x50000) | 75 | #define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x50000) |
69 | 76 | ||
@@ -80,6 +87,11 @@ | |||
80 | #define GE01_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x74000) | 87 | #define GE01_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x74000) |
81 | 88 | ||
82 | #define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000) | 89 | #define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000) |
90 | #define SATA_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x80000) | ||
91 | #define SATA0_IF_CTRL (SATA_VIRT_BASE | 0x2050) | ||
92 | #define SATA0_PHY_MODE_2 (SATA_VIRT_BASE | 0x2330) | ||
93 | #define SATA1_IF_CTRL (SATA_VIRT_BASE | 0x4050) | ||
94 | #define SATA1_PHY_MODE_2 (SATA_VIRT_BASE | 0x4330) | ||
83 | 95 | ||
84 | #define SDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x90000) | 96 | #define SDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x90000) |
85 | 97 | ||
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c index 63c44934391a..a5900f64e38c 100644 --- a/arch/arm/mach-kirkwood/mpp.c +++ b/arch/arm/mach-kirkwood/mpp.c | |||
@@ -48,6 +48,9 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list) | |||
48 | if (!variant_mask) | 48 | if (!variant_mask) |
49 | return; | 49 | return; |
50 | 50 | ||
51 | /* Initialize gpiolib. */ | ||
52 | orion_gpio_init(); | ||
53 | |||
51 | printk(KERN_DEBUG "initial MPP regs:"); | 54 | printk(KERN_DEBUG "initial MPP regs:"); |
52 | for (i = 0; i < MPP_NR_REGS; i++) { | 55 | for (i = 0; i < MPP_NR_REGS; i++) { |
53 | mpp_ctrl[i] = readl(MPP_CTRL(i)); | 56 | mpp_ctrl[i] = readl(MPP_CTRL(i)); |
diff --git a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c new file mode 100644 index 000000000000..0358f45766cb --- /dev/null +++ b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c | |||
@@ -0,0 +1,173 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c | ||
3 | * | ||
4 | * Marvell 88F6281 GTW GE 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/pci.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <linux/mtd/physmap.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/mv643xx_eth.h> | ||
19 | #include <linux/ethtool.h> | ||
20 | #include <linux/gpio.h> | ||
21 | #include <linux/leds.h> | ||
22 | #include <linux/input.h> | ||
23 | #include <linux/gpio_keys.h> | ||
24 | #include <linux/spi/flash.h> | ||
25 | #include <linux/spi/spi.h> | ||
26 | #include <linux/spi/orion_spi.h> | ||
27 | #include <net/dsa.h> | ||
28 | #include <asm/mach-types.h> | ||
29 | #include <asm/mach/arch.h> | ||
30 | #include <asm/mach/pci.h> | ||
31 | #include <mach/kirkwood.h> | ||
32 | #include "common.h" | ||
33 | #include "mpp.h" | ||
34 | |||
35 | static struct mv643xx_eth_platform_data mv88f6281gtw_ge_ge00_data = { | ||
36 | .phy_addr = MV643XX_ETH_PHY_NONE, | ||
37 | .speed = SPEED_1000, | ||
38 | .duplex = DUPLEX_FULL, | ||
39 | }; | ||
40 | |||
41 | static struct dsa_chip_data mv88f6281gtw_ge_switch_chip_data = { | ||
42 | .port_names[0] = "lan1", | ||
43 | .port_names[1] = "lan2", | ||
44 | .port_names[2] = "lan3", | ||
45 | .port_names[3] = "lan4", | ||
46 | .port_names[4] = "wan", | ||
47 | .port_names[5] = "cpu", | ||
48 | }; | ||
49 | |||
50 | static struct dsa_platform_data mv88f6281gtw_ge_switch_plat_data = { | ||
51 | .nr_chips = 1, | ||
52 | .chip = &mv88f6281gtw_ge_switch_chip_data, | ||
53 | }; | ||
54 | |||
55 | static const struct flash_platform_data mv88f6281gtw_ge_spi_slave_data = { | ||
56 | .type = "mx25l12805d", | ||
57 | }; | ||
58 | |||
59 | static struct spi_board_info __initdata mv88f6281gtw_ge_spi_slave_info[] = { | ||
60 | { | ||
61 | .modalias = "m25p80", | ||
62 | .platform_data = &mv88f6281gtw_ge_spi_slave_data, | ||
63 | .irq = -1, | ||
64 | .max_speed_hz = 50000000, | ||
65 | .bus_num = 0, | ||
66 | .chip_select = 0, | ||
67 | }, | ||
68 | }; | ||
69 | |||
70 | static struct gpio_keys_button mv88f6281gtw_ge_button_pins[] = { | ||
71 | { | ||
72 | .code = KEY_RESTART, | ||
73 | .gpio = 47, | ||
74 | .desc = "SWR Button", | ||
75 | .active_low = 1, | ||
76 | }, { | ||
77 | .code = KEY_F1, | ||
78 | .gpio = 46, | ||
79 | .desc = "WPS Button(F1)", | ||
80 | .active_low = 1, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct gpio_keys_platform_data mv88f6281gtw_ge_button_data = { | ||
85 | .buttons = mv88f6281gtw_ge_button_pins, | ||
86 | .nbuttons = ARRAY_SIZE(mv88f6281gtw_ge_button_pins), | ||
87 | }; | ||
88 | |||
89 | static struct platform_device mv88f6281gtw_ge_buttons = { | ||
90 | .name = "gpio-keys", | ||
91 | .id = -1, | ||
92 | .num_resources = 0, | ||
93 | .dev = { | ||
94 | .platform_data = &mv88f6281gtw_ge_button_data, | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | static struct gpio_led mv88f6281gtw_ge_led_pins[] = { | ||
99 | { | ||
100 | .name = "gtw:green:Status", | ||
101 | .gpio = 20, | ||
102 | .active_low = 0, | ||
103 | }, { | ||
104 | .name = "gtw:red:Status", | ||
105 | .gpio = 21, | ||
106 | .active_low = 0, | ||
107 | }, { | ||
108 | .name = "gtw:green:USB", | ||
109 | .gpio = 12, | ||
110 | .active_low = 0, | ||
111 | }, | ||
112 | }; | ||
113 | |||
114 | static struct gpio_led_platform_data mv88f6281gtw_ge_led_data = { | ||
115 | .leds = mv88f6281gtw_ge_led_pins, | ||
116 | .num_leds = ARRAY_SIZE(mv88f6281gtw_ge_led_pins), | ||
117 | }; | ||
118 | |||
119 | static struct platform_device mv88f6281gtw_ge_leds = { | ||
120 | .name = "leds-gpio", | ||
121 | .id = -1, | ||
122 | .dev = { | ||
123 | .platform_data = &mv88f6281gtw_ge_led_data, | ||
124 | }, | ||
125 | }; | ||
126 | |||
127 | static unsigned int mv88f6281gtw_ge_mpp_config[] __initdata = { | ||
128 | MPP12_GPO, /* Status#_USB pin */ | ||
129 | MPP20_GPIO, /* Status#_GLED pin */ | ||
130 | MPP21_GPIO, /* Status#_RLED pin */ | ||
131 | MPP46_GPIO, /* WPS_Switch pin */ | ||
132 | MPP47_GPIO, /* SW_Init pin */ | ||
133 | 0 | ||
134 | }; | ||
135 | |||
136 | static void __init mv88f6281gtw_ge_init(void) | ||
137 | { | ||
138 | /* | ||
139 | * Basic setup. Needs to be called early. | ||
140 | */ | ||
141 | kirkwood_init(); | ||
142 | kirkwood_mpp_conf(mv88f6281gtw_ge_mpp_config); | ||
143 | |||
144 | kirkwood_ehci_init(); | ||
145 | kirkwood_ge00_init(&mv88f6281gtw_ge_ge00_data); | ||
146 | kirkwood_ge00_switch_init(&mv88f6281gtw_ge_switch_plat_data, NO_IRQ); | ||
147 | spi_register_board_info(mv88f6281gtw_ge_spi_slave_info, | ||
148 | ARRAY_SIZE(mv88f6281gtw_ge_spi_slave_info)); | ||
149 | kirkwood_spi_init(); | ||
150 | kirkwood_uart0_init(); | ||
151 | platform_device_register(&mv88f6281gtw_ge_leds); | ||
152 | platform_device_register(&mv88f6281gtw_ge_buttons); | ||
153 | } | ||
154 | |||
155 | static int __init mv88f6281gtw_ge_pci_init(void) | ||
156 | { | ||
157 | if (machine_is_mv88f6281gtw_ge()) | ||
158 | kirkwood_pcie_init(); | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | subsys_initcall(mv88f6281gtw_ge_pci_init); | ||
163 | |||
164 | MACHINE_START(MV88F6281GTW_GE, "Marvell 88F6281 GTW GE Board") | ||
165 | /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */ | ||
166 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, | ||
167 | .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc, | ||
168 | .boot_params = 0x00000100, | ||
169 | .init_machine = mv88f6281gtw_ge_init, | ||
170 | .map_io = kirkwood_map_io, | ||
171 | .init_irq = kirkwood_init_irq, | ||
172 | .timer = &kirkwood_timer, | ||
173 | MACHINE_END | ||
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c index 73fccacd1a73..d90b9aae308d 100644 --- a/arch/arm/mach-kirkwood/pcie.c +++ b/arch/arm/mach-kirkwood/pcie.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
15 | #include <asm/mach/pci.h> | 15 | #include <asm/mach/pci.h> |
16 | #include <plat/pcie.h> | 16 | #include <plat/pcie.h> |
17 | #include <mach/bridge-regs.h> | ||
17 | #include "common.h" | 18 | #include "common.h" |
18 | 19 | ||
19 | 20 | ||
@@ -95,6 +96,7 @@ static struct pci_ops pcie_ops = { | |||
95 | static int kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) | 96 | static int kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) |
96 | { | 97 | { |
97 | struct resource *res; | 98 | struct resource *res; |
99 | extern unsigned int kirkwood_clk_ctrl; | ||
98 | 100 | ||
99 | /* | 101 | /* |
100 | * Generic PCIe unit setup. | 102 | * Generic PCIe unit setup. |
@@ -133,6 +135,8 @@ static int kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) | |||
133 | sys->resource[2] = NULL; | 135 | sys->resource[2] = NULL; |
134 | sys->io_offset = 0; | 136 | sys->io_offset = 0; |
135 | 137 | ||
138 | kirkwood_clk_ctrl |= CGC_PEX0; | ||
139 | |||
136 | return 1; | 140 | return 1; |
137 | } | 141 | } |
138 | 142 | ||
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c index 2f0e4ef3db0f..8bf4153d0840 100644 --- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | |||
@@ -11,8 +11,6 @@ | |||
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/mtd/nand.h> | ||
15 | #include <linux/mtd/partitions.h> | ||
16 | #include <linux/ata_platform.h> | 14 | #include <linux/ata_platform.h> |
17 | #include <linux/mv643xx_eth.h> | 15 | #include <linux/mv643xx_eth.h> |
18 | #include <linux/spi/flash.h> | 16 | #include <linux/spi/flash.h> |
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c index 31e996d65fc4..31708ddbc83e 100644 --- a/arch/arm/mach-kirkwood/rd88f6281-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c | |||
@@ -12,7 +12,6 @@ | |||
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/irq.h> | 14 | #include <linux/irq.h> |
15 | #include <linux/mtd/nand.h> | ||
16 | #include <linux/mtd/partitions.h> | 15 | #include <linux/mtd/partitions.h> |
17 | #include <linux/ata_platform.h> | 16 | #include <linux/ata_platform.h> |
18 | #include <linux/mv643xx_eth.h> | 17 | #include <linux/mv643xx_eth.h> |
@@ -22,7 +21,6 @@ | |||
22 | #include <asm/mach/arch.h> | 21 | #include <asm/mach/arch.h> |
23 | #include <mach/kirkwood.h> | 22 | #include <mach/kirkwood.h> |
24 | #include <plat/mvsdio.h> | 23 | #include <plat/mvsdio.h> |
25 | #include <plat/orion_nand.h> | ||
26 | #include "common.h" | 24 | #include "common.h" |
27 | #include "mpp.h" | 25 | #include "mpp.h" |
28 | 26 | ||
@@ -42,32 +40,6 @@ static struct mtd_partition rd88f6281_nand_parts[] = { | |||
42 | }, | 40 | }, |
43 | }; | 41 | }; |
44 | 42 | ||
45 | static struct resource rd88f6281_nand_resource = { | ||
46 | .flags = IORESOURCE_MEM, | ||
47 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
48 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + | ||
49 | KIRKWOOD_NAND_MEM_SIZE - 1, | ||
50 | }; | ||
51 | |||
52 | static struct orion_nand_data rd88f6281_nand_data = { | ||
53 | .parts = rd88f6281_nand_parts, | ||
54 | .nr_parts = ARRAY_SIZE(rd88f6281_nand_parts), | ||
55 | .cle = 0, | ||
56 | .ale = 1, | ||
57 | .width = 8, | ||
58 | .chip_delay = 25, | ||
59 | }; | ||
60 | |||
61 | static struct platform_device rd88f6281_nand_flash = { | ||
62 | .name = "orion_nand", | ||
63 | .id = -1, | ||
64 | .dev = { | ||
65 | .platform_data = &rd88f6281_nand_data, | ||
66 | }, | ||
67 | .resource = &rd88f6281_nand_resource, | ||
68 | .num_resources = 1, | ||
69 | }; | ||
70 | |||
71 | static struct mv643xx_eth_platform_data rd88f6281_ge00_data = { | 43 | static struct mv643xx_eth_platform_data rd88f6281_ge00_data = { |
72 | .phy_addr = MV643XX_ETH_PHY_NONE, | 44 | .phy_addr = MV643XX_ETH_PHY_NONE, |
73 | .speed = SPEED_1000, | 45 | .speed = SPEED_1000, |
@@ -114,6 +86,7 @@ static void __init rd88f6281_init(void) | |||
114 | kirkwood_init(); | 86 | kirkwood_init(); |
115 | kirkwood_mpp_conf(rd88f6281_mpp_config); | 87 | kirkwood_mpp_conf(rd88f6281_mpp_config); |
116 | 88 | ||
89 | kirkwood_nand_init(ARRAY_AND_SIZE(rd88f6281_nand_parts), 25); | ||
117 | kirkwood_ehci_init(); | 90 | kirkwood_ehci_init(); |
118 | 91 | ||
119 | kirkwood_ge00_init(&rd88f6281_ge00_data); | 92 | kirkwood_ge00_init(&rd88f6281_ge00_data); |
@@ -129,8 +102,6 @@ static void __init rd88f6281_init(void) | |||
129 | kirkwood_sata_init(&rd88f6281_sata_data); | 102 | kirkwood_sata_init(&rd88f6281_sata_data); |
130 | kirkwood_sdio_init(&rd88f6281_mvsdio_data); | 103 | kirkwood_sdio_init(&rd88f6281_mvsdio_data); |
131 | kirkwood_uart0_init(); | 104 | kirkwood_uart0_init(); |
132 | |||
133 | platform_device_register(&rd88f6281_nand_flash); | ||
134 | } | 105 | } |
135 | 106 | ||
136 | static int __init rd88f6281_pci_init(void) | 107 | static int __init rd88f6281_pci_init(void) |
diff --git a/arch/arm/mach-kirkwood/sheevaplug-setup.c b/arch/arm/mach-kirkwood/sheevaplug-setup.c index 831e4a56cae1..c7319eeac8bb 100644 --- a/arch/arm/mach-kirkwood/sheevaplug-setup.c +++ b/arch/arm/mach-kirkwood/sheevaplug-setup.c | |||
@@ -11,7 +11,6 @@ | |||
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/mtd/nand.h> | ||
15 | #include <linux/mtd/partitions.h> | 14 | #include <linux/mtd/partitions.h> |
16 | #include <linux/mv643xx_eth.h> | 15 | #include <linux/mv643xx_eth.h> |
17 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
@@ -20,7 +19,6 @@ | |||
20 | #include <asm/mach/arch.h> | 19 | #include <asm/mach/arch.h> |
21 | #include <mach/kirkwood.h> | 20 | #include <mach/kirkwood.h> |
22 | #include <plat/mvsdio.h> | 21 | #include <plat/mvsdio.h> |
23 | #include <plat/orion_nand.h> | ||
24 | #include "common.h" | 22 | #include "common.h" |
25 | #include "mpp.h" | 23 | #include "mpp.h" |
26 | 24 | ||
@@ -40,38 +38,12 @@ static struct mtd_partition sheevaplug_nand_parts[] = { | |||
40 | }, | 38 | }, |
41 | }; | 39 | }; |
42 | 40 | ||
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 = { | 41 | static struct mv643xx_eth_platform_data sheevaplug_ge00_data = { |
70 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), | 42 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), |
71 | }; | 43 | }; |
72 | 44 | ||
73 | static struct mvsdio_platform_data sheevaplug_mvsdio_data = { | 45 | static struct mvsdio_platform_data sheevaplug_mvsdio_data = { |
74 | // unfortunately the CD signal has not been connected */ | 46 | /* unfortunately the CD signal has not been connected */ |
75 | }; | 47 | }; |
76 | 48 | ||
77 | static struct gpio_led sheevaplug_led_pins[] = { | 49 | static struct gpio_led sheevaplug_led_pins[] = { |
@@ -111,6 +83,7 @@ static void __init sheevaplug_init(void) | |||
111 | kirkwood_mpp_conf(sheevaplug_mpp_config); | 83 | kirkwood_mpp_conf(sheevaplug_mpp_config); |
112 | 84 | ||
113 | kirkwood_uart0_init(); | 85 | kirkwood_uart0_init(); |
86 | kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25); | ||
114 | 87 | ||
115 | if (gpio_request(29, "USB Power Enable") != 0 || | 88 | if (gpio_request(29, "USB Power Enable") != 0 || |
116 | gpio_direction_output(29, 1) != 0) | 89 | gpio_direction_output(29, 1) != 0) |
@@ -120,7 +93,6 @@ static void __init sheevaplug_init(void) | |||
120 | kirkwood_ge00_init(&sheevaplug_ge00_data); | 93 | kirkwood_ge00_init(&sheevaplug_ge00_data); |
121 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); | 94 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); |
122 | 95 | ||
123 | platform_device_register(&sheevaplug_nand_flash); | ||
124 | platform_device_register(&sheevaplug_leds); | 96 | platform_device_register(&sheevaplug_leds); |
125 | } | 97 | } |
126 | 98 | ||