diff options
author | Jason Cooper <jason@lakedaemon.net> | 2012-02-27 11:07:13 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-02-27 11:21:40 -0500 |
commit | 3d468b6d6052293ad3b8538b8277077981c28286 (patch) | |
tree | e07c9d6e5ded0ca2bbcd1194fa61fc1b326f5347 /arch/arm/mach-kirkwood/board-dt.c | |
parent | d65b4e98d7ea3038b767b70fe8be959b2913f16d (diff) |
ARM: kirkwood: add dreamplug (fdt) support.
Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g.
Then, switched to SPI based NOR flash.
After talking to Arnd Bergman, chose an incremental approach to adding
devicetree support. First, we use the dtb to tell us we are on the
dreamplug, then we gradually port over drivers.
Driver porting will start with the uart (see next patch), and progress
from there. Possibly, spi/flash/partitions will be next.
When done, board-dt.c will no longer be dreamplug specific, and dt's can
be made for the other kirkwood boards.
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-kirkwood/board-dt.c')
-rw-r--r-- | arch/arm/mach-kirkwood/board-dt.c | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c new file mode 100644 index 000000000000..76392af791de --- /dev/null +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -0,0 +1,182 @@ | |||
1 | /* | ||
2 | * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net> | ||
3 | * | ||
4 | * arch/arm/mach-kirkwood/board-dt.c | ||
5 | * | ||
6 | * Marvell DreamPlug Reference Board Setup | ||
7 | * | ||
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> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/mtd/partitions.h> | ||
17 | #include <linux/ata_platform.h> | ||
18 | #include <linux/mv643xx_eth.h> | ||
19 | #include <linux/of.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 <mach/kirkwood.h> | ||
33 | #include <plat/mvsdio.h> | ||
34 | #include "common.h" | ||
35 | #include "mpp.h" | ||
36 | |||
37 | static struct of_device_id kirkwood_dt_match_table[] __initdata = { | ||
38 | { .compatible = "simple-bus", }, | ||
39 | { } | ||
40 | }; | ||
41 | |||
42 | struct mtd_partition dreamplug_partitions[] = { | ||
43 | { | ||
44 | .name = "u-boot", | ||
45 | .size = SZ_512K, | ||
46 | .offset = 0, | ||
47 | }, | ||
48 | { | ||
49 | .name = "u-boot env", | ||
50 | .size = SZ_64K, | ||
51 | .offset = SZ_512K + SZ_512K, | ||
52 | }, | ||
53 | { | ||
54 | .name = "dtb", | ||
55 | .size = SZ_64K, | ||
56 | .offset = SZ_512K + SZ_512K + SZ_512K, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | static const struct flash_platform_data dreamplug_spi_slave_data = { | ||
61 | .type = "mx25l1606e", | ||
62 | .name = "spi_flash", | ||
63 | .parts = dreamplug_partitions, | ||
64 | .nr_parts = ARRAY_SIZE(dreamplug_partitions), | ||
65 | }; | ||
66 | |||
67 | static struct spi_board_info __initdata dreamplug_spi_slave_info[] = { | ||
68 | { | ||
69 | .modalias = "m25p80", | ||
70 | .platform_data = &dreamplug_spi_slave_data, | ||
71 | .irq = -1, | ||
72 | .max_speed_hz = 50000000, | ||
73 | .bus_num = 0, | ||
74 | .chip_select = 0, | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | static struct mv643xx_eth_platform_data dreamplug_ge00_data = { | ||
79 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), | ||
80 | }; | ||
81 | |||
82 | static struct mv643xx_eth_platform_data dreamplug_ge01_data = { | ||
83 | .phy_addr = MV643XX_ETH_PHY_ADDR(1), | ||
84 | }; | ||
85 | |||
86 | static struct mv_sata_platform_data dreamplug_sata_data = { | ||
87 | .n_ports = 1, | ||
88 | }; | ||
89 | |||
90 | static struct mvsdio_platform_data dreamplug_mvsdio_data = { | ||
91 | /* unfortunately the CD signal has not been connected */ | ||
92 | }; | ||
93 | |||
94 | static struct gpio_led dreamplug_led_pins[] = { | ||
95 | { | ||
96 | .name = "dreamplug:blue:bluetooth", | ||
97 | .gpio = 47, | ||
98 | .active_low = 1, | ||
99 | }, | ||
100 | { | ||
101 | .name = "dreamplug:green:wifi", | ||
102 | .gpio = 48, | ||
103 | .active_low = 1, | ||
104 | }, | ||
105 | { | ||
106 | .name = "dreamplug:green:wifi_ap", | ||
107 | .gpio = 49, | ||
108 | .active_low = 1, | ||
109 | }, | ||
110 | }; | ||
111 | |||
112 | static struct gpio_led_platform_data dreamplug_led_data = { | ||
113 | .leds = dreamplug_led_pins, | ||
114 | .num_leds = ARRAY_SIZE(dreamplug_led_pins), | ||
115 | }; | ||
116 | |||
117 | static struct platform_device dreamplug_leds = { | ||
118 | .name = "leds-gpio", | ||
119 | .id = -1, | ||
120 | .dev = { | ||
121 | .platform_data = &dreamplug_led_data, | ||
122 | } | ||
123 | }; | ||
124 | |||
125 | static unsigned int dreamplug_mpp_config[] __initdata = { | ||
126 | MPP0_SPI_SCn, | ||
127 | MPP1_SPI_MOSI, | ||
128 | MPP2_SPI_SCK, | ||
129 | MPP3_SPI_MISO, | ||
130 | MPP47_GPIO, /* Bluetooth LED */ | ||
131 | MPP48_GPIO, /* Wifi LED */ | ||
132 | MPP49_GPIO, /* Wifi AP LED */ | ||
133 | 0 | ||
134 | }; | ||
135 | |||
136 | static void __init dreamplug_init(void) | ||
137 | { | ||
138 | /* | ||
139 | * Basic setup. Needs to be called early. | ||
140 | */ | ||
141 | kirkwood_mpp_conf(dreamplug_mpp_config); | ||
142 | |||
143 | kirkwood_uart0_init(); | ||
144 | |||
145 | spi_register_board_info(dreamplug_spi_slave_info, | ||
146 | ARRAY_SIZE(dreamplug_spi_slave_info)); | ||
147 | kirkwood_spi_init(); | ||
148 | |||
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); | ||
154 | |||
155 | platform_device_register(&dreamplug_leds); | ||
156 | } | ||
157 | |||
158 | static void __init kirkwood_dt_init(void) | ||
159 | { | ||
160 | kirkwood_init(); | ||
161 | |||
162 | if (of_machine_is_compatible("globalscale,dreamplug")) | ||
163 | dreamplug_init(); | ||
164 | |||
165 | of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); | ||
166 | } | ||
167 | |||
168 | static const char *kirkwood_dt_board_compat[] = { | ||
169 | "globalscale,dreamplug", | ||
170 | NULL | ||
171 | }; | ||
172 | |||
173 | DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") | ||
174 | /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ | ||
175 | .map_io = kirkwood_map_io, | ||
176 | .init_early = kirkwood_init_early, | ||
177 | .init_irq = kirkwood_init_irq, | ||
178 | .timer = &kirkwood_timer, | ||
179 | .init_machine = kirkwood_dt_init, | ||
180 | .restart = kirkwood_restart, | ||
181 | .dt_compat = kirkwood_dt_board_compat, | ||
182 | MACHINE_END | ||