1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Device tree file for the Zyxel NSA 310S NAS box.
4 *
5 * Copyright (c) 2015-2021, Tony Dinh <mibodhi@gmail.com>
6 *
7 * Based on
8 * Copyright (c) 2014, Adam Baker <linux@baker-net.org.uk>
9 * Based upon the board setup file created by Peter Schildmann
10 */
11/dts-v1/;
12
13#include "kirkwood.dtsi"
14#include "kirkwood-6281.dtsi"
15
16/ {
17	model = "Zyxel NSA310S";
18	compatible = "zyxel,nsa320s", "marvell,kirkwood-88f6702", "marvell,kirkwood";
19
20	memory {
21		device_type = "memory";
22		reg = <0x00000000 0x10000000>;
23	};
24
25	chosen {
26		bootargs = "console=ttyS0,115200";
27		stdout-path = &uart0;
28	};
29
30	ocp@f1000000 {
31		pinctrl: pin-controller@10000 {
32			pinctrl-names = "default";
33
34			pmx_sata0: pmx-sata0 {
35				marvell,pins ;
36				marvell,function = "sata0";
37			};
38
39			pmx_sata1: pmx-sata1 {
40				marvell,pins ;
41				marvell,function = "sata1";
42			};
43
44			pmx_usb_power: pmx-usb-power {
45				marvell,pins = "mpp21";
46				marvell,function = "gpio";
47			};
48
49			pmx_pwr_off: pmx-pwr-off {
50				marvell,pins = "mpp27";
51				marvell,function = "gpio";
52			};
53
54			pmx_btn_reset: pmx-btn-reset {
55				marvell,pins = "mpp24";
56				marvell,function = "gpio";
57			};
58
59			pmx_btn_copy: pmx-btn-copy {
60				marvell,pins = "mpp25";
61				marvell,function = "gpio";
62			};
63
64			pmx_btn_power: pmx-btn-power {
65				marvell,pins = "mpp26";
66				marvell,function = "gpio";
67			};
68
69			pmx_led_hdd2_green: pmx-led-hdd2-green {
70				marvell,pins = "mpp34";
71				marvell,function = "gpio";
72			};
73
74			pmx_led_hdd2_red: pmx-led-hdd2-red {
75				marvell,pins = "mpp12";
76				marvell,function = "gpio";
77			};
78
79			pmx_led_usb_green: pmx-led-usb-green {
80				marvell,pins = "mpp15";
81				marvell,function = "gpio";
82			};
83
84			pmx_led_copy_green: pmx-led-copy-green {
85				marvell,pins = "mpp22";
86				marvell,function = "gpio";
87			};
88
89			pmx_led_copy_red: pmx-led-copy-red {
90				marvell,pins = "mpp23";
91				marvell,function = "gpio";
92			};
93
94			pmx_led_sys_green: pmx-led-sys-green {
95				marvell,pins = "mpp28";
96				marvell,function = "gpio";
97			};
98
99			pmx_led_sys_orange: pmx-led-sys-orange {
100				marvell,pins = "mpp29";
101				marvell,function = "gpio";
102			};
103
104			pmx_led_hdd1_green: pmx-led-hdd1-green {
105				marvell,pins = "mpp16";
106				marvell,function = "gpio";
107			};
108
109			pmx_led_hdd1_red: pmx-led-hdd1-red {
110				marvell,pins = "mpp13";
111				marvell,function = "gpio";
112			};
113
114			pmx_pwr_sata1: pmx-pwr-sata1 {
115				marvell,pins = "mpp33";
116				marvell,function = "gpio";
117			};
118		};
119
120		serial@12000 {
121			status = "ok";
122		};
123
124		sata@80000 {
125			status = "okay";
126			nr-ports = <1>;
127		};
128
129		rtc@10300 {
130			status = "disabled";
131		};
132
133		i2c@11000 {
134			status = "okay";
135			ht1382: rtc@68 {
136				compatible = "htk,ht1382";
137				reg = <0x68>;
138			};
139		};
140	};
141
142	regulators {
143		compatible = "simple-bus";
144		#address-cells = <1>;
145		#size-cells = <0>;
146		pinctrl-names = "default";
147		pinctrl-0 = <&pmx_usb_power &pmx_pwr_sata1>;
148
149		usb0_power: regulator@1 {
150			compatible = "regulator-fixed";
151			reg = <1>;
152			regulator-name = "USB Power";
153			regulator-min-microvolt = <5000000>;
154			regulator-max-microvolt = <5000000>;
155			regulator-always-on;
156			regulator-boot-on;
157			enable-active-high;
158			gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
159		};
160
161		sata1_power: regulator@2 {
162			compatible = "regulator-fixed";
163			reg = <2>;
164			regulator-name = "SATA1 Power";
165			regulator-min-microvolt = <5000000>;
166			regulator-max-microvolt = <5000000>;
167			regulator-always-on;
168			regulator-boot-on;
169			enable-active-high;
170			gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
171		};
172	};
173
174	gpio_poweroff {
175		compatible = "gpio-poweroff";
176		pinctrl-0 = <&pmx_pwr_off>;
177		pinctrl-names = "default";
178		gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
179	};
180
181	gpio_keys {
182		compatible = "gpio-keys";
183		#address-cells = <1>;
184		#size-cells = <0>;
185		pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
186		pinctrl-names = "default";
187
188		button@1 {
189			label = "Power Button";
190			linux,code = <KEY_POWER>;
191			gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
192		};
193		button@2 {
194			label = "Copy Button";
195			linux,code = <KEY_COPY>;
196			gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
197		};
198		button@3 {
199			label = "Reset Button";
200			linux,code = <KEY_RESTART>;
201			gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
202		};
203	};
204
205	gpio-leds {
206		compatible = "gpio-leds";
207		pinctrl-0 = <&pmx_led_hdd2_green &pmx_led_hdd2_red
208			     &pmx_led_usb_green
209			     &pmx_led_sys_green &pmx_led_sys_orange
210			     &pmx_led_copy_green &pmx_led_copy_red
211			     &pmx_led_hdd1_green &pmx_led_hdd1_red>;
212		pinctrl-names = "default";
213
214		green-sys {
215			label = "nsa310s:green:sys";
216			gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
217			linux,default-trigger = "default-on";
218		};
219		orange-sys {
220			label = "nsa310s:orange:sys";
221			gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
222		};
223		green-hdd1 {
224			label = "nsa310s:green:hdd1";
225			gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
226		};
227		red-hdd1 {
228			label = "nsa310s:red:hdd1";
229			gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
230		};
231		green-hdd2 {
232			label = "nsa310s:green:hdd2";
233			gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
234		};
235		red-hdd2 {
236			label = "nsa310s:red:hdd2";
237			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
238		};
239		green-usb {
240			label = "nsa310s:green:usb";
241			gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
242		};
243		green-copy {
244			label = "nsa310s:green:copy";
245			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
246			linux,default-trigger = "ide-disk";
247		};
248		red-copy {
249			label = "nsa310s:red:copy";
250			gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
251		};
252	};
253};
254
255&nand {
256	status = "okay";
257	chip-delay = <35>;
258
259	partition@0 {
260		label = "uboot";
261		reg = <0x0000000 0x0100000>;
262	};
263	partition@100000 {
264		label = "stock_uboot_env";
265		reg = <0x0100000 0x0080000>;
266	};
267	partition@180000 {
268		label = "key_store";
269		reg = <0x0180000 0x0080000>;
270	};
271	partition@200000 {
272		label = "info";
273		reg = <0x0200000 0x0080000>;
274	};
275	partition@280000 {
276		label = "etc";
277		reg = <0x0280000 0x0a00000>;
278	};
279	partition@c80000 {
280		label = "kernel_1";
281		reg = <0x0c80000 0x0a00000>;
282	};
283	partition@1680000 {
284		label = "rootfs1";
285		reg = <0x1680000 0x2fc0000>;
286	};
287	partition@4640000 {
288		label = "kernel_2";
289		reg = <0x4640000 0x0a00000>;
290	};
291	partition@5040000 {
292		label = "rootfs2";
293		reg = <0x5040000 0x2fc0000>;
294	};
295};
296
297&mdio {
298	status = "okay";
299	ethphy0: ethernet-phy@1 {
300		compatible = "marvell,88e1510";
301		reg = <1>;
302	};
303};
304
305&eth0 {
306	status = "okay";
307	ethernet0-port@0 {
308		phy-handle = <&ethphy0>;
309	};
310};
311
312&pciec {
313	status = "okay";
314};
315
316&pcie0 {
317	status = "okay";
318};
319