2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
4 * arch/arm/mach-kirkwood/board-dt.c
6 * Flattened Device Tree board initialization
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.
13 #include <linux/kernel.h>
14 #include <linux/init.h>
16 #include <linux/of_platform.h>
17 #include <linux/clk-provider.h>
18 #include <linux/kexec.h>
19 #include <asm/mach/arch.h>
20 #include <asm/mach/map.h>
21 #include <mach/bridge-regs.h>
22 #include <linux/platform_data/usb-ehci-orion.h>
24 #include <plat/common.h>
28 * There are still devices that doesn't know about DT yet. Get clock
29 * gates here and add a clock lookup alias, so that old platform
33 static void __init
kirkwood_legacy_clk_init(void)
36 struct device_node
*np
= of_find_compatible_node(
37 NULL
, NULL
, "marvell,kirkwood-gating-clock");
38 struct of_phandle_args clkspec
;
42 clkspec
.args_count
= 1;
44 clkspec
.args
[0] = CGC_BIT_PEX0
;
45 orion_clkdev_add("0", "pcie",
46 of_clk_get_from_provider(&clkspec
));
48 clkspec
.args
[0] = CGC_BIT_PEX1
;
49 orion_clkdev_add("1", "pcie",
50 of_clk_get_from_provider(&clkspec
));
52 clkspec
.args
[0] = CGC_BIT_SDIO
;
53 orion_clkdev_add(NULL
, "mvsdio",
54 of_clk_get_from_provider(&clkspec
));
57 * The ethernet interfaces forget the MAC address assigned by
58 * u-boot if the clocks are turned off. Until proper DT support
59 * is available we always enable them for now.
61 clkspec
.args
[0] = CGC_BIT_GE0
;
62 clk
= of_clk_get_from_provider(&clkspec
);
63 orion_clkdev_add(NULL
, "mv643xx_eth_port.0", clk
);
64 clk_prepare_enable(clk
);
66 clkspec
.args
[0] = CGC_BIT_GE1
;
67 clk
= of_clk_get_from_provider(&clkspec
);
68 orion_clkdev_add(NULL
, "mv643xx_eth_port.1", clk
);
69 clk_prepare_enable(clk
);
72 static void __init
kirkwood_of_clk_init(void)
75 kirkwood_legacy_clk_init();
78 static void __init
kirkwood_dt_init(void)
80 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk
);
83 * Disable propagation of mbus errors to the CPU local bus,
84 * as this causes mbus errors (which can occur for example
85 * for PCI aborts) to throw CPU aborts, which we're not set
88 writel(readl(CPU_CONFIG
) & ~CPU_CONFIG_ERROR_PROP
, CPU_CONFIG
);
90 kirkwood_setup_wins();
94 kirkwood_cpufreq_init();
96 /* Setup root of clk tree */
97 kirkwood_of_clk_init();
99 kirkwood_cpuidle_init();
102 kexec_reinit
= kirkwood_enable_pcie
;
105 if (of_machine_is_compatible("globalscale,dreamplug"))
108 if (of_machine_is_compatible("globalscale,guruplug"))
111 if (of_machine_is_compatible("globalscale,sheevaplug"))
112 sheevaplug_dt_init();
114 if (of_machine_is_compatible("dlink,dns-kirkwood"))
117 if (of_machine_is_compatible("iom,iconnect"))
120 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
123 if (of_machine_is_compatible("qnap,ts219"))
124 qnap_dt_ts219_init();
126 if (of_machine_is_compatible("seagate,dockstar"))
129 if (of_machine_is_compatible("seagate,goflexnet"))
132 if (of_machine_is_compatible("buffalo,lsxl"))
135 if (of_machine_is_compatible("iom,ix2-200"))
136 iomega_ix2_200_init();
138 if (of_machine_is_compatible("keymile,km_kirkwood"))
141 if (of_machine_is_compatible("lacie,cloudbox") ||
142 of_machine_is_compatible("lacie,inetspace_v2") ||
143 of_machine_is_compatible("lacie,netspace_lite_v2") ||
144 of_machine_is_compatible("lacie,netspace_max_v2") ||
145 of_machine_is_compatible("lacie,netspace_mini_v2") ||
146 of_machine_is_compatible("lacie,netspace_v2"))
149 if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
150 of_machine_is_compatible("marvell,db-88f6282-bp"))
153 if (of_machine_is_compatible("mpl,cec4"))
156 if (of_machine_is_compatible("netgear,readynas-duo-v2"))
157 netgear_readynas_init();
159 if (of_machine_is_compatible("plathome,openblocks-a6"))
160 openblocks_a6_init();
162 if (of_machine_is_compatible("usi,topkick"))
165 of_platform_populate(NULL
, of_default_bus_match_table
, NULL
, NULL
);
168 static const char * const kirkwood_dt_board_compat
[] = {
169 "globalscale,dreamplug",
170 "globalscale,guruplug",
171 "globalscale,sheevaplug",
175 "raidsonic,ib-nas62x0",
181 "keymile,km_kirkwood",
183 "lacie,inetspace_v2",
184 "lacie,netspace_lite_v2",
185 "lacie,netspace_max_v2",
186 "lacie,netspace_mini_v2",
188 "marvell,db-88f6281-bp",
189 "marvell,db-88f6282-bp",
191 "netgear,readynas-duo-v2",
192 "plathome,openblocks-a6",
198 DT_MACHINE_START(KIRKWOOD_DT
, "Marvell Kirkwood (Flattened Device Tree)")
199 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
200 .map_io
= kirkwood_map_io
,
201 .init_early
= kirkwood_init_early
,
202 .init_irq
= orion_dt_init_irq
,
203 .init_time
= kirkwood_timer_init
,
204 .init_machine
= kirkwood_dt_init
,
205 .restart
= kirkwood_restart
,
206 .dt_compat
= kirkwood_dt_board_compat
,