ARM64: dts: gru: fix pwm regulator supplies
[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                 pwm-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                 pwm-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                 pwm-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                 pwm-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         backlight: backlight {
491                 compatible = "gpio-backlight";
492                 pinctrl-names = "default";
493                 pinctrl-0 = <&bl_en>;
494                 gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
495         };
496
497         edp_panel: edp-panel {
498                 compatible = "samsung,lsn122dl01-c01", "panel-simple";
499                 backlight = <&backlight>;
500                 power-supply = <&pp3300_disp>;
501
502                 ports {
503                         panel_in_edp: endpoint {
504                                 remote-endpoint = <&edp_out_panel>;
505                         };
506                 };
507         };
508 };
509
510 &cpu_l0 {
511         cpu-supply = <&ppvar_litcpu>;
512 };
513
514 &cpu_l1 {
515         cpu-supply = <&ppvar_litcpu>;
516 };
517
518 &cpu_l2 {
519         cpu-supply = <&ppvar_litcpu>;
520 };
521
522 &cpu_l3 {
523         cpu-supply = <&ppvar_litcpu>;
524 };
525
526 &cpu_b0 {
527         cpu-supply = <&ppvar_bigcpu>;
528 };
529
530 &cpu_b1 {
531         cpu-supply = <&ppvar_bigcpu>;
532 };
533
534 &emmc_phy {
535         status = "okay";
536 };
537
538 ap_i2c_mic: &i2c1 {
539         status = "okay";
540
541         // TODO: bus speed
542         //       ...with no speed, it should just use 100kHz
543         // TODO: rise / fall times?
544
545         // TODO: This is in mainline, but not the Rockchip private kernel
546         // TODO: Need to hook this into the rest of audio stuff...
547
548         // TODO: any pinctrl needed for this codec???
549         headsetcodec: rt5514@57 {
550                 compatible = "realtek,rt5514";
551                 reg = <0x57>;
552                 pinctrl-names = "default";
553                 pinctrl-0 = <&mic_int>;
554
555                 /*
556                  * NOTE: Interrupts aren't part of the binding and driver
557                  * doesn't support it, but throw it in anyway.
558                  */
559                 interrupt-parent = <&gpio1>;
560                 interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
561         };
562 };
563
564 ap_i2c_ts: &i2c3 {
565         status = "okay";
566
567         // TODO: bus speed
568         //       ...with no speed, it should just use 100kHz
569         // TODO: rise / fall times?
570
571         // TODO: Add the proper touchscreen reference...
572
573
574         // TODO: Might need to go in sub boards????
575 };
576
577 ap_i2c_tp: &i2c5 {
578         /*
579          * Note strange pullup enable.  Apparently this avoids leakage but
580          * still allows us to get nice 4.7K pullups for high speed i2c
581          * transfers.  Basically we want the pullup on whenever the ap is
582          * alive, so the "en" pin just gets set to output high.
583          */
584         pinctrl-0 = <&i2c5_xfer &ap_i2c_tp_pu_en>;
585
586         status = "okay";
587
588         // TODO: bus speed
589         //       ...with no speed, it should just use 100kHz
590         // TODO: rise / fall times?
591
592         // TODO: Add the proper touchpanel reference...
593 };
594
595 ap_i2c_audio: &i2c8 {
596         status = "okay";
597
598         // TODO: bus speed
599         //       ...with no speed, it should just use 100kHz
600         // TODO: rise / fall times?
601         // ...on gru-gru this is on a sub board, so expect bad rise/fall times
602
603         // TODO: copied from sample.  Double-check...
604         codec: da7219@1a {
605                 compatible = "dlg,da7219";
606                 reg = <0x1a>;
607
608                 pinctrl-names = "default";
609                 pinctrl-0 = <&headset_int_l>;
610
611                 interrupt-parent = <&gpio1>;
612                 interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
613
614                 VDD-supply = <&pp1800>;
615                 VDDMIC-supply = <&pp3300>;
616                 VDDIO-supply = <&pp1800>;
617
618                 // TODO: I THINK this is right, but it's a bit of a guess.
619                 clocks = <&cru SCLK_I2S_8CH_OUT>;
620                 clock-names = "mclk";
621
622 // Below is from bindings; we need to adjust for our SoC / board.
623                 dlg,ldo-lvl = <1200>;
624                 dlg,micbias-lvl = <2600>;
625                 dlg,mic-amp-in-sel = "diff";
626
627                 da7219_aad {
628                         dlg,btn-cfg = <50>;
629                         dlg,mic-det-thr = <500>;
630                         dlg,jack-ins-deb = <20>;
631                         dlg,jack-det-rate = "32ms_64ms";
632                         dlg,jack-rem-deb = <1>;
633
634                         dlg,a-d-btn-thr = <0xa>;
635                         dlg,d-b-btn-thr = <0x16>;
636                         dlg,b-c-btn-thr = <0x21>;
637                         dlg,c-mic-btn-thr = <0x3E>;
638
639                         dlg,btn-avg = <4>;
640                         dlg,adc-1bit-rpt = <1>;
641                 };
642         };
643 };
644
645 &i2s0 {
646         status = "okay";
647 };
648
649 &pwm0 {
650         status = "okay";
651 };
652
653 &pwm1 {
654         status = "okay";
655 };
656
657 &pwm2 {
658         status = "okay";
659 };
660
661 &pwm3 {
662         status = "okay";
663 };
664
665 &sdhci {
666         status = "okay";
667
668         // HACK: supports-emmc is not mainline.
669         supports-emmc;
670
671         // HACK: limit to 50MHz to avoid tuning during bringup.
672         max-frequency = <50000000>;
673
674         // TODO: add caps?
675         //cap-mmc-highspeed;
676         //mmc-hs200-1_8v;
677         //mmc-hs400-1_8v;
678
679         bus-width = <8>;
680         non-removable;
681
682         vmmc-supply = <&pp3000>;
683         vqmmc-supply = <&pp1800_emmc>;
684 };
685
686 &sdmmc {
687         status = "okay";
688
689         /*
690          * Note: configure "sdmmc_cd" as card detect even though it's actually
691          * hooked to ground.  Because we specified "cd-gpios" below dw_mmc
692          * should be ignoring card detect anyway.  Specifying the pin as
693          * sdmmc_cd means that even if you've got GRF_SOC_CON7[12] (force_jtag)
694          * turned on that the system will still make sure the port is
695          * configured as SDMMC and not JTAG.
696          */
697         pinctrl-names = "default";
698         pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio
699                      &sdmmc_bus4>;
700
701         // HACK: supports-sd is not in mainline.
702         supports-sd;
703
704         // HACK: Limit freq for now
705         // ...as of 160330 confirmed that things break if you remove this.
706         clock-frequency = <37500000>;
707         clock-freq-min-max = <400000 37500000>;
708
709         bus-width = <4>;
710         cd-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;
711         disable-wp;
712
713         cap-mmc-highspeed;
714         cap-sd-highspeed;
715
716         // TODO: enable once tested...
717         //sd-uhs-sdr12;
718         //sd-uhs-sdr25;
719         //sd-uhs-sdr50;
720         //sd-uhs-sdr104;
721
722         // Comment out until we turn on gpio-regulator config
723         vmmc-supply = <&pp3000_sd_slot>;
724         vqmmc-supply = <&ppvar_sd_card_io>;
725 };
726
727 &spi0 {
728         status = "okay";
729
730         // TODO: more properly.  Hacky spidev for now???
731         // A few notes:
732         // - We either have a Haven here or a Infineon SLB9670.  The SLB9670
733         //   is supposed to be a fallback if Haven is broken.
734         // - Either TPM is supposed to be TPM 2.0 hooked up to SPI.  I see some
735         //   kernel support for TPM 2.0 on x86 (hooked up with ACPI) but no
736         //   generic way to say "we have a SPI TPM 2.0".  We'll need to add
737         //   a driver for whichever way we go.
738         // - wfrichar@ says that for Haven if it has gone to sleep we might
739         //   need to add a delay after asserting chip select.  Presumably
740         //   haven-specific driver will need to handle this logic (keeping
741         //   track when we last talked and adding an extra delay if it's been
742         //   a while).
743         tpm@0 {
744                 compatible = "spidev";
745                 // TODO: can run faster once verified.
746                 // TODO: add rx-sample-delay-ns.
747                 spi-max-frequency = <10000000>;
748                 reg = <0>;
749         };
750 };
751
752 &spi1 {
753         status = "okay";
754
755         // TODO: Ideally we want to use MTD for this, but presumably
756         // we'll wait until we can test it and also bring it up in our
757         // kernel tree.
758         spiflash@0 {
759                 compatible = "spidev";
760                 // TODO: can run faster once verified.
761                 // TODO: add rx-sample-delay-ns.
762                 spi-max-frequency = <10000000>;
763                 reg = <0>;
764         };
765 };
766
767 &spi2 {
768         status = "okay";
769
770         // TODO: more properly.  Hacky spidev for now???
771         wacky_spi_audio@0 {
772                 compatible = "spidev";
773
774                 // TODO: can run faster once verified.
775                 // TODO: add rx-sample-delay-ns.
776                 spi-max-frequency = <10000000>;
777                 reg = <0>;
778         };
779 };
780
781 &spi5 {
782         status = "okay";
783
784         cros_ec: ec@0 {
785                 compatible = "google,cros-ec-spi";
786                 reg = <0>;
787                 pinctrl-names = "default";
788                 pinctrl-0 = <&ec_ap_int_l>;
789
790                 google,cros-ec-spi-pre-delay = <30>;    // TODO: check
791                 interrupt-parent = <&gpio0>;
792                 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
793                 spi-max-frequency = <3000000>;          // TODO: check; TODO: rx-sample-delay-ns?
794
795                 i2c_tunnel: i2c-tunnel {
796                         compatible = "google,cros-ec-i2c-tunnel";
797                         google,remote-bus = <0>;
798                         #address-cells = <1>;
799                         #size-cells = <0>;
800                 };
801         };
802 };
803
804 // TODO:
805 // - double-check that hw-tshut-mode is same as EVB
806 // - double check that hw-tshut-polarity is the same as EVB
807 &tsadc {
808         status = "okay";
809
810         rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
811         rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
812 };
813
814 &uart2 {
815         status = "okay";
816 };
817
818 &usb_host0_echi {
819         status = "okay";
820 };
821
822 &usb_host0_ohci {
823         status = "okay";
824 };
825
826 &usb_host1_echi {
827         status = "okay";
828 };
829
830 &usb_host1_ohci {
831         status = "okay";
832 };
833
834 &usbdrd3_0 {
835         status = "okay";
836 };
837
838 &usbdrd_dwc3_0 {
839         status = "okay";
840         dr_mode = "host";       // TODO: needed?
841 };
842
843 &usbdrd3_1 {
844         status = "okay";
845 };
846
847 &usbdrd_dwc3_1 {
848         status = "okay";
849         dr_mode = "host";       // TODO: needed?
850 };
851
852 &edp {
853         status = "okay";
854
855         ports {
856                 edp_out: port@1 {
857                         reg = <1>;
858                         #address-cells = <1>;
859                         #size-cells = <0>;
860
861                         edp_out_panel: endpoint@0 {
862                                 reg = <0>;
863                                 remote-endpoint = <&panel_in_edp>;
864                         };
865                 };
866         };
867 };
868
869 &vopb {
870         status = "okay";
871 };
872
873 &vopb_mmu {
874         status = "okay";
875 };
876
877 &vopl {
878         status = "okay";
879 };
880
881 &vopl_mmu {
882         status = "okay";
883 };
884
885 &display_subsystem {
886         status = "okay";
887 };
888
889 &gpu {
890         mali-supply = <&ppvar_gpu>;
891         status = "okay";
892 };
893
894 /* HACKS: Poorly formatted on purpose so you know they're hacks */
895
896 /* HACK THE PWM REGULATOR OUT
897  *
898  * We'll hack them all to pretend they are fixed regulators
899  * and at exactly .9V, which is where cpufreq wants them.
900  *
901  * We'll also set all PWMs to disabled so we know that the PWM
902  * framework won't touch them.
903  *
904  * This relies on PWM clock being a critical clock.
905  */
906 &ppvar_bigcpu {
907         compatible = "regulator-fixed";
908         regulator-min-microvolt = <900000>;
909         regulator-max-microvolt = <900000>;
910 };
911
912 &ppvar_centerlogic {
913         compatible = "regulator-fixed";
914         regulator-min-microvolt = <900000>;
915         regulator-max-microvolt = <900000>;
916 };
917
918 &ppvar_litcpu {
919         compatible = "regulator-fixed";
920         regulator-min-microvolt = <900000>;
921         regulator-max-microvolt = <900000>;
922 };
923
924 &ppvar_gpu {
925         compatible = "regulator-fixed";
926         regulator-min-microvolt = <900000>;
927         regulator-max-microvolt = <900000>;
928 };
929
930 &pwm0 {
931         status = "disabled";
932 };
933
934 &pwm1 {
935         status = "disabled";
936 };
937
938 &pwm2 {
939
940         status = "disabled";
941 };
942
943 &pwm3 {
944         status = "disabled";
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 = <0 2 RK_FUNC_GPIO &pcfg_pull_up>;
957                 };
958         };
959
960         discrete-regulators {
961                 pp1500_en: pp1500-en {
962                         rockchip,pins = <RK_GPIO1 11 RK_FUNC_GPIO
963                                          &pcfg_pull_none>;
964                 };
965
966                 pp1800_audio_en: pp1800-audio-en {
967                         rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO
968                                          &pcfg_pull_none>;
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_GPIO1 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 8 RK_FUNC_GPIO
998                                          &pcfg_pull_none>;
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 26 RK_FUNC_GPIO &pcfg_pull_none>;
1057                 };
1058         };
1059
1060         touchpanel {
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
1066         backlight-enable {
1067                 bl_en: bl-en {
1068                         rockchip,pins = <1 17 RK_FUNC_GPIO &pcfg_pull_none>;
1069                 };
1070         };
1071 };
1072
1073 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1074 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1075 /* DON'T PUT ANYTHING BELOW HERE.  PUT IT ABOVE PINCTRL */
1076