aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2014-02-22 14:14:47 -0500
committerJason Cooper <jason@lakedaemon.net>2014-02-22 15:40:42 -0500
commitdab7dfb6c0e23d5fab56824e40795872c13afc1c (patch)
treeed9475f7252742436383b4cc3e00d8ba8fcc1e57
parent15a705ec849829be7866a989a52dbd56e498e760 (diff)
ARM: kirkwood: Separate board-dt from common and pcie code.
In order to be able to move DT support into mach-mvebu, the DT code needs to be cleanly separated from common and pcie code. Import the needed bits of these files into board-dt.c. The "common" code then becomes purely legacy, supporting non-DT boards, so reflect this in the Makefile targets. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r--arch/arm/mach-kirkwood/Makefile3
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c88
2 files changed, 88 insertions, 3 deletions
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index dc22bf5b21ed..3a72c5c6e747 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -1,5 +1,4 @@
1obj-y += common.o pcie.o 1obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o common.o pcie.o
2obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o
3obj-$(CONFIG_PM) += pm.o 2obj-$(CONFIG_PM) += pm.o
4 3
5obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o 4obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index a0c0ff39788e..64151a4a378f 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -21,11 +21,97 @@
21#include <linux/irqchip.h> 21#include <linux/irqchip.h>
22#include <linux/kexec.h> 22#include <linux/kexec.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
24#include <mach/bridge-regs.h> 25#include <mach/bridge-regs.h>
25#include <plat/common.h> 26#include <plat/common.h>
26#include "common.h" 27#include <plat/cache-feroceon-l2.h>
28#include <plat/pcie.h>
27#include "pm.h" 29#include "pm.h"
28 30
31static struct map_desc kirkwood_io_desc[] __initdata = {
32 {
33 .virtual = (unsigned long) KIRKWOOD_REGS_VIRT_BASE,
34 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
35 .length = KIRKWOOD_REGS_SIZE,
36 .type = MT_DEVICE,
37 },
38};
39
40static void __init kirkwood_map_io(void)
41{
42 iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc));
43}
44
45static void __init kirkwood_l2_init(void)
46{
47#ifdef CONFIG_CACHE_FEROCEON_L2
48#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH
49 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG);
50 feroceon_l2_init(1);
51#else
52 writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG);
53 feroceon_l2_init(0);
54#endif
55#endif
56}
57
58static struct resource kirkwood_cpufreq_resources[] = {
59 [0] = {
60 .start = CPU_CONTROL_PHYS,
61 .end = CPU_CONTROL_PHYS + 3,
62 .flags = IORESOURCE_MEM,
63 },
64};
65
66static struct platform_device kirkwood_cpufreq_device = {
67 .name = "kirkwood-cpufreq",
68 .id = -1,
69 .num_resources = ARRAY_SIZE(kirkwood_cpufreq_resources),
70 .resource = kirkwood_cpufreq_resources,
71};
72
73static void __init kirkwood_cpufreq_init(void)
74{
75 platform_device_register(&kirkwood_cpufreq_device);
76}
77
78static struct resource kirkwood_cpuidle_resource[] = {
79 {
80 .flags = IORESOURCE_MEM,
81 .start = DDR_OPERATION_BASE,
82 .end = DDR_OPERATION_BASE + 3,
83 },
84};
85
86static struct platform_device kirkwood_cpuidle = {
87 .name = "kirkwood_cpuidle",
88 .id = -1,
89 .resource = kirkwood_cpuidle_resource,
90 .num_resources = 1,
91};
92
93static void __init kirkwood_cpuidle_init(void)
94{
95 platform_device_register(&kirkwood_cpuidle);
96}
97
98/* Temporary here since mach-mvebu has a function we can use */
99static void kirkwood_restart(enum reboot_mode mode, const char *cmd)
100{
101 /*
102 * Enable soft reset to assert RSTOUTn.
103 */
104 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
105
106 /*
107 * Assert soft reset.
108 */
109 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
110
111 while (1)
112 ;
113}
114
29#define MV643XX_ETH_MAC_ADDR_LOW 0x0414 115#define MV643XX_ETH_MAC_ADDR_LOW 0x0414
30#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418 116#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418
31 117