1/*
2 * Device Tree file for NETGEAR ReadyNAS 2120
3 *
4 * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 *  a) This file is free software; you can redistribute it and/or
12 *     modify it under the terms of the GNU General Public License as
13 *     published by the Free Software Foundation; either version 2 of the
14 *     License, or (at your option) any later version.
15 *
16 *     This file is distributed in the hope that it will be useful
17 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *     GNU General Public License for more details.
20 *
21 * Or, alternatively
22 *
23 *  b) Permission is hereby granted, free of charge, to any person
24 *     obtaining a copy of this software and associated documentation
25 *     files (the "Software"), to deal in the Software without
26 *     restriction, including without limitation the rights to use
27 *     copy, modify, merge, publish, distribute, sublicense, and/or
28 *     sell copies of the Software, and to permit persons to whom the
29 *     Software is furnished to do so, subject to the following
30 *     conditions:
31 *
32 *     The above copyright notice and this permission notice shall be
33 *     included in all copies or substantial portions of the Software.
34 *
35 *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
36 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
37 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
39 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
40 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
42 *     OTHER DEALINGS IN THE SOFTWARE.
43 */
44
45/dts-v1/;
46
47#include <dt-bindings/input/input.h>
48#include <dt-bindings/gpio/gpio.h>
49#include "armada-xp-mv78230.dtsi"
50
51/ {
52	model = "NETGEAR ReadyNAS 2120";
53	compatible = "netgear,readynas-2120", "marvell,armadaxp-mv78230", "marvell,armadaxp", "marvell,armada-370-xp";
54
55	chosen {
56		stdout-path = "serial0:115200n8";
57	};
58
59	memory {
60		device_type = "memory";
61		reg = <0 0x00000000 0 0x80000000>; /* 2GB */
62	};
63
64	soc {
65		ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
66			  MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000>;
67
68		pcie-controller {
69			status = "okay";
70
71			/* Connected to first Marvell 88SE9170 SATA controller */
72			pcie@1,0 {
73				/* Port 0, Lane 0 */
74				status = "okay";
75			};
76
77			/* Connected to second Marvell 88SE9170 SATA controller */
78			pcie@2,0 {
79				/* Port 0, Lane 1 */
80				status = "okay";
81			};
82
83			/* Connected to Fresco Logic FL1009 USB 3.0 controller */
84			pcie@5,0 {
85				/* Port 1, Lane 0 */
86				status = "okay";
87			};
88		};
89
90		internal-regs {
91			/* Two rear eSATA ports */
92			sata@a0000 {
93				nr-ports = <2>;
94				status = "okay";
95			};
96
97			serial@12000 {
98				status = "okay";
99			};
100
101			mdio {
102				phy0: ethernet-phy@0 { /* Marvell 88E1318 */
103					reg = <0>;
104				};
105
106				phy1: ethernet-phy@1 { /* Marvell 88E1318 */
107					reg = <1>;
108				};
109			};
110
111			ethernet@70000 {
112				status = "okay";
113				phy = <&phy0>;
114				phy-mode = "rgmii-id";
115			};
116
117			ethernet@74000 {
118				status = "okay";
119				phy = <&phy1>;
120				phy-mode = "rgmii-id";
121			};
122
123			/* Front USB 2.0 port */
124			usb@50000 {
125				status = "okay";
126			};
127
128			i2c@11000 {
129				compatible = "marvell,mv64xxx-i2c";
130				clock-frequency = <400000>;
131				status = "okay";
132
133				isl12057: isl12057@68 {
134					compatible = "isil,isl12057";
135					reg = <0x68>;
136					isil,irq2-can-wakeup-machine;
137				};
138
139				/* Controller for rear fan #1 of 3 (Protechnic
140				 * MGT4012XB-O20, 8000RPM) near eSATA port */
141				g762_fan1: g762@3e {
142					compatible = "gmt,g762";
143					reg = <0x3e>;
144					clocks = <&g762_clk>; /* input clock */
145					fan_gear_mode = <0>;
146					fan_startv = <1>;
147					pwm_polarity = <0>;
148				};
149
150				/*  Controller for rear (center) fan #2 of 3 */
151				g762_fan2: g762@48 {
152					compatible = "gmt,g762";
153					reg = <0x48>;
154					clocks = <&g762_clk>; /* input clock */
155					fan_gear_mode = <0>;
156					fan_startv = <1>;
157					pwm_polarity = <0>;
158				};
159
160				/*  Controller for rear fan #3 of 3 */
161				g762_fan3: g762@49 {
162					compatible = "gmt,g762";
163					reg = <0x49>;
164					clocks = <&g762_clk>; /* input clock */
165					fan_gear_mode = <0>;
166					fan_startv = <1>;
167					pwm_polarity = <0>;
168				};
169
170				/* Temperature sensor */
171				g751: g751@4c {
172					compatible = "gmt,g751";
173					reg = <0x4c>;
174				};
175			};
176
177			nand@d0000 {
178				status = "okay";
179				num-cs = <1>;
180				marvell,nand-keep-config;
181				marvell,nand-enable-arbiter;
182				nand-on-flash-bbt;
183
184				/* Use Hardware BCH ECC */
185				nand-ecc-strength = <4>;
186				nand-ecc-step-size = <512>;
187
188				partition@0 {
189					label = "u-boot";
190					reg = <0x0000000 0x180000>;  /* 1.5MB */
191					read-only;
192				};
193
194				partition@180000 {
195					label = "u-boot-env";
196					reg = <0x180000 0x20000>;    /* 128KB */
197					read-only;
198				};
199
200				partition@200000 {
201					label = "uImage";
202					reg = <0x0200000 0x600000>;    /* 6MB */
203				};
204
205				partition@800000 {
206					label = "minirootfs";
207					reg = <0x0800000 0x400000>;    /* 4MB */
208				};
209
210				/* Last MB is for the BBT, i.e. not writable */
211				partition@c00000 {
212					label = "ubifs";
213					reg = <0x0c00000 0x7400000>; /* 116MB */
214				};
215			};
216		};
217	};
218
219	clocks {
220	       g762_clk: g762-oscillator {
221			 compatible = "fixed-clock";
222			 #clock-cells = <0>;
223			 clock-frequency = <32768>;
224	       };
225	};
226
227	gpio-leds {
228		compatible = "gpio-leds";
229		pinctrl-0 = <&sata1_led_pin &sata2_led_pin &err_led_pin
230			     &sata3_led_pin &sata4_led_pin>;
231		pinctrl-names = "default";
232
233		red-sata1-led {
234			label = "rn2120:red:sata1";
235			gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
236			default-state = "off";
237		};
238
239		red-sata2-led {
240			label = "rn2120:red:sata2";
241			gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
242			default-state = "off";
243		};
244
245		red-sata3-led {
246			label = "rn2120:red:sata3";
247			gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
248			default-state = "off";
249		};
250
251		red-sata4-led {
252			label = "rn2120:red:sata4";
253			gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
254			default-state = "off";
255		};
256
257		red-err-led {
258			label = "rn2120:red:err";
259			gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
260			default-state = "off";
261		};
262	};
263
264	gpio-keys {
265		compatible = "gpio-keys";
266		pinctrl-0 = <&power_button_pin &reset_button_pin>;
267		pinctrl-names = "default";
268
269		power-button {
270			label = "Power Button";
271			linux,code = <KEY_POWER>;
272			gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
273		};
274
275		reset-button {
276			label = "Reset Button";
277			linux,code = <KEY_RESTART>;
278			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
279		};
280	};
281
282	gpio-poweroff {
283		compatible = "gpio-poweroff";
284		pinctrl-0 = <&poweroff>;
285		pinctrl-names = "default";
286		gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
287	};
288};
289
290&pinctrl {
291	poweroff: poweroff {
292		marvell,pins = "mpp42";
293		marvell,function = "gpio";
294	};
295
296	power_button_pin: power-button-pin {
297		marvell,pins = "mpp27";
298		marvell,function = "gpio";
299	};
300
301	reset_button_pin: reset-button-pin {
302		marvell,pins = "mpp41";
303		marvell,function = "gpio";
304	};
305
306	sata1_led_pin: sata1-led-pin {
307		marvell,pins = "mpp31";
308		marvell,function = "gpio";
309	};
310
311	sata2_led_pin: sata2-led-pin {
312		marvell,pins = "mpp40";
313		marvell,function = "gpio";
314	};
315
316	sata3_led_pin: sata3-led-pin {
317		marvell,pins = "mpp44";
318		marvell,function = "gpio";
319	};
320
321	sata4_led_pin: sata4-led-pin {
322		marvell,pins = "mpp47";
323		marvell,function = "gpio";
324	};
325
326	sata1_power_pin: sata1-power-pin {
327		marvell,pins = "mpp24";
328		marvell,function = "gpio";
329	};
330
331	sata2_power_pin: sata2-power-pin {
332		marvell,pins = "mpp25";
333		marvell,function = "gpio";
334	};
335
336	sata3_power_pin: sata3-power-pin {
337		marvell,pins = "mpp26";
338		marvell,function = "gpio";
339	};
340
341	sata4_power_pin: sata4-power-pin {
342		marvell,pins = "mpp28";
343		marvell,function = "gpio";
344	};
345
346	sata1_pres_pin: sata1-pres-pin {
347		marvell,pins = "mpp32";
348		marvell,function = "gpio";
349	};
350
351	sata2_pres_pin: sata2-pres-pin {
352		marvell,pins = "mpp33";
353		marvell,function = "gpio";
354	};
355
356	sata3_pres_pin: sata3-pres-pin {
357		marvell,pins = "mpp34";
358		marvell,function = "gpio";
359	};
360
361	sata4_pres_pin: sata4-pres-pin {
362		marvell,pins = "mpp35";
363		marvell,function = "gpio";
364	};
365
366	err_led_pin: err-led-pin {
367		marvell,pins = "mpp45";
368		marvell,function = "gpio";
369	};
370};
371