xref: /openbmc/linux/arch/arm/mach-orion5x/board-dt.c (revision d4692f6c)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright 2012 (C), Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
4  *
5  * arch/arm/mach-orion5x/board-dt.c
6  *
7  * Flattened Device Tree board initialization
8  */
9 
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/of.h>
13 #include <linux/of_platform.h>
14 #include <linux/cpu.h>
15 #include <linux/mbus.h>
16 #include <linux/clocksource.h>
17 #include <asm/system_misc.h>
18 #include <asm/mach/arch.h>
19 #include <asm/mach/map.h>
20 #include <plat/irq.h>
21 #include <plat/time.h>
22 #include "orion5x.h"
23 #include "bridge-regs.h"
24 #include "common.h"
25 
26 static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = {
27 	OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
28 	OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
29 		       NULL),
30 	OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
31 	OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
32 	OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1090000, "mv_crypto", NULL),
33 	{},
34 };
35 
36 static void __init orion5x_dt_init(void)
37 {
38 	char *dev_name;
39 	u32 dev, rev;
40 
41 	orion5x_id(&dev, &rev, &dev_name);
42 	printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
43 
44 	BUG_ON(mvebu_mbus_dt_init(false));
45 
46 	/*
47 	 * Setup Orion address map
48 	 */
49 	orion5x_setup_wins();
50 
51 	/*
52 	 * Don't issue "Wait for Interrupt" instruction if we are
53 	 * running on D0 5281 silicon.
54 	 */
55 	if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) {
56 		printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
57 		cpu_idle_poll_ctrl(true);
58 	}
59 
60 	if (of_machine_is_compatible("maxtor,shared-storage-2"))
61 		mss2_init();
62 
63 	if (of_machine_is_compatible("lacie,d2-network"))
64 		d2net_init();
65 
66 	of_platform_default_populate(NULL, orion5x_auxdata_lookup, NULL);
67 }
68 
69 static const char *orion5x_dt_compat[] = {
70 	"marvell,orion5x",
71 	NULL,
72 };
73 
74 DT_MACHINE_START(ORION5X_DT, "Marvell Orion5x (Flattened Device Tree)")
75 	/* Maintainer: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> */
76 	.map_io		= orion5x_map_io,
77 	.init_machine	= orion5x_dt_init,
78 	.restart	= orion5x_restart,
79 	.dt_compat	= orion5x_dt_compat,
80 MACHINE_END
81