ARM64: dts: rk3399-tb: add wifi/sdio/sdcard support
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / boot / dts / rockchip / rk3399-tb.dtsi
1 /*
2  * Copyright (c) 2016 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
46 / {
47         compatible = "rockchip,tb", "rockchip,rk3399";
48
49         vdd_log: vdd-log {
50                 compatible = "pwm-regulator";
51                 pwms = <&pwm2 0 1000>;
52                 regulator-name = "vdd_log";
53                 regulator-min-microvolt = <800000>;
54                 regulator-max-microvolt = <1400000>;
55                 regulator-always-on;
56                 status = "okay";
57         };
58
59         vdd_center: vdd-center {
60                 compatible = "pwm-regulator";
61                 pwms = <&pwm3 0 1000>;
62                 regulator-name = "vdd_center";
63                 regulator-min-microvolt = <800000>;
64                 regulator-max-microvolt = <1400000>;
65                 regulator-always-on;
66                 status = "okay";
67         };
68
69         vcc3v3_sys: vcc3v3-sys {
70                 compatible = "regulator-fixed";
71                 regulator-name = "vcc3v3_sys";
72                 regulator-always-on;
73                 regulator-boot-on;
74                 regulator-min-microvolt = <3300000>;
75                 regulator-max-microvolt = <3300000>;
76         };
77
78         backlight: backlight {
79                 compatible = "pwm-backlight";
80                 pwms = <&pwm0 0 25000 0>;
81                 brightness-levels = <
82                           0   1   2   3   4   5   6   7
83                           8   9  10  11  12  13  14  15
84                          16  17  18  19  20  21  22  23
85                          24  25  26  27  28  29  30  31
86                          32  33  34  35  36  37  38  39
87                          40  41  42  43  44  45  46  47
88                          48  49  50  51  52  53  54  55
89                          56  57  58  59  60  61  62  63
90                          64  65  66  67  68  69  70  71
91                          72  73  74  75  76  77  78  79
92                          80  81  82  83  84  85  86  87
93                          88  89  90  91  92  93  94  95
94                          96  97  98  99 100 101 102 103
95                         104 105 106 107 108 109 110 111
96                         112 113 114 115 116 117 118 119
97                         120 121 122 123 124 125 126 127
98                         128 129 130 131 132 133 134 135
99                         136 137 138 139 140 141 142 143
100                         144 145 146 147 148 149 150 151
101                         152 153 154 155 156 157 158 159
102                         160 161 162 163 164 165 166 167
103                         168 169 170 171 172 173 174 175
104                         176 177 178 179 180 181 182 183
105                         184 185 186 187 188 189 190 191
106                         192 193 194 195 196 197 198 199
107                         200 201 202 203 204 205 206 207
108                         208 209 210 211 212 213 214 215
109                         216 217 218 219 220 221 222 223
110                         224 225 226 227 228 229 230 231
111                         232 233 234 235 236 237 238 239
112                         240 241 242 243 244 245 246 247
113                         248 249 250 251 252 253 254 255>;
114                 default-brightness-level = <200>;
115                 enable-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
116         };
117
118         ext_gmac: external-gmac-clock {
119                 compatible = "fixed-clock";
120                 clock-frequency = <125000000>;
121                 clock-output-names = "ext_gmac";
122                 #clock-cells = <0>;
123         };
124
125         vcc_phy: vcc-phy-regulator {
126                 compatible = "regulator-fixed";
127                 regulator-name = "vcc_phy";
128                 regulator-always-on;
129                 regulator-boot-on;
130         };
131
132         io-domains {
133                 compatible = "rockchip,rk3399-io-voltage-domain";
134                 rockchip,grf = <&grf>;
135
136                 bt656-supply = <&vcc1v8_dvp>;
137                 audio-supply = <&vcca1v8_codec>;
138                 sdmmc-supply = <&vcc_sd>;
139                 gpio1830-supply = <&vcc_3v0>;
140         };
141
142         pmu-io-domains {
143                 compatible = "rockchip,rk3399-pmu-io-voltage-domain";
144                 rockchip,grf = <&pmugrf>;
145
146                 pmu1830-supply = <&vcc1v8_pmu>;
147         };
148
149         es8316-sound {
150                 compatible = "simple-audio-card";
151                 simple-audio-card,format = "i2s";
152                 simple-audio-card,name = "rockchip,es8316-codec";
153                 simple-audio-card,mclk-fs = <256>;
154                 simple-audio-card,widgets =
155                         "Microphone", "Mic Jack",
156                         "Headphone", "Headphone Jack";
157                 simple-audio-card,routing =
158                         "Mic Jack", "MICBIAS1",
159                         "IN1P", "Mic Jack",
160                         "Headphone Jack", "HPOL",
161                         "Headphone Jack", "HPOR";
162                 simple-audio-card,cpu {
163                         sound-dai = <&i2s0>;
164                 };
165                 simple-audio-card,codec {
166                         sound-dai = <&es8316>;
167                 };
168         };
169
170         spdif-sound {
171                 compatible = "simple-audio-card";
172                 simple-audio-card,name = "rockchip,spdif";
173                 simple-audio-card,cpu {
174                         sound-dai = <&spdif>;
175                 };
176                 simple-audio-card,codec {
177                         sound-dai = <&spdif_out>;
178                 };
179         };
180
181         spdif_out: spdif-out {
182                 compatible = "linux,spdif-dit";
183                 #sound-dai-cells = <0>;
184         };
185
186         sdio_pwrseq: sdio-pwrseq {
187                 compatible = "mmc-pwrseq-simple";
188                 clocks = <&rk808 1>;
189                 clock-names = "ext_clock";
190                 pinctrl-names = "default";
191                 pinctrl-0 = <&wifi_enable_h>;
192
193                 /*
194                  * On the module itself this is one of these (depending
195                  * on the actual card populated):
196                  * - SDIO_RESET_L_WL_REG_ON
197                  * - PDN (power down when low)
198                  */
199                 reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */
200         };
201
202         wireless-wlan {
203                 compatible = "wlan-platdata";
204                 rockchip,grf = <&grf>;
205                 wifi_chip_type = "ap6354";
206                 sdio_vref = <1800>;
207                 WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /* GPIO0_a3 */
208                 status = "okay";
209         };
210 };
211
212 &pinctrl {
213         sdio-pwrseq {
214                 wifi_enable_h: wifi-enable-h {
215                         rockchip,pins = <0 10 RK_FUNC_GPIO &pcfg_pull_none>;
216                 };
217         };
218 };
219
220 &sdmmc {
221         clock-frequency = <37500000>;
222         clock-freq-min-max = <400000 37500000>;
223         supports-sd;
224         bus-width = <4>;
225         cap-mmc-highspeed;
226         cap-sd-highspeed;
227         disable-wp;
228         num-slots = <1>;
229         pinctrl-names = "default";
230         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
231         status = "okay";
232 };
233
234 &sdio0 {
235         clock-frequency = <50000000>;
236         clock-freq-min-max = <200000 50000000>;
237         supports-sdio;
238         bus-width = <4>;
239         disable-wp;
240         cap-sd-highspeed;
241         cap-sdio-irq;
242         keep-power-in-suspend;
243         mmc-pwrseq = <&sdio_pwrseq>;
244         non-removable;
245         num-slots = <1>;
246         pinctrl-names = "default";
247         pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
248         sd-uhs-sdr104;
249         status = "okay";
250 };
251
252 &emmc_phy {
253         status = "okay";
254 };
255
256 &sdhci {
257         bus-width = <8>;
258         supports-emmc;
259         non-removable;
260         max-frequency = <50000000>;
261         status = "okay";
262 };
263
264 &i2s0 {
265         status = "okay";
266         rockchip,i2s-broken-burst-len;
267         rockchip,playback-channels = <8>;
268         rockchip,capture-channels = <8>;
269         #sound-dai-cells = <0>;
270 };
271
272 &spdif {
273         status = "okay";
274         #sound-dai-cells = <0>;
275 };
276
277 &i2c0 {
278         status = "okay";
279         i2c-scl-rising-time-ns = <450>;
280         i2c-scl-falling-time-ns = <15>;
281
282         mp8865: mp8865@68 {
283                 compatible = "mps,mp8865";
284                 reg = <0x68>;
285                 status = "okay";
286                 regulators {
287                         vdd_gpu: mp8865_dcdc1 {
288                                 regulator-name = "vdd_gpu";
289                                 regulator-min-microvolt = <712500>;
290                                 regulator-max-microvolt = <1500000>;
291                                 regulator-always-on;
292                                 regulator-boot-on;
293                         };
294                 };
295         };
296
297         rk808: pmic@1b {
298                 compatible = "rockchip,rk808";
299                 reg = <0x1b>;
300                 interrupt-parent = <&gpio1>;
301                 interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
302                 pinctrl-names = "default";
303                 pinctrl-0 = <&pmic_int_l>;
304                 rockchip,system-power-controller;
305                 wakeup-source;
306                 #clock-cells = <1>;
307                 clock-output-names = "xin32k", "rk808-clkout2";
308
309                 vcc1-supply = <&vcc3v3_sys>;
310                 vcc2-supply = <&vcc3v3_sys>;
311                 vcc3-supply = <&vcc3v3_sys>;
312                 vcc4-supply = <&vcc3v3_sys>;
313                 vcc6-supply = <&vcc3v3_sys>;
314                 vcc7-supply = <&vcc3v3_sys>;
315                 vcc8-supply = <&vcc3v3_sys>;
316                 vcc9-supply = <&vcc3v3_sys>;
317                 vcc10-supply = <&vcc3v3_sys>;
318                 vcc11-supply = <&vcc3v3_sys>;
319                 vcc12-supply = <&vcc3v3_sys>;
320                 vddio-supply = <&vcc1v8_pmu>;
321
322                 regulators {
323                         vdd_cpu_b: DCDC_REG1 {
324                                 regulator-always-on;
325                                 regulator-boot-on;
326                                 regulator-min-microvolt = <750000>;
327                                 regulator-max-microvolt = <1350000>;
328                                 regulator-name = "vdd_cpu_b";
329                                 regulator-state-mem {
330                                         regulator-off-in-suspend;
331                                 };
332                         };
333
334                         vdd_cpu_l: DCDC_REG2 {
335                                 regulator-always-on;
336                                 regulator-boot-on;
337                                 regulator-min-microvolt = <750000>;
338                                 regulator-max-microvolt = <1350000>;
339                                 regulator-name = "vdd_cpu_l";
340                                 regulator-state-mem {
341                                         regulator-off-in-suspend;
342                                 };
343                         };
344
345                         vcc_ddr: DCDC_REG3 {
346                                 regulator-always-on;
347                                 regulator-boot-on;
348                                 regulator-name = "vcc_ddr";
349                                 regulator-state-mem {
350                                         regulator-on-in-suspend;
351                                 };
352                         };
353
354                         vcc_1v8: DCDC_REG4 {
355                                 regulator-always-on;
356                                 regulator-boot-on;
357                                 regulator-min-microvolt = <1800000>;
358                                 regulator-max-microvolt = <1800000>;
359                                 regulator-name = "vcc_1v8";
360                                 regulator-state-mem {
361                                         regulator-on-in-suspend;
362                                         regulator-suspend-microvolt = <1800000>;
363                                 };
364                         };
365
366                         vcc1v8_dvp: LDO_REG1 {
367                                 regulator-always-on;
368                                 regulator-boot-on;
369                                 regulator-min-microvolt = <1800000>;
370                                 regulator-max-microvolt = <1800000>;
371                                 regulator-name = "vcc1v8_dvp";
372                                 regulator-state-mem {
373                                         regulator-on-in-suspend;
374                                         regulator-suspend-microvolt = <1800000>;
375                                 };
376                         };
377
378                         vcc3v0_tp: LDO_REG2 {
379                                 regulator-always-on;
380                                 regulator-boot-on;
381                                 regulator-min-microvolt = <3000000>;
382                                 regulator-max-microvolt = <3000000>;
383                                 regulator-name = "vcc3v0_tp";
384                                 regulator-state-mem {
385                                         regulator-off-in-suspend;
386                                 };
387                         };
388
389                         vcc1v8_pmu: LDO_REG3 {
390                                 regulator-always-on;
391                                 regulator-boot-on;
392                                 regulator-min-microvolt = <1800000>;
393                                 regulator-max-microvolt = <1800000>;
394                                 regulator-name = "vcc1v8_pmu";
395                                 regulator-state-mem {
396                                         regulator-on-in-suspend;
397                                         regulator-suspend-microvolt = <1800000>;
398                                 };
399                         };
400
401                         vcc_sd: LDO_REG4 {
402                                 regulator-always-on;
403                                 regulator-boot-on;
404                                 regulator-min-microvolt = <1800000>;
405                                 regulator-max-microvolt = <3300000>;
406                                 regulator-name = "vcc_sd";
407                                 regulator-state-mem {
408                                         regulator-on-in-suspend;
409                                         regulator-suspend-microvolt = <3300000>;
410                                 };
411                         };
412
413                         vcca3v0_codec: LDO_REG5 {
414                                 regulator-always-on;
415                                 regulator-boot-on;
416                                 regulator-min-microvolt = <3000000>;
417                                 regulator-max-microvolt = <3000000>;
418                                 regulator-name = "vcca3v0_codec";
419                                 regulator-state-mem {
420                                         regulator-on-in-suspend;
421                                         regulator-suspend-microvolt = <3000000>;
422                                 };
423                         };
424
425                         vcc_1v5: LDO_REG6 {
426                                 regulator-always-on;
427                                 regulator-boot-on;
428                                 regulator-min-microvolt = <1500000>;
429                                 regulator-max-microvolt = <1500000>;
430                                 regulator-name = "vcc_1v5";
431                                 regulator-state-mem {
432                                         regulator-on-in-suspend;
433                                         regulator-suspend-microvolt = <1500000>;
434                                 };
435                         };
436
437                         vcca1v8_codec: LDO_REG7 {
438                                 regulator-always-on;
439                                 regulator-boot-on;
440                                 regulator-min-microvolt = <1800000>;
441                                 regulator-max-microvolt = <1800000>;
442                                 regulator-name = "vcca1v8_codec";
443                                 regulator-state-mem {
444                                         regulator-on-in-suspend;
445                                         regulator-suspend-microvolt = <1800000>;
446                                 };
447                         };
448
449                         vcc_3v0: LDO_REG8 {
450                                 regulator-always-on;
451                                 regulator-boot-on;
452                                 regulator-min-microvolt = <3000000>;
453                                 regulator-max-microvolt = <3000000>;
454                                 regulator-name = "vcc_3v0";
455                                 regulator-state-mem {
456                                         regulator-on-in-suspend;
457                                         regulator-suspend-microvolt = <3000000>;
458                                 };
459                         };
460
461                         vcc3v3_s3: SWITCH_REG1 {
462                                 regulator-always-on;
463                                 regulator-boot-on;
464                                 regulator-name = "vcc3v3_s3";
465                                 regulator-state-mem {
466                                         regulator-on-in-suspend;
467                                 };
468                         };
469
470                         vcc3v3_s0: SWITCH_REG2 {
471                                 regulator-always-on;
472                                 regulator-boot-on;
473                                 regulator-name = "vcc3v3_s0";
474                                 regulator-state-mem {
475                                         regulator-on-in-suspend;
476                                 };
477                         };
478                 };
479         };
480 };
481
482 &i2c4 {
483         status = "okay";
484         i2c-scl-rising-time-ns = <600>;
485         i2c-scl-falling-time-ns = <20>;
486
487         gt9xx: gt9xx@14 {
488                 compatible = "goodix,gt9xx";
489                 reg = <0x14>;
490                 touch-gpio = <&gpio1 20 IRQ_TYPE_LEVEL_LOW>;
491                 reset-gpio = <&gpio4 22 GPIO_ACTIVE_HIGH>;
492                 max-x = <1200>;
493                 max-y = <1900>;
494                 tp-size = <911>;
495                 tp-supply = <&vcc3v0_tp>;
496         };
497 };
498
499 &i2c1 {
500         status = "okay";
501         i2c-scl-rising-time-ns = <300>;
502         i2c-scl-falling-time-ns = <15>;
503
504         es8316: es8316@10 {
505                 #sound-dai-cells = <0>;
506                 compatible = "everest,es8316";
507                 reg = <0x10>;
508                 clocks = <&cru SCLK_I2S_8CH_OUT>;
509                 clock-names = "mclk";
510                 spk-con-gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>;
511                 hp-det-gpio = <&gpio4 28 GPIO_ACTIVE_LOW>;
512         };
513 };
514
515 &pwm2 {
516         status = "okay";
517 };
518
519 &pwm3 {
520         status = "okay";
521 };
522
523 &tsadc {
524         rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
525         rockchip,hw-tshut-polarity = <0>; /* tshut polarity 0:LOW 1:HIGH */
526         status = "okay";
527 };
528
529 &uart2 {
530         status = "okay";
531 };
532
533 &usb_host0_echi {
534         status = "okay";
535 };
536
537 &usb_host0_ohci {
538         status = "okay";
539 };
540
541 &usb_host1_echi {
542         status = "okay";
543 };
544
545 &usb_host1_ohci {
546         status = "okay";
547 };
548
549 &usbdrd3_0 {
550         status = "okay";
551 };
552
553 &usbdrd_dwc3_0 {
554         status = "okay";
555 };
556
557 &usbdrd3_1 {
558         status = "okay";
559 };
560
561 &usbdrd_dwc3_1 {
562         status = "okay";
563 };
564
565 &pwm0 {
566         status = "okay";
567 };
568
569 &cpu_l0 {
570         cpu-supply = <&vdd_cpu_l>;
571 };
572
573 &cpu_l1 {
574         cpu-supply = <&vdd_cpu_l>;
575 };
576
577 &cpu_l2 {
578         cpu-supply = <&vdd_cpu_l>;
579 };
580
581 &cpu_l3 {
582         cpu-supply = <&vdd_cpu_l>;
583 };
584
585 &cpu_b0 {
586         cpu-supply = <&vdd_cpu_b>;
587 };
588
589 &cpu_b1 {
590         cpu-supply = <&vdd_cpu_b>;
591 };
592
593 &gmac {
594         phy-supply = <&vcc_phy>;
595         phy-mode = "rgmii";
596         clock_in_out = "input";
597         snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>;
598         snps,reset-active-low;
599         snps,reset-delays-us = <0 10000 50000>;
600         assigned-clocks = <&cru SCLK_MAC>;
601         assigned-clock-parents = <&ext_gmac>;
602         pinctrl-names = "default";
603         pinctrl-0 = <&rgmii_pins>;
604         tx_delay = <0x30>;
605         rx_delay = <0x10>;
606         status = "disabled";
607 };
608
609 &gpu {
610         mali-supply = <&vdd_gpu>;
611         status = "okay";
612 };