ARM: kirkwood: Add support for NETGEAR ReadyNAS Duo v2 using DT
[deliverable/linux.git] / arch / arm / mach-kirkwood / board-dt.c
CommitLineData
3d468b6d
JC
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-dt.c
5 *
6fa6b878 6 * Flattened Device Tree board initialization
3d468b6d
JC
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
3d468b6d 15#include <linux/of.h>
3d468b6d 16#include <linux/of_platform.h>
1611f872
AL
17#include <linux/clk-provider.h>
18#include <linux/clk/mvebu.h>
a7ac56de 19#include <linux/kexec.h>
3d468b6d 20#include <asm/mach/arch.h>
2b45e05f 21#include <asm/mach/map.h>
2b45e05f 22#include <mach/bridge-regs.h>
1611f872 23#include <linux/platform_data/usb-ehci-orion.h>
278b45b0 24#include <plat/irq.h>
1611f872 25#include <plat/common.h>
3d468b6d 26#include "common.h"
3d468b6d
JC
27
28static struct of_device_id kirkwood_dt_match_table[] __initdata = {
29 { .compatible = "simple-bus", },
30 { }
31};
32
1611f872
AL
33/*
34 * There are still devices that doesn't know about DT yet. Get clock
35 * gates here and add a clock lookup alias, so that old platform
36 * devices still work.
37*/
38
39static void __init kirkwood_legacy_clk_init(void)
40{
41
42 struct device_node *np = of_find_compatible_node(
43 NULL, NULL, "marvell,kirkwood-gating-clock");
1611f872 44 struct of_phandle_args clkspec;
7bf5b408 45 struct clk *clk;
1611f872
AL
46
47 clkspec.np = np;
48 clkspec.args_count = 1;
49
1611f872
AL
50 clkspec.args[0] = CGC_BIT_PEX0;
51 orion_clkdev_add("0", "pcie",
52 of_clk_get_from_provider(&clkspec));
53
1611f872
AL
54 clkspec.args[0] = CGC_BIT_PEX1;
55 orion_clkdev_add("1", "pcie",
56 of_clk_get_from_provider(&clkspec));
57
7bf5b408
SH
58 clkspec.args[0] = CGC_BIT_SDIO;
59 orion_clkdev_add(NULL, "mvsdio",
1611f872 60 of_clk_get_from_provider(&clkspec));
7bf5b408
SH
61
62 /*
63 * The ethernet interfaces forget the MAC address assigned by
64 * u-boot if the clocks are turned off. Until proper DT support
65 * is available we always enable them for now.
66 */
67 clkspec.args[0] = CGC_BIT_GE0;
68 clk = of_clk_get_from_provider(&clkspec);
69 orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
70 clk_prepare_enable(clk);
71
72 clkspec.args[0] = CGC_BIT_GE1;
73 clk = of_clk_get_from_provider(&clkspec);
74 orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
75 clk_prepare_enable(clk);
1611f872
AL
76}
77
78static void __init kirkwood_of_clk_init(void)
79{
80 mvebu_clocks_init();
81 kirkwood_legacy_clk_init();
82}
76372120 83
3d468b6d
JC
84static void __init kirkwood_dt_init(void)
85{
2b45e05f
JC
86 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
87
88 /*
89 * Disable propagation of mbus errors to the CPU local bus,
90 * as this causes mbus errors (which can occur for example
91 * for PCI aborts) to throw CPU aborts, which we're not set
92 * up to deal with.
93 */
94 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
95
96 kirkwood_setup_cpu_mbus();
97
2b45e05f 98 kirkwood_l2_init();
2b45e05f 99
2f129bf4 100 /* Setup root of clk tree */
1611f872 101 kirkwood_of_clk_init();
2b45e05f 102
9cfc94eb
AL
103 kirkwood_cpuidle_init();
104
2b45e05f
JC
105#ifdef CONFIG_KEXEC
106 kexec_reinit = kirkwood_enable_pcie;
107#endif
3d468b6d
JC
108
109 if (of_machine_is_compatible("globalscale,dreamplug"))
110 dreamplug_init();
111
9b47a4fb
WT
112 if (of_machine_is_compatible("globalscale,guruplug"))
113 guruplug_dt_init();
114
9007d100
JL
115 if (of_machine_is_compatible("dlink,dns-kirkwood"))
116 dnskw_init();
117
c06cd9bf
APR
118 if (of_machine_is_compatible("iom,iconnect"))
119 iconnect_init();
120
f5520363
SB
121 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
122 ib62x0_init();
123
9eb61f47
AL
124 if (of_machine_is_compatible("qnap,ts219"))
125 qnap_dt_ts219_init();
126
dd88db78
SH
127 if (of_machine_is_compatible("seagate,dockstar"))
128 dockstar_dt_init();
129
5136b2aa
JC
130 if (of_machine_is_compatible("seagate,goflexnet"))
131 goflexnet_init();
132
4aff38a3
MW
133 if (of_machine_is_compatible("buffalo,lsxl"))
134 lsxl_init();
135
4f48b7fc
AB
136 if (of_machine_is_compatible("iom,ix2-200"))
137 iomega_ix2_200_init();
138
0510c8a0
VL
139 if (of_machine_is_compatible("keymile,km_kirkwood"))
140 km_kirkwood_init();
141
ecee1e47
SG
142 if (of_machine_is_compatible("lacie,inetspace_v2") ||
143 of_machine_is_compatible("lacie,netspace_v2") ||
ca7d9452 144 of_machine_is_compatible("lacie,netspace_max_v2") ||
7f9871d9
SG
145 of_machine_is_compatible("lacie,netspace_lite_v2") ||
146 of_machine_is_compatible("lacie,netspace_mini_v2"))
ecee1e47
SG
147 ns2_init();
148
5492a110
SP
149 if (of_machine_is_compatible("mpl,cec4"))
150 mplcec4_init();
151
f236f5aa
AE
152 if (of_machine_is_compatible("netgear,readynas-duo-v2"))
153 netgear_readynas_init();
154
f17073a3
NI
155 if (of_machine_is_compatible("plathome,openblocks-a6"))
156 openblocks_a6_init();
157
767fc1ea
JC
158 if (of_machine_is_compatible("usi,topkick"))
159 usi_topkick_init();
160
1611f872 161 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
3d468b6d
JC
162}
163
98adf932 164static const char * const kirkwood_dt_board_compat[] = {
3d468b6d 165 "globalscale,dreamplug",
9b47a4fb 166 "globalscale,guruplug",
9007d100
JL
167 "dlink,dns-320",
168 "dlink,dns-325",
c06cd9bf 169 "iom,iconnect",
f5520363 170 "raidsonic,ib-nas62x0",
9eb61f47 171 "qnap,ts219",
dd88db78 172 "seagate,dockstar",
5136b2aa 173 "seagate,goflexnet",
4aff38a3 174 "buffalo,lsxl",
4f48b7fc 175 "iom,ix2-200",
0510c8a0 176 "keymile,km_kirkwood",
ecee1e47
SG
177 "lacie,inetspace_v2",
178 "lacie,netspace_max_v2",
179 "lacie,netspace_v2",
ca7d9452 180 "lacie,netspace_lite_v2",
7f9871d9 181 "lacie,netspace_mini_v2",
5492a110 182 "mpl,cec4",
f236f5aa 183 "netgear,readynas-duo-v2",
f17073a3 184 "plathome,openblocks-a6",
767fc1ea 185 "usi,topkick",
afcad884 186 "zyxel,nsa310",
3d468b6d
JC
187 NULL
188};
189
190DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
191 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
192 .map_io = kirkwood_map_io,
193 .init_early = kirkwood_init_early,
278b45b0 194 .init_irq = orion_dt_init_irq,
6bb27d73 195 .init_time = kirkwood_timer_init,
3d468b6d
JC
196 .init_machine = kirkwood_dt_init,
197 .restart = kirkwood_restart,
198 .dt_compat = kirkwood_dt_board_compat,
199MACHINE_END
This page took 0.078812 seconds and 5 git commands to generate.