1/*
2 * Device Tree file for Lenovo Iomega ix4-300d
3 *
4 * Copyright (C) 2014, Benoit Masson <yahoo@perenite.com>
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 = "Lenovo Iomega ix4-300d";
53	compatible = "lenovo,ix4-300d", "marvell,armadaxp-mv78230",
54		     "marvell,armadaxp", "marvell,armada-370-xp";
55
56	chosen {
57		stdout-path = "serial0:115200n8";
58	};
59
60	memory {
61		device_type = "memory";
62		reg = <0 0x00000000 0 0x20000000>; /* 512MB */
63	};
64
65	soc {
66		ranges = <MBUS_ID(0xf0, 0x01) 0 0 0xd0000000 0x100000
67			MBUS_ID(0x01, 0x1d) 0 0 0xfff00000 0x100000>;
68
69		pcie-controller {
70			status = "okay";
71
72			/* Quad port sata: Marvell 88SX7042 */
73			pcie@1,0 {
74				/* Port 0, Lane 0 */
75				status = "okay";
76			};
77
78			/* USB 3.0 xHCI controller: NEC D720200F1 */
79			pcie@5,0 {
80				/* Port 1, Lane 0 */
81				status = "okay";
82			};
83		};
84
85		internal-regs {
86			serial@12000 {
87				status = "okay";
88			};
89
90			mdio {
91				phy0: ethernet-phy@0 { /* Marvell 88E1318 */
92					reg = <0>;
93				};
94
95				phy1: ethernet-phy@1 { /* Marvell 88E1318 */
96					reg = <1>;
97				};
98			};
99
100			ethernet@70000 {
101				pinctrl-0 = <&ge0_rgmii_pins>;
102				pinctrl-names = "default";
103				status = "okay";
104				phy = <&phy0>;
105				phy-mode = "rgmii-id";
106			};
107
108			ethernet@74000 {
109				pinctrl-0 = <&ge1_rgmii_pins>;
110				pinctrl-names = "default";
111				status = "okay";
112				phy = <&phy1>;
113				phy-mode = "rgmii-id";
114			};
115
116			usb@50000 {
117				status = "okay";
118			};
119
120			usb@51000 {
121				status = "okay";
122			};
123
124			i2c@11000 {
125				clock-frequency = <400000>;
126				status = "okay";
127
128				adt7473@2e {
129					compatible = "adi,adt7473";
130					reg = <0x2e>;
131				};
132
133				eeprom@50 {
134					compatible = "atmel,24c64";
135					reg = <0x50>;
136				};
137
138				pcf8563@51 {
139					compatible = "nxp,pcf8563";
140					reg = <0x51>;
141				};
142
143			};
144
145			nand@d0000 {
146				status = "okay";
147				num-cs = <1>;
148				marvell,nand-keep-config;
149				marvell,nand-enable-arbiter;
150				nand-on-flash-bbt;
151
152				partition@0 {
153					label = "u-boot";
154					reg = <0x0000000 0xe0000>;
155					read-only;
156				};
157
158				partition@e0000 {
159					label = "u-boot-env";
160					reg = <0xe0000 0x20000>;
161					read-only;
162				};
163
164				partition@100000 {
165					label = "u-boot-env2";
166					reg = <0x100000 0x20000>;
167					read-only;
168				};
169
170				partition@120000 {
171					label = "zImage";
172					reg = <0x120000 0x400000>;
173				};
174
175				partition@520000 {
176					label = "initrd";
177					reg = <0x520000 0x400000>;
178				};
179
180				partition@xE00000 {
181					label = "boot";
182					reg = <0xE00000 0x3F200000>;
183				};
184
185				partition@flash {
186					label = "flash";
187					reg = <0x0 0x40000000>;
188				};
189			};
190		};
191	};
192
193	gpio-keys {
194		compatible = "gpio-keys";
195		pinctrl-0 = <&power_button_pin &reset_button_pin
196			&select_button_pin &scroll_button_pin>;
197		pinctrl-names = "default";
198
199		power-button {
200			label = "Power Button";
201			linux,code = <KEY_POWER>;
202			gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
203		};
204
205		reset-button {
206			label = "Reset Button";
207			linux,code = <KEY_RESTART>;
208			gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
209		};
210
211		select-button {
212			label = "Select Button";
213			linux,code = <BTN_SELECT>;
214			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
215		};
216
217		scroll-button {
218			label = "Scroll Button";
219			linux,code = <KEY_SCROLLDOWN>;
220			gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
221		};
222	};
223
224	spi3 {
225		compatible = "spi-gpio";
226		status = "okay";
227		gpio-sck = <&gpio0 25 GPIO_ACTIVE_LOW>;
228		gpio-mosi = <&gpio1 15 GPIO_ACTIVE_LOW>; /*gpio 47*/
229		cs-gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
230		num-chipselects = <1>;
231		#address-cells = <1>;
232		#size-cells = <0>;
233
234		gpio_spi: gpio_spi@0 {
235			compatible = "fairchild,74hc595";
236			gpio-controller;
237			#gpio-cells = <2>;
238			reg = <0>;
239			registers-number = <1>;
240			spi-max-frequency = <100000>;
241		};
242	};
243
244	gpio-leds {
245		compatible = "gpio-leds";
246		pinctrl-0 = <&hdd_led_pin>;
247		pinctrl-names = "default";
248
249		hdd-led {
250			label = "ix4-300d:hdd:blue";
251			gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
252			default-state = "off";
253		};
254
255		power-led {
256			label = "ix4-300d:power:white";
257			gpios = <&gpio_spi 1 GPIO_ACTIVE_LOW>;
258			/* init blinking while booting */
259			linux,default-trigger = "timer";
260			default-state = "on";
261		};
262
263		sysfail-led {
264			label = "ix4-300d:sysfail:red";
265			gpios = <&gpio_spi 2 GPIO_ACTIVE_HIGH>;
266			default-state = "off";
267		};
268
269		sys-led {
270			label = "ix4-300d:sys:blue";
271			gpios = <&gpio_spi 3 GPIO_ACTIVE_HIGH>;
272			default-state = "off";
273		};
274
275		hddfail-led {
276			label = "ix4-300d:hddfail:red";
277			gpios = <&gpio_spi 4 GPIO_ACTIVE_HIGH>;
278			default-state = "off";
279		};
280
281	};
282
283	/*
284	 * Warning: you need both eth1 & 0 PHY initialized (i.e having
285	 * them up does the tweak) for poweroff to shutdown otherwise it
286	 * reboots
287	 */
288	gpio-poweroff {
289		compatible = "gpio-poweroff";
290		pinctrl-0 = <&poweroff_pin>;
291		pinctrl-names = "default";
292		gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
293	};
294};
295
296&pinctrl {
297	poweroff_pin: poweroff-pin {
298		marvell,pins = "mpp24";
299		marvell,function = "gpio";
300	};
301
302	power_button_pin: power-button-pin {
303		marvell,pins = "mpp44";
304		marvell,function = "gpio";
305	};
306
307	reset_button_pin: reset-button-pin {
308		marvell,pins = "mpp45";
309		marvell,function = "gpio";
310	};
311	select_button_pin: select-button-pin {
312		marvell,pins = "mpp41";
313		marvell,function = "gpio";
314	};
315
316	scroll_button_pin: scroll-button-pin {
317		marvell,pins = "mpp42";
318		marvell,function = "gpio";
319	};
320
321	hdd_led_pin: hdd-led-pin {
322		marvell,pins = "mpp26";
323		marvell,function = "gpio";
324	};
325};
326