1/*
2 * Device Tree file for Buffalo Linkstation LS-WTGL
3 *
4 * Copyright (C) 2015, Roger Shimizu <rogershimizu@gmail.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/gpio/gpio.h>
48#include <dt-bindings/input/input.h>
49#include "orion5x-mv88f5182.dtsi"
50
51/ {
52	model = "Buffalo Linkstation LS-WTGL";
53	compatible = "buffalo,lswtgl", "marvell,orion5x-88f5182", "marvell,orion5x";
54
55	memory { /* 64 MB */
56		device_type = "memory";
57		reg = <0x00000000 0x4000000>;
58	};
59
60	chosen {
61		bootargs = "console=ttyS0,115200n8 earlyprintk";
62		linux,stdout-path = &uart0;
63	};
64
65	soc {
66		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>,
67		         <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>,
68			 <MBUS_ID(0x01, 0x0f) 0 0xf4000000 0x40000>;
69
70		internal-regs {
71			pinctrl: pinctrl@10000 {
72				pinctrl-0 = <&pmx_usb_power &pmx_power_hdd
73					&pmx_fan_low &pmx_fan_high &pmx_fan_lock>;
74				pinctrl-names = "default";
75
76				pmx_led_power: pmx-leds {
77					marvell,pins = "mpp0";
78					marvell,function = "gpio";
79				};
80
81				pmx_led_alarm: pmx-leds {
82					marvell,pins = "mpp2";
83					marvell,function = "gpio";
84				};
85
86				pmx_led_info: pmx-leds {
87					marvell,pins = "mpp3";
88					marvell,function = "gpio";
89				};
90
91				pmx_power_hdd: pmx-power-hdd {
92					marvell,pins = "mpp1";
93					marvell,function = "gpio";
94				};
95
96				pmx_usb_power: pmx-usb-power {
97					marvell,pins = "mpp9";
98					marvell,function = "gpio";
99				};
100
101				pmx_sata0: pmx-sata0 {
102					marvell,pins = "mpp12";
103					marvell,function = "sata0";
104				};
105
106				pmx_sata1: pmx-sata1 {
107					marvell,pins = "mpp13";
108					marvell,function = "sata1";
109				};
110
111				pmx_fan_high: pmx-fan-high {
112					marvell,pins = "mpp14";
113					marvell,function = "gpio";
114				};
115
116				pmx_fan_low: pmx-fan-low {
117					marvell,pins = "mpp17";
118					marvell,function = "gpio";
119				};
120
121				pmx_fan_lock: pmx-fan-lock {
122					marvell,pins = "mpp6";
123					marvell,function = "gpio";
124				};
125
126				pmx_power_switch: pmx-power-switch {
127					marvell,pins = "mpp8", "mpp10";
128					marvell,function = "gpio";
129				};
130			};
131		};
132	};
133
134	gpio_keys {
135		compatible = "gpio-keys";
136		#address-cells = <1>;
137		#size-cells = <0>;
138		pinctrl-0 = <&pmx_power_switch>;
139		pinctrl-names = "default";
140
141		button@1 {
142			label = "Power-on Switch";
143			linux,code = <KEY_RESERVED>;
144			linux,input-type = <5>;
145			gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
146		};
147
148		button@2 {
149			label = "Power-auto Switch";
150			linux,code = <KEY_ESC>;
151			linux,input-type = <5>;
152			gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
153		};
154	};
155
156	gpio_leds {
157		compatible = "gpio-leds";
158		pinctrl-0 = <&pmx_led_power &pmx_led_alarm
159			     &pmx_led_info>;
160		pinctrl-names = "default";
161
162		led@1 {
163			label = "lswtgl:blue:power";
164			gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
165		};
166
167		led@2 {
168			label = "lswtgl:red:alarm";
169			gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
170		};
171
172		led@3 {
173			label = "lswtgl:amber:info";
174			gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
175		};
176	};
177
178	gpio_fan {
179		compatible = "gpio-fan";
180		pinctrl-0 = <&pmx_fan_low &pmx_fan_high &pmx_fan_lock>;
181		pinctrl-names = "default";
182
183		gpios = <&gpio0 14 GPIO_ACTIVE_LOW
184			 &gpio0 17 GPIO_ACTIVE_LOW>;
185
186		gpio-fan,speed-map = <0 3
187				1500 2
188				3250 1
189				5000 0>;
190
191		alarm-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
192	};
193
194	restart_poweroff {
195		compatible = "restart-poweroff";
196	};
197
198	regulators {
199		compatible = "simple-bus";
200		#address-cells = <1>;
201		#size-cells = <0>;
202		pinctrl-0 = <&pmx_power_hdd &pmx_usb_power>;
203		pinctrl-names = "default";
204
205		usb_power: regulator@1 {
206			compatible = "regulator-fixed";
207			reg = <1>;
208			regulator-name = "USB Power";
209			regulator-min-microvolt = <5000000>;
210			regulator-max-microvolt = <5000000>;
211			enable-active-high;
212			regulator-always-on;
213			regulator-boot-on;
214			gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
215		};
216
217		hdd_power: regulator@2 {
218			compatible = "regulator-fixed";
219			reg = <2>;
220			regulator-name = "HDD Power";
221			regulator-min-microvolt = <5000000>;
222			regulator-max-microvolt = <5000000>;
223			enable-active-high;
224			regulator-always-on;
225			regulator-boot-on;
226			gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
227		};
228	};
229};
230
231&mdio {
232	status = "okay";
233
234	ethphy: ethernet-phy {
235		reg = <8>;
236	};
237};
238
239&eth {
240	status = "okay";
241
242	ethernet-port@0 {
243		phy-handle = <&ethphy>;
244	};
245};
246
247&ehci0 {
248	status = "okay";
249};
250
251&i2c {
252	status = "okay";
253
254	rtc {
255		compatible = "ricoh,rs5c372a";
256		reg = <0x32>;
257	};
258};
259
260&wdt {
261	status = "disabled";
262};
263
264&sata {
265	pinctrl-0 = <&pmx_sata0 &pmx_sata1>;
266	pinctrl-names = "default";
267	status = "okay";
268	nr-ports = <2>;
269};
270
271&uart0 {
272	status = "okay";
273};
274