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