2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
4 * arch/arm/mach-kirkwood/board-dt.c
6 * Marvell DreamPlug Reference Board Setup
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>
15 #include <linux/platform_device.h>
16 #include <linux/mtd/partitions.h>
17 #include <linux/ata_platform.h>
18 #include <linux/mv643xx_eth.h>
20 #include <linux/of_address.h>
21 #include <linux/of_fdt.h>
22 #include <linux/of_irq.h>
23 #include <linux/of_platform.h>
24 #include <linux/gpio.h>
25 #include <linux/leds.h>
26 #include <linux/mtd/physmap.h>
27 #include <linux/spi/flash.h>
28 #include <linux/spi/spi.h>
29 #include <linux/spi/orion_spi.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
33 #include <mach/kirkwood.h>
34 #include <mach/bridge-regs.h>
35 #include <plat/mvsdio.h>
39 static struct of_device_id kirkwood_dt_match_table[] __initdata = {
40 { .compatible = "simple-bus", },
44 struct mtd_partition dreamplug_partitions[] = {
53 .offset = SZ_512K + SZ_512K,
58 .offset = SZ_512K + SZ_512K + SZ_512K,
62 static const struct flash_platform_data dreamplug_spi_slave_data = {
65 .parts = dreamplug_partitions,
66 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
69 static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
72 .platform_data = &dreamplug_spi_slave_data,
74 .max_speed_hz = 50000000,
80 static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
81 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
84 static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
85 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
88 static struct mv_sata_platform_data dreamplug_sata_data = {
92 static struct mvsdio_platform_data dreamplug_mvsdio_data = {
93 /* unfortunately the CD signal has not been connected */
96 static struct gpio_led dreamplug_led_pins[] = {
98 .name = "dreamplug:blue:bluetooth",
103 .name = "dreamplug:green:wifi",
108 .name = "dreamplug:green:wifi_ap",
114 static struct gpio_led_platform_data dreamplug_led_data = {
115 .leds = dreamplug_led_pins,
116 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
119 static struct platform_device dreamplug_leds = {
123 .platform_data = &dreamplug_led_data,
127 static unsigned int dreamplug_mpp_config[] __initdata = {
132 MPP47_GPIO, /* Bluetooth LED */
133 MPP48_GPIO, /* Wifi LED */
134 MPP49_GPIO, /* Wifi AP LED */
138 static void __init dreamplug_init(void)
141 * Basic setup. Needs to be called early.
143 kirkwood_mpp_conf(dreamplug_mpp_config);
145 spi_register_board_info(dreamplug_spi_slave_info,
146 ARRAY_SIZE(dreamplug_spi_slave_info));
149 kirkwood_ehci_init();
150 kirkwood_ge00_init(&dreamplug_ge00_data);
151 kirkwood_ge01_init(&dreamplug_ge01_data);
152 kirkwood_sata_init(&dreamplug_sata_data);
153 kirkwood_sdio_init(&dreamplug_mvsdio_data);
155 platform_device_register(&dreamplug_leds);
158 static void __init kirkwood_dt_init(void)
160 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
163 * Disable propagation of mbus errors to the CPU local bus,
164 * as this causes mbus errors (which can occur for example
165 * for PCI aborts) to throw CPU aborts, which we're not set
168 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
170 kirkwood_setup_cpu_mbus();
172 #ifdef CONFIG_CACHE_FEROCEON_L2
176 /* internal devices that every board has */
179 kirkwood_xor0_init();
180 kirkwood_xor1_init();
181 kirkwood_crypto_init();
184 kexec_reinit = kirkwood_enable_pcie;
187 if (of_machine_is_compatible("globalscale,dreamplug"))
190 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
193 static const char *kirkwood_dt_board_compat[] = {
194 "globalscale,dreamplug",
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 = kirkwood_init_irq,
203 .timer = &kirkwood_timer,
204 .init_machine = kirkwood_dt_init,
205 .restart = kirkwood_restart,
206 .dt_compat = kirkwood_dt_board_compat,