485d59b253649e5a15b6d6ddb65fb434080b317f
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / boot / dts / rockchip / rk3399-gru.dtsi
1 /*
2  * Google Gru (and derivatives) board device tree source
3  *
4  * Copyright 2016 Google, Inc
5  *
6  * This file is dual-licensed: you can use it either under the terms
7  * of the GPL or the X11 license, at your option. Note that this dual
8  * licensing only applies to this file, and not this project as a
9  * whole.
10  *
11  *  a) This file is free software; you can redistribute it and/or
12  *     modify it under the terms of the GNU General Public License as
13  *     published by the Free Software Foundation; either version 2 of the
14  *     License, or (at your option) any later version.
15  *
16  *     This file is distributed in the hope that it will be useful,
17  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *     GNU General Public License for more details.
20  *
21  *  Or, alternatively,
22  *
23  *  b) Permission is hereby granted, free of charge, to any person
24  *     obtaining a copy of this software and associated documentation
25  *     files (the "Software"), to deal in the Software without
26  *     restriction, including without limitation the rights to use,
27  *     copy, modify, merge, publish, distribute, sublicense, and/or
28  *     sell copies of the Software, and to permit persons to whom the
29  *     Software is furnished to do so, subject to the following
30  *     conditions:
31  *
32  *     The above copyright notice and this permission notice shall be
33  *     included in all copies or substantial portions of the Software.
34  *
35  *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36  *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
37  *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38  *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
39  *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
40  *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41  *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
42  *     OTHER DEALINGS IN THE SOFTWARE.
43  */
44
45 #include <dt-bindings/input/input.h>
46 #include <dt-bindings/pwm/pwm.h>
47 #include "rk3399.dtsi"
48
49 / {
50         /*
51          * Power Tree
52          *
53          * In general an attempt is made to include all rails called out by
54          * the schematic as long as those rails interact in some way with
55          * the AP.  AKA:
56          * - Rails that only connect to the EC (or devices that the EC talks to)
57          *   are not included.
58          * - Rails _are_ included if the rails go to the AP even if the AP
59          *   doesn't currently care about them / they are always on.  The idea
60          *   here is that it makes it easier to map to the schematic or extend
61          *   later.
62          *
63          * If two rails are substantially the same from the AP's point of
64          * view, though, we won't create a full fixed regulator.  We'll just
65          * put the child rail as an alias of the parent rail.  Sometimes rails
66          * look the same to the AP because one of these is true:
67          * - The EC controls the enable and the EC always enables a rail as
68          *   long as the AP is running.
69          * - The rails are actually connected to each other by a jumper and
70          *   the distinction is just there to add clarity/flexibility to the
71          *   schematic.
72          */
73
74         /* parentless regulators */
75
76         ppvar_sys: ppvar-sys {
77                 compatible = "regulator-fixed";
78                 regulator-name = "ppvar_sys";
79                 regulator-always-on;
80                 regulator-boot-on;
81         };
82
83         /* ppvar_sys children, sorted by name */
84
85         pp900_ap: pp900-ap {
86                 compatible = "regulator-fixed";
87                 regulator-name = "pp900_ap";
88
89                 /* EC turns on w/ pp900_ap_en; always on for AP */
90                 regulator-always-on;
91                 regulator-boot-on;
92
93                 regulator-min-microvolt = <900000>;
94                 regulator-max-microvolt = <900000>;
95
96                 vin-supply = <&ppvar_sys>;
97         };
98
99         pp1200_lpddr: pp1200-lpddr {
100                 compatible = "regulator-fixed";
101                 regulator-name = "pp1200_lpddr";
102
103                 /* EC turns on w/ lpddr_pwr_en; always on for AP */
104                 regulator-always-on;
105                 regulator-boot-on;
106
107                 regulator-min-microvolt = <1200000>;
108                 regulator-max-microvolt = <1200000>;
109
110                 vin-supply = <&ppvar_sys>;
111         };
112
113         pp1800: pp1800 {
114                 compatible = "regulator-fixed";
115                 regulator-name = "pp1800";
116
117                 /* Always on when ppvar_sys shows power good */
118                 regulator-always-on;
119                 regulator-boot-on;
120
121                 regulator-min-microvolt = <1800000>;
122                 regulator-max-microvolt = <1800000>;
123                 vin-supply = <&ppvar_sys>;
124         };
125
126         pp3000: pp3000 {
127                 compatible = "regulator-fixed";
128                 regulator-name = "pp3000";
129                 pinctrl-names = "default";
130                 pinctrl-0 = <&pp3000_en>;
131
132                 enable-active-high;
133                 gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>;
134
135                 regulator-always-on;
136                 regulator-boot-on;
137
138                 regulator-min-microvolt = <3000000>;
139                 regulator-max-microvolt = <3000000>;
140
141                 vin-supply = <&ppvar_sys>;
142         };
143
144         pp3300: pp3300 {
145                 compatible = "regulator-fixed";
146                 regulator-name = "pp3300";
147
148                 /* Always on; plain and simple */
149                 regulator-always-on;
150                 regulator-boot-on;
151
152                 regulator-min-microvolt = <3300000>;
153                 regulator-max-microvolt = <3300000>;
154
155                 vin-supply = <&ppvar_sys>;
156         };
157
158         pp5000: pp5000 {
159                 compatible = "regulator-fixed";
160                 regulator-name = "pp5000";
161
162                 /* EC turns on w/ pp5000_en; always on for AP */
163                 regulator-always-on;
164                 regulator-boot-on;
165
166                 regulator-min-microvolt = <5000000>;
167                 regulator-max-microvolt = <5000000>;
168
169                 vin-supply = <&ppvar_sys>;
170         };
171
172         ppvar_bigcpu: ppvar-bigcpu {
173                 compatible = "pwm-regulator";
174                 regulator-name = "ppvar_bigcpu";
175                 status = "okay";
176
177                 pwms = <&pwm1 0 3333 0>;
178
179                 // TODO: where's the mapping of duty cycle to voltage???
180                 // TODO: we probably need in-flight PWM regulator series?
181
182                 /* EC turns on w/ ap_core_en; always on for AP */
183                 regulator-always-on;
184                 regulator-boot-on;
185
186                 regulator-min-microvolt = <800000>;
187                 regulator-max-microvolt = <1500000>;
188
189                 pwm-supply = <&ppvar_sys>;
190         };
191
192         ppvar_litcpu: ppvar-litcpu {
193                 compatible = "pwm-regulator";
194                 regulator-name = "ppvar_litcpu";
195                 status = "okay";
196
197                 pwms = <&pwm2 0 3333 0>;
198
199                 /* EC turns on w/ ap_core_en; always on for AP */
200                 regulator-always-on;
201                 regulator-boot-on;
202
203                 regulator-min-microvolt = <800000>;
204                 regulator-max-microvolt = <1500000>;
205
206                 pwm-supply = <&ppvar_sys>;
207         };
208
209         ppvar_gpu: ppvar-gpu {
210                 compatible = "pwm-regulator";
211                 regulator-name = "ppvar_gpu";
212                 status = "okay";
213
214                 pwms = <&pwm0 0 3333 0>;
215
216                 /* EC turns on w/ ap_core_en; always on for AP */
217                 regulator-always-on;
218                 regulator-boot-on;
219
220                 regulator-min-microvolt = <800000>;
221                 regulator-max-microvolt = <1500000>;
222
223                 pwm-supply = <&ppvar_sys>;
224         };
225
226         ppvar_centerlogic: ppvar-centerlogic {
227                 compatible = "pwm-regulator";
228                 regulator-name = "ppvar_centerlogic";
229                 status = "okay";
230
231                 pwms = <&pwm3 0 3333 0>;
232
233                 /* EC turns on w/ ppvar_centerlogic_en; always on for AP */
234                 regulator-always-on;
235                 regulator-boot-on;
236
237                 regulator-min-microvolt = <800000>;
238                 regulator-max-microvolt = <1500000>;
239
240                 pwm-supply = <&ppvar_sys>;
241         };
242
243         /* Schematics call this PPVAR even though it's fixed */
244         ppvar_logic: ppvar-logic {
245                 compatible = "regulator-fixed";
246                 regulator-name = "ppvar_logic";
247
248                 /* EC turns on w/ ppvar_logic_en; always on for AP */
249                 regulator-always-on;
250                 regulator-boot-on;
251
252                 regulator-min-microvolt = <900000>;
253                 regulator-max-microvolt = <900000>;
254
255                 vin-supply = <&ppvar_sys>;
256         };
257
258         /* pp900_ap aliases; these are always on for AP so just use alias */
259
260         /* EC turns on w/ pp900_ddrpll_en */
261         pp900_ddrpll: pp900_ap {
262         };
263
264         /* EC turns on w/ pp900_pcie_en */
265         pp900_pcie: pp900_ap {
266         };
267
268         /* EC turns on w/ pp900_pll_en */
269         pp900_pll: pp900_ap {
270         };
271
272         /* EC turns on w/ pp900_pmu_en */
273         pp900_pmu: pp900_ap {
274         };
275
276         /* EC turns on w/ pp900_usb_en */
277         pp900_usb: pp900_ap {
278         };
279
280         /* pp1800 aliases; these are always on for AP so just use alias */
281
282         /* EC turns on w/ pp1800_s0_en_l */
283         pp1800_ap_io: pp1800_emmc: pp1800_nfc: pp1800_s0: pp1800 {
284         };
285
286         /* EC turns on w/ pp1800_avdd_en_l */
287         pp1800_avdd: pp1800 {
288         };
289
290         /* EC turns on w/ pp1800_lid_en_l */
291         pp1800_lid: pp1800_mic: pp1800 {
292         };
293
294         /* EC turns on w/ lpddr_pwr_en */
295         pp1800_lpddr: pp1800 {
296         };
297
298         /* EC turns on w/ pp1800_pmu_en_l */
299         pp1800_pmu: pp1800 {
300         };
301
302         /* EC turns on w/ pp1800_sensor_en_l */
303         // TODO: Only for EC and things EC talks to I think; remove?
304         pp1800_sensor: pp1800 {
305         };
306
307         /* EC turns on w/ pp1800_usb_en_l */
308         pp1800_usb: pp1800 {
309         };
310
311         /* pp1800 children */
312
313         /* EC turns on w/ pp1200_hsic_en */
314         // TODO: Might be removed in future schematics?
315         pp1200_hsic: pp1200-hsic {
316                 compatible = "regulator-fixed";
317                 regulator-name = "pp1200_hsic";
318
319                 regulator-always-on;
320                 regulator-boot-on;
321                 regulator-min-microvolt = <1200000>;
322                 regulator-max-microvolt = <1200000>;
323
324                 vin-supply = <&pp1800>;
325         };
326
327         pp1500_ap_io: pp1500-ap-io {
328                 compatible = "regulator-fixed";
329                 regulator-name = "pp1500_ap_io";
330                 pinctrl-names = "default";
331                 pinctrl-0 = <&pp1500_en>;
332
333                 enable-active-high;
334                 gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
335
336                 regulator-always-on;
337                 regulator-boot-on;
338                 regulator-min-microvolt = <1500000>;
339                 regulator-max-microvolt = <1500000>;
340
341                 vin-supply = <&pp1800>;                 // TODO: DNS for 3.3??
342         };
343
344         pp1800_audio: pp1800-audio {
345                 compatible = "regulator-fixed";
346                 regulator-name = "pp1800_audio";
347                 pinctrl-names = "default";
348                 pinctrl-0 = <&pp1800_audio_en>;
349
350                 regulator-always-on;
351                 regulator-boot-on;
352
353                 enable-active-high;
354                 gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>;
355
356                 vin-supply = <&pp1800>;
357         };
358
359         pp1800_pcie: pp1800-pcie {
360                 compatible = "regulator-fixed";
361                 regulator-name = "pp1800_pcie";
362                 pinctrl-names = "default";
363                 pinctrl-0 = <&wlan_module_pd_l>;
364
365                 regulator-always-on;                    // TODO: for bringup???
366                 regulator-boot-on;                      // TODO: for bringup???
367                 enable-active-high;
368                 gpio = <&gpio0 4 GPIO_ACTIVE_HIGH>;
369
370                 vin-supply = <&pp1800>;
371         };
372
373         /* pp3000 aliases; these are always on for AP so just use alias */
374
375         /* Always on; plain and simple */
376         pp3000_ap: pp3000_emmc: pp3000 {
377         };
378
379         /* pp3000 children */
380
381         pp3000_sd_slot: pp3000-sd-slot {
382                 compatible = "regulator-fixed";
383                 regulator-name = "pp3000_sd_slot";
384                 pinctrl-names = "default";
385                 pinctrl-0 = <&sd_slot_pwr_en>;
386
387 //              regulator-always-on;    // TODO: for bringup???
388 //              regulator-boot-on;      // TODO: for bringup???
389
390                 enable-active-high;
391                 gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
392
393                 vin-supply = <&pp3000>;
394         };
395
396         ppvar_sd_card_io: ppvar-sd-card-io {
397                 compatible = "regulator-gpio";
398                 regulator-name = "ppvar_sd_card_io";
399                 pinctrl-names = "default";
400                 pinctrl-0 = <&sd_io_pwr_en &sd_pwr_1800_sel>;
401
402 //              regulator-always-on;    // TODO: for bringup???
403 //              regulator-boot-on;      // TODO: for bringup???
404
405                 enable-active-high;
406                 enable-gpio = <&gpio2 2 GPIO_ACTIVE_HIGH>;
407                 gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>;
408                 states = <1800000 0x1
409                           3000000 0x0>;
410
411                 regulator-min-microvolt = <1800000>;
412                 regulator-max-microvolt = <3000000>;
413
414                 // TODO: add support in driver for input supplies.
415                 // ...and specify pp3000 and pp1800.
416         };
417
418         /* pp3300 aliases; these are always on for AP so just use alias */
419
420         /* EC turns on w/ pp3300_trackpad_en_l */
421         pp3300_trackpad: pp3300-trackpad {
422         };
423
424         /* EC turns on w/ pp3300_usb_en_l */
425         pp3300_usb: pp3300 {
426         };
427
428         /* pp3300 children */
429
430         pp3300_disp: pp3300-disp {
431                 compatible = "regulator-fixed";
432                 regulator-name = "pp3300_disp";
433                 pinctrl-names = "default";
434                 pinctrl-0 = <&pp3300_disp_en>;
435
436                 enable-active-high;
437
438                 // TODO: for bringup; we should reference (and enable) this
439                 // regulator with a panel (?) or backlight (?) driver
440                 regulator-always-on;
441                 regulator-boot-on;
442
443                 gpio = <&gpio4 27 GPIO_ACTIVE_HIGH>;
444
445                 vin-supply = <&pp3300>;
446         };
447
448         pp3300_wifi_bt:pp3300-wifi-bt {
449                 compatible = "regulator-fixed";
450                 regulator-name = "pp3300_wifi_bt";
451                 /* NOTE: wlan_module_pd_l pinctrl in pp1800_pcie */
452
453                 regulator-always-on;                    // TODO: for bringup???
454                 regulator-boot-on;                      // TODO: for bringup???
455                 enable-active-high;
456
457                 // TODO: I _think_ it's OK to specify the same GPIO in two
458                 // regulator-fixed regulators.  See pp1800_pcie
459                 gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
460
461                 vin-supply = <&pp3300>;
462         };
463
464
465         /* END REGULATORS */
466
467         io-domains {
468                 compatible = "rockchip,rk3399-io-voltage-domain";
469                 rockchip,grf = <&grf>;
470
471                 bt656-supply = <&pp1800_ap_io>;         /* APIO2_VDD;  2a 2b */
472                 audio-supply = <&pp1800_audio>;         /* APIO5_VDD;  3d 4a */
473                 sdmmc-supply = <&ppvar_sd_card_io>;     /* SDMMC0_VDD; 4b    */
474                 gpio1830-supply = <&pp3000_ap>;         /* APIO4_VDD;  4c 4d */
475         };
476
477         pmu-io-domains {
478                 compatible = "rockchip,rk3399-pmu-io-voltage-domain";
479                 rockchip,grf = <&pmugrf>;
480
481                 pmu1830-supply = <&pp1800_pmu>;         /* PMUIO2_VDD */
482         };
483
484         sound {
485                 compatible = "rockchip,rockchip-audio-da7219";
486                 rockchip,model = "audio-da7219";
487                 rockchip,i2s-controller = <&i2s0>;
488                 rockchip,audio-codec = <&codec>;
489         };
490
491         backlight: backlight {
492                 compatible = "gpio-backlight";
493                 pinctrl-names = "default";
494                 pinctrl-0 = <&bl_en>;
495                 gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
496         };
497
498         edp_panel: edp-panel {
499                 compatible = "samsung,lsn122dl01-c01", "panel-simple";
500                 backlight = <&backlight>;
501                 power-supply = <&pp3300_disp>;
502
503                 ports {
504                         panel_in_edp: endpoint {
505                                 remote-endpoint = <&edp_out_panel>;
506                         };
507                 };
508         };
509 };
510
511 &cpu_l0 {
512         cpu-supply = <&ppvar_litcpu>;
513 };
514
515 &cpu_l1 {
516         cpu-supply = <&ppvar_litcpu>;
517 };
518
519 &cpu_l2 {
520         cpu-supply = <&ppvar_litcpu>;
521 };
522
523 &cpu_l3 {
524         cpu-supply = <&ppvar_litcpu>;
525 };
526
527 &cpu_b0 {
528         cpu-supply = <&ppvar_bigcpu>;
529 };
530
531 &cpu_b1 {
532         cpu-supply = <&ppvar_bigcpu>;
533 };
534
535 &emmc_phy {
536         status = "okay";
537 };
538
539 ap_i2c_mic: &i2c1 {
540         status = "okay";
541
542         // TODO: bus speed
543         //       ...with no speed, it should just use 100kHz
544         // TODO: rise / fall times?
545
546         // TODO: This is in mainline, but not the Rockchip private kernel
547         // TODO: Need to hook this into the rest of audio stuff...
548
549         // TODO: any pinctrl needed for this codec???
550         headsetcodec: rt5514@57 {
551                 compatible = "realtek,rt5514";
552                 reg = <0x57>;
553                 pinctrl-names = "default";
554                 pinctrl-0 = <&mic_int>;
555
556                 /*
557                  * NOTE: Interrupts aren't part of the binding and driver
558                  * doesn't support it, but throw it in anyway.
559                  */
560                 interrupt-parent = <&gpio1>;
561                 interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
562         };
563 };
564
565 ap_i2c_ts: &i2c3 {
566         status = "okay";
567
568         // TODO: bus speed
569         //       ...with no speed, it should just use 100kHz
570         // TODO: rise / fall times?
571
572         // TODO: Add the proper touchscreen reference...
573
574
575         // TODO: Might need to go in sub boards????
576 };
577
578 ap_i2c_tp: &i2c5 {
579         status = "okay";
580
581         /*
582          * Note strange pullup enable.  Apparently this avoids leakage but
583          * still allows us to get nice 4.7K pullups for high speed i2c
584          * transfers.  Basically we want the pullup on whenever the ap is
585          * alive, so the "en" pin just gets set to output high.
586          */
587         pinctrl-0 = <&i2c5_xfer &ap_i2c_tp_pu_en>;
588
589         clock-frequency = <400000>;
590
591         /* These are relatively safe rise/fall times; TODO: measure */
592         i2c-scl-falling-time-ns = <50>;
593         i2c-scl-rising-time-ns = <300>;
594 };
595
596 ap_i2c_audio: &i2c8 {
597         status = "okay";
598
599         // TODO: bus speed
600         //       ...with no speed, it should just use 100kHz
601         // TODO: rise / fall times?
602         // ...on gru-gru this is on a sub board, so expect bad rise/fall times
603
604         // TODO: copied from sample.  Double-check...
605         codec: da7219@1a {
606                 compatible = "dlg,da7219";
607                 reg = <0x1a>;
608
609                 pinctrl-names = "default";
610                 pinctrl-0 = <&headset_int_l>;
611
612                 interrupt-parent = <&gpio1>;
613                 interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
614
615                 VDD-supply = <&pp1800>;
616                 VDDMIC-supply = <&pp3300>;
617                 VDDIO-supply = <&pp1800>;
618
619                 // TODO: I THINK this is right, but it's a bit of a guess.
620                 clocks = <&cru SCLK_I2S_8CH_OUT>;
621                 clock-names = "mclk";
622
623 // Below is from bindings; we need to adjust for our SoC / board.
624                 dlg,ldo-lvl = <1200>;
625                 dlg,micbias-lvl = <2600>;
626                 dlg,mic-amp-in-sel = "diff";
627
628                 da7219_aad {
629                         dlg,btn-cfg = <50>;
630                         dlg,mic-det-thr = <500>;
631                         dlg,jack-ins-deb = <20>;
632                         dlg,jack-det-rate = "32ms_64ms";
633                         dlg,jack-rem-deb = <1>;
634
635                         dlg,a-d-btn-thr = <0xa>;
636                         dlg,d-b-btn-thr = <0x16>;
637                         dlg,b-c-btn-thr = <0x21>;
638                         dlg,c-mic-btn-thr = <0x3E>;
639
640                         dlg,btn-avg = <4>;
641                         dlg,adc-1bit-rpt = <1>;
642                 };
643         };
644 };
645
646 &i2s0 {
647         status = "okay";
648 };
649
650 &pwm0 {
651         status = "okay";
652 };
653
654 &pwm1 {
655         status = "okay";
656 };
657
658 &pwm2 {
659         status = "okay";
660 };
661
662 &pwm3 {
663         status = "okay";
664 };
665
666 &emmc_phy {
667         freq-sel = <200000000>;
668         dr-sel = <50>;
669         opdelay = <4>;
670         status = "okay";
671 };
672
673 &sdhci {
674         bus-width = <8>;
675         mmc-hs400-1_8v;
676         supports-emmc;
677         non-removable;
678         status = "okay";
679 };
680
681 &sdmmc {
682         status = "okay";
683
684         /*
685          * Note: configure "sdmmc_cd" as card detect even though it's actually
686          * hooked to ground.  Because we specified "cd-gpios" below dw_mmc
687          * should be ignoring card detect anyway.  Specifying the pin as
688          * sdmmc_cd means that even if you've got GRF_SOC_CON7[12] (force_jtag)
689          * turned on that the system will still make sure the port is
690          * configured as SDMMC and not JTAG.
691          */
692         pinctrl-names = "default";
693         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio
694                      &sdmmc_bus4>;
695
696         // HACK: supports-sd is not in mainline.
697         supports-sd;
698
699         // HACK: Limit freq for now
700         // ...as of 160330 confirmed that things break if you remove this.
701         clock-frequency = <37500000>;
702         clock-freq-min-max = <400000 37500000>;
703
704         bus-width = <4>;
705         cd-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
706         disable-wp;
707
708         cap-mmc-highspeed;
709         cap-sd-highspeed;
710
711         // TODO: enable once tested...
712         //sd-uhs-sdr12;
713         //sd-uhs-sdr25;
714         //sd-uhs-sdr50;
715         //sd-uhs-sdr104;
716
717         // Comment out until we turn on gpio-regulator config
718         vmmc-supply = <&pp3000_sd_slot>;
719         vqmmc-supply = <&ppvar_sd_card_io>;
720 };
721
722 &spi0 {
723         status = "okay";
724
725         // TODO: more properly.  Hacky spidev for now???
726         // A few notes:
727         // - We either have a Haven here or a Infineon SLB9670.  The SLB9670
728         //   is supposed to be a fallback if Haven is broken.
729         // - Either TPM is supposed to be TPM 2.0 hooked up to SPI.  I see some
730         //   kernel support for TPM 2.0 on x86 (hooked up with ACPI) but no
731         //   generic way to say "we have a SPI TPM 2.0".  We'll need to add
732         //   a driver for whichever way we go.
733         // - wfrichar@ says that for Haven if it has gone to sleep we might
734         //   need to add a delay after asserting chip select.  Presumably
735         //   haven-specific driver will need to handle this logic (keeping
736         //   track when we last talked and adding an extra delay if it's been
737         //   a while).
738         tpm@0 {
739                 compatible = "spidev";
740                 // TODO: can run faster once verified.
741                 // TODO: add rx-sample-delay-ns.
742                 spi-max-frequency = <10000000>;
743                 reg = <0>;
744         };
745 };
746
747 &spi1 {
748         status = "okay";
749
750         // TODO: Ideally we want to use MTD for this, but presumably
751         // we'll wait until we can test it and also bring it up in our
752         // kernel tree.
753         spiflash@0 {
754                 compatible = "spidev";
755                 // TODO: can run faster once verified.
756                 // TODO: add rx-sample-delay-ns.
757                 spi-max-frequency = <10000000>;
758                 reg = <0>;
759         };
760 };
761
762 &spi2 {
763         status = "okay";
764
765         // TODO: more properly.  Hacky spidev for now???
766         wacky_spi_audio@0 {
767                 compatible = "spidev";
768
769                 // TODO: can run faster once verified.
770                 // TODO: add rx-sample-delay-ns.
771                 spi-max-frequency = <10000000>;
772                 reg = <0>;
773         };
774 };
775
776 &spi5 {
777         status = "okay";
778
779         cros_ec: ec@0 {
780                 compatible = "google,cros-ec-spi";
781                 reg = <0>;
782                 pinctrl-names = "default";
783                 pinctrl-0 = <&ec_ap_int_l>;
784
785                 google,cros-ec-spi-pre-delay = <30>;    // TODO: check
786                 interrupt-parent = <&gpio0>;
787                 interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
788                 spi-max-frequency = <3000000>;          // TODO: check; TODO: rx-sample-delay-ns?
789
790                 i2c_tunnel: i2c-tunnel {
791                         compatible = "google,cros-ec-i2c-tunnel";
792                         google,remote-bus = <0>;
793                         #address-cells = <1>;
794                         #size-cells = <0>;
795                 };
796         };
797 };
798
799 // TODO:
800 // - double-check that hw-tshut-mode is same as EVB
801 // - double check that hw-tshut-polarity is the same as EVB
802 &tsadc {
803         status = "okay";
804
805         rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
806         rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
807 };
808
809 &uart2 {
810         status = "okay";
811 };
812
813 &usb_host0_ehci {
814         status = "okay";
815 };
816
817 &usb_host0_ohci {
818         status = "okay";
819 };
820
821 &usb_host1_ehci {
822         status = "okay";
823 };
824
825 &usb_host1_ohci {
826         status = "okay";
827 };
828
829 &usbdrd3_0 {
830         status = "okay";
831 };
832
833 &usbdrd_dwc3_0 {
834         status = "okay";
835         dr_mode = "host";       // TODO: needed?
836 };
837
838 &usbdrd3_1 {
839         status = "okay";
840 };
841
842 &usbdrd_dwc3_1 {
843         status = "okay";
844         dr_mode = "host";       // TODO: needed?
845 };
846
847 &edp {
848         status = "okay";
849
850         ports {
851                 edp_out: port@1 {
852                         reg = <1>;
853                         #address-cells = <1>;
854                         #size-cells = <0>;
855
856                         edp_out_panel: endpoint@0 {
857                                 reg = <0>;
858                                 remote-endpoint = <&panel_in_edp>;
859                         };
860                 };
861         };
862 };
863
864 &vopb {
865         status = "okay";
866 };
867
868 &vopb_mmu {
869         status = "okay";
870 };
871
872 &vopl {
873         status = "okay";
874 };
875
876 &vopl_mmu {
877         status = "okay";
878 };
879
880 &display_subsystem {
881         status = "okay";
882 };
883
884 &gpu {
885         mali-supply = <&ppvar_gpu>;
886         status = "okay";
887 };
888
889 /* HACKS: Poorly formatted on purpose so you know they're hacks */
890
891 /* HACK THE PWM REGULATOR OUT
892  *
893  * We'll hack them all to pretend they are fixed regulators
894  * and at exactly .9V, which is where cpufreq wants them.
895  *
896  * We'll also set all PWMs to disabled so we know that the PWM
897  * framework won't touch them.
898  *
899  * This relies on PWM clock being a critical clock.
900  */
901 &ppvar_bigcpu {
902         compatible = "regulator-fixed";
903         regulator-min-microvolt = <900000>;
904         regulator-max-microvolt = <900000>;
905 };
906
907 &ppvar_centerlogic {
908         compatible = "regulator-fixed";
909         regulator-min-microvolt = <900000>;
910         regulator-max-microvolt = <900000>;
911 };
912
913 &ppvar_litcpu {
914         compatible = "regulator-fixed";
915         regulator-min-microvolt = <900000>;
916         regulator-max-microvolt = <900000>;
917 };
918
919 &ppvar_gpu {
920         compatible = "regulator-fixed";
921         regulator-min-microvolt = <900000>;
922         regulator-max-microvolt = <900000>;
923 };
924
925 &pwm0 {
926         status = "disabled";
927 };
928
929 &pwm1 {
930         status = "disabled";
931 };
932
933 &pwm2 {
934
935         status = "disabled";
936 };
937
938 &pwm3 {
939         status = "disabled";
940 };
941
942 /* PINCTRL: always below everything else */
943
944 &pinctrl {
945         pcfg_output_high: pcfg-output-high {
946                 output-high;
947         };
948
949         cros-ec {
950                 ec_ap_int_l: ec-ap-int-l {
951                         rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO &pcfg_pull_up>;
952                 };
953         };
954
955         discrete-regulators {
956                 pp1500_en: pp1500-en {
957                         rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO
958                                          &pcfg_pull_none>;
959                 };
960
961                 pp1800_audio_en: pp1800-audio-en {
962                         rockchip,pins = <RK_GPIO0 2 RK_FUNC_GPIO
963                                          &pcfg_pull_down>;
964                 };
965
966                 pp3300_disp_en: pp3300-disp-en {
967                         rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
968                                          &pcfg_pull_none>;
969                 };
970
971                 pp3000_en: pp3000-en {
972                         rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO
973                                          &pcfg_pull_none>;
974                 };
975
976                 sd_io_pwr_en: sd-io-pwr-en {
977                         rockchip,pins = <RK_GPIO2 2 RK_FUNC_GPIO
978                                          &pcfg_pull_none>;
979                 };
980
981                 sd_pwr_1800_sel: sd-pwr-1800-sel {
982                         rockchip,pins = <RK_GPIO2 28 RK_FUNC_GPIO
983                                          &pcfg_pull_none>;
984                 };
985
986                 sd_slot_pwr_en: sd-slot-pwr-en {
987                         rockchip,pins = <RK_GPIO4 29 RK_FUNC_GPIO
988                                          &pcfg_pull_none>;
989                 };
990
991                 wlan_module_pd_l: wlan-module-pd-l {
992                         rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO
993                                          &pcfg_pull_down>;
994                 };
995         };
996
997         codec {
998                 /* Has external pullup */
999                 headset_int_l: headset-int-l {
1000                         rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_none>;
1001                 };
1002
1003                 // TODO: check pull.  From signal name assume active high.
1004                 mic_int: mic-int {
1005                         rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_down>;
1006                 };
1007         };
1008
1009         sdmmc {
1010                 /*
1011                  * We have external pulls on SDMMC, so diable internals
1012                  *
1013                  * TODO:
1014                  * - On veyron we found that we needed to drive at 8mA.  Do we
1015                  *   need to that here?  If so, 8mA or 12mA?
1016                  */
1017                 sdmmc_bus4: sdmmc-bus4 {
1018                         rockchip,pins =
1019                                 <4 8 RK_FUNC_1 &pcfg_pull_none>,
1020                                 <4 9 RK_FUNC_1 &pcfg_pull_none>,
1021                                 <4 10 RK_FUNC_1 &pcfg_pull_none>,
1022                                 <4 11 RK_FUNC_1 &pcfg_pull_none>;
1023                 };
1024
1025                 sdmmc_clk: sdmmc-clk {
1026                         rockchip,pins =
1027                                 <4 12 RK_FUNC_1 &pcfg_pull_none>;
1028                 };
1029
1030                 sdmmc_cmd: sdmmc-cmd {
1031                         rockchip,pins =
1032                                 <4 13 RK_FUNC_1 &pcfg_pull_none>;
1033                 };
1034
1035                 /*
1036                  * In our case the official card detect is hooked to ground
1037                  * to avoid getting access to JTAG just by sticking something
1038                  * in the SD card slot (see the force_jtag bit in the TRM).
1039                  *
1040                  * We still configure it as card detect because it doesn't
1041                  * hurt and dw_mmc will ignore it.  We make sure to disable
1042                  * the pull though so we don't burn needless power.
1043                  */
1044                 sdmmc_cd: sdmcc-cd {
1045                         rockchip,pins =
1046                                 <0 7 RK_FUNC_1 &pcfg_pull_none>;
1047                 };
1048
1049                 /* This is where we actually hook up CD; has external pull */
1050                 sdmmc_cd_gpio: sdmmc-cd-gpio {
1051                         rockchip,pins = <4 24 RK_FUNC_GPIO &pcfg_pull_none>;
1052                 };
1053         };
1054
1055         trackpad {
1056                 ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
1057                         rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
1058                 };
1059
1060                 trackpad_int_l: trackpad-int-l {
1061                         rockchip,pins = <1 4 RK_FUNC_GPIO &pcfg_pull_up>;
1062                 };
1063         };
1064
1065         backlight-enable {
1066                 bl_en: bl-en {
1067                         rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_none>;
1068                 };
1069         };
1070 };
1071
1072 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1073 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1074 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1075