ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1
[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         status = "okay";
660 };
661
662 &sdhci {
663         bus-width = <8>;
664         mmc-hs400-1_8v;
665         supports-emmc;
666         non-removable;
667         status = "okay";
668 };
669
670 &sdmmc {
671         status = "okay";
672
673         /*
674          * Note: configure "sdmmc_cd" as card detect even though it's actually
675          * hooked to ground.  Because we specified "cd-gpios" below dw_mmc
676          * should be ignoring card detect anyway.  Specifying the pin as
677          * sdmmc_cd means that even if you've got GRF_SOC_CON7[12] (force_jtag)
678          * turned on that the system will still make sure the port is
679          * configured as SDMMC and not JTAG.
680          */
681         pinctrl-names = "default";
682         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio
683                      &sdmmc_bus4>;
684
685         // HACK: supports-sd is not in mainline.
686         supports-sd;
687
688         // HACK: Limit freq for now
689         // ...as of 160330 confirmed that things break if you remove this.
690         clock-frequency = <37500000>;
691         clock-freq-min-max = <400000 37500000>;
692
693         bus-width = <4>;
694         cd-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
695         disable-wp;
696
697         cap-mmc-highspeed;
698         cap-sd-highspeed;
699
700         // TODO: enable once tested...
701         //sd-uhs-sdr12;
702         //sd-uhs-sdr25;
703         //sd-uhs-sdr50;
704         //sd-uhs-sdr104;
705
706         // Comment out until we turn on gpio-regulator config
707         vmmc-supply = <&pp3000_sd_slot>;
708         vqmmc-supply = <&ppvar_sd_card_io>;
709 };
710
711 &spi0 {
712         status = "okay";
713
714         // TODO: more properly.  Hacky spidev for now???
715         // A few notes:
716         // - We either have a Haven here or a Infineon SLB9670.  The SLB9670
717         //   is supposed to be a fallback if Haven is broken.
718         // - Either TPM is supposed to be TPM 2.0 hooked up to SPI.  I see some
719         //   kernel support for TPM 2.0 on x86 (hooked up with ACPI) but no
720         //   generic way to say "we have a SPI TPM 2.0".  We'll need to add
721         //   a driver for whichever way we go.
722         // - wfrichar@ says that for Haven if it has gone to sleep we might
723         //   need to add a delay after asserting chip select.  Presumably
724         //   haven-specific driver will need to handle this logic (keeping
725         //   track when we last talked and adding an extra delay if it's been
726         //   a while).
727         tpm@0 {
728                 compatible = "spidev";
729                 // TODO: can run faster once verified.
730                 // TODO: add rx-sample-delay-ns.
731                 spi-max-frequency = <10000000>;
732                 reg = <0>;
733         };
734 };
735
736 &spi1 {
737         status = "okay";
738
739         // TODO: Ideally we want to use MTD for this, but presumably
740         // we'll wait until we can test it and also bring it up in our
741         // kernel tree.
742         spiflash@0 {
743                 compatible = "spidev";
744                 // TODO: can run faster once verified.
745                 // TODO: add rx-sample-delay-ns.
746                 spi-max-frequency = <10000000>;
747                 reg = <0>;
748         };
749 };
750
751 &spi2 {
752         status = "okay";
753
754         // TODO: more properly.  Hacky spidev for now???
755         wacky_spi_audio@0 {
756                 compatible = "spidev";
757
758                 // TODO: can run faster once verified.
759                 // TODO: add rx-sample-delay-ns.
760                 spi-max-frequency = <10000000>;
761                 reg = <0>;
762         };
763 };
764
765 &spi5 {
766         status = "okay";
767
768         cros_ec: ec@0 {
769                 compatible = "google,cros-ec-spi";
770                 reg = <0>;
771                 pinctrl-names = "default";
772                 pinctrl-0 = <&ec_ap_int_l>;
773
774                 google,cros-ec-spi-pre-delay = <30>;    // TODO: check
775                 interrupt-parent = <&gpio0>;
776                 interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
777                 spi-max-frequency = <3000000>;          // TODO: check; TODO: rx-sample-delay-ns?
778
779                 i2c_tunnel: i2c-tunnel {
780                         compatible = "google,cros-ec-i2c-tunnel";
781                         google,remote-bus = <0>;
782                         #address-cells = <1>;
783                         #size-cells = <0>;
784                 };
785         };
786 };
787
788 // TODO:
789 // - double-check that hw-tshut-mode is same as EVB
790 // - double check that hw-tshut-polarity is the same as EVB
791 &tsadc {
792         status = "okay";
793
794         rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
795         rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
796 };
797
798 &uart2 {
799         status = "okay";
800 };
801
802 &usb_host0_ehci {
803         status = "okay";
804 };
805
806 &usb_host0_ohci {
807         status = "okay";
808 };
809
810 &usb_host1_ehci {
811         status = "okay";
812 };
813
814 &usb_host1_ohci {
815         status = "okay";
816 };
817
818 &usbdrd3_0 {
819         status = "okay";
820 };
821
822 &usbdrd_dwc3_0 {
823         status = "okay";
824         dr_mode = "host";       // TODO: needed?
825 };
826
827 &usbdrd3_1 {
828         status = "okay";
829 };
830
831 &usbdrd_dwc3_1 {
832         status = "okay";
833         dr_mode = "host";       // TODO: needed?
834 };
835
836 &edp {
837         status = "okay";
838
839         ports {
840                 edp_out: port@1 {
841                         reg = <1>;
842                         #address-cells = <1>;
843                         #size-cells = <0>;
844
845                         edp_out_panel: endpoint@0 {
846                                 reg = <0>;
847                                 remote-endpoint = <&panel_in_edp>;
848                         };
849                 };
850         };
851 };
852
853 &vopb {
854         status = "okay";
855 };
856
857 &vopb_mmu {
858         status = "okay";
859 };
860
861 &vopl {
862         status = "okay";
863 };
864
865 &vopl_mmu {
866         status = "okay";
867 };
868
869 &display_subsystem {
870         status = "okay";
871 };
872
873 &gpu {
874         mali-supply = <&ppvar_gpu>;
875         status = "okay";
876 };
877
878 /* HACKS: Poorly formatted on purpose so you know they're hacks */
879
880 /* HACK THE PWM REGULATOR OUT
881  *
882  * We'll hack them all to pretend they are fixed regulators
883  * and at exactly .9V, which is where cpufreq wants them.
884  *
885  * We'll also set all PWMs to disabled so we know that the PWM
886  * framework won't touch them.
887  *
888  * This relies on PWM clock being a critical clock.
889  */
890 &ppvar_bigcpu {
891         compatible = "regulator-fixed";
892         regulator-min-microvolt = <900000>;
893         regulator-max-microvolt = <900000>;
894 };
895
896 &ppvar_centerlogic {
897         compatible = "regulator-fixed";
898         regulator-min-microvolt = <900000>;
899         regulator-max-microvolt = <900000>;
900 };
901
902 &ppvar_litcpu {
903         compatible = "regulator-fixed";
904         regulator-min-microvolt = <900000>;
905         regulator-max-microvolt = <900000>;
906 };
907
908 &ppvar_gpu {
909         compatible = "regulator-fixed";
910         regulator-min-microvolt = <900000>;
911         regulator-max-microvolt = <900000>;
912 };
913
914 &pwm0 {
915         status = "disabled";
916 };
917
918 &pwm1 {
919         status = "disabled";
920 };
921
922 &pwm2 {
923
924         status = "disabled";
925 };
926
927 &pwm3 {
928         status = "disabled";
929 };
930
931 &pvtm {
932         status = "okay";
933 };
934
935 &pmu_pvtm {
936         status = "okay";
937 };
938
939 &pmu_io_domains {
940         status = "okay";
941         pmu1830-supply = <&pp1800_pmu>;         /* PMUIO2_VDD */
942 };
943
944 /* PINCTRL: always below everything else */
945
946 &pinctrl {
947         pcfg_output_high: pcfg-output-high {
948                 output-high;
949         };
950
951         cros-ec {
952                 ec_ap_int_l: ec-ap-int-l {
953                         rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO &pcfg_pull_up>;
954                 };
955         };
956
957         discrete-regulators {
958                 pp1500_en: pp1500-en {
959                         rockchip,pins = <RK_GPIO0 10 RK_FUNC_GPIO
960                                          &pcfg_pull_none>;
961                 };
962
963                 pp1800_audio_en: pp1800-audio-en {
964                         rockchip,pins = <RK_GPIO0 2 RK_FUNC_GPIO
965                                          &pcfg_pull_down>;
966                 };
967
968                 pp3300_disp_en: pp3300-disp-en {
969                         rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
970                                          &pcfg_pull_none>;
971                 };
972
973                 pp3000_en: pp3000-en {
974                         rockchip,pins = <RK_GPIO0 12 RK_FUNC_GPIO
975                                          &pcfg_pull_none>;
976                 };
977
978                 sd_io_pwr_en: sd-io-pwr-en {
979                         rockchip,pins = <RK_GPIO2 2 RK_FUNC_GPIO
980                                          &pcfg_pull_none>;
981                 };
982
983                 sd_pwr_1800_sel: sd-pwr-1800-sel {
984                         rockchip,pins = <RK_GPIO2 28 RK_FUNC_GPIO
985                                          &pcfg_pull_none>;
986                 };
987
988                 sd_slot_pwr_en: sd-slot-pwr-en {
989                         rockchip,pins = <RK_GPIO4 29 RK_FUNC_GPIO
990                                          &pcfg_pull_none>;
991                 };
992
993                 wlan_module_pd_l: wlan-module-pd-l {
994                         rockchip,pins = <RK_GPIO0 4 RK_FUNC_GPIO
995                                          &pcfg_pull_down>;
996                 };
997         };
998
999         codec {
1000                 /* Has external pullup */
1001                 headset_int_l: headset-int-l {
1002                         rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_none>;
1003                 };
1004
1005                 // TODO: check pull.  From signal name assume active high.
1006                 mic_int: mic-int {
1007                         rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_down>;
1008                 };
1009         };
1010
1011         sdmmc {
1012                 /*
1013                  * We have external pulls on SDMMC, so diable internals
1014                  *
1015                  * TODO:
1016                  * - On veyron we found that we needed to drive at 8mA.  Do we
1017                  *   need to that here?  If so, 8mA or 12mA?
1018                  */
1019                 sdmmc_bus4: sdmmc-bus4 {
1020                         rockchip,pins =
1021                                 <4 8 RK_FUNC_1 &pcfg_pull_none>,
1022                                 <4 9 RK_FUNC_1 &pcfg_pull_none>,
1023                                 <4 10 RK_FUNC_1 &pcfg_pull_none>,
1024                                 <4 11 RK_FUNC_1 &pcfg_pull_none>;
1025                 };
1026
1027                 sdmmc_clk: sdmmc-clk {
1028                         rockchip,pins =
1029                                 <4 12 RK_FUNC_1 &pcfg_pull_none>;
1030                 };
1031
1032                 sdmmc_cmd: sdmmc-cmd {
1033                         rockchip,pins =
1034                                 <4 13 RK_FUNC_1 &pcfg_pull_none>;
1035                 };
1036
1037                 /*
1038                  * In our case the official card detect is hooked to ground
1039                  * to avoid getting access to JTAG just by sticking something
1040                  * in the SD card slot (see the force_jtag bit in the TRM).
1041                  *
1042                  * We still configure it as card detect because it doesn't
1043                  * hurt and dw_mmc will ignore it.  We make sure to disable
1044                  * the pull though so we don't burn needless power.
1045                  */
1046                 sdmmc_cd: sdmcc-cd {
1047                         rockchip,pins =
1048                                 <0 7 RK_FUNC_1 &pcfg_pull_none>;
1049                 };
1050
1051                 /* This is where we actually hook up CD; has external pull */
1052                 sdmmc_cd_gpio: sdmmc-cd-gpio {
1053                         rockchip,pins = <4 24 RK_FUNC_GPIO &pcfg_pull_none>;
1054                 };
1055         };
1056
1057         trackpad {
1058                 ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
1059                         rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
1060                 };
1061
1062                 trackpad_int_l: trackpad-int-l {
1063                         rockchip,pins = <1 4 RK_FUNC_GPIO &pcfg_pull_up>;
1064                 };
1065         };
1066
1067         backlight-enable {
1068                 bl_en: bl-en {
1069                         rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_none>;
1070                 };
1071         };
1072 };
1073
1074 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1075 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1076 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1077