ARM64: dts: rockchip: fixes the hw-tshut-polarity for rk3399
[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                 regulator-always-on;
350                 regulator-boot-on;
351
352                 enable-active-high;
353                 gpio = <&gpio0 1 GPIO_ACTIVE_HIGH>;
354
355                 vin-supply = <&pp1800>;
356         };
357
358         pp1800_pcie: pp1800-pcie {
359                 compatible = "regulator-fixed";
360                 regulator-name = "pp1800_pcie";
361                 pinctrl-names = "default";
362                 pinctrl-0 = <&wlan_module_pd_l>;
363
364                 regulator-always-on;                    // TODO: for bringup???
365                 regulator-boot-on;                      // TODO: for bringup???
366                 enable-active-high;
367                 gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
368
369                 vin-supply = <&pp1800>;
370         };
371
372         /* pp3000 aliases; these are always on for AP so just use alias */
373
374         /* Always on; plain and simple */
375         pp3000_ap: pp3000_emmc: pp3000 {
376         };
377
378         /* pp3000 children */
379
380         pp3000_sd_slot: pp3000-sd-slot {
381                 compatible = "regulator-fixed";
382                 regulator-name = "pp3000_sd_slot";
383                 pinctrl-names = "default";
384                 pinctrl-0 = <&sd_slot_pwr_en>;
385
386 //              regulator-always-on;    // TODO: for bringup???
387 //              regulator-boot-on;      // TODO: for bringup???
388
389                 enable-active-high;
390                 gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
391
392                 vin-supply = <&pp3000>;
393         };
394
395         ppvar_sd_card_io: ppvar-sd-card-io {
396                 compatible = "regulator-gpio";
397                 regulator-name = "ppvar_sd_card_io";
398                 pinctrl-names = "default";
399                 pinctrl-0 = <&sd_io_pwr_en &sd_pwr_1800_sel>;
400
401 //              regulator-always-on;    // TODO: for bringup???
402 //              regulator-boot-on;      // TODO: for bringup???
403
404                 enable-active-high;
405                 enable-gpio = <&gpio2 2 GPIO_ACTIVE_HIGH>;
406                 gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>;
407                 states = <1800000 0x1
408                           3000000 0x0>;
409
410                 regulator-min-microvolt = <1800000>;
411                 regulator-max-microvolt = <3000000>;
412
413                 // TODO: add support in driver for input supplies.
414                 // ...and specify pp3000 and pp1800.
415         };
416
417         /* pp3300 aliases; these are always on for AP so just use alias */
418
419         /* EC turns on w/ pp3300_trackpad_en_l */
420         pp3300_trackpad: pp3300-trackpad {
421         };
422
423         /* EC turns on w/ pp3300_usb_en_l */
424         pp3300_usb: pp3300 {
425         };
426
427         /* pp3300 children */
428
429         pp3300_disp: pp3300-disp {
430                 compatible = "regulator-fixed";
431                 regulator-name = "pp3300_disp";
432                 pinctrl-names = "default";
433                 pinctrl-0 = <&pp3300_disp_en>;
434
435                 enable-active-high;
436
437                 // TODO: for bringup; we should reference (and enable) this
438                 // regulator with a panel (?) or backlight (?) driver
439                 regulator-always-on;
440                 regulator-boot-on;
441
442                 gpio = <&gpio4 27 GPIO_ACTIVE_HIGH>;
443
444                 vin-supply = <&pp3300>;
445         };
446
447         pp3300_wifi_bt:pp3300-wifi-bt {
448                 compatible = "regulator-fixed";
449                 regulator-name = "pp3300_wifi_bt";
450                 /* NOTE: wlan_module_pd_l pinctrl in pp1800_pcie */
451
452                 regulator-always-on;                    // TODO: for bringup???
453                 regulator-boot-on;                      // TODO: for bringup???
454                 enable-active-high;
455
456                 // TODO: I _think_ it's OK to specify the same GPIO in two
457                 // regulator-fixed regulators.  See pp1800_pcie
458                 gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
459
460                 vin-supply = <&pp3300>;
461         };
462
463
464         /* END REGULATORS */
465
466         io-domains {
467                 compatible = "rockchip,rk3399-io-voltage-domain";
468                 rockchip,grf = <&grf>;
469
470                 bt656-supply = <&pp1800_ap_io>;         /* APIO2_VDD;  2a 2b */
471                 audio-supply = <&pp1800_audio>;         /* APIO5_VDD;  3d 4a */
472                 sdmmc-supply = <&ppvar_sd_card_io>;     /* SDMMC0_VDD; 4b    */
473                 gpio1830-supply = <&pp3000_ap>;         /* APIO4_VDD;  4c 4d */
474         };
475
476         pmu-io-domains {
477                 compatible = "rockchip,rk3399-pmu-io-voltage-domain";
478                 rockchip,grf = <&pmugrf>;
479
480                 pmu1830-supply = <&pp1800_pmu>;         /* PMUIO2_VDD */
481         };
482
483         sound {
484                 compatible = "rockchip,rockchip-audio-da7219";
485                 rockchip,model = "audio-da7219";
486                 rockchip,i2s-controller = <&i2s0>;
487                 rockchip,audio-codec = <&codec>;
488         };
489 };
490
491 &cpu_l0 {
492         cpu-supply = <&ppvar_litcpu>;
493 };
494
495 &cpu_l1 {
496         cpu-supply = <&ppvar_litcpu>;
497 };
498
499 &cpu_l2 {
500         cpu-supply = <&ppvar_litcpu>;
501 };
502
503 &cpu_l3 {
504         cpu-supply = <&ppvar_litcpu>;
505 };
506
507 &cpu_b0 {
508         cpu-supply = <&ppvar_bigcpu>;
509 };
510
511 &cpu_b1 {
512         cpu-supply = <&ppvar_bigcpu>;
513 };
514
515 &emmc_phy {
516         status = "okay";
517 };
518
519 ap_i2c_mic: &i2c1 {
520         status = "okay";
521
522         // TODO: bus speed
523         //       ...with no speed, it should just use 100kHz
524         // TODO: rise / fall times?
525
526         // TODO: This is in mainline, but not the Rockchip private kernel
527         // TODO: Need to hook this into the rest of audio stuff...
528
529         // TODO: any pinctrl needed for this codec???
530         headsetcodec: rt5514@57 {
531                 compatible = "realtek,rt5514";
532                 reg = <0x57>;
533                 pinctrl-names = "default";
534                 pinctrl-0 = <&mic_int>;
535
536                 /*
537                  * NOTE: Interrupts aren't part of the binding and driver
538                  * doesn't support it, but throw it in anyway.
539                  */
540                 interrupt-parent = <&gpio1>;
541                 interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
542         };
543 };
544
545 ap_i2c_ts: &i2c3 {
546         status = "okay";
547
548         // TODO: bus speed
549         //       ...with no speed, it should just use 100kHz
550         // TODO: rise / fall times?
551
552         // TODO: Add the proper touchscreen reference...
553
554
555         // TODO: Might need to go in sub boards????
556 };
557
558 ap_i2c_tp: &i2c5 {
559         /*
560          * Note strange pullup enable.  Apparently this avoids leakage but
561          * still allows us to get nice 4.7K pullups for high speed i2c
562          * transfers.  Basically we want the pullup on whenever the ap is
563          * alive, so the "en" pin just gets set to output high.
564          */
565         pinctrl-0 = <&i2c5_xfer &ap_i2c_tp_pu_en>;
566
567         status = "okay";
568
569         // TODO: bus speed
570         //       ...with no speed, it should just use 100kHz
571         // TODO: rise / fall times?
572
573         // TODO: Add the proper touchpanel reference...
574 };
575
576 ap_i2c_audio: &i2c8 {
577         status = "okay";
578
579         // TODO: bus speed
580         //       ...with no speed, it should just use 100kHz
581         // TODO: rise / fall times?
582         // ...on gru-gru this is on a sub board, so expect bad rise/fall times
583
584         // TODO: copied from sample.  Double-check...
585         codec: da7219@1a {
586                 compatible = "dlg,da7219";
587                 reg = <0x1a>;
588
589                 pinctrl-names = "default";
590                 pinctrl-0 = <&headset_int_l>;
591
592                 interrupt-parent = <&gpio1>;
593                 interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
594
595                 VDD-supply = <&pp1800>;
596                 VDDMIC-supply = <&pp3300>;
597                 VDDIO-supply = <&pp1800>;
598
599                 // TODO: I THINK this is right, but it's a bit of a guess.
600                 clocks = <&cru SCLK_I2S_8CH_OUT>;
601                 clock-names = "mclk";
602
603 // Below is from bindings; we need to adjust for our SoC / board.
604                 dlg,ldo-lvl = <1200>;
605                 dlg,micbias-lvl = <2600>;
606                 dlg,mic-amp-in-sel = "diff";
607
608                 da7219_aad {
609                         dlg,btn-cfg = <50>;
610                         dlg,mic-det-thr = <500>;
611                         dlg,jack-ins-deb = <20>;
612                         dlg,jack-det-rate = "32ms_64ms";
613                         dlg,jack-rem-deb = <1>;
614
615                         dlg,a-d-btn-thr = <0xa>;
616                         dlg,d-b-btn-thr = <0x16>;
617                         dlg,b-c-btn-thr = <0x21>;
618                         dlg,c-mic-btn-thr = <0x3E>;
619
620                         dlg,btn-avg = <4>;
621                         dlg,adc-1bit-rpt = <1>;
622                 };
623         };
624 };
625
626 &i2s0 {
627         status = "okay";
628 };
629
630 &pwm0 {
631         status = "okay";
632 };
633
634 &pwm1 {
635         status = "okay";
636 };
637
638 &pwm2 {
639         status = "okay";
640 };
641
642 &pwm3 {
643         status = "okay";
644 };
645
646 &sdhci {
647         status = "okay";
648
649         // HACK: supports-emmc is not mainline.
650         supports-emmc;
651
652         // HACK: limit to 50MHz to avoid tuning during bringup.
653         max-frequency = <50000000>;
654
655         // TODO: add caps?
656         //cap-mmc-highspeed;
657         //mmc-hs200-1_8v;
658         //mmc-hs400-1_8v;
659
660         bus-width = <8>;
661         non-removable;
662
663         vmmc-supply = <&pp3000>;
664         vqmmc-supply = <&pp1800_emmc>;
665 };
666
667 &sdmmc {
668         status = "okay";
669
670         /*
671          * Note: configure "sdmmc_cd" as card detect even though it's actually
672          * hooked to ground.  Because we specified "cd-gpios" below dw_mmc
673          * should be ignoring card detect anyway.  Specifying the pin as
674          * sdmmc_cd means that even if you've got GRF_SOC_CON7[12] (force_jtag)
675          * turned on that the system will still make sure the port is
676          * configured as SDMMC and not JTAG.
677          */
678         pinctrl-names = "default";
679         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio
680                      &sdmmc_bus4>;
681
682         // HACK: supports-sd is not in mainline.
683         supports-sd;
684
685         // HACK: Limit freq for now
686         // ...as of 160330 confirmed that things break if you remove this.
687         clock-frequency = <37500000>;
688         clock-freq-min-max = <400000 37500000>;
689
690         bus-width = <4>;
691         cd-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;
692         disable-wp;
693
694         cap-mmc-highspeed;
695         cap-sd-highspeed;
696
697         // TODO: enable once tested...
698         //sd-uhs-sdr12;
699         //sd-uhs-sdr25;
700         //sd-uhs-sdr50;
701         //sd-uhs-sdr104;
702
703         // Comment out until we turn on gpio-regulator config
704         vmmc-supply = <&pp3000_sd_slot>;
705         vqmmc-supply = <&ppvar_sd_card_io>;
706 };
707
708 &spi0 {
709         status = "okay";
710
711         // TODO: more properly.  Hacky spidev for now???
712         // A few notes:
713         // - We either have a Haven here or a Infineon SLB9670.  The SLB9670
714         //   is supposed to be a fallback if Haven is broken.
715         // - Either TPM is supposed to be TPM 2.0 hooked up to SPI.  I see some
716         //   kernel support for TPM 2.0 on x86 (hooked up with ACPI) but no
717         //   generic way to say "we have a SPI TPM 2.0".  We'll need to add
718         //   a driver for whichever way we go.
719         // - wfrichar@ says that for Haven if it has gone to sleep we might
720         //   need to add a delay after asserting chip select.  Presumably
721         //   haven-specific driver will need to handle this logic (keeping
722         //   track when we last talked and adding an extra delay if it's been
723         //   a while).
724         tpm@0 {
725                 compatible = "spidev";
726                 // TODO: can run faster once verified.
727                 // TODO: add rx-sample-delay-ns.
728                 spi-max-frequency = <10000000>;
729                 reg = <0>;
730         };
731 };
732
733 &spi1 {
734         status = "okay";
735
736         // TODO: Ideally we want to use MTD for this, but presumably
737         // we'll wait until we can test it and also bring it up in our
738         // kernel tree.
739         spiflash@0 {
740                 compatible = "spidev";
741                 // TODO: can run faster once verified.
742                 // TODO: add rx-sample-delay-ns.
743                 spi-max-frequency = <10000000>;
744                 reg = <0>;
745         };
746 };
747
748 &spi2 {
749         status = "okay";
750
751         // TODO: more properly.  Hacky spidev for now???
752         wacky_spi_audio@0 {
753                 compatible = "spidev";
754
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 &spi5 {
763         status = "okay";
764
765         cros_ec: ec@0 {
766                 compatible = "google,cros-ec-spi";
767                 reg = <0>;
768                 pinctrl-names = "default";
769                 pinctrl-0 = <&ec_ap_int_l>;
770
771                 google,cros-ec-spi-pre-delay = <30>;    // TODO: check
772                 interrupt-parent = <&gpio0>;
773                 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
774                 spi-max-frequency = <3000000>;          // TODO: check; TODO: rx-sample-delay-ns?
775
776                 i2c_tunnel: i2c-tunnel {
777                         compatible = "google,cros-ec-i2c-tunnel";
778                         google,remote-bus = <0>;
779                         #address-cells = <1>;
780                         #size-cells = <0>;
781                 };
782         };
783 };
784
785 // TODO:
786 // - double-check that hw-tshut-mode is same as EVB
787 // - double check that hw-tshut-polarity is the same as EVB
788 &tsadc {
789         status = "okay";
790
791         rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
792         rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
793 };
794
795 &uart2 {
796         status = "okay";
797 };
798
799 &usb_host0_echi {
800         status = "okay";
801 };
802
803 &usb_host0_ohci {
804         status = "okay";
805 };
806
807 &usb_host1_echi {
808         status = "okay";
809 };
810
811 &usb_host1_ohci {
812         status = "okay";
813 };
814
815 &usbdrd3_0 {
816         status = "okay";
817 };
818
819 &usbdrd_dwc3_0 {
820         status = "okay";
821         dr_mode = "host";       // TODO: needed?
822 };
823
824 &usbdrd3_1 {
825         status = "okay";
826 };
827
828 &usbdrd_dwc3_1 {
829         status = "okay";
830         dr_mode = "host";       // TODO: needed?
831 };
832
833 &edp {
834         status = "okay";
835 };
836
837 &vopb {
838         status = "okay";
839 };
840
841 &vopb_mmu {
842         status = "okay";
843 };
844
845 &vopl {
846         status = "okay";
847 };
848
849 &vopl_mmu {
850         status = "okay";
851 };
852
853 &display_subsystem {
854         status = "okay";
855 };
856
857 /* PINCTRL: always below everything else */
858
859 &pinctrl {
860         pcfg_output_high: pcfg-output-high {
861                 output-high;
862         };
863
864         cros-ec {
865                 ec_ap_int_l: ec-ap-int-l {
866                         rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_up>;
867                 };
868         };
869
870         discrete-regulators {
871                 pp1500_en: pp1500-en {
872                         rockchip,pins = <RK_GPIO1 11 RK_FUNC_GPIO
873                                          &pcfg_pull_none>;
874                 };
875
876                 pp1800_audio_en: pp1800-audio-en {
877                         rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO
878                                          &pcfg_pull_none>;
879                 };
880
881                 pp3300_disp_en: pp3300-disp-en {
882                         rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
883                                          &pcfg_pull_none>;
884                 };
885
886                 pp3000_en: pp3000-en {
887                         rockchip,pins = <RK_GPIO1 12 RK_FUNC_GPIO
888                                          &pcfg_pull_none>;
889                 };
890
891                 sd_io_pwr_en: sd-io-pwr-en {
892                         rockchip,pins = <RK_GPIO2 2 RK_FUNC_GPIO
893                                          &pcfg_pull_none>;
894                 };
895
896                 sd_pwr_1800_sel: sd-pwr-1800-sel {
897                         rockchip,pins = <RK_GPIO2 28 RK_FUNC_GPIO
898                                          &pcfg_pull_none>;
899                 };
900
901                 sd_slot_pwr_en: sd-slot-pwr-en {
902                         rockchip,pins = <RK_GPIO4 29 RK_FUNC_GPIO
903                                          &pcfg_pull_none>;
904                 };
905
906                 wlan_module_pd_l: wlan-module-pd-l {
907                         rockchip,pins = <RK_GPIO0 8 RK_FUNC_GPIO
908                                          &pcfg_pull_none>;
909                 };
910         };
911
912         codec {
913                 /* Has external pullup */
914                 headset_int_l: headset-int-l {
915                         rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_none>;
916                 };
917
918                 // TODO: check pull.  From signal name assume active high.
919                 mic_int: mic-int {
920                         rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_down>;
921                 };
922         };
923
924         sdmmc {
925                 /*
926                  * We have external pulls on SDMMC, so diable internals
927                  *
928                  * TODO:
929                  * - On veyron we found that we needed to drive at 8mA.  Do we
930                  *   need to that here?  If so, 8mA or 12mA?
931                  */
932                 sdmmc_bus4: sdmmc-bus4 {
933                         rockchip,pins =
934                                 <4 8 RK_FUNC_1 &pcfg_pull_none>,
935                                 <4 9 RK_FUNC_1 &pcfg_pull_none>,
936                                 <4 10 RK_FUNC_1 &pcfg_pull_none>,
937                                 <4 11 RK_FUNC_1 &pcfg_pull_none>;
938                 };
939
940                 sdmmc_clk: sdmmc-clk {
941                         rockchip,pins =
942                                 <4 12 RK_FUNC_1 &pcfg_pull_none>;
943                 };
944
945                 sdmmc_cmd: sdmmc-cmd {
946                         rockchip,pins =
947                                 <4 13 RK_FUNC_1 &pcfg_pull_none>;
948                 };
949
950                 /*
951                  * In our case the official card detect is hooked to ground
952                  * to avoid getting access to JTAG just by sticking something
953                  * in the SD card slot (see the force_jtag bit in the TRM).
954                  *
955                  * We still configure it as card detect because it doesn't
956                  * hurt and dw_mmc will ignore it.  We make sure to disable
957                  * the pull though so we don't burn needless power.
958                  */
959                 sdmmc_cd: sdmcc-cd {
960                         rockchip,pins =
961                                 <0 7 RK_FUNC_1 &pcfg_pull_none>;
962                 };
963
964                 /* This is where we actually hook up CD; has external pull */
965                 sdmmc_cd_gpio: sdmmc-cd-gpio {
966                         rockchip,pins = <4 26 RK_FUNC_GPIO &pcfg_pull_none>;
967                 };
968         };
969
970         touchpanel {
971                 ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
972                         rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
973                 };
974         };
975 };
976
977 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
978 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
979 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
980