mvebu: migrate mamba support to the upstreamed code
[openwrt/openwrt.git] / target / linux / mvebu / patches-3.18 / 001-add_mamba_support.patch
1 From 4824140f4bd1caaf900215aabe27e4bdd1677704 Mon Sep 17 00:00:00 2001
2 From: Imre Kaloz <kaloz@openwrt.org>
3 Date: Mon, 16 Feb 2015 13:31:04 +0100
4 Subject: [PATCH] ARM: mvebu: add Linksys WRT1900AC (Mamba) support
5
6 The Linksys WRT1900AC (Mamba) is a router that has
7
8 - 2 mini-PCIe slots with Marvell 88W8864 radios
9 - 1 USB 3.0 port
10 - 1 USB 2.0/eSATAp port
11 - 2 Ethernet interfaces connected to a 88E6172 switch (1x WAN + 4x LAN)
12 - 128MB NAND flash
13 - 256MB RAM
14
15 gregory.clement@free-electrons.com: - add ARM to the title
16 - fix the reference to CONFIG_DEBUG_MVEBU_UART0_ALTERNATE
17 - fix the unbalanced comment for the syscfg partition
18
19 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
20 Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
21 Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
22 ---
23 arch/arm/boot/dts/Makefile | 1 +
24 arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 348 ++++++++++++++++++++++++++
25 2 files changed, 349 insertions(+)
26 create mode 100644 arch/arm/boot/dts/armada-xp-linksys-mamba.dts
27
28 --- a/arch/arm/boot/dts/Makefile
29 +++ b/arch/arm/boot/dts/Makefile
30 @@ -506,6 +506,7 @@ dtb-$(CONFIG_MACH_ARMADA_XP) += \
31 armada-xp-db.dtb \
32 armada-xp-gp.dtb \
33 armada-xp-lenovo-ix4-300d.dtb \
34 + armada-xp-linksys-mamba.dtb \
35 armada-xp-matrix.dtb \
36 armada-xp-netgear-rn2120.dtb \
37 armada-xp-openblocks-ax3-4.dtb
38 --- /dev/null
39 +++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
40 @@ -0,0 +1,348 @@
41 +/*
42 + * Device Tree file for the Linksys WRT1900AC (Mamba).
43 + *
44 + * Note: this board is shipped with a new generation boot loader that
45 + * remaps internal registers at 0xf1000000. Therefore, if earlyprintk
46 + * is used, the CONFIG_DEBUG_MVEBU_UART0_ALTERNATE option should be
47 + * used.
48 + *
49 + * Copyright (C) 2014 Imre Kaloz <kaloz@openwrt.org>
50 + *
51 + * Based on armada-xp-axpwifiap.dts:
52 + *
53 + * Copyright (C) 2013 Marvell
54 + *
55 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
56 + *
57 + * This file is dual-licensed: you can use it either under the terms
58 + * of the GPL or the X11 license, at your option. Note that this dual
59 + * licensing only applies to this file, and not this project as a
60 + * whole.
61 + *
62 + * a) This file is licensed under the terms of the GNU General Public
63 + * License version 2. This program is licensed "as is" without
64 + * any warranty of any kind, whether express or implied.
65 + *
66 + * Or, alternatively,
67 + *
68 + * b) Permission is hereby granted, free of charge, to any person
69 + * obtaining a copy of this software and associated documentation
70 + * files (the "Software"), to deal in the Software without
71 + * restriction, including without limitation the rights to use,
72 + * copy, modify, merge, publish, distribute, sublicense, and/or
73 + * sell copies of the Software, and to permit persons to whom the
74 + * Software is furnished to do so, subject to the following
75 + * conditions:
76 + *
77 + * The above copyright notice and this permission notice shall be
78 + * included in all copies or substantial portions of the Software.
79 + *
80 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
81 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
82 + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
83 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
84 + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
85 + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
86 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
87 + * OTHER DEALINGS IN THE SOFTWARE.
88 + */
89 +
90 +/dts-v1/;
91 +#include <dt-bindings/gpio/gpio.h>
92 +#include <dt-bindings/input/input.h>
93 +#include "armada-xp-mv78230.dtsi"
94 +
95 +/ {
96 + model = "Linksys WRT1900AC";
97 + compatible = "linksys,mamba", "marvell,armadaxp-mv78230",
98 + "marvell,armadaxp", "marvell,armada-370-xp";
99 +
100 + chosen {
101 + bootargs = "console=ttyS0,115200";
102 + stdout-path = &uart0;
103 + };
104 +
105 + memory {
106 + device_type = "memory";
107 + reg = <0x00000000 0x00000000 0x00000000 0x10000000>; /* 256MB */
108 + };
109 +
110 + soc {
111 + ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xf1000000 0x100000
112 + MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000>;
113 +
114 + pcie-controller {
115 + status = "okay";
116 +
117 + /* Etron EJ168 USB 3.0 controller */
118 + pcie@1,0 {
119 + /* Port 0, Lane 0 */
120 + status = "okay";
121 + };
122 +
123 + /* First mini-PCIe port */
124 + pcie@2,0 {
125 + /* Port 0, Lane 1 */
126 + status = "okay";
127 + };
128 +
129 + /* Second mini-PCIe port */
130 + pcie@3,0 {
131 + /* Port 0, Lane 3 */
132 + status = "okay";
133 + };
134 + };
135 +
136 + internal-regs {
137 +
138 + /* J10: VCC, NC, RX, NC, TX, GND */
139 + serial@12000 {
140 + status = "okay";
141 + };
142 +
143 + sata@a0000 {
144 + nr-ports = <1>;
145 + status = "okay";
146 + };
147 +
148 + ethernet@70000 {
149 + pinctrl-0 = <&ge0_rgmii_pins>;
150 + pinctrl-names = "default";
151 + status = "okay";
152 + phy-mode = "rgmii-id";
153 + fixed-link {
154 + speed = <1000>;
155 + full-duplex;
156 + };
157 + };
158 +
159 + ethernet@74000 {
160 + pinctrl-0 = <&ge1_rgmii_pins>;
161 + pinctrl-names = "default";
162 + status = "okay";
163 + phy-mode = "rgmii-id";
164 + fixed-link {
165 + speed = <1000>;
166 + full-duplex;
167 + };
168 + };
169 +
170 + /* USB part of the eSATA/USB 2.0 port */
171 + usb@50000 {
172 + status = "okay";
173 + };
174 +
175 + i2c@11000 {
176 + status = "okay";
177 + clock-frequency = <100000>;
178 +
179 + tmp421@4c {
180 + compatible = "ti,tmp421";
181 + reg = <0x4c>;
182 + };
183 +
184 + tlc59116@68 {
185 + #address-cells = <1>;
186 + #size-cells = <0>;
187 + #gpio-cells = <2>;
188 + compatible = "ti,tlc59116";
189 + reg = <0x68>;
190 +
191 + wan_amber@0 {
192 + label = "mamba:amber:wan";
193 + reg = <0x0>;
194 + };
195 +
196 + wan_white@1 {
197 + label = "mamba:white:wan";
198 + reg = <0x1>;
199 + };
200 +
201 + wlan_2g@2 {
202 + label = "mamba:white:wlan_2g";
203 + reg = <0x2>;
204 + };
205 +
206 + wlan_5g@3 {
207 + label = "mamba:white:wlan_5g";
208 + reg = <0x3>;
209 + };
210 +
211 + esata@4 {
212 + label = "mamba:white:esata";
213 + reg = <0x4>;
214 + };
215 +
216 + usb2@5 {
217 + label = "mamba:white:usb2";
218 + reg = <0x5>;
219 + };
220 +
221 + usb3_1@6 {
222 + label = "mamba:white:usb3_1";
223 + reg = <0x6>;
224 + };
225 +
226 + usb3_2@7 {
227 + label = "mamba:white:usb3_2";
228 + reg = <0x7>;
229 + };
230 +
231 + wps_white@8 {
232 + label = "mamba:white:wps";
233 + reg = <0x8>;
234 + };
235 +
236 + wps_amber@9 {
237 + label = "mamba:amber:wps";
238 + reg = <0x9>;
239 + };
240 + };
241 + };
242 +
243 + nand@d0000 {
244 + status = "okay";
245 + num-cs = <1>;
246 + marvell,nand-keep-config;
247 + marvell,nand-enable-arbiter;
248 + nand-on-flash-bbt;
249 + nand-ecc-strength = <4>;
250 + nand-ecc-step-size = <512>;
251 +
252 + partition@0 {
253 + label = "u-boot";
254 + reg = <0x0000000 0x100000>; /* 1MB */
255 + read-only;
256 + };
257 +
258 + partition@100000 {
259 + label = "u_env";
260 + reg = <0x100000 0x40000>; /* 256KB */
261 + };
262 +
263 + partition@140000 {
264 + label = "s_env";
265 + reg = <0x140000 0x40000>; /* 256KB */
266 + };
267 +
268 + partition@900000 {
269 + label = "devinfo";
270 + reg = <0x900000 0x100000>; /* 1MB */
271 + read-only;
272 + };
273 +
274 + /* kernel1 overlaps with rootfs1 by design */
275 + partition@a00000 {
276 + label = "kernel1";
277 + reg = <0xa00000 0x2800000>; /* 40MB */
278 + };
279 +
280 + partition@d00000 {
281 + label = "rootfs1";
282 + reg = <0xd00000 0x2500000>; /* 37MB */
283 + };
284 +
285 + /* kernel2 overlaps with rootfs2 by design */
286 + partition@3200000 {
287 + label = "kernel2";
288 + reg = <0x3200000 0x2800000>; /* 40MB */
289 + };
290 +
291 + partition@3500000 {
292 + label = "rootfs2";
293 + reg = <0x3500000 0x2500000>; /* 37MB */
294 + };
295 +
296 + /*
297 + * 38MB, last MB is for the BBT, not writable
298 + */
299 + partition@5a00000 {
300 + label = "syscfg";
301 + reg = <0x5a00000 0x2600000>;
302 + };
303 +
304 + /*
305 + * Unused area between "s_env" and "devinfo".
306 + * Moved here because otherwise the renumbered
307 + * partitions would break the bootloader
308 + * supplied bootargs
309 + */
310 + partition@180000 {
311 + label = "unused_area";
312 + reg = <0x180000 0x780000>; /* 7.5MB */
313 + };
314 + };
315 +
316 + spi0: spi@10600 {
317 + status = "okay";
318 +
319 + spi-flash@0 {
320 + #address-cells = <1>;
321 + #size-cells = <1>;
322 + compatible = "everspin,mr25h256";
323 + reg = <0>; /* Chip select 0 */
324 + spi-max-frequency = <40000000>;
325 + };
326 + };
327 + };
328 + };
329 +
330 + gpio_keys {
331 + compatible = "gpio-keys";
332 + #address-cells = <1>;
333 + #size-cells = <0>;
334 + pinctrl-0 = <&keys_pin>;
335 + pinctrl-names = "default";
336 +
337 + button@1 {
338 + label = "WPS";
339 + linux,code = <KEY_WPS_BUTTON>;
340 + gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
341 + };
342 +
343 + button@2 {
344 + label = "Factory Reset Button";
345 + linux,code = <KEY_RESTART>;
346 + gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
347 + };
348 + };
349 +
350 + gpio-leds {
351 + compatible = "gpio-leds";
352 + pinctrl-0 = <&power_led_pin>;
353 + pinctrl-names = "default";
354 +
355 + power {
356 + label = "mamba:white:power";
357 + gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
358 + default-state = "on";
359 + };
360 + };
361 +
362 + gpio_fan {
363 + /* SUNON HA4010V4-0000-C99 */
364 + compatible = "gpio-fan";
365 + gpios = <&gpio0 24 0>;
366 +
367 + gpio-fan,speed-map = <0 0
368 + 4500 1>;
369 + };
370 +};
371 +
372 +&pinctrl {
373 +
374 + keys_pin: keys-pin {
375 + marvell,pins = "mpp32", "mpp33";
376 + marvell,function = "gpio";
377 + };
378 +
379 + power_led_pin: power-led-pin {
380 + marvell,pins = "mpp40";
381 + marvell,function = "gpio";
382 + };
383 +
384 + gpio_fan_pin: gpio-fan-pin {
385 + marvell,pins = "mpp24";
386 + marvell,function = "gpio";
387 + };
388 +};