blob: 8c67c222a0c1da04b9c529b545e9ea09c0f8182f [file] [log] [blame]
Jason Cooper3d468b62012-02-27 16:07:13 +00001/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-dt.c
5 *
Jason Cooper6fa6b872012-03-15 00:52:31 +00006 * Flattened Device Tree board initialization
Jason Cooper3d468b62012-02-27 16:07:13 +00007 *
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>
Jason Cooper3d468b62012-02-27 16:07:13 +000015#include <linux/of.h>
Jason Cooper3d468b62012-02-27 16:07:13 +000016#include <linux/of_platform.h>
Ian Campbella7ac56d2012-04-29 14:40:42 +010017#include <linux/kexec.h>
Jason Cooper3d468b62012-02-27 16:07:13 +000018#include <asm/mach/arch.h>
Jason Cooper2b45e052012-02-29 17:39:08 +000019#include <asm/mach/map.h>
Jason Cooper2b45e052012-02-29 17:39:08 +000020#include <mach/bridge-regs.h>
Andrew Lunn278b45b2012-06-27 13:40:04 +020021#include <plat/irq.h>
Jason Cooper3d468b62012-02-27 16:07:13 +000022#include "common.h"
Jason Cooper3d468b62012-02-27 16:07:13 +000023
24static struct of_device_id kirkwood_dt_match_table[] __initdata = {
25 { .compatible = "simple-bus", },
26 { }
27};
28
Michael Walle76372122012-06-06 20:30:57 +020029struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
30 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
Andrew Lunne91cac02012-07-20 13:51:55 +020031 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
32 NULL),
Andrew Lunn1e7bad02012-06-10 15:20:06 +020033 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
Andrew Lunn97b414e2012-06-10 16:45:37 +020034 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
Michael Walle76372122012-06-06 20:30:57 +020035 {},
36};
37
Jason Cooper3d468b62012-02-27 16:07:13 +000038static void __init kirkwood_dt_init(void)
39{
Jason Cooper2b45e052012-02-29 17:39:08 +000040 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
41
42 /*
43 * Disable propagation of mbus errors to the CPU local bus,
44 * as this causes mbus errors (which can occur for example
45 * for PCI aborts) to throw CPU aborts, which we're not set
46 * up to deal with.
47 */
48 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
49
50 kirkwood_setup_cpu_mbus();
51
52#ifdef CONFIG_CACHE_FEROCEON_L2
53 kirkwood_l2_init();
54#endif
55
Andrew Lunn2f129bf2011-12-15 08:15:07 +010056 /* Setup root of clk tree */
57 kirkwood_clk_init();
58
Jason Cooper2b45e052012-02-29 17:39:08 +000059 /* internal devices that every board has */
Jason Cooper2b45e052012-02-29 17:39:08 +000060 kirkwood_xor0_init();
61 kirkwood_xor1_init();
62 kirkwood_crypto_init();
63
64#ifdef CONFIG_KEXEC
65 kexec_reinit = kirkwood_enable_pcie;
66#endif
Jason Cooper3d468b62012-02-27 16:07:13 +000067
68 if (of_machine_is_compatible("globalscale,dreamplug"))
69 dreamplug_init();
70
Jamie Lentin9007d102012-04-18 11:06:40 +010071 if (of_machine_is_compatible("dlink,dns-kirkwood"))
72 dnskw_init();
73
Arnaud Patard (Rtp)c06cd9b2012-04-18 23:16:41 +020074 if (of_machine_is_compatible("iom,iconnect"))
75 iconnect_init();
76
Simon Baatzf5520362012-04-30 23:55:17 +020077 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
78 ib62x0_init();
79
Michael Walle76372122012-06-06 20:30:57 +020080 of_platform_populate(NULL, kirkwood_dt_match_table,
81 kirkwood_auxdata_lookup, NULL);
Jason Cooper3d468b62012-02-27 16:07:13 +000082}
83
84static const char *kirkwood_dt_board_compat[] = {
85 "globalscale,dreamplug",
Jamie Lentin9007d102012-04-18 11:06:40 +010086 "dlink,dns-320",
87 "dlink,dns-325",
Arnaud Patard (Rtp)c06cd9b2012-04-18 23:16:41 +020088 "iom,iconnect",
Simon Baatzf5520362012-04-30 23:55:17 +020089 "raidsonic,ib-nas62x0",
Jason Cooper3d468b62012-02-27 16:07:13 +000090 NULL
91};
92
93DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
94 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
95 .map_io = kirkwood_map_io,
96 .init_early = kirkwood_init_early,
Andrew Lunn278b45b2012-06-27 13:40:04 +020097 .init_irq = orion_dt_init_irq,
Jason Cooper3d468b62012-02-27 16:07:13 +000098 .timer = &kirkwood_timer,
99 .init_machine = kirkwood_dt_init,
100 .restart = kirkwood_restart,
101 .dt_compat = kirkwood_dt_board_compat,
102MACHINE_END