Merge remote-tracking branches 'regulator/fix/88pm800', 'regulator/fix/max8973',...
[linux-drm-fsl-dcu.git] / arch / arm / boot / dts / armada-370-synology-ds213j.dts
1 /*
2  * Device Tree file for Synology DS213j
3  *
4  * Copyright (C) 2014, 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  * Note: this Device Tree assumes that the bootloader has remapped the
45  * internal registers to 0xf1000000 (instead of the old 0xd0000000).
46  * The 0xf1000000 is the default used by the recent, DT-capable, U-Boot
47  * bootloaders provided by Marvell. It is used in recent versions of
48  * DSM software provided by Synology. Nonetheless, some earlier boards
49  * were delivered with an older version of u-boot that left internal
50  * registers mapped at 0xd0000000. If you have such a device you will
51  * not be able to directly boot a kernel based on this Device Tree. In
52  * that case, the preferred solution is to update your bootloader (e.g.
53  * by upgrading to latest version of DSM, or building a new one and
54  * installing it from u-boot prompt) or adjust the Devive Tree
55  * (s/0xf1000000/0xd0000000/ in 'ranges' below).
56  */
57
58 /dts-v1/;
59
60 #include <dt-bindings/input/input.h>
61 #include <dt-bindings/gpio/gpio.h>
62 #include "armada-370.dtsi"
63
64 / {
65         model = "Synology DS213j";
66         compatible = "synology,ds213j", "marvell,armada370",
67                      "marvell,armada-370-xp";
68
69         chosen {
70                 stdout-path = "serial0:115200n8";
71         };
72
73         memory {
74                 device_type = "memory";
75                 reg = <0x00000000 0x20000000>; /* 512 MB */
76         };
77
78         soc {
79                 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000
80                           MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000>;
81
82                 internal-regs {
83
84                         /* RTC provided by Seiko S-35390A I2C RTC chip below */
85                         rtc@10300 {
86                                 status = "disabled";
87                         };
88
89                         spi0: spi@10600 {
90                                 status = "okay";
91
92                                 spi-flash@0 {
93                                         #address-cells = <1>;
94                                         #size-cells = <1>;
95                                         compatible = "micron,n25q064", "jedec,spi-nor";
96                                         reg = <0>; /* Chip select 0 */
97                                         spi-max-frequency = <20000000>;
98
99                                         /*
100                                          * Warning!
101                                          *
102                                          * Synology u-boot uses its compiled-in environment
103                                          * and it seems Synology did not care to change u-boot
104                                          * default configuration in order to allow saving a
105                                          * modified environment at a sensible location. So,
106                                          * if you do a 'saveenv' under u-boot, your modified
107                                          * environment will be saved at 1MB after the start
108                                          * of the flash, i.e. in the middle of the uImage.
109                                          * For that reason, it is strongly advised not to
110                                          * change the default environment, unless you know
111                                          * what you are doing.
112                                          */
113                                         partition@00000000 { /* u-boot */
114                                                 label = "RedBoot";
115                                                 reg = <0x00000000 0x000c0000>; /* 768KB */
116                                         };
117
118                                         partition@000c0000 { /* uImage */
119                                                 label = "zImage";
120                                                 reg = <0x000c0000 0x002d0000>; /* 2880KB */
121                                         };
122
123                                         partition@00390000 { /* uInitramfs */
124                                                 label = "rd.gz";
125                                                 reg = <0x00390000 0x00440000>; /* 4250KB */
126                                         };
127
128                                         partition@007d0000 { /* MAC address and serial number */
129                                                 label = "vendor";
130                                                 reg = <0x007d0000 0x00010000>; /* 64KB */
131                                         };
132
133                                         partition@007e0000 {
134                                                 label = "RedBoot config";
135                                                 reg = <0x007e0000 0x00010000>; /* 64KB */
136                                         };
137
138                                         partition@007f0000 {
139                                                 label = "FIS directory";
140                                                 reg = <0x007f0000 0x00010000>; /* 64KB */
141                                         };
142                                 };
143                         };
144
145                         i2c@11000 {
146                                 compatible = "marvell,mv64xxx-i2c";
147                                 pinctrl-0 = <&i2c0_pins>;
148                                 pinctrl-names = "default";
149                                 clock-frequency = <400000>;
150                                 status = "okay";
151
152                                 /* Main device RTC chip */
153                                 s35390a: s35390a@30 {
154                                          compatible = "sii,s35390a";
155                                          reg = <0x30>;
156                                 };
157                         };
158
159                         /* Connected to a header on device's PCB */
160                         serial@12000 {
161                                 status = "okay";
162                         };
163
164                         /* Connected to a TI MSP430F2111 for power control */
165                         serial@12100 {
166                                 status = "okay";
167                         };
168
169                         poweroff@12100 {
170                                 compatible = "synology,power-off";
171                                 reg = <0x12100 0x100>;
172                                 clocks = <&coreclk 0>;
173                         };
174
175                         /* rear USB port, near reset button */
176                         usb@50000 {
177                                 status = "okay";
178                         };
179
180                         /* rear USB port, near RJ45 port */
181                         usb@51000 {
182                                 status = "okay";
183                         };
184
185                         mdio {
186                                 phy1: ethernet-phy@1 { /* Marvell 88E1512 */
187                                         reg = <1>;
188                                 };
189                         };
190
191                         ethernet@70000 {
192                                status = "okay";
193                                phy = <&phy1>;
194                                phy-mode = "sgmii";
195                         };
196
197                         sata@a0000 {
198                                 nr-ports = <2>;
199                                 status = "okay";
200                         };
201                 };
202         };
203
204         gpio-fan-32-38 {
205                 status = "okay";
206                 compatible = "gpio-fan";
207                 pinctrl-0 = <&fan_ctrl_low_pin &fan_ctrl_mid_pin
208                              &fan_ctrl_high_pin &fan_alarm_pin>;
209                 pinctrl-names = "default";
210                 gpios = <&gpio1 31 GPIO_ACTIVE_HIGH
211                          &gpio2  0 GPIO_ACTIVE_HIGH
212                          &gpio2  1 GPIO_ACTIVE_HIGH>;
213                 alarm-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
214                 gpio-fan,speed-map = <    0 0
215                                        1000 1
216                                        1150 2
217                                        1350 4
218                                        1500 3
219                                        1650 5
220                                        1750 6
221                                        1900 7 >;
222         };
223
224         gpio-leds {
225                 compatible = "gpio-leds";
226                 pinctrl-0 = <&disk1_led_pin
227                              &disk2_led_pin>;
228                 pinctrl-names = "default";
229
230                 disk1-led-amber {
231                         label = "synology:amber:disk1";
232                         gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
233                         default-state = "keep";
234                 };
235
236                 disk2-led-amber {
237                         label = "synology:amber:disk2";
238                         gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
239                         default-state = "keep";
240                 };
241         };
242
243         regulators {
244                 compatible = "simple-bus";
245                 #address-cells = <1>;
246                 #size-cells = <0>;
247                 pinctrl-0 = <&sata1_pwr_pin &sata2_pwr_pin>;
248                 pinctrl-names = "default";
249
250                 sata1_regulator: sata1-regulator {
251                         compatible = "regulator-fixed";
252                         reg = <1>;
253                         regulator-name = "SATA1 Power";
254                         regulator-min-microvolt = <5000000>;
255                         regulator-max-microvolt = <5000000>;
256                         startup-delay-us = <2000000>;
257                         enable-active-high;
258                         regulator-always-on;
259                         regulator-boot-on;
260                         gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>;
261                 };
262
263                 sata2_regulator: sata2-regulator {
264                         compatible = "regulator-fixed";
265                         reg = <2>;
266                         regulator-name = "SATA2 Power";
267                         regulator-min-microvolt = <5000000>;
268                         regulator-max-microvolt = <5000000>;
269                         startup-delay-us = <4000000>;
270                         enable-active-high;
271                         regulator-always-on;
272                         regulator-boot-on;
273                         gpio = <&gpio1 30 GPIO_ACTIVE_HIGH>;
274                 };
275         };
276 };
277
278 &pinctrl {
279         disk1_led_pin: disk1-led-pin {
280                 marvell,pins = "mpp31";
281                 marvell,function = "gpio";
282         };
283
284         disk2_led_pin: disk2-led-pin {
285                 marvell,pins = "mpp32";
286                 marvell,function = "gpio";
287         };
288
289         sata1_pwr_pin: sata1-pwr-pin {
290                 marvell,pins = "mpp37";
291                 marvell,function = "gpio";
292         };
293
294         sata2_pwr_pin: sata2-pwr-pin {
295                 marvell,pins = "mpp62";
296                 marvell,function = "gpio";
297         };
298
299         sata1_pres_pin: sata1-pres-pin {
300                 marvell,pins = "mpp60";
301                 marvell,function = "gpio";
302         };
303
304         sata2_pres_pin: sata2-pres-pin {
305                 marvell,pins = "mpp48";
306                 marvell,function = "gpio";
307         };
308
309         syno_id_bit0_pin: syno-id-bit0-pin {
310                 marvell,pins = "mpp55";
311                 marvell,function = "gpio";
312         };
313
314         syno_id_bit1_pin: syno-id-bit1-pin {
315                 marvell,pins = "mpp56";
316                 marvell,function = "gpio";
317         };
318
319         syno_id_bit2_pin: syno-id-bit2-pin {
320                 marvell,pins = "mpp57";
321                 marvell,function = "gpio";
322         };
323
324         syno_id_bit3_pin: syno-id-bit3-pin {
325                 marvell,pins = "mpp58";
326                 marvell,function = "gpio";
327         };
328
329         fan_ctrl_low_pin: fan-ctrl-low-pin {
330                 marvell,pins = "mpp65";
331                 marvell,function = "gpio";
332         };
333
334         fan_ctrl_mid_pin: fan-ctrl-mid-pin {
335                 marvell,pins = "mpp64";
336                 marvell,function = "gpio";
337         };
338
339         fan_ctrl_high_pin: fan-ctrl-high-pin {
340                 marvell,pins = "mpp63";
341                 marvell,function = "gpo";
342         };
343
344         fan_alarm_pin: fan-alarm-pin {
345                 marvell,pins = "mpp38";
346                 marvell,function = "gpio";
347         };
348 };