arm64: dts: rockchip: add mmc dt-bindings for rk3328 and evb board
[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         sound {
468                 compatible = "rockchip,rockchip-audio-da7219";
469                 rockchip,model = "audio-da7219";
470                 rockchip,i2s-controller = <&i2s0>;
471                 rockchip,audio-codec = <&codec>;
472         };
473
474         backlight: backlight {
475                 compatible = "gpio-backlight";
476                 pinctrl-names = "default";
477                 pinctrl-0 = <&bl_en>;
478                 gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
479         };
480
481         edp_panel: edp-panel {
482                 compatible = "samsung,lsn122dl01-c01", "panel-simple";
483                 backlight = <&backlight>;
484                 power-supply = <&pp3300_disp>;
485
486                 ports {
487                         panel_in_edp: endpoint {
488                                 remote-endpoint = <&edp_out_panel>;
489                         };
490                 };
491         };
492 };
493
494 &cpu_l0 {
495         cpu-supply = <&ppvar_litcpu>;
496 };
497
498 &cpu_l1 {
499         cpu-supply = <&ppvar_litcpu>;
500 };
501
502 &cpu_l2 {
503         cpu-supply = <&ppvar_litcpu>;
504 };
505
506 &cpu_l3 {
507         cpu-supply = <&ppvar_litcpu>;
508 };
509
510 &cpu_b0 {
511         cpu-supply = <&ppvar_bigcpu>;
512 };
513
514 &cpu_b1 {
515         cpu-supply = <&ppvar_bigcpu>;
516 };
517
518 &emmc_phy {
519         status = "okay";
520 };
521
522 ap_i2c_mic: &i2c1 {
523         status = "okay";
524
525         // TODO: bus speed
526         //       ...with no speed, it should just use 100kHz
527         // TODO: rise / fall times?
528
529         // TODO: This is in mainline, but not the Rockchip private kernel
530         // TODO: Need to hook this into the rest of audio stuff...
531
532         // TODO: any pinctrl needed for this codec???
533         headsetcodec: rt5514@57 {
534                 compatible = "realtek,rt5514";
535                 reg = <0x57>;
536                 pinctrl-names = "default";
537                 pinctrl-0 = <&mic_int>;
538
539                 /*
540                  * NOTE: Interrupts aren't part of the binding and driver
541                  * doesn't support it, but throw it in anyway.
542                  */
543                 interrupt-parent = <&gpio1>;
544                 interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
545         };
546 };
547
548 ap_i2c_ts: &i2c3 {
549         status = "okay";
550
551         // TODO: bus speed
552         //       ...with no speed, it should just use 100kHz
553         // TODO: rise / fall times?
554
555         // TODO: Add the proper touchscreen reference...
556
557
558         // TODO: Might need to go in sub boards????
559 };
560
561 ap_i2c_tp: &i2c5 {
562         status = "okay";
563
564         /*
565          * Note strange pullup enable.  Apparently this avoids leakage but
566          * still allows us to get nice 4.7K pullups for high speed i2c
567          * transfers.  Basically we want the pullup on whenever the ap is
568          * alive, so the "en" pin just gets set to output high.
569          */
570         pinctrl-0 = <&i2c5_xfer &ap_i2c_tp_pu_en>;
571
572         clock-frequency = <400000>;
573
574         /* These are relatively safe rise/fall times; TODO: measure */
575         i2c-scl-falling-time-ns = <50>;
576         i2c-scl-rising-time-ns = <300>;
577 };
578
579 ap_i2c_audio: &i2c8 {
580         status = "okay";
581
582         // TODO: bus speed
583         //       ...with no speed, it should just use 100kHz
584         // TODO: rise / fall times?
585         // ...on gru-gru this is on a sub board, so expect bad rise/fall times
586
587         // TODO: copied from sample.  Double-check...
588         codec: da7219@1a {
589                 compatible = "dlg,da7219";
590                 reg = <0x1a>;
591
592                 pinctrl-names = "default";
593                 pinctrl-0 = <&headset_int_l>;
594
595                 interrupt-parent = <&gpio1>;
596                 interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
597
598                 VDD-supply = <&pp1800>;
599                 VDDMIC-supply = <&pp3300>;
600                 VDDIO-supply = <&pp1800>;
601
602                 // TODO: I THINK this is right, but it's a bit of a guess.
603                 clocks = <&cru SCLK_I2S_8CH_OUT>;
604                 clock-names = "mclk";
605
606 // Below is from bindings; we need to adjust for our SoC / board.
607                 dlg,ldo-lvl = <1200>;
608                 dlg,micbias-lvl = <2600>;
609                 dlg,mic-amp-in-sel = "diff";
610
611                 da7219_aad {
612                         dlg,btn-cfg = <50>;
613                         dlg,mic-det-thr = <500>;
614                         dlg,jack-ins-deb = <20>;
615                         dlg,jack-det-rate = "32ms_64ms";
616                         dlg,jack-rem-deb = <1>;
617
618                         dlg,a-d-btn-thr = <0xa>;
619                         dlg,d-b-btn-thr = <0x16>;
620                         dlg,b-c-btn-thr = <0x21>;
621                         dlg,c-mic-btn-thr = <0x3E>;
622
623                         dlg,btn-avg = <4>;
624                         dlg,adc-1bit-rpt = <1>;
625                 };
626         };
627 };
628
629 &i2s0 {
630         status = "okay";
631 };
632
633 &io_domains {
634         status = "okay";
635
636         bt656-supply = <&pp1800_ap_io>;         /* APIO2_VDD;  2a 2b */
637         audio-supply = <&pp1800_audio>;         /* APIO5_VDD;  3d 4a */
638         sdmmc-supply = <&ppvar_sd_card_io>;     /* SDMMC0_VDD; 4b    */
639         gpio1830-supply = <&pp3000_ap>;         /* APIO4_VDD;  4c 4d */
640 };
641
642 &pwm0 {
643         status = "okay";
644 };
645
646 &pwm1 {
647         status = "okay";
648 };
649
650 &pwm2 {
651         status = "okay";
652 };
653
654 &pwm3 {
655         status = "okay";
656 };
657
658 &emmc_phy {
659         freq-sel = <200000000>;
660         dr-sel = <50>;
661         opdelay = <4>;
662         status = "okay";
663 };
664
665 &sdhci {
666         bus-width = <8>;
667         mmc-hs400-1_8v;
668         supports-emmc;
669         non-removable;
670         status = "okay";
671 };
672
673 &sdmmc {
674         status = "okay";
675
676         /*
677          * Note: configure "sdmmc_cd" as card detect even though it's actually
678          * hooked to ground.  Because we specified "cd-gpios" below dw_mmc
679          * should be ignoring card detect anyway.  Specifying the pin as
680          * sdmmc_cd means that even if you've got GRF_SOC_CON7[12] (force_jtag)
681          * turned on that the system will still make sure the port is
682          * configured as SDMMC and not JTAG.
683          */
684         pinctrl-names = "default";
685         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio
686                      &sdmmc_bus4>;
687
688         // HACK: supports-sd is not in mainline.
689         supports-sd;
690
691         // HACK: Limit freq for now
692         // ...as of 160330 confirmed that things break if you remove this.
693         clock-frequency = <37500000>;
694         clock-freq-min-max = <400000 37500000>;
695
696         bus-width = <4>;
697         cd-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
698         disable-wp;
699
700         cap-mmc-highspeed;
701         cap-sd-highspeed;
702
703         // TODO: enable once tested...
704         //sd-uhs-sdr12;
705         //sd-uhs-sdr25;
706         //sd-uhs-sdr50;
707         //sd-uhs-sdr104;
708
709         // Comment out until we turn on gpio-regulator config
710         vmmc-supply = <&pp3000_sd_slot>;
711         vqmmc-supply = <&ppvar_sd_card_io>;
712 };
713
714 &spi0 {
715         status = "okay";
716
717         // TODO: more properly.  Hacky spidev for now???
718         // A few notes:
719         // - We either have a Haven here or a Infineon SLB9670.  The SLB9670
720         //   is supposed to be a fallback if Haven is broken.
721         // - Either TPM is supposed to be TPM 2.0 hooked up to SPI.  I see some
722         //   kernel support for TPM 2.0 on x86 (hooked up with ACPI) but no
723         //   generic way to say "we have a SPI TPM 2.0".  We'll need to add
724         //   a driver for whichever way we go.
725         // - wfrichar@ says that for Haven if it has gone to sleep we might
726         //   need to add a delay after asserting chip select.  Presumably
727         //   haven-specific driver will need to handle this logic (keeping
728         //   track when we last talked and adding an extra delay if it's been
729         //   a while).
730         tpm@0 {
731                 compatible = "spidev";
732                 // TODO: can run faster once verified.
733                 // TODO: add rx-sample-delay-ns.
734                 spi-max-frequency = <10000000>;
735                 reg = <0>;
736         };
737 };
738
739 &spi1 {
740         status = "okay";
741
742         // TODO: Ideally we want to use MTD for this, but presumably
743         // we'll wait until we can test it and also bring it up in our
744         // kernel tree.
745         spiflash@0 {
746                 compatible = "spidev";
747                 // TODO: can run faster once verified.
748                 // TODO: add rx-sample-delay-ns.
749                 spi-max-frequency = <10000000>;
750                 reg = <0>;
751         };
752 };
753
754 &spi2 {
755         status = "okay";
756
757         // TODO: more properly.  Hacky spidev for now???
758         wacky_spi_audio@0 {
759                 compatible = "spidev";
760
761                 // TODO: can run faster once verified.
762                 // TODO: add rx-sample-delay-ns.
763                 spi-max-frequency = <10000000>;
764                 reg = <0>;
765         };
766 };
767
768 &spi5 {
769         status = "okay";
770
771         cros_ec: ec@0 {
772                 compatible = "google,cros-ec-spi";
773                 reg = <0>;
774                 pinctrl-names = "default";
775                 pinctrl-0 = <&ec_ap_int_l>;
776
777                 google,cros-ec-spi-pre-delay = <30>;    // TODO: check
778                 interrupt-parent = <&gpio0>;
779                 interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
780                 spi-max-frequency = <3000000>;          // TODO: check; TODO: rx-sample-delay-ns?
781
782                 i2c_tunnel: i2c-tunnel {
783                         compatible = "google,cros-ec-i2c-tunnel";
784                         google,remote-bus = <0>;
785                         #address-cells = <1>;
786                         #size-cells = <0>;
787                 };
788         };
789 };
790
791 // TODO:
792 // - double-check that hw-tshut-mode is same as EVB
793 // - double check that hw-tshut-polarity is the same as EVB
794 &tsadc {
795         status = "okay";
796
797         rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
798         rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
799 };
800
801 &uart2 {
802         status = "okay";
803 };
804
805 &usb_host0_ehci {
806         status = "okay";
807 };
808
809 &usb_host0_ohci {
810         status = "okay";
811 };
812
813 &usb_host1_ehci {
814         status = "okay";
815 };
816
817 &usb_host1_ohci {
818         status = "okay";
819 };
820
821 &usbdrd3_0 {
822         status = "okay";
823 };
824
825 &usbdrd_dwc3_0 {
826         status = "okay";
827         dr_mode = "host";       // TODO: needed?
828 };
829
830 &usbdrd3_1 {
831         status = "okay";
832 };
833
834 &usbdrd_dwc3_1 {
835         status = "okay";
836         dr_mode = "host";       // TODO: needed?
837 };
838
839 &edp {
840         status = "okay";
841
842         ports {
843                 edp_out: port@1 {
844                         reg = <1>;
845                         #address-cells = <1>;
846                         #size-cells = <0>;
847
848                         edp_out_panel: endpoint@0 {
849                                 reg = <0>;
850                                 remote-endpoint = <&panel_in_edp>;
851                         };
852                 };
853         };
854 };
855
856 &vopb {
857         status = "okay";
858 };
859
860 &vopb_mmu {
861         status = "okay";
862 };
863
864 &vopl {
865         status = "okay";
866 };
867
868 &vopl_mmu {
869         status = "okay";
870 };
871
872 &display_subsystem {
873         status = "okay";
874 };
875
876 &gpu {
877         mali-supply = <&ppvar_gpu>;
878         status = "okay";
879 };
880
881 /* HACKS: Poorly formatted on purpose so you know they're hacks */
882
883 /* HACK THE PWM REGULATOR OUT
884  *
885  * We'll hack them all to pretend they are fixed regulators
886  * and at exactly .9V, which is where cpufreq wants them.
887  *
888  * We'll also set all PWMs to disabled so we know that the PWM
889  * framework won't touch them.
890  *
891  * This relies on PWM clock being a critical clock.
892  */
893 &ppvar_bigcpu {
894         compatible = "regulator-fixed";
895         regulator-min-microvolt = <900000>;
896         regulator-max-microvolt = <900000>;
897 };
898
899 &ppvar_centerlogic {
900         compatible = "regulator-fixed";
901         regulator-min-microvolt = <900000>;
902         regulator-max-microvolt = <900000>;
903 };
904
905 &ppvar_litcpu {
906         compatible = "regulator-fixed";
907         regulator-min-microvolt = <900000>;
908         regulator-max-microvolt = <900000>;
909 };
910
911 &ppvar_gpu {
912         compatible = "regulator-fixed";
913         regulator-min-microvolt = <900000>;
914         regulator-max-microvolt = <900000>;
915 };
916
917 &pwm0 {
918         status = "disabled";
919 };
920
921 &pwm1 {
922         status = "disabled";
923 };
924
925 &pwm2 {
926
927         status = "disabled";
928 };
929
930 &pwm3 {
931         status = "disabled";
932 };
933
934 &pvtm {
935         status = "okay";
936 };
937
938 &pmu_pvtm {
939         status = "okay";
940 };
941
942 &pmu_io_domains {
943         status = "okay";
944         pmu1830-supply = <&pp1800_pmu>;         /* PMUIO2_VDD */
945 };
946
947 /* PINCTRL: always below everything else */
948
949 &pinctrl {
950         pcfg_output_high: pcfg-output-high {
951                 output-high;
952         };
953
954         cros-ec {
955                 ec_ap_int_l: ec-ap-int-l {
956                         rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO &pcfg_pull_up>;
957                 };
958         };
959
960         discrete-regulators {
961                 pp1500_en: pp1500-en {
962                         rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO
963                                          &pcfg_pull_none>;
964                 };
965
966                 pp1800_audio_en: pp1800-audio-en {
967                         rockchip,pins = <RK_GPIO0 2 RK_FUNC_GPIO
968                                          &pcfg_pull_down>;
969                 };
970
971                 pp3300_disp_en: pp3300-disp-en {
972                         rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
973                                          &pcfg_pull_none>;
974                 };
975
976                 pp3000_en: pp3000-en {
977                         rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO
978                                          &pcfg_pull_none>;
979                 };
980
981                 sd_io_pwr_en: sd-io-pwr-en {
982                         rockchip,pins = <RK_GPIO2 2 RK_FUNC_GPIO
983                                          &pcfg_pull_none>;
984                 };
985
986                 sd_pwr_1800_sel: sd-pwr-1800-sel {
987                         rockchip,pins = <RK_GPIO2 28 RK_FUNC_GPIO
988                                          &pcfg_pull_none>;
989                 };
990
991                 sd_slot_pwr_en: sd-slot-pwr-en {
992                         rockchip,pins = <RK_GPIO4 29 RK_FUNC_GPIO
993                                          &pcfg_pull_none>;
994                 };
995
996                 wlan_module_pd_l: wlan-module-pd-l {
997                         rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO
998                                          &pcfg_pull_down>;
999                 };
1000         };
1001
1002         codec {
1003                 /* Has external pullup */
1004                 headset_int_l: headset-int-l {
1005                         rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_none>;
1006                 };
1007
1008                 // TODO: check pull.  From signal name assume active high.
1009                 mic_int: mic-int {
1010                         rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_down>;
1011                 };
1012         };
1013
1014         sdmmc {
1015                 /*
1016                  * We have external pulls on SDMMC, so diable internals
1017                  *
1018                  * TODO:
1019                  * - On veyron we found that we needed to drive at 8mA.  Do we
1020                  *   need to that here?  If so, 8mA or 12mA?
1021                  */
1022                 sdmmc_bus4: sdmmc-bus4 {
1023                         rockchip,pins =
1024                                 <4 8 RK_FUNC_1 &pcfg_pull_none>,
1025                                 <4 9 RK_FUNC_1 &pcfg_pull_none>,
1026                                 <4 10 RK_FUNC_1 &pcfg_pull_none>,
1027                                 <4 11 RK_FUNC_1 &pcfg_pull_none>;
1028                 };
1029
1030                 sdmmc_clk: sdmmc-clk {
1031                         rockchip,pins =
1032                                 <4 12 RK_FUNC_1 &pcfg_pull_none>;
1033                 };
1034
1035                 sdmmc_cmd: sdmmc-cmd {
1036                         rockchip,pins =
1037                                 <4 13 RK_FUNC_1 &pcfg_pull_none>;
1038                 };
1039
1040                 /*
1041                  * In our case the official card detect is hooked to ground
1042                  * to avoid getting access to JTAG just by sticking something
1043                  * in the SD card slot (see the force_jtag bit in the TRM).
1044                  *
1045                  * We still configure it as card detect because it doesn't
1046                  * hurt and dw_mmc will ignore it.  We make sure to disable
1047                  * the pull though so we don't burn needless power.
1048                  */
1049                 sdmmc_cd: sdmcc-cd {
1050                         rockchip,pins =
1051                                 <0 7 RK_FUNC_1 &pcfg_pull_none>;
1052                 };
1053
1054                 /* This is where we actually hook up CD; has external pull */
1055                 sdmmc_cd_gpio: sdmmc-cd-gpio {
1056                         rockchip,pins = <4 24 RK_FUNC_GPIO &pcfg_pull_none>;
1057                 };
1058         };
1059
1060         trackpad {
1061                 ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
1062                         rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
1063                 };
1064
1065                 trackpad_int_l: trackpad-int-l {
1066                         rockchip,pins = <1 4 RK_FUNC_GPIO &pcfg_pull_up>;
1067                 };
1068         };
1069
1070         backlight-enable {
1071                 bl_en: bl-en {
1072                         rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_none>;
1073                 };
1074         };
1075 };
1076
1077 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1078 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1079 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1080