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