mvebu: add support for Buffalo LinkStation LS421DE
[oweals/openwrt.git] / target / linux / mvebu / files-4.19 / arch / arm / boot / dts / armada-370-buffalo-ls421de.dts
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2 /*
3  * Device Tree file for Buffalo LinkStation LS421DE
4  *
5  * Copyright (C) 2020 Daniel González Cabanelas <dgcbueu@gmail.com>
6  */
7
8 /dts-v1/;
9
10 #include "armada-370.dtsi"
11 #include "mvebu-linkstation-fan.dtsi"
12 #include <dt-bindings/gpio/gpio.h>
13 #include <dt-bindings/input/input.h>
14
15 / {
16         model = "Buffalo LinkStation LS421DE";
17         compatible = "buffalo,ls421de", "marvell,armada370", "marvell,armada-370-xp";
18
19         aliases {
20                 led-boot = &led_boot;
21                 led-failsafe = &led_failsafe;
22                 led-running = &led_power;
23                 led-upgrade = &led_upgrade;
24         };
25
26         chosen {
27                 bootargs = "console=ttyS0,115200 earlyprintk noinitrd rootfstype=squashfs";
28                 stdout-path = "serial0:115200n8";
29                 append-rootblock = "nullparameter="; /* override the bootloader args */
30         };
31
32         memory {
33                 device_type = "memory";
34                 reg = <0x00000000 0x20000000>; /* 512 MB */
35         };
36
37         soc {
38                 ranges = <MBUS_ID(0xf0, 0x01) 0 0xd0000000 0x100000
39                           MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000
40                           MBUS_ID(0x09, 0x01) 0 0xf1100000 0x10000>;
41         };
42
43         gpio_fan {
44                 gpios = <&gpio0 13 GPIO_ACTIVE_HIGH
45                         &gpio0 14 GPIO_ACTIVE_HIGH>;
46                 alarm-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
47         };
48
49         gpio_keys {
50                 compatible = "gpio-keys";
51                 #address-cells = <1>;
52                 #size-cells = <0>;
53                 pinctrl-0 = <&pmx_hdd_present &pmx_buttons>;
54                 pinctrl-names = "default";
55
56                 hdd1-present {
57                         label = "HDD1 Present";
58                         linux,code = <KEY_PROG1>;
59                         gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
60                 };
61
62                 hdd2-present {
63                         label = "HDD2 Present";
64                         linux,code = <KEY_PROG2>;
65                         gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
66
67                 };
68
69                 power {
70                         label = "Power Switch";
71                         linux,code = <KEY_POWER>;
72                         linux,input-type = <EV_SW>;
73                         gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
74                 };
75
76                 function {
77                         label = "Function Button";
78                         linux,code = <KEY_OPTION>;
79                         gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
80                 };
81         };
82
83         gpio_leds {
84                 compatible = "gpio-leds";
85                 pinctrl-names = "default";
86                 pinctrl-0 = <&pmx_leds1 &pmx_leds2>;
87
88                 system_red {
89                         label = "ls421de:red:system";
90                         gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
91                 };
92
93                 led_power: power_white {
94                         label = "ls421de:white:power";
95                         gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
96                         default-state = "on";
97                 };
98
99                 led_failsafe: power_red {
100                         label = "ls421de:red:power";
101                         gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
102                 };
103
104                 led_upgrade: power_orange {
105                         label = "ls421de:orange:power";
106                         gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>;
107                 };
108
109                 led_boot: system_white {
110                         label = "ls421de:white:system";
111                         gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
112                 };
113
114                 hdd1_red {
115                         label = "ls421de:red:hdd1";
116                         gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
117                         default-state = "off";
118                         linux,default-trigger = "disk-activity";
119                 };
120
121                 hdd2_red {
122                         label = "ls421de:red:hdd2";
123                         gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
124                         default-state = "off";
125                         linux,default-trigger = "disk-activity";
126                 };
127         };
128
129         regulators {
130                 compatible = "simple-bus";
131                 #address-cells = <1>;
132                 #size-cells = <0>;
133                 pinctrl-0 = <&pmx_power_usb &pmx_power_hdd1 &pmx_power_hdd2>;
134
135                 pinctrl-names = "default";
136
137                 usb_v5_regulator: usb-v5-regulator {
138                         compatible = "regulator-fixed";
139                         regulator-name = "USB";
140                         regulator-min-microvolt = <5000000>;
141                         regulator-max-microvolt = <5000000>;
142                         enable-active-high;
143                         regulator-always-on;
144                         regulator-boot-on;
145                         gpio = <&gpio0 5 GPIO_ACTIVE_HIGH>;
146                 };
147
148                 ata1_regulator: ata1-regulator {
149                         compatible = "regulator-fixed";
150                         reg = <1>;
151                         regulator-name = "HDD1";
152                         regulator-min-microvolt = <12000000>;
153                         regulator-max-microvolt = <12000000>;
154                         startup-delay-us = <2000000>;
155                         enable-active-high;
156                         regulator-always-on;
157                         regulator-boot-on;
158                         gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
159                 };
160
161                 ata2_regulator: ata2-regulator {
162                         compatible = "regulator-fixed";
163                         reg = <2>;
164                         regulator-name = "HDD2";
165                         regulator-min-microvolt = <12000000>;
166                         regulator-max-microvolt = <12000000>;
167                         startup-delay-us = <4000000>;
168                         enable-active-high;
169                         regulator-always-on;
170                         regulator-boot-on;
171                         gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>;
172                 };
173         };
174
175         /* FIXME: this driver needs to be aware of the LED2 eth phy use,
176            which must be set to off state before shutting down the machine */
177         restart_poweroff {
178                 compatible = "restart-poweroff";
179         };
180 };
181
182 &eth1 {
183         pinctrl-0 = <&ge1_rgmii_pins>;
184         pinctrl-names = "default";
185         status = "okay";
186         phy = <&phy0>;
187         phy-mode = "rgmii-id";
188 };
189
190 &i2c0 {
191         clock-frequency = <100000>;
192         status = "okay";
193
194         rs5c372a: rs5c372a@32 {
195                 compatible = "ricoh,rs5c372a";
196                 reg = <0x32>;
197         };
198 };
199
200 &mdio {
201         pinctrl-0 = <&mdio_pins>;
202         pinctrl-names = "default";
203
204         phy0: ethernet-phy@0 { /* Marvell 88E1518 */
205                 reg = <0>;
206                 /* LED2 is used to inform uBoot if the power-switch was slided
207                    to the "off" position, and then power off the machine.
208                    Page 0x3, Register 0x10, bit 8:
209                                 0x800: LED2 off, power off the machine
210                                 0x900: LED2 on, boot the machine */
211                 marvell,reg-init = <0x3 0x10 0x1 0x1991>, /* LED Function */
212                                         <0x3 0x11 0x1 0x4401>, /* LED polarity */
213                                         <0x3 0x12 0x1 0x4905>; /* LED Timer */
214         };
215 };
216
217 &pciec {
218         status = "okay";
219         /* Connected to uPD720202 USB 3.0 Host */
220         pcie@1,0 {
221                 status = "okay";
222         };
223 };
224
225 &pmsu {
226         pinctrl-0 = <&pmx_power_cpu>;
227         pinctrl-names = "default";
228 };
229
230 &rtc {
231         status = "disabled";
232 };
233
234 &sata {
235         nr-ports = <2>;
236         status = "okay";
237 };
238
239 &sdio {
240         pinctrl-0 = <&sdio_pins2>;
241         pinctrl-names = "default";
242         status = "okay";
243         /* No CD or WP GPIOs */
244         broken-cd;
245 };
246
247 &uart0 {
248         status = "okay";
249 };
250
251 &usb0 {
252         status = "okay";
253 };
254
255 &nand_controller {
256         status = "okay";
257
258         nand@0 {
259                 reg = <0>;
260                 label = "pxa3xx_nand-0";
261                 nand-rb = <0>;
262                 marvell,nand-keep-config;
263                 nand-on-flash-bbt;
264                 nand-ecc-strength = <4>;
265                 nand-ecc-step-size = <512>;
266
267                 partitions {
268                         compatible = "fixed-partitions";
269                         #address-cells = <1>;
270                         #size-cells = <1>;
271
272                         partition@0 {
273                                 label = "kernel";
274                                 reg = <0x00000000 0x02000000>;  /* 32 MiB */
275                         };
276
277                         partition@2000000 {
278                                 label = "ubi";
279                                 reg = <0x02000000 0x1e000000>;  /* 480 MiB */
280                         };
281                 };
282         };
283 };
284
285 &spi0 {
286         status = "okay";
287         pinctrl-0 = <&spi0_pins2>;
288         pinctrl-names = "default";
289
290         spi-flash@0 {
291                 #address-cells = <1>;
292                 #size-cells = <1>;
293                 compatible = "mxicy,mx25l8005", "jedec,spi-nor";
294                 reg = <0>; /* Chip select 0 */
295                 spi-max-frequency = <50000000>;
296
297                 partitions {
298                         compatible = "fixed-partitions";
299                         #address-cells = <1>;
300                         #size-cells = <1>;
301
302                         partition@0 {
303                                 reg = <0x00000 0xf0000>; /* 960 KiB*/
304                                 label = "u-boot";
305                                 read-only;
306                         };
307                         partition@f0000 {
308                                 reg = <0xf0000 0x10000>; /* 64 KiB */
309                                 label = "u-boot-env";
310                         };
311                 };
312         };
313 };
314
315 &pinctrl {
316         pmx_power_cpu: pmx-power-cpu {
317                 marvell,pins = "mpp4";
318                 marvell,function = "vdd";
319         };
320         pmx_power_usb: pmx-power-usb {
321                 marvell,pins = "mpp5";
322                 marvell,function = "gpo";
323         };
324         pmx_power_hdd1: pmx-power-hdd1 {
325                 marvell,pins = "mpp8";
326                 marvell,function = "gpio";
327         };
328         pmx_power_hdd2: pmx-power-hdd2 {
329                 marvell,pins = "mpp9";
330                 marvell,function = "gpo";
331         };
332         pmx_fan_lock: pmx-fan-lock {
333                 marvell,pins = "mpp10";
334                 marvell,function = "gpio";
335         };
336         pmx_hdd_present: pmx-hdd-present {
337                 marvell,pins = "mpp11", "mpp12";
338                 marvell,function = "gpio";
339         };
340         pmx_fan_high: pmx-fan-high {
341                 marvell,pins = "mpp13";
342                 marvell,function = "gpio";
343         };
344         pmx_fan_low: pmx-fan-low {
345                 marvell,pins = "mpp14";
346                 marvell,function = "gpio";
347         };
348         pmx_buttons: pmx-buttons {
349                 marvell,pins = "mpp15", "mpp16";
350                 marvell,function = "gpio";
351         };
352         pmx_leds1: pmx-leds {
353                 marvell,pins = "mpp7", "mpp54", "mpp59", "mpp61";
354                 marvell,function = "gpo";
355         };
356         pmx_leds2: pmx-leds {
357                 marvell,pins = "mpp55", "mpp57", "mpp62";
358                 marvell,function = "gpio";
359         };
360 };