2 * Google Gru (and derivatives) board device tree source
4 * Copyright 2016 Google, Inc
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
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.
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.
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
32 * The above copyright notice and this permission notice shall be
33 * included in all copies or substantial portions of the Software.
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.
45 #include <dt-bindings/pwm/pwm.h>
46 #include "rk3399.dtsi"
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
55 * - Rails that only connect to the EC (or devices that the EC talks to)
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
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
73 /* parentless regulators */
75 ppvar_sys: ppvar-sys {
76 compatible = "regulator-fixed";
77 regulator-name = "ppvar_sys";
82 /* ppvar_sys children, sorted by name */
85 compatible = "regulator-fixed";
86 regulator-name = "pp900_ap";
88 /* EC turns on w/ pp900_ap_en; always on for AP */
92 regulator-min-microvolt = <900000>;
93 regulator-max-microvolt = <900000>;
95 vin-supply = <&ppvar_sys>;
98 pp1200_lpddr: pp1200-lpddr {
99 compatible = "regulator-fixed";
100 regulator-name = "pp1200_lpddr";
102 /* EC turns on w/ lpddr_pwr_en; always on for AP */
106 regulator-min-microvolt = <1200000>;
107 regulator-max-microvolt = <1200000>;
109 vin-supply = <&ppvar_sys>;
113 compatible = "regulator-fixed";
114 regulator-name = "pp1800";
116 /* Always on when ppvar_sys shows power good */
120 regulator-min-microvolt = <1800000>;
121 regulator-max-microvolt = <1800000>;
122 vin-supply = <&ppvar_sys>;
126 compatible = "regulator-fixed";
127 regulator-name = "pp3000";
128 pinctrl-names = "default";
129 pinctrl-0 = <&pp3000_en>;
132 gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
137 regulator-min-microvolt = <3000000>;
138 regulator-max-microvolt = <3000000>;
140 vin-supply = <&ppvar_sys>;
144 compatible = "regulator-fixed";
145 regulator-name = "pp3300";
147 /* Always on; plain and simple */
151 regulator-min-microvolt = <3300000>;
152 regulator-max-microvolt = <3300000>;
154 vin-supply = <&ppvar_sys>;
158 compatible = "regulator-fixed";
159 regulator-name = "pp5000";
161 /* EC turns on w/ pp5000_en; always on for AP */
165 regulator-min-microvolt = <5000000>;
166 regulator-max-microvolt = <5000000>;
168 vin-supply = <&ppvar_sys>;
171 ppvar_bigcpu: ppvar-bigcpu {
172 compatible = "pwm-regulator";
173 regulator-name = "ppvar_bigcpu";
176 pwms = <&pwm1 0 3333 0>;
178 // TODO: where's the mapping of duty cycle to voltage???
179 // TODO: we probably need in-flight PWM regulator series?
181 /* EC turns on w/ ap_core_en; always on for AP */
185 regulator-min-microvolt = <800000>;
186 regulator-max-microvolt = <1500000>;
188 vin-supply = <&ppvar_sys>;
191 ppvar_litcpu: ppvar-litcpu {
192 compatible = "pwm-regulator";
193 regulator-name = "ppvar_litcpu";
196 pwms = <&pwm2 0 3333 0>;
198 /* EC turns on w/ ap_core_en; always on for AP */
202 regulator-min-microvolt = <800000>;
203 regulator-max-microvolt = <1500000>;
205 vin-supply = <&ppvar_sys>;
208 ppvar_gpu: ppvar-gpu {
209 compatible = "pwm-regulator";
210 regulator-name = "ppvar_gpu";
213 pwms = <&pwm0 0 3333 0>;
215 /* EC turns on w/ ap_core_en; always on for AP */
219 regulator-min-microvolt = <800000>;
220 regulator-max-microvolt = <1500000>;
222 vin-supply = <&ppvar_sys>;
225 ppvar_centerlogic: ppvar-centerlogic {
226 compatible = "pwm-regulator";
227 regulator-name = "ppvar_centerlogic";
230 pwms = <&pwm3 0 3333 0>;
232 /* EC turns on w/ ppvar_centerlogic_en; always on for AP */
236 regulator-min-microvolt = <800000>;
237 regulator-max-microvolt = <1500000>;
239 vin-supply = <&ppvar_sys>;
242 /* Schematics call this PPVAR even though it's fixed */
243 ppvar_logic: ppvar-logic {
244 compatible = "regulator-fixed";
245 regulator-name = "ppvar_logic";
247 /* EC turns on w/ ppvar_logic_en; always on for AP */
251 regulator-min-microvolt = <900000>;
252 regulator-max-microvolt = <900000>;
254 vin-supply = <&ppvar_sys>;
257 /* pp900_ap aliases; these are always on for AP so just use alias */
259 /* EC turns on w/ pp900_ddrpll_en */
260 pp900_ddrpll: pp900_ap {
263 /* EC turns on w/ pp900_pcie_en */
264 pp900_pcie: pp900_ap {
267 /* EC turns on w/ pp900_pll_en */
268 pp900_pll: pp900_ap {
271 /* EC turns on w/ pp900_pmu_en */
272 pp900_pmu: pp900_ap {
275 /* EC turns on w/ pp900_usb_en */
276 pp900_usb: pp900_ap {
279 /* pp1800 aliases; these are always on for AP so just use alias */
281 /* EC turns on w/ pp1800_s0_en_l */
282 pp1800_ap_io: pp1800_emmc: pp1800_nfc: pp1800_s0: pp1800 {
285 /* EC turns on w/ pp1800_avdd_en_l */
286 pp1800_avdd: pp1800 {
289 /* EC turns on w/ pp1800_lid_en_l */
290 pp1800_lid: pp1800_mic: pp1800 {
293 /* EC turns on w/ lpddr_pwr_en */
294 pp1800_lpddr: pp1800 {
297 /* EC turns on w/ pp1800_pmu_en_l */
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 {
306 /* EC turns on w/ pp1800_usb_en_l */
310 /* pp1800 children */
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";
320 regulator-min-microvolt = <1200000>;
321 regulator-max-microvolt = <1200000>;
323 vin-supply = <&pp1800>;
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>;
333 gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
337 regulator-min-microvolt = <1500000>;
338 regulator-max-microvolt = <1500000>;
340 vin-supply = <&pp1800>; // TODO: DNS for 3.3??
343 pp1800_audio: pp1800-audio {
344 compatible = "regulator-fixed";
345 regulator-name = "pp1800_audio";
346 pinctrl-names = "default";
347 pinctrl-0 = <&pp1800_audio_en>;
350 gpio = <&gpio0 1 GPIO_ACTIVE_HIGH>;
352 vin-supply = <&pp1800>;
355 pp1800_pcie: pp1800-pcie {
356 compatible = "regulator-fixed";
357 regulator-name = "pp1800_pcie";
358 pinctrl-names = "default";
359 pinctrl-0 = <&wlan_module_pd_l>;
361 regulator-always-on; // TODO: for bringup???
362 regulator-boot-on; // TODO: for bringup???
364 gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
366 vin-supply = <&pp1800>;
369 /* pp3000 aliases; these are always on for AP so just use alias */
371 /* Always on; plain and simple */
372 pp3000_ap: pp3000_emmc: pp3000 {
375 /* pp3000 children */
377 pp3000_sd_slot: pp3000-sd-slot {
378 compatible = "regulator-fixed";
379 regulator-name = "pp3000_sd_slot";
380 pinctrl-names = "default";
381 pinctrl-0 = <&sd_slot_pwr_en>;
383 // regulator-always-on; // TODO: for bringup???
384 // regulator-boot-on; // TODO: for bringup???
387 gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
389 vin-supply = <&pp3000>;
392 ppvar_sd_card_io: ppvar-sd-card-io {
393 compatible = "regulator-gpio";
394 regulator-name = "ppvar_sd_card_io";
395 pinctrl-names = "default";
396 pinctrl-0 = <&sd_io_pwr_en &sd_pwr_1800_sel>;
398 // regulator-always-on; // TODO: for bringup???
399 // regulator-boot-on; // TODO: for bringup???
402 enable-gpio = <&gpio2 2 GPIO_ACTIVE_HIGH>;
403 gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>;
404 states = <1800000 0x1
407 regulator-min-microvolt = <1800000>;
408 regulator-max-microvolt = <3000000>;
410 // TODO: add support in driver for input supplies.
411 // ...and specify pp3000 and pp1800.
414 /* pp3300 aliases; these are always on for AP so just use alias */
416 /* EC turns on w/ pp3300_trackpad_en_l */
417 pp3300_trackpad: pp3300-trackpad {
420 /* EC turns on w/ pp3300_usb_en_l */
424 /* pp3300 children */
426 pp3300_disp: pp3300-disp {
427 compatible = "regulator-fixed";
428 regulator-name = "pp3300_disp";
429 pinctrl-names = "default";
430 pinctrl-0 = <&pp3300_disp_en>;
433 gpio = <&gpio4 27 GPIO_ACTIVE_HIGH>;
435 vin-supply = <&pp3300>;
438 pp3300_wifi_bt:pp3300-wifi-bt {
439 compatible = "regulator-fixed";
440 regulator-name = "pp3300_wifi_bt";
441 /* NOTE: wlan_module_pd_l pinctrl in pp1800_pcie */
443 regulator-always-on; // TODO: for bringup???
444 regulator-boot-on; // TODO: for bringup???
447 // TODO: I _think_ it's OK to specify the same GPIO in two
448 // regulator-fixed regulators. See pp1800_pcie
449 gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
451 vin-supply = <&pp3300>;
458 compatible = "rockchip,rk3399-io-voltage-domain";
459 rockchip,grf = <&grf>;
461 bt656-supply = <&pp1800_ap_io>; /* APIO2_VDD; 2a 2b */
462 audio-supply = <&pp1800_audio>; /* APIO5_VDD; 3d 4a */
463 sdmmc-supply = <&ppvar_sd_card_io>; /* SDMMC0_VDD; 4b */
464 gpio1830-supply = <&pp3000_ap>; /* APIO4_VDD; 4c 4d */
468 compatible = "rockchip,rk3399-pmu-io-voltage-domain";
469 rockchip,grf = <&pmugrf>;
471 pmu1830-supply = <&pp1800_pmu>; /* PMUIO2_VDD */
476 cpu-supply = <&ppvar_litcpu>;
480 cpu-supply = <&ppvar_litcpu>;
484 cpu-supply = <&ppvar_litcpu>;
488 cpu-supply = <&ppvar_litcpu>;
492 cpu-supply = <&ppvar_bigcpu>;
496 cpu-supply = <&ppvar_bigcpu>;
507 // ...with no speed, it should just use 100kHz
508 // TODO: rise / fall times?
510 // TODO: This is in mainline, but not the Rockchip private kernel
511 // TODO: Need to hook this into the rest of audio stuff...
513 // TODO: any pinctrl needed for this codec???
514 headsetcodec: rt5514@57 {
515 compatible = "realtek,rt5514";
517 pinctrl-names = "default";
518 pinctrl-0 = <&mic_int>;
521 * NOTE: Interrupts aren't part of the binding and driver
522 * doesn't support it, but throw it in anyway.
524 interrupt-parent = <&gpio1>;
525 interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
533 // ...with no speed, it should just use 100kHz
534 // TODO: rise / fall times?
536 // TODO: Add the proper touchscreen reference...
539 // TODO: Might need to go in sub boards????
544 * Note strange pullup enable. Apparently this avoids leakage but
545 * still allows us to get nice 4.7K pullups for high speed i2c
546 * transfers. Basically we want the pullup on whenever the ap is
547 * alive, so the "en" pin just gets set to output high.
549 pinctrl-0 = <&i2c5_xfer &ap_i2c_tp_pu_en>;
554 // ...with no speed, it should just use 100kHz
555 // TODO: rise / fall times?
557 // TODO: Add the proper touchpanel reference...
560 ap_i2c_audio: &i2c8 {
564 // ...with no speed, it should just use 100kHz
565 // TODO: rise / fall times?
566 // ...on gru-gru this is on a sub board, so expect bad rise/fall times
568 // TODO: copied from sample. Double-check...
570 compatible = "dlg,da7219";
572 pinctrl-names = "default";
573 pinctrl-0 = <&headset_int_l>;
575 interrupt-parent = <&gpio1>;
576 interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
578 VDD-supply = <&pp1800>;
579 VDDMIC-supply = <&pp3300>;
580 VDDIO-supply = <&pp1800>;
582 // TODO: I THINK this is right, but it's a bit of a guess.
583 clocks = <&cru SCLK_I2S_8CH_OUT>;
584 clock-names = "mclk";
586 // Below is from bindings; we need to adjust for our SoC / board.
587 // dlg,ldo-lvl = <1200>;
588 // dlg,micbias-lvl = <2600>;
589 // dlg,mic-amp-in-sel = "diff";
592 // dlg,btn-cfg = <50>;
593 // dlg,mic-det-thr = <500>;
594 // dlg,jack-ins-deb = <20>;
595 // dlg,jack-det-rate = "32ms_64ms";
596 // dlg,jack-rem-deb = <1>;
598 // dlg,a-d-btn-thr = <0xa>;
599 // dlg,d-b-btn-thr = <0x16>;
600 // dlg,b-c-btn-thr = <0x21>;
601 // dlg,c-mic-btn-thr = <0x3E>;
603 // dlg,btn-avg = <4>;
604 // dlg,adc-1bit-rpt = <1>;
632 // HACK: supports-emmc is not mainline.
635 // HACK: limit to 50MHz to avoid tuning during bringup.
636 max-frequency = <50000000>;
646 vmmc-supply = <&pp3000>;
647 vqmmc-supply = <&pp1800_emmc>;
654 * Note: configure "sdmmc_cd" as card detect even though it's actually
655 * hooked to ground. Because we specified "cd-gpios" below dw_mmc
656 * should be ignoring card detect anyway. Specifying the pin as
657 * sdmmc_cd means that even if you've got GRF_SOC_CON7[12] (force_jtag)
658 * turned on that the system will still make sure the port is
659 * configured as SDMMC and not JTAG.
661 pinctrl-names = "default";
662 pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio
665 // HACK: supports-sd is not in mainline.
668 // HACK: Limit freq for now
669 // ...as of 160330 confirmed that things break if you remove this.
670 clock-frequency = <37500000>;
671 clock-freq-min-max = <400000 37500000>;
674 cd-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;
676 rockchip,default-sample-phase = <90>;
681 // TODO: enable once tested...
687 // Comment out until we turn on gpio-regulator config
688 vmmc-supply = <&pp3000_sd_slot>;
689 vqmmc-supply = <&ppvar_sd_card_io>;
695 // TODO: more properly. Hacky spidev for now???
697 // - We either have a Haven here or a Infineon SLB9670. The SLB9670
698 // is supposed to be a fallback if Haven is broken.
699 // - Either TPM is supposed to be TPM 2.0 hooked up to SPI. I see some
700 // kernel support for TPM 2.0 on x86 (hooked up with ACPI) but no
701 // generic way to say "we have a SPI TPM 2.0". We'll need to add
702 // a driver for whichever way we go.
703 // - wfrichar@ says that for Haven if it has gone to sleep we might
704 // need to add a delay after asserting chip select. Presumably
705 // haven-specific driver will need to handle this logic (keeping
706 // track when we last talked and adding an extra delay if it's been
709 compatible = "spidev";
710 // TODO: can run faster once verified.
711 // TODO: add rx-sample-delay-ns.
712 spi-max-frequency = <10000000>;
720 // TODO: Ideally we want to use MTD for this, but presumably
721 // we'll wait until we can test it and also bring it up in our
724 compatible = "spidev";
725 // TODO: can run faster once verified.
726 // TODO: add rx-sample-delay-ns.
727 spi-max-frequency = <10000000>;
735 // TODO: more properly. Hacky spidev for now???
737 compatible = "spidev";
739 // TODO: can run faster once verified.
740 // TODO: add rx-sample-delay-ns.
741 spi-max-frequency = <10000000>;
750 compatible = "google,cros-ec-spi";
752 pinctrl-names = "default";
753 pinctrl-0 = <&ec_ap_int_l>;
755 google,cros-ec-spi-pre-delay = <30>; // TODO: check
756 interrupt-parent = <&gpio0>;
757 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
758 spi-max-frequency = <3000000>; // TODO: check; TODO: rx-sample-delay-ns?
760 i2c_tunnel: i2c-tunnel {
761 compatible = "google,cros-ec-i2c-tunnel";
762 google,remote-bus = <0>;
763 #address-cells = <1>;
770 // - double-check that hw-tshut-mode is same as EVB
771 // - double check that hw-tshut-polarity is the same as EVB
775 rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
776 rockchip,hw-tshut-polarity = <0>; /* tshut polarity 0:LOW 1:HIGH */
805 dr_mode = "host"; // TODO: needed?
814 dr_mode = "host"; // TODO: needed?
841 /* PINCTRL: always below everything else */
844 pcfg_output_high: pcfg-output-high {
849 ec_ap_int_l: ec-ap-int-l {
850 rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_up>;
854 discrete-regulators {
855 pp1500_en: pp1500-en {
856 rockchip,pins = <RK_GPIO1 11 RK_FUNC_GPIO
860 pp1800_audio_en: pp1800-audio-en {
861 rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO
865 pp3300_disp_en: pp3300-disp-en {
866 rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
870 pp3000_en: pp3000-en {
871 rockchip,pins = <RK_GPIO1 12 RK_FUNC_GPIO
875 sd_io_pwr_en: sd-io-pwr-en {
876 rockchip,pins = <RK_GPIO2 2 RK_FUNC_GPIO
880 sd_pwr_1800_sel: sd-pwr-1800-sel {
881 rockchip,pins = <RK_GPIO2 28 RK_FUNC_GPIO
885 sd_slot_pwr_en: sd-slot-pwr-en {
886 rockchip,pins = <RK_GPIO4 29 RK_FUNC_GPIO
890 wlan_module_pd_l: wlan-module-pd-l {
891 rockchip,pins = <RK_GPIO0 8 RK_FUNC_GPIO
897 /* Has external pullup */
898 headset_int_l: headset-int-l {
899 rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_none>;
902 // TODO: check pull. From signal name assume active high.
904 rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_down>;
910 * We have external pulls on SDMMC, so diable internals
913 * - On veyron we found that we needed to drive at 8mA. Do we
914 * need to that here? If so, 8mA or 12mA?
916 sdmmc_bus4: sdmmc-bus4 {
918 <4 8 RK_FUNC_1 &pcfg_pull_none>,
919 <4 9 RK_FUNC_1 &pcfg_pull_none>,
920 <4 10 RK_FUNC_1 &pcfg_pull_none>,
921 <4 11 RK_FUNC_1 &pcfg_pull_none>;
924 sdmmc_clk: sdmmc-clk {
926 <4 12 RK_FUNC_1 &pcfg_pull_none>;
929 sdmmc_cmd: sdmmc-cmd {
931 <4 13 RK_FUNC_1 &pcfg_pull_none>;
935 * In our case the official card detect is hooked to ground
936 * to avoid getting access to JTAG just by sticking something
937 * in the SD card slot (see the force_jtag bit in the TRM).
939 * We still configure it as card detect because it doesn't
940 * hurt and dw_mmc will ignore it. We make sure to disable
941 * the pull though so we don't burn needless power.
945 <0 7 RK_FUNC_1 &pcfg_pull_none>;
948 /* This is where we actually hook up CD; has external pull */
949 sdmmc_cd_gpio: sdmmc-cd-gpio {
950 rockchip,pins = <4 26 RK_FUNC_GPIO &pcfg_pull_none>;
955 ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
956 rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
961 /* DON'T PUT ANYTHING BELOW HERE. PUT IT ABOVE PINCTRL */
962 /* DON'T PUT ANYTHING BELOW HERE. PUT IT ABOVE PINCTRL */
963 /* DON'T PUT ANYTHING BELOW HERE. PUT IT ABOVE PINCTRL */