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