GNU Linux-libre 4.14.266-gnu1
[releases.git] / arch / arm / boot / dts / sun9i-a80-optimus.dts
1 /*
2  * Copyright 2014 Chen-Yu Tsai
3  *
4  * Chen-Yu Tsai <wens@csie.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 "AS IS", 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 #include "sun9i-a80.dtsi"
47
48 #include <dt-bindings/gpio/gpio.h>
49
50 / {
51         model = "Merrii A80 Optimus Board";
52         compatible = "merrii,a80-optimus", "allwinner,sun9i-a80";
53
54         aliases {
55                 serial0 = &uart0;
56                 serial1 = &uart4;
57         };
58
59         chosen {
60                 stdout-path = "serial0:115200n8";
61         };
62
63         leds {
64                 compatible = "gpio-leds";
65                 pinctrl-names = "default";
66                 pinctrl-0 = <&led_pins_optimus>, <&led_r_pins_optimus>;
67
68                 /* The LED names match those found on the board */
69
70                 led2 {
71                         label = "optimus:led2:usr";
72                         gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>;
73                 };
74
75                 led3 {
76                         label = "optimus:led3:usr";
77                         gpios = <&r_pio 1 15 GPIO_ACTIVE_HIGH>; /* PM15 */
78                 };
79
80                 led4 {
81                         label = "optimus:led4:usr";
82                         gpios = <&pio 7 0 GPIO_ACTIVE_HIGH>;
83                 };
84         };
85
86         reg_usb1_vbus: usb1-vbus {
87                 compatible = "regulator-fixed";
88                 pinctrl-names = "default";
89                 pinctrl-0 = <&usb1_vbus_pin_optimus>;
90                 regulator-name = "usb1-vbus";
91                 regulator-min-microvolt = <5000000>;
92                 regulator-max-microvolt = <5000000>;
93                 enable-active-high;
94                 gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
95         };
96
97         reg_usb3_vbus: usb3-vbus {
98                 compatible = "regulator-fixed";
99                 pinctrl-names = "default";
100                 pinctrl-0 = <&usb3_vbus_pin_optimus>;
101                 regulator-name = "usb3-vbus";
102                 regulator-min-microvolt = <5000000>;
103                 regulator-max-microvolt = <5000000>;
104                 enable-active-high;
105                 gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
106         };
107
108         wifi_pwrseq: wifi_pwrseq {
109                 compatible = "mmc-pwrseq-simple";
110                 clocks = <&ac100_rtc 1>;
111                 clock-names = "ext_clock";
112                 /* enables internal regulator and de-asserts reset */
113                 reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 WL-PMU-EN */
114         };
115 };
116
117 &ehci0 {
118         status = "okay";
119 };
120
121 &ehci1 {
122         /* Enable if HSIC peripheral is connected */
123         status = "disabled";
124 };
125
126 &ehci2 {
127         status = "okay";
128 };
129
130 &mmc0 {
131         pinctrl-names = "default";
132         pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin_optimus>;
133         vmmc-supply = <&reg_dcdc1>;
134         bus-width = <4>;
135         cd-gpios = <&pio 7 18 GPIO_ACTIVE_HIGH>; /* PH8 */
136         cd-inverted;
137         status = "okay";
138 };
139
140 &mmc1 {
141         pinctrl-names = "default";
142         pinctrl-0 = <&mmc1_pins>, <&wifi_en_pin_optimus>;
143         vmmc-supply = <&reg_dldo1>;
144         vqmmc-supply = <&reg_cldo3>;
145         mmc-pwrseq = <&wifi_pwrseq>;
146         bus-width = <4>;
147         non-removable;
148         status = "okay";
149 };
150
151 &mmc1_pins {
152         bias-pull-up;
153 };
154
155 &mmc2 {
156         pinctrl-names = "default";
157         pinctrl-0 = <&mmc2_8bit_pins>;
158         vmmc-supply = <&reg_dcdc1>;
159         bus-width = <8>;
160         non-removable;
161         cap-mmc-hw-reset;
162         status = "okay";
163 };
164
165 &mmc2_8bit_pins {
166         /* Increase drive strength for DDR modes */
167         drive-strength = <40>;
168 };
169
170 &ohci0 {
171         status = "okay";
172 };
173
174 &ohci2 {
175         status = "okay";
176 };
177
178 &osc32k {
179         /* osc32k input is from AC100 */
180         clocks = <&ac100_rtc 0>;
181 };
182
183 &pio {
184         led_pins_optimus: led-pins@0 {
185                 pins = "PH0", "PH1";
186                 function = "gpio_out";
187         };
188
189         mmc0_cd_pin_optimus: mmc0_cd_pin@0 {
190                 pins = "PH18";
191                 function = "gpio_in";
192                 bias-pull-up;
193         };
194
195         usb1_vbus_pin_optimus: usb1_vbus_pin@1 {
196                 pins = "PH4";
197                 function = "gpio_out";
198         };
199
200         usb3_vbus_pin_optimus: usb3_vbus_pin@1 {
201                 pins = "PH5";
202                 function = "gpio_out";
203         };
204 };
205
206 &r_ir {
207         status = "okay";
208 };
209
210 &r_pio {
211         led_r_pins_optimus: led-pins@1 {
212                 pins = "PM15";
213                 function = "gpio_out";
214         };
215
216         wifi_en_pin_optimus: wifi_en_pin@0 {
217                 pins = "PL2";
218                 function = "gpio_out";
219         };
220 };
221
222 &r_rsb {
223         status = "okay";
224
225         axp809: pmic@3a3 {
226                 reg = <0x3a3>;
227                 interrupt-parent = <&nmi_intc>;
228                 interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
229
230                 regulators {
231                         reg_aldo1: aldo1 {
232                                 /*
233                                  * TODO: This should be handled by the
234                                  * USB PHY driver.
235                                  */
236                                 regulator-always-on;
237                                 regulator-min-microvolt = <3000000>;
238                                 regulator-max-microvolt = <3000000>;
239                                 regulator-name = "vcc33-usbh";
240                         };
241
242                         reg_aldo2: aldo2 {
243                                 regulator-min-microvolt = <1800000>;
244                                 regulator-max-microvolt = <1800000>;
245                                 regulator-name = "vcc-pb-io-cam";
246                         };
247
248                         aldo3 {
249                                 /* unused */
250                         };
251
252                         reg_dc5ldo: dc5ldo {
253                                 regulator-always-on;
254                                 regulator-min-microvolt = <800000>;
255                                 regulator-max-microvolt = <1100000>;
256                                 regulator-name = "vdd-cpus-09-usbh";
257                         };
258
259                         reg_dcdc1: dcdc1 {
260                                 regulator-always-on;
261                                 regulator-min-microvolt = <3000000>;
262                                 regulator-max-microvolt = <3000000>;
263                                 regulator-name = "vcc-3v";
264                         };
265
266                         reg_dcdc2: dcdc2 {
267                                 regulator-min-microvolt = <800000>;
268                                 regulator-max-microvolt = <1100000>;
269                                 regulator-name = "vdd-gpu";
270                         };
271
272                         reg_dcdc3: dcdc3 {
273                                 regulator-always-on;
274                                 regulator-min-microvolt = <800000>;
275                                 regulator-max-microvolt = <1100000>;
276                                 regulator-name = "vdd-cpua";
277                         };
278
279                         reg_dcdc4: dcdc4 {
280                                 regulator-always-on;
281                                 regulator-min-microvolt = <800000>;
282                                 regulator-max-microvolt = <1100000>;
283                                 regulator-name = "vdd-sys-usb0-hdmi";
284                         };
285
286                         reg_dcdc5: dcdc5 {
287                                 regulator-always-on;
288                                 regulator-min-microvolt = <1425000>;
289                                 regulator-max-microvolt = <1575000>;
290                                 regulator-name = "vcc-dram";
291                         };
292
293                         reg_dldo1: dldo1 {
294                                 /*
295                                  * The WiFi chip supports a wide range
296                                  * (3.0 ~ 4.8V) of voltages, and so does
297                                  * this regulator (3.0 ~ 4.2V), but
298                                  * Allwinner SDK always sets it to 3.3V.
299                                  */
300                                 regulator-min-microvolt = <3300000>;
301                                 regulator-max-microvolt = <3300000>;
302                                 regulator-name = "vcc-wifi";
303                         };
304
305                         reg_dldo2: dldo2 {
306                                 regulator-always-on;
307                                 regulator-min-microvolt = <3000000>;
308                                 regulator-max-microvolt = <3000000>;
309                                 regulator-name = "vcc-pl";
310                         };
311
312                         reg_eldo1: eldo1 {
313                                 regulator-min-microvolt = <1200000>;
314                                 regulator-max-microvolt = <1200000>;
315                                 regulator-name = "vcc-dvdd-cam";
316                         };
317
318                         reg_eldo2: eldo2 {
319                                 regulator-min-microvolt = <1800000>;
320                                 regulator-max-microvolt = <1800000>;
321                                 regulator-name = "vcc-pe";
322                         };
323
324                         reg_eldo3: eldo3 {
325                                 regulator-always-on;
326                                 regulator-min-microvolt = <3000000>;
327                                 regulator-max-microvolt = <3000000>;
328                                 regulator-name = "vcc-pm-codec-io1";
329                         };
330
331                         reg_ldo_io0: ldo_io0 {
332                                 regulator-always-on;
333                                 regulator-min-microvolt = <3000000>;
334                                 regulator-max-microvolt = <3000000>;
335                                 regulator-name = "vcc-pg";
336                         };
337
338                         reg_ldo_io1: ldo_io1 {
339                                 regulator-min-microvolt = <2500000>;
340                                 regulator-max-microvolt = <2500000>;
341                                 regulator-name = "vcc-pa-gmac-2v5";
342                         };
343
344                         reg_rtc_ldo: rtc_ldo {
345                                 regulator-name = "vcc-rtc-vdd1v8-io";
346                         };
347
348                         sw {
349                                 /* unused */
350                         };
351                 };
352         };
353
354         axp806: pmic@745 {
355                 compatible = "x-powers,axp806";
356                 reg = <0x745>;
357                 interrupt-parent = <&nmi_intc>;
358                 interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
359                 interrupt-controller;
360                 #interrupt-cells = <1>;
361                 bldoin-supply = <&reg_dcdce>;
362
363                 regulators {
364                         reg_s_aldo1: aldo1 {
365                                 regulator-always-on;
366                                 regulator-min-microvolt = <3000000>;
367                                 regulator-max-microvolt = <3000000>;
368                                 regulator-name = "avcc";
369                         };
370
371                         aldo2 {
372                                 /*
373                                  * unused, but use a different name to
374                                  * avoid name clash with axp809's aldo's
375                                  */
376                                 regulator-name = "s_aldo2";
377                         };
378
379                         aldo3 {
380                                 /*
381                                  * unused, but use a different name to
382                                  * avoid name clash with axp809's aldo's
383                                  */
384                                 regulator-name = "s_aldo3";
385                         };
386
387                         reg_bldo1: bldo1 {
388                                 regulator-always-on;
389                                 regulator-min-microvolt = <1700000>;
390                                 regulator-max-microvolt = <1900000>;
391                                 regulator-name = "vcc18-efuse-adc-display-csi";
392                         };
393
394                         reg_bldo2: bldo2 {
395                                 regulator-always-on;
396                                 regulator-min-microvolt = <1700000>;
397                                 regulator-max-microvolt = <1900000>;
398                                 regulator-name =
399                                         "vdd18-drampll-vcc18-pll-cpvdd";
400                         };
401
402                         bldo3 {
403                                 /* unused */
404                         };
405
406                         reg_bldo4: bldo4 {
407                                 regulator-min-microvolt = <1100000>;
408                                 regulator-max-microvolt = <1300000>;
409                                 regulator-name = "vcc12-hsic";
410                         };
411
412                         reg_cldo1: cldo1 {
413                                 /*
414                                  * This was 3V in the original design, but
415                                  * 3.3V is the recommended supply voltage
416                                  * for the Ethernet PHY.
417                                  */
418                                 regulator-min-microvolt = <3300000>;
419                                 regulator-max-microvolt = <3300000>;
420                                 regulator-name = "vcc-gmac-phy";
421                         };
422
423                         reg_cldo2: cldo2 {
424                                 regulator-min-microvolt = <2800000>;
425                                 regulator-max-microvolt = <2800000>;
426                                 regulator-name = "afvcc-cam";
427                         };
428
429                         reg_cldo3: cldo3 {
430                                 regulator-min-microvolt = <3000000>;
431                                 regulator-max-microvolt = <3000000>;
432                                 regulator-name = "vcc-io-wifi-codec-io2";
433                         };
434
435                         reg_dcdca: dcdca {
436                                 regulator-always-on;
437                                 regulator-min-microvolt = <800000>;
438                                 regulator-max-microvolt = <1100000>;
439                                 regulator-name = "vdd-cpub";
440                         };
441
442                         reg_dcdcd: dcdcd {
443                                 regulator-always-on;
444                                 regulator-min-microvolt = <800000>;
445                                 regulator-max-microvolt = <1100000>;
446                                 regulator-name = "vdd-vpu";
447                         };
448
449                         reg_dcdce: dcdce {
450                                 regulator-always-on;
451                                 regulator-min-microvolt = <2100000>;
452                                 regulator-max-microvolt = <2100000>;
453                                 regulator-name = "vcc-bldo-codec-ldoin";
454                         };
455
456                         sw {
457                                 /*
458                                  * unused, but use a different name to
459                                  * avoid name clash with axp809's sw
460                                  */
461                                 regulator-name = "s_sw";
462                         };
463                 };
464         };
465
466         ac100: codec@e89 {
467                 compatible = "x-powers,ac100";
468                 reg = <0xe89>;
469
470                 ac100_codec: codec {
471                         compatible = "x-powers,ac100-codec";
472                         interrupt-parent = <&r_pio>;
473                         interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>; /* PL9 */
474                         #clock-cells = <0>;
475                         clock-output-names = "4M_adda";
476                 };
477
478                 ac100_rtc: rtc {
479                         compatible = "x-powers,ac100-rtc";
480                         interrupt-parent = <&nmi_intc>;
481                         interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
482                         clocks = <&ac100_codec>;
483                         #clock-cells = <1>;
484                         clock-output-names = "cko1_rtc",
485                                              "cko2_rtc",
486                                              "cko3_rtc";
487                 };
488         };
489 };
490
491 #include "axp809.dtsi"
492
493 &uart0 {
494         pinctrl-names = "default";
495         pinctrl-0 = <&uart0_pins_a>;
496         status = "okay";
497 };
498
499 &usbphy1 {
500         phy-supply = <&reg_usb1_vbus>;
501         status = "okay";
502 };
503
504 &usbphy2 {
505         phy-supply = <&reg_bldo4>;
506         /* Enable if HSIC peripheral is connected */
507         status = "disabled";
508 };
509
510 &usbphy3 {
511         phy-supply = <&reg_usb3_vbus>;
512         status = "okay";
513 };