Merge tag 'for-linus-5.1a-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / arm64 / boot / dts / rockchip / rk3399-nanopi4.dtsi
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2 /*
3  * RK3399-based FriendlyElec boards device tree source
4  *
5  * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd
6  *
7  * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
8  * (http://www.friendlyarm.com)
9  *
10  * Copyright (c) 2018 Collabora Ltd.
11  * Copyright (c) 2019 Arm Ltd.
12  */
13
14 /dts-v1/;
15 #include <dt-bindings/input/linux-event-codes.h>
16 #include "rk3399.dtsi"
17 #include "rk3399-opp.dtsi"
18
19 / {
20         chosen {
21                 stdout-path = "serial2:1500000n8";
22         };
23
24         clkin_gmac: external-gmac-clock {
25                 compatible = "fixed-clock";
26                 clock-frequency = <125000000>;
27                 clock-output-names = "clkin_gmac";
28                 #clock-cells = <0>;
29         };
30
31         vcc3v3_sys: vcc3v3-sys {
32                 compatible = "regulator-fixed";
33                 regulator-always-on;
34                 regulator-boot-on;
35                 regulator-min-microvolt = <3300000>;
36                 regulator-max-microvolt = <3300000>;
37                 regulator-name = "vcc3v3_sys";
38         };
39
40         vcc5v0_sys: vcc5v0-sys {
41                 compatible = "regulator-fixed";
42                 regulator-always-on;
43                 regulator-boot-on;
44                 regulator-min-microvolt = <5000000>;
45                 regulator-max-microvolt = <5000000>;
46                 regulator-name = "vcc5v0_sys";
47                 vin-supply = <&vdd_5v>;
48         };
49
50         /* switched by pmic_sleep */
51         vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
52                 compatible = "regulator-fixed";
53                 regulator-always-on;
54                 regulator-boot-on;
55                 regulator-min-microvolt = <1800000>;
56                 regulator-max-microvolt = <1800000>;
57                 regulator-name = "vcc1v8_s3";
58                 vin-supply = <&vcc_1v8>;
59         };
60
61         vcc3v0_sd: vcc3v0-sd {
62                 compatible = "regulator-fixed";
63                 enable-active-high;
64                 gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
65                 pinctrl-names = "default";
66                 pinctrl-0 = <&sdmmc0_pwr_h>;
67                 regulator-always-on;
68                 regulator-min-microvolt = <3000000>;
69                 regulator-max-microvolt = <3000000>;
70                 regulator-name = "vcc3v0_sd";
71                 vin-supply = <&vcc3v3_sys>;
72         };
73
74         vbus_typec: vbus-typec {
75                 compatible = "regulator-fixed";
76                 regulator-min-microvolt = <5000000>;
77                 regulator-max-microvolt = <5000000>;
78                 regulator-name = "vbus_typec";
79         };
80
81         gpio-keys {
82                 compatible = "gpio-keys";
83                 autorepeat;
84                 pinctrl-names = "default";
85                 pinctrl-0 = <&power_key>;
86
87                 power {
88                         debounce-interval = <100>;
89                         gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
90                         label = "GPIO Key Power";
91                         linux,code = <KEY_POWER>;
92                         wakeup-source;
93                 };
94         };
95
96         leds: gpio-leds {
97                 compatible = "gpio-leds";
98                 pinctrl-names = "default";
99                 pinctrl-0 = <&leds_gpio>;
100
101                 status {
102                         gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
103                         label = "status_led";
104                         linux,default-trigger = "heartbeat";
105                 };
106         };
107
108         sdio_pwrseq: sdio-pwrseq {
109                 compatible = "mmc-pwrseq-simple";
110                 clocks = <&rk808 1>;
111                 clock-names = "ext_clock";
112                 pinctrl-names = "default";
113                 pinctrl-0 = <&wifi_reg_on_h>;
114                 reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
115         };
116 };
117
118 &cpu_b0 {
119         cpu-supply = <&vdd_cpu_b>;
120 };
121
122 &cpu_b1 {
123         cpu-supply = <&vdd_cpu_b>;
124 };
125
126 &cpu_l0 {
127         cpu-supply = <&vdd_cpu_l>;
128 };
129
130 &cpu_l1 {
131         cpu-supply = <&vdd_cpu_l>;
132 };
133
134 &cpu_l2 {
135         cpu-supply = <&vdd_cpu_l>;
136 };
137
138 &cpu_l3 {
139         cpu-supply = <&vdd_cpu_l>;
140 };
141
142 &emmc_phy {
143         status = "okay";
144 };
145
146 &gmac {
147         assigned-clock-parents = <&clkin_gmac>;
148         assigned-clocks = <&cru SCLK_RMII_SRC>;
149         clock_in_out = "input";
150         pinctrl-names = "default";
151         pinctrl-0 = <&rgmii_pins>;
152         phy-mode = "rgmii";
153         phy-supply = <&vcc3v3_s3>;
154         snps,reset-active-low;
155         snps,reset-delays-us = <0 10000 50000>;
156         snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
157         tx_delay = <0x28>;
158         rx_delay = <0x11>;
159         status = "okay";
160 };
161
162 &gpu {
163         mali-supply = <&vdd_gpu>;
164         status = "okay";
165 };
166
167 &hdmi {
168         ddc-i2c-bus = <&i2c7>;
169         pinctrl-names = "default";
170         pinctrl-0 = <&hdmi_cec>;
171         status = "okay";
172 };
173
174 &i2c0 {
175         clock-frequency = <400000>;
176         i2c-scl-rising-time-ns = <160>;
177         i2c-scl-falling-time-ns = <30>;
178         status = "okay";
179
180         vdd_cpu_b: regulator@40 {
181                 compatible = "silergy,syr827";
182                 reg = <0x40>;
183                 fcs,suspend-voltage-selector = <1>;
184                 pinctrl-names = "default";
185                 pinctrl-0 = <&cpu_b_sleep>;
186                 regulator-always-on;
187                 regulator-boot-on;
188                 regulator-min-microvolt = <712500>;
189                 regulator-max-microvolt = <1500000>;
190                 regulator-name = "vdd_cpu_b";
191                 regulator-ramp-delay = <1000>;
192                 vin-supply = <&vcc3v3_sys>;
193
194                 regulator-state-mem {
195                         regulator-off-in-suspend;
196                 };
197         };
198
199         vdd_gpu: regulator@41 {
200                 compatible = "silergy,syr828";
201                 reg = <0x41>;
202                 fcs,suspend-voltage-selector = <1>;
203                 pinctrl-names = "default";
204                 pinctrl-0 = <&gpu_sleep>;
205                 regulator-always-on;
206                 regulator-boot-on;
207                 regulator-min-microvolt = <712500>;
208                 regulator-max-microvolt = <1500000>;
209                 regulator-name = "vdd_gpu";
210                 regulator-ramp-delay = <1000>;
211                 vin-supply = <&vcc3v3_sys>;
212
213                 regulator-state-mem {
214                         regulator-off-in-suspend;
215                 };
216         };
217
218         rk808: pmic@1b {
219                 compatible = "rockchip,rk808";
220                 reg = <0x1b>;
221                 clock-output-names = "xin32k", "rtc_clko_wifi";
222                 #clock-cells = <1>;
223                 interrupt-parent = <&gpio1>;
224                 interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
225                 pinctrl-names = "default";
226                 pinctrl-0 = <&pmic_int_l>;
227                 rockchip,system-power-controller;
228                 wakeup-source;
229
230                 vcc1-supply = <&vcc3v3_sys>;
231                 vcc2-supply = <&vcc3v3_sys>;
232                 vcc3-supply = <&vcc3v3_sys>;
233                 vcc4-supply = <&vcc3v3_sys>;
234                 vcc6-supply = <&vcc3v3_sys>;
235                 vcc7-supply = <&vcc3v3_sys>;
236                 vcc8-supply = <&vcc3v3_sys>;
237                 vcc9-supply = <&vcc3v3_sys>;
238                 vcc10-supply = <&vcc3v3_sys>;
239                 vcc11-supply = <&vcc3v3_sys>;
240                 vcc12-supply = <&vcc3v3_sys>;
241                 vddio-supply = <&vcc_3v0>;
242
243                 regulators {
244                         vdd_center: DCDC_REG1 {
245                                 regulator-always-on;
246                                 regulator-boot-on;
247                                 regulator-min-microvolt = <750000>;
248                                 regulator-max-microvolt = <1350000>;
249                                 regulator-name = "vdd_center";
250                                 regulator-ramp-delay = <6001>;
251
252                                 regulator-state-mem {
253                                         regulator-off-in-suspend;
254                                 };
255                         };
256
257                         vdd_cpu_l: DCDC_REG2 {
258                                 regulator-always-on;
259                                 regulator-boot-on;
260                                 regulator-min-microvolt = <750000>;
261                                 regulator-max-microvolt = <1350000>;
262                                 regulator-name = "vdd_cpu_l";
263                                 regulator-ramp-delay = <6001>;
264
265                                 regulator-state-mem {
266                                         regulator-off-in-suspend;
267                                 };
268                         };
269
270                         vcc_ddr: DCDC_REG3 {
271                                 regulator-always-on;
272                                 regulator-boot-on;
273                                 regulator-name = "vcc_ddr";
274
275                                 regulator-state-mem {
276                                         regulator-on-in-suspend;
277                                 };
278                         };
279
280                         vcc_1v8: DCDC_REG4 {
281                                 regulator-always-on;
282                                 regulator-boot-on;
283                                 regulator-min-microvolt = <1800000>;
284                                 regulator-max-microvolt = <1800000>;
285                                 regulator-name = "vcc_1v8";
286
287                                 regulator-state-mem {
288                                         regulator-on-in-suspend;
289                                         regulator-suspend-microvolt = <1800000>;
290                                 };
291                         };
292
293                         vcc1v8_cam: LDO_REG1 {
294                                 regulator-always-on;
295                                 regulator-boot-on;
296                                 regulator-min-microvolt = <1800000>;
297                                 regulator-max-microvolt = <1800000>;
298                                 regulator-name = "vcc1v8_cam";
299
300                                 regulator-state-mem {
301                                         regulator-off-in-suspend;
302                                 };
303                         };
304
305                         vcc3v0_touch: LDO_REG2 {
306                                 regulator-always-on;
307                                 regulator-boot-on;
308                                 regulator-min-microvolt = <3000000>;
309                                 regulator-max-microvolt = <3000000>;
310                                 regulator-name = "vcc3v0_touch";
311
312                                 regulator-state-mem {
313                                         regulator-off-in-suspend;
314                                 };
315                         };
316
317                         vcc1v8_pmupll: LDO_REG3 {
318                                 regulator-always-on;
319                                 regulator-boot-on;
320                                 regulator-min-microvolt = <1800000>;
321                                 regulator-max-microvolt = <1800000>;
322                                 regulator-name = "vcc1v8_pmupll";
323
324                                 regulator-state-mem {
325                                         regulator-on-in-suspend;
326                                         regulator-suspend-microvolt = <1800000>;
327                                 };
328                         };
329
330                         vcc_sdio: LDO_REG4 {
331                                 regulator-always-on;
332                                 regulator-boot-on;
333                                 regulator-init-microvolt = <3000000>;
334                                 regulator-min-microvolt = <1800000>;
335                                 regulator-max-microvolt = <3300000>;
336                                 regulator-name = "vcc_sdio";
337
338                                 regulator-state-mem {
339                                         regulator-on-in-suspend;
340                                         regulator-suspend-microvolt = <3000000>;
341                                 };
342                         };
343
344                         vcca3v0_codec: LDO_REG5 {
345                                 regulator-always-on;
346                                 regulator-boot-on;
347                                 regulator-min-microvolt = <3000000>;
348                                 regulator-max-microvolt = <3000000>;
349                                 regulator-name = "vcca3v0_codec";
350
351                                 regulator-state-mem {
352                                         regulator-off-in-suspend;
353                                 };
354                         };
355
356                         vcc_1v5: LDO_REG6 {
357                                 regulator-always-on;
358                                 regulator-boot-on;
359                                 regulator-min-microvolt = <1500000>;
360                                 regulator-max-microvolt = <1500000>;
361                                 regulator-name = "vcc_1v5";
362
363                                 regulator-state-mem {
364                                         regulator-on-in-suspend;
365                                         regulator-suspend-microvolt = <1500000>;
366                                 };
367                         };
368
369                         vcca1v8_codec: LDO_REG7 {
370                                 regulator-always-on;
371                                 regulator-boot-on;
372                                 regulator-min-microvolt = <1800000>;
373                                 regulator-max-microvolt = <1800000>;
374                                 regulator-name = "vcca1v8_codec";
375
376                                 regulator-state-mem {
377                                         regulator-off-in-suspend;
378                                 };
379                         };
380
381                         vcc_3v0: LDO_REG8 {
382                                 regulator-always-on;
383                                 regulator-boot-on;
384                                 regulator-min-microvolt = <3000000>;
385                                 regulator-max-microvolt = <3000000>;
386                                 regulator-name = "vcc_3v0";
387
388                                 regulator-state-mem {
389                                         regulator-on-in-suspend;
390                                         regulator-suspend-microvolt = <3000000>;
391                                 };
392                         };
393
394                         vcc3v3_s3: SWITCH_REG1 {
395                                 regulator-always-on;
396                                 regulator-boot-on;
397                                 regulator-name = "vcc3v3_s3";
398
399                                 regulator-state-mem {
400                                         regulator-off-in-suspend;
401                                 };
402                         };
403
404                         vcc3v3_s0: SWITCH_REG2 {
405                                 regulator-always-on;
406                                 regulator-boot-on;
407                                 regulator-name = "vcc3v3_s0";
408
409                                 regulator-state-mem {
410                                         regulator-off-in-suspend;
411                                 };
412                         };
413                 };
414         };
415 };
416
417 &i2c1 {
418         clock-frequency = <200000>;
419         i2c-scl-rising-time-ns = <150>;
420         i2c-scl-falling-time-ns = <30>;
421         status = "okay";
422 };
423
424 &i2c2 {
425         status = "okay";
426 };
427
428 &i2c4 {
429         clock-frequency = <400000>;
430         i2c-scl-rising-time-ns = <160>;
431         i2c-scl-falling-time-ns = <30>;
432         status = "okay";
433
434         fusb0: typec-portc@22 {
435                 compatible = "fcs,fusb302";
436                 reg = <0x22>;
437                 interrupt-parent = <&gpio1>;
438                 interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
439                 pinctrl-names = "default";
440                 pinctrl-0 = <&fusb0_int>;
441                 vbus-supply = <&vbus_typec>;
442         };
443 };
444
445 &i2c7 {
446         status = "okay";
447 };
448
449 &io_domains {
450         bt656-supply = <&vcc_1v8>;
451         audio-supply = <&vcca1v8_codec>;
452         sdmmc-supply = <&vcc_sdio>;
453         gpio1830-supply = <&vcc_3v0>;
454         status = "okay";
455 };
456
457 &pcie_phy {
458         assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>;
459         assigned-clock-rates = <100000000>;
460         assigned-clocks = <&cru SCLK_PCIEPHY_REF>;
461         status = "okay";
462 };
463
464 &pcie0 {
465         ep-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>;
466         max-link-speed = <2>;
467         num-lanes = <4>;
468         status = "okay";
469 };
470
471 &pinctrl {
472         fusb30x {
473                 fusb0_int: fusb0-int {
474                         rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
475                 };
476         };
477
478         gpio-leds {
479                 leds_gpio: leds-gpio {
480                         rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
481                 };
482         };
483
484         pmic {
485                 cpu_b_sleep: cpu-b-sleep {
486                         rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
487                 };
488
489                 gpu_sleep: gpu-sleep {
490                         rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
491                 };
492
493                 pmic_int_l: pmic-int-l {
494                         rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
495                 };
496         };
497
498         rockchip-key {
499                 power_key: power-key {
500                         rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
501                 };
502         };
503
504         sdio {
505                 bt_host_wake_l: bt-host-wake-l {
506                         rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
507                 };
508
509                 bt_reg_on_h: bt-reg-on-h {
510                         /* external pullup to VCC1V8_PMUPLL */
511                         rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
512                 };
513
514                 bt_wake_l: bt-wake-l {
515                         rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
516                 };
517
518                 wifi_reg_on_h: wifi-reg_on-h {
519                         rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
520                 };
521         };
522
523         sdmmc {
524                 sdmmc0_det_l: sdmmc0-det-l {
525                         rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>;
526                 };
527
528                 sdmmc0_pwr_h: sdmmc0-pwr-h {
529                         rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
530                 };
531         };
532 };
533
534 &pmu_io_domains {
535         pmu1830-supply = <&vcc_3v0>;
536         status = "okay";
537 };
538
539 &pwm0 {
540         status = "okay";
541 };
542
543 &pwm1 {
544         status = "okay";
545 };
546
547 &pwm2 {
548         pinctrl-names = "active";
549         pinctrl-0 = <&pwm2_pin_pull_down>;
550         status = "okay";
551 };
552
553 &saradc {
554         vref-supply = <&vcca1v8_s3>;
555         status = "okay";
556 };
557
558 &sdhci {
559         bus-width = <8>;
560         mmc-hs200-1_8v;
561         non-removable;
562         status = "okay";
563 };
564
565 &sdio0 {
566         bus-width = <4>;
567         cap-sd-highspeed;
568         cap-sdio-irq;
569         keep-power-in-suspend;
570         mmc-pwrseq = <&sdio_pwrseq>;
571         non-removable;
572         pinctrl-names = "default";
573         pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
574         sd-uhs-sdr104;
575         status = "okay";
576 };
577
578 &sdmmc {
579         bus-width = <4>;
580         cap-sd-highspeed;
581         cap-mmc-highspeed;
582         cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
583         disable-wp;
584         pinctrl-names = "default";
585         pinctrl-0 = <&sdmmc_bus4 &sdmmc_clk &sdmmc_cmd &sdmmc0_det_l>;
586         sd-uhs-sdr104;
587         vmmc-supply = <&vcc3v0_sd>;
588         vqmmc-supply = <&vcc_sdio>;
589         status = "okay";
590 };
591
592 &tcphy0 {
593         status = "okay";
594 };
595
596 &tcphy1 {
597         status = "okay";
598 };
599
600 &tsadc {
601         /* tshut mode 0:CRU 1:GPIO */
602         rockchip,hw-tshut-mode = <1>;
603         /* tshut polarity 0:LOW 1:HIGH */
604         rockchip,hw-tshut-polarity = <1>;
605         status = "okay";
606 };
607
608 &u2phy0 {
609         status = "okay";
610 };
611
612 &u2phy0_host {
613         status = "okay";
614 };
615
616 &u2phy0_otg {
617         status = "okay";
618 };
619
620 &u2phy1 {
621         status = "okay";
622 };
623
624 &u2phy1_host {
625         status = "okay";
626 };
627
628 &u2phy1_otg {
629         status = "okay";
630 };
631
632 &uart0 {
633         pinctrl-names = "default";
634         pinctrl-0 = <&uart0_xfer &uart0_rts &uart0_cts>;
635         status = "okay";
636
637         bluetooth {
638                 compatible = "brcm,bcm43438-bt";
639                 clocks = <&rk808 1>;
640                 clock-names = "lpo";
641                 device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>;
642                 host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
643                 shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
644                 max-speed = <4000000>;
645                 pinctrl-names = "default";
646                 pinctrl-0 = <&bt_reg_on_h &bt_host_wake_l &bt_wake_l>;
647                 vbat-supply = <&vcc3v3_sys>;
648                 vddio-supply = <&vcc_1v8>;
649         };
650 };
651
652 &uart2 {
653         status = "okay";
654 };
655
656 &usbdrd3_0 {
657         status = "okay";
658 };
659
660 &usbdrd3_1 {
661         status = "okay";
662 };
663
664 &usbdrd_dwc3_0 {
665         status = "okay";
666 };
667
668 &usbdrd_dwc3_1 {
669         dr_mode = "host";
670         status = "okay";
671 };
672
673 &usb_host0_ehci {
674         status = "okay";
675 };
676
677 &usb_host0_ohci {
678         status = "okay";
679 };
680
681 &usb_host1_ehci {
682         status = "okay";
683 };
684
685 &usb_host1_ohci {
686         status = "okay";
687 };
688
689 &vopb {
690         status = "okay";
691 };
692
693 &vopb_mmu {
694         status = "okay";
695 };
696
697 &vopl {
698         status = "okay";
699 };
700
701 &vopl_mmu {
702         status = "okay";
703 };