blob: edc3f8a9d45e8eb85b9884b4e52f5e117568a366 [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>
Jason Cooper3d468b62012-02-27 16:07:13 +000021#include "common.h"
Jason Cooper3d468b62012-02-27 16:07:13 +000022
23static struct of_device_id kirkwood_dt_match_table[] __initdata = {
24 { .compatible = "simple-bus", },
25 { }
26};
27
Jason Cooper3d468b62012-02-27 16:07:13 +000028static void __init kirkwood_dt_init(void)
29{
Jason Cooper2b45e052012-02-29 17:39:08 +000030 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
31
32 /*
33 * Disable propagation of mbus errors to the CPU local bus,
34 * as this causes mbus errors (which can occur for example
35 * for PCI aborts) to throw CPU aborts, which we're not set
36 * up to deal with.
37 */
38 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
39
40 kirkwood_setup_cpu_mbus();
41
42#ifdef CONFIG_CACHE_FEROCEON_L2
43 kirkwood_l2_init();
44#endif
45
Andrew Lunn2f129bf2011-12-15 08:15:07 +010046 /* Setup root of clk tree */
47 kirkwood_clk_init();
48
Jason Cooper2b45e052012-02-29 17:39:08 +000049 /* internal devices that every board has */
Jason Cooper2b45e052012-02-29 17:39:08 +000050 kirkwood_wdt_init();
51 kirkwood_xor0_init();
52 kirkwood_xor1_init();
53 kirkwood_crypto_init();
54
55#ifdef CONFIG_KEXEC
56 kexec_reinit = kirkwood_enable_pcie;
57#endif
Jason Cooper3d468b62012-02-27 16:07:13 +000058
59 if (of_machine_is_compatible("globalscale,dreamplug"))
60 dreamplug_init();
61
Jamie Lentin9007d102012-04-18 11:06:40 +010062 if (of_machine_is_compatible("dlink,dns-kirkwood"))
63 dnskw_init();
64
Arnaud Patard (Rtp)c06cd9b2012-04-18 23:16:41 +020065 if (of_machine_is_compatible("iom,iconnect"))
66 iconnect_init();
67
Simon Baatzf5520362012-04-30 23:55:17 +020068 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
69 ib62x0_init();
70
Jason Cooper3d468b62012-02-27 16:07:13 +000071 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
72}
73
74static const char *kirkwood_dt_board_compat[] = {
75 "globalscale,dreamplug",
Jamie Lentin9007d102012-04-18 11:06:40 +010076 "dlink,dns-320",
77 "dlink,dns-325",
Arnaud Patard (Rtp)c06cd9b2012-04-18 23:16:41 +020078 "iom,iconnect",
Simon Baatzf5520362012-04-30 23:55:17 +020079 "raidsonic,ib-nas62x0",
Jason Cooper3d468b62012-02-27 16:07:13 +000080 NULL
81};
82
83DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
84 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
85 .map_io = kirkwood_map_io,
86 .init_early = kirkwood_init_early,
87 .init_irq = kirkwood_init_irq,
88 .timer = &kirkwood_timer,
89 .init_machine = kirkwood_dt_init,
90 .restart = kirkwood_restart,
91 .dt_compat = kirkwood_dt_board_compat,
92MACHINE_END