GNU Linux-libre 4.14.254-gnu1
[releases.git] / arch / arm64 / boot / dts / rockchip / rk3399-sapphire.dtsi
1 /*
2  * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
3  *
4  * This file is dual-licensed: you can use it either under the terms
5  * of the GPL or the X11 license, at your option. Note that this dual
6  * licensing only applies to this file, and not this project as a
7  * whole.
8  *
9  *  a) This file is free software; you can redistribute it and/or
10  *     modify it under the terms of the GNU General Public License as
11  *     published by the Free Software Foundation; either version 2 of the
12  *     License, or (at your option) any later version.
13  *
14  *     This file is distributed in the hope that it will be useful,
15  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *     GNU General Public License for more details.
18  *
19  * Or, alternatively,
20  *
21  *  b) Permission is hereby granted, free of charge, to any person
22  *     obtaining a copy of this software and associated documentation
23  *     files (the "Software"), to deal in the Software without
24  *     restriction, including without limitation the rights to use,
25  *     copy, modify, merge, publish, distribute, sublicense, and/or
26  *     sell copies of the Software, and to permit persons to whom the
27  *     Software is furnished to do so, subject to the following
28  *     conditions:
29  *
30  *     The above copyright notice and this permission notice shall be
31  *     included in all copies or substantial portions of the Software.
32  *
33  *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34  *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35  *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36  *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37  *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38  *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39  *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40  *     OTHER DEALINGS IN THE SOFTWARE.
41  */
42
43 #include "dt-bindings/pwm/pwm.h"
44 #include "rk3399.dtsi"
45 #include "rk3399-opp.dtsi"
46
47 / {
48         compatible = "rockchip,rk3399-sapphire", "rockchip,rk3399";
49
50         backlight: backlight {
51                 compatible = "pwm-backlight";
52                 brightness-levels = <
53                           0   1   2   3   4   5   6   7
54                           8   9  10  11  12  13  14  15
55                          16  17  18  19  20  21  22  23
56                          24  25  26  27  28  29  30  31
57                          32  33  34  35  36  37  38  39
58                          40  41  42  43  44  45  46  47
59                          48  49  50  51  52  53  54  55
60                          56  57  58  59  60  61  62  63
61                          64  65  66  67  68  69  70  71
62                          72  73  74  75  76  77  78  79
63                          80  81  82  83  84  85  86  87
64                          88  89  90  91  92  93  94  95
65                          96  97  98  99 100 101 102 103
66                         104 105 106 107 108 109 110 111
67                         112 113 114 115 116 117 118 119
68                         120 121 122 123 124 125 126 127
69                         128 129 130 131 132 133 134 135
70                         136 137 138 139 140 141 142 143
71                         144 145 146 147 148 149 150 151
72                         152 153 154 155 156 157 158 159
73                         160 161 162 163 164 165 166 167
74                         168 169 170 171 172 173 174 175
75                         176 177 178 179 180 181 182 183
76                         184 185 186 187 188 189 190 191
77                         192 193 194 195 196 197 198 199
78                         200 201 202 203 204 205 206 207
79                         208 209 210 211 212 213 214 215
80                         216 217 218 219 220 221 222 223
81                         224 225 226 227 228 229 230 231
82                         232 233 234 235 236 237 238 239
83                         240 241 242 243 244 245 246 247
84                         248 249 250 251 252 253 254 255>;
85                 default-brightness-level = <200>;
86                 pwms = <&pwm0 0 25000 0>;
87         };
88
89         clkin_gmac: external-gmac-clock {
90                 compatible = "fixed-clock";
91                 clock-frequency = <125000000>;
92                 clock-output-names = "clkin_gmac";
93                 #clock-cells = <0>;
94         };
95
96         dc_12v: dc-12v {
97                 compatible = "regulator-fixed";
98                 regulator-name = "dc_12v";
99                 regulator-always-on;
100                 regulator-boot-on;
101                 regulator-min-microvolt = <12000000>;
102                 regulator-max-microvolt = <12000000>;
103         };
104
105         /* switched by pmic_sleep */
106         vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
107                 compatible = "regulator-fixed";
108                 regulator-name = "vcc1v8_s3";
109                 regulator-always-on;
110                 regulator-boot-on;
111                 regulator-min-microvolt = <1800000>;
112                 regulator-max-microvolt = <1800000>;
113                 vin-supply = <&vcc_1v8>;
114         };
115
116         vcc3v0_sd: vcc3v0-sd {
117                 compatible = "regulator-fixed";
118                 enable-active-high;
119                 gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
120                 pinctrl-names = "default";
121                 pinctrl-0 = <&sdmmc0_pwr_h>;
122                 regulator-always-on;
123                 regulator-max-microvolt = <3000000>;
124                 regulator-min-microvolt = <3000000>;
125                 regulator-name = "vcc3v0_sd";
126                 vin-supply = <&vcc3v3_sys>;
127         };
128
129         vcc3v3_sys: vcc3v3-sys {
130                 compatible = "regulator-fixed";
131                 regulator-name = "vcc3v3_sys";
132                 regulator-always-on;
133                 regulator-boot-on;
134                 regulator-min-microvolt = <3300000>;
135                 regulator-max-microvolt = <3300000>;
136                 vin-supply = <&vcc_sys>;
137         };
138
139         vcc_sys: vcc-sys {
140                 compatible = "regulator-fixed";
141                 regulator-name = "vcc_sys";
142                 regulator-always-on;
143                 regulator-boot-on;
144                 regulator-min-microvolt = <5000000>;
145                 regulator-max-microvolt = <5000000>;
146                 vin-supply = <&dc_12v>;
147         };
148
149         vcc5v0_host: vcc5v0-host-regulator {
150                 compatible = "regulator-fixed";
151                 enable-active-high;
152                 gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
153                 pinctrl-names = "default";
154                 pinctrl-0 = <&vcc5v0_host_en>;
155                 regulator-name = "vcc5v0_host";
156                 regulator-always-on;
157                 vin-supply = <&vcc_sys>;
158         };
159 };
160
161 &cpu_l0 {
162         cpu-supply = <&vdd_cpu_l>;
163 };
164
165 &cpu_l1 {
166         cpu-supply = <&vdd_cpu_l>;
167 };
168
169 &cpu_l2 {
170         cpu-supply = <&vdd_cpu_l>;
171 };
172
173 &cpu_l3 {
174         cpu-supply = <&vdd_cpu_l>;
175 };
176
177 &cpu_b0 {
178         cpu-supply = <&vdd_cpu_b>;
179 };
180
181 &cpu_b1 {
182         cpu-supply = <&vdd_cpu_b>;
183 };
184
185 &emmc_phy {
186         status = "okay";
187 };
188
189 &gmac {
190         assigned-clocks = <&cru SCLK_RMII_SRC>;
191         assigned-clock-parents = <&clkin_gmac>;
192         clock_in_out = "input";
193         phy-supply = <&vcc_lan>;
194         phy-mode = "rgmii";
195         pinctrl-names = "default";
196         pinctrl-0 = <&rgmii_pins>;
197         snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
198         snps,reset-active-low;
199         snps,reset-delays-us = <0 10000 50000>;
200         tx_delay = <0x28>;
201         rx_delay = <0x11>;
202         status = "okay";
203 };
204
205 &gpu {
206         mali-supply = <&vdd_gpu>;
207         status = "okay";
208 };
209
210 &hdmi {
211         ddc-i2c-bus = <&i2c3>;
212         status = "okay";
213 };
214
215 &i2c0 {
216         clock-frequency = <400000>;
217         i2c-scl-rising-time-ns = <168>;
218         i2c-scl-falling-time-ns = <4>;
219         status = "okay";
220
221         rk808: pmic@1b {
222                 compatible = "rockchip,rk808";
223                 reg = <0x1b>;
224                 interrupt-parent = <&gpio1>;
225                 interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
226                 #clock-cells = <1>;
227                 clock-output-names = "xin32k", "rk808-clkout2";
228                 pinctrl-names = "default";
229                 pinctrl-0 = <&pmic_int_l &pmic_dvs2>;
230                 rockchip,system-power-controller;
231                 wakeup-source;
232
233                 vcc1-supply = <&vcc_sys>;
234                 vcc2-supply = <&vcc_sys>;
235                 vcc3-supply = <&vcc_sys>;
236                 vcc4-supply = <&vcc_sys>;
237                 vcc6-supply = <&vcc_sys>;
238                 vcc7-supply = <&vcc_sys>;
239                 vcc8-supply = <&vcc3v3_sys>;
240                 vcc9-supply = <&vcc_sys>;
241                 vcc10-supply = <&vcc_sys>;
242                 vcc11-supply = <&vcc_sys>;
243                 vcc12-supply = <&vcc3v3_sys>;
244                 vddio-supply = <&vcc1v8_pmu>;
245
246                 regulators {
247                         vdd_center: DCDC_REG1 {
248                                 regulator-name = "vdd_center";
249                                 regulator-always-on;
250                                 regulator-boot-on;
251                                 regulator-min-microvolt = <750000>;
252                                 regulator-max-microvolt = <1350000>;
253                                 regulator-ramp-delay = <6001>;
254                                 regulator-state-mem {
255                                         regulator-off-in-suspend;
256                                 };
257                         };
258
259                         vdd_cpu_l: DCDC_REG2 {
260                                 regulator-name = "vdd_cpu_l";
261                                 regulator-always-on;
262                                 regulator-boot-on;
263                                 regulator-min-microvolt = <750000>;
264                                 regulator-max-microvolt = <1350000>;
265                                 regulator-ramp-delay = <6001>;
266                                 regulator-state-mem {
267                                         regulator-off-in-suspend;
268                                 };
269                         };
270
271                         vcc_ddr: DCDC_REG3 {
272                                 regulator-name = "vcc_ddr";
273                                 regulator-always-on;
274                                 regulator-boot-on;
275                                 regulator-state-mem {
276                                         regulator-on-in-suspend;
277                                 };
278                         };
279
280                         vcc_1v8: DCDC_REG4 {
281                                 regulator-name = "vcc_1v8";
282                                 regulator-always-on;
283                                 regulator-boot-on;
284                                 regulator-min-microvolt = <1800000>;
285                                 regulator-max-microvolt = <1800000>;
286                                 regulator-state-mem {
287                                         regulator-on-in-suspend;
288                                         regulator-suspend-microvolt = <1800000>;
289                                 };
290                         };
291
292                         vcc1v8_dvp: LDO_REG1 {
293                                 regulator-name = "vcc1v8_dvp";
294                                 regulator-always-on;
295                                 regulator-boot-on;
296                                 regulator-min-microvolt = <1800000>;
297                                 regulator-max-microvolt = <1800000>;
298                                 regulator-state-mem {
299                                         regulator-off-in-suspend;
300                                 };
301                         };
302
303                         vcc3v0_tp: LDO_REG2 {
304                                 regulator-name = "vcc3v0_tp";
305                                 regulator-always-on;
306                                 regulator-boot-on;
307                                 regulator-min-microvolt = <3000000>;
308                                 regulator-max-microvolt = <3000000>;
309                                 regulator-state-mem {
310                                         regulator-off-in-suspend;
311                                 };
312                         };
313
314                         vcc1v8_pmu: LDO_REG3 {
315                                 regulator-name = "vcc1v8_pmu";
316                                 regulator-always-on;
317                                 regulator-boot-on;
318                                 regulator-min-microvolt = <1800000>;
319                                 regulator-max-microvolt = <1800000>;
320                                 regulator-state-mem {
321                                         regulator-on-in-suspend;
322                                         regulator-suspend-microvolt = <1800000>;
323                                 };
324                         };
325
326                         vcc_sdio: LDO_REG4 {
327                                 regulator-name = "vcc_sdio";
328                                 regulator-always-on;
329                                 regulator-boot-on;
330                                 regulator-min-microvolt = <1800000>;
331                                 regulator-max-microvolt = <3300000>;
332                                 regulator-state-mem {
333                                         regulator-on-in-suspend;
334                                         regulator-suspend-microvolt = <3000000>;
335                                 };
336                         };
337
338                         vcca3v0_codec: LDO_REG5 {
339                                 regulator-name = "vcca3v0_codec";
340                                 regulator-always-on;
341                                 regulator-boot-on;
342                                 regulator-min-microvolt = <3000000>;
343                                 regulator-max-microvolt = <3000000>;
344                                 regulator-state-mem {
345                                         regulator-off-in-suspend;
346                                 };
347                         };
348
349                         vcc_1v5: LDO_REG6 {
350                                 regulator-name = "vcc_1v5";
351                                 regulator-always-on;
352                                 regulator-boot-on;
353                                 regulator-min-microvolt = <1500000>;
354                                 regulator-max-microvolt = <1500000>;
355                                 regulator-state-mem {
356                                         regulator-on-in-suspend;
357                                         regulator-suspend-microvolt = <1500000>;
358                                 };
359                         };
360
361                         vcca1v8_codec: LDO_REG7 {
362                                 regulator-name = "vcca1v8_codec";
363                                 regulator-always-on;
364                                 regulator-boot-on;
365                                 regulator-min-microvolt = <1800000>;
366                                 regulator-max-microvolt = <1800000>;
367                                 regulator-state-mem {
368                                         regulator-off-in-suspend;
369                                 };
370                         };
371
372                         vcc_3v0: LDO_REG8 {
373                                 regulator-name = "vcc_3v0";
374                                 regulator-always-on;
375                                 regulator-boot-on;
376                                 regulator-min-microvolt = <3000000>;
377                                 regulator-max-microvolt = <3000000>;
378                                 regulator-state-mem {
379                                         regulator-on-in-suspend;
380                                         regulator-suspend-microvolt = <3000000>;
381                                 };
382                         };
383
384                         vcc3v3_s3: vcc_lan: SWITCH_REG1 {
385                                 regulator-name = "vcc3v3_s3";
386                                 regulator-always-on;
387                                 regulator-boot-on;
388                                 regulator-state-mem {
389                                         regulator-off-in-suspend;
390                                 };
391                         };
392
393                         vcc3v3_s0: SWITCH_REG2 {
394                                 regulator-name = "vcc3v3_s0";
395                                 regulator-always-on;
396                                 regulator-boot-on;
397                                 regulator-state-mem {
398                                         regulator-off-in-suspend;
399                                 };
400                         };
401                 };
402         };
403
404         vdd_cpu_b: regulator@40 {
405                 compatible = "silergy,syr827";
406                 reg = <0x40>;
407                 fcs,suspend-voltage-selector = <1>;
408                 regulator-name = "vdd_cpu_b";
409                 regulator-min-microvolt = <712500>;
410                 regulator-max-microvolt = <1500000>;
411                 regulator-ramp-delay = <1000>;
412                 regulator-always-on;
413                 regulator-boot-on;
414                 vin-supply = <&vcc_sys>;
415
416                 regulator-state-mem {
417                         regulator-off-in-suspend;
418                 };
419         };
420
421         vdd_gpu: regulator@41 {
422                 compatible = "silergy,syr828";
423                 reg = <0x41>;
424                 fcs,suspend-voltage-selector = <1>;
425                 regulator-name = "vdd_gpu";
426                 regulator-min-microvolt = <712500>;
427                 regulator-max-microvolt = <1500000>;
428                 regulator-ramp-delay = <1000>;
429                 regulator-always-on;
430                 regulator-boot-on;
431                 vin-supply = <&vcc_sys>;
432
433                 regulator-state-mem {
434                         regulator-off-in-suspend;
435                 };
436         };
437
438         vdd_log: vdd-log {
439                 compatible = "pwm-regulator";
440                 pwms = <&pwm2 0 25000 1>;
441                 regulator-name = "vdd_log";
442                 regulator-always-on;
443                 regulator-boot-on;
444                 regulator-min-microvolt = <800000>;
445                 regulator-max-microvolt = <1400000>;
446                 vin-supply = <&vcc_sys>;
447         };
448 };
449
450 &i2c3 {
451         i2c-scl-rising-time-ns = <450>;
452         i2c-scl-falling-time-ns = <15>;
453         status = "okay";
454 };
455
456 &io_domains {
457         status = "okay";
458
459         bt656-supply = <&vcc_3v0>;
460         audio-supply = <&vcca1v8_codec>;
461         sdmmc-supply = <&vcc_sdio>;
462         gpio1830-supply = <&vcc_3v0>;
463 };
464
465 &pcie_phy {
466         status = "okay";
467 };
468
469 &pcie0 {
470         assigned-clocks = <&cru SCLK_PCIEPHY_REF>;
471         assigned-clock-parents = <&cru SCLK_PCIEPHY_REF100M>;
472         assigned-clock-rates = <100000000>;
473         ep-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>;
474         num-lanes = <4>;
475         pinctrl-names = "default";
476         pinctrl-0 = <&pcie_clkreqn_cpm>;
477         status = "okay";
478 };
479
480 &pmu_io_domains {
481         pmu1830-supply = <&vcc_3v0>;
482         status = "okay";
483 };
484
485 &pinctrl {
486         pmic {
487                 pmic_int_l: pmic-int-l {
488                         rockchip,pins =
489                                 <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
490                 };
491
492                 pmic_dvs2: pmic-dvs2 {
493                         rockchip,pins =
494                                 <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
495                 };
496
497                 vsel1_gpio: vsel1-gpio {
498                         rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
499                 };
500
501                 vsel2_gpio: vsel2-gpio {
502                         rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
503                 };
504         };
505
506         sd {
507                 sdmmc0_pwr_h: sdmmc0-pwr-h {
508                         rockchip,pins =
509                                 <RK_GPIO0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
510                 };
511         };
512
513         usb2 {
514                 vcc5v0_host_en: vcc5v0-host-en {
515                         rockchip,pins =
516                                 <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
517                 };
518         };
519 };
520
521 &pwm0 {
522         status = "okay";
523 };
524
525 &pwm2 {
526         status = "okay";
527 };
528
529 &saradc {
530         vref-supply = <&vcca1v8_s3>;
531         status = "okay";
532 };
533
534 &sdhci {
535         bus-width = <8>;
536         keep-power-in-suspend;
537         mmc-hs400-1_8v;
538         mmc-hs400-enhanced-strobe;
539         non-removable;
540         status = "okay";
541 };
542
543 &sdio0 {
544         bus-width = <4>;
545         cap-sd-highspeed;
546         cap-sdio-irq;
547         clock-frequency = <50000000>;
548         disable-wp;
549         keep-power-in-suspend;
550         max-frequency = <50000000>;
551         mmc-pwrseq = <&sdio_pwrseq>;
552         non-removable;
553         pinctrl-names = "default";
554         pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
555         sd-uhs-sdr104;
556         status = "okay";
557 };
558
559 &sdmmc {
560         broken-cd;
561         bus-width = <4>;
562         cap-mmc-highspeed;
563         cap-sd-highspeed;
564         clock-frequency = <150000000>;
565         disable-wp;
566         max-frequency = <150000000>;
567         pinctrl-names = "default";
568         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
569         vmmc-supply = <&vcc3v0_sd>;
570         vqmmc-supply = <&vcc_sdio>;
571         status = "okay";
572 };
573
574 &tsadc {
575         /* tshut mode 0:CRU 1:GPIO */
576         rockchip,hw-tshut-mode = <1>;
577         /* tshut polarity 0:LOW 1:HIGH */
578         rockchip,hw-tshut-polarity = <1>;
579         status = "okay";
580 };
581
582 &u2phy0 {
583         status = "okay";
584
585         u2phy0_otg: otg-port {
586                 status = "okay";
587         };
588
589         u2phy0_host: host-port {
590                 phy-supply = <&vcc5v0_host>;
591                 status = "okay";
592         };
593 };
594
595 &u2phy1 {
596         status = "okay";
597
598         u2phy1_otg: otg-port {
599                 status = "okay";
600         };
601
602         u2phy1_host: host-port {
603                 phy-supply = <&vcc5v0_host>;
604                 status = "okay";
605         };
606 };
607
608 &uart0 {
609         pinctrl-names = "default";
610         pinctrl-0 = <&uart0_xfer &uart0_cts>;
611         status = "okay";
612 };
613
614 &uart2 {
615         status = "okay";
616 };
617
618 &usb_host0_ehci {
619         status = "okay";
620 };
621
622 &usb_host0_ohci {
623         status = "okay";
624 };
625
626 &usb_host1_ehci {
627         status = "okay";
628 };
629
630 &usb_host1_ohci {
631         status = "okay";
632 };
633
634 &usbdrd3_0 {
635         status = "okay";
636 };
637
638 &usbdrd_dwc3_0 {
639         status = "okay";
640         dr_mode = "otg";
641 };
642
643 &usbdrd3_1 {
644         status = "okay";
645 };
646
647 &usbdrd_dwc3_1 {
648         status = "okay";
649         dr_mode = "host";
650 };
651
652 &vopb {
653         status = "okay";
654 };
655
656 &vopb_mmu {
657         status = "okay";
658 };
659
660 &vopl {
661         status = "okay";
662 };
663
664 &vopl_mmu {
665         status = "okay";
666 };