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 1000>; // TODO: schematics say "FSW 600KHz". Change these???
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 */
184 regulator-min-microvolt = <800000>;
185 regulator-max-microvolt = <1500000>;
187 vin-supply = <&ppvar_sys>;
190 ppvar_litcpu: ppvar-litcpu {
191 compatible = "pwm-regulator";
192 regulator-name = "ppvar_litcpu";
195 pwms = <&pwm2 0 1000>;
197 /* EC turns on w/ ap_core_en; always on for AP */
200 regulator-min-microvolt = <800000>;
201 regulator-max-microvolt = <1500000>;
203 vin-supply = <&ppvar_sys>;
206 ppvar_gpu: ppvar-gpu {
207 compatible = "pwm-regulator";
208 regulator-name = "ppvar_gpu";
211 pwms = <&pwm0 0 1000>;
213 /* EC turns on w/ ap_core_en; always on for AP */
216 regulator-min-microvolt = <800000>;
217 regulator-max-microvolt = <1500000>;
219 vin-supply = <&ppvar_sys>;
222 ppvar_centerlogic: ppvar-centerlogic {
223 compatible = "pwm-regulator";
224 regulator-name = "ppvar_centerlogic";
227 pwms = <&pwm3 0 1000>;
229 /* EC turns on w/ ppvar_centerlogic_en; always on for AP */
232 regulator-min-microvolt = <800000>;
233 regulator-max-microvolt = <1500000>;
235 vin-supply = <&ppvar_sys>;
238 /* Schematics call this PPVAR even though it's fixed */
239 ppvar_logic: ppvar-logic {
240 compatible = "regulator-fixed";
241 regulator-name = "ppvar_logic";
243 /* EC turns on w/ ppvar_logic_en; always on for AP */
247 regulator-min-microvolt = <900000>;
248 regulator-max-microvolt = <900000>;
250 vin-supply = <&ppvar_sys>;
253 /* pp900_ap aliases; these are always on for AP so just use alias */
255 /* EC turns on w/ pp900_ddrpll_en */
256 pp900_ddrpll: pp900_ap {
259 /* EC turns on w/ pp900_pcie_en */
260 pp900_pcie: pp900_ap {
263 /* EC turns on w/ pp900_pll_en */
264 pp900_pll: pp900_ap {
267 /* EC turns on w/ pp900_pmu_en */
268 pp900_pmu: pp900_ap {
271 /* EC turns on w/ pp900_usb_en */
272 pp900_usb: pp900_ap {
275 /* pp1800 aliases; these are always on for AP so just use alias */
277 /* EC turns on w/ pp1800_s0_en_l */
278 pp1800_ap_io: pp1800_emmc: pp1800_nfc: pp1800_s0: pp1800 {
281 /* EC turns on w/ pp1800_avdd_en_l */
282 pp1800_avdd: pp1800 {
285 /* EC turns on w/ pp1800_lid_en_l */
286 pp1800_lid: pp1800_mic: pp1800 {
289 /* EC turns on w/ lpddr_pwr_en */
290 pp1800_lpddr: pp1800 {
293 /* EC turns on w/ pp1800_pmu_en_l */
297 /* EC turns on w/ pp1800_sensor_en_l */
298 // TODO: Only for EC and things EC talks to I think; remove?
299 pp1800_sensor: pp1800 {
302 /* EC turns on w/ pp1800_usb_en_l */
306 /* pp1800 children */
308 /* EC turns on w/ pp1200_hsic_en */
309 // TODO: Might be removed in future schematics?
310 pp1200_hsic: pp1200-hsic {
311 compatible = "regulator-fixed";
312 regulator-name = "pp1200_hsic";
316 regulator-min-microvolt = <1200000>;
317 regulator-max-microvolt = <1200000>;
319 vin-supply = <&pp1800>;
322 pp1500_ap_io: pp1500-ap-io {
323 compatible = "regulator-fixed";
324 regulator-name = "pp1500_ap_io";
325 pinctrl-names = "default";
326 pinctrl-0 = <&pp1500_en>;
329 gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
333 regulator-min-microvolt = <1500000>;
334 regulator-max-microvolt = <1500000>;
336 vin-supply = <&pp1800>; // TODO: DNS for 3.3??
339 pp1800_audio: pp1800-audio {
340 compatible = "regulator-fixed";
341 regulator-name = "pp1800_audio";
342 pinctrl-names = "default";
343 pinctrl-0 = <&pp1800_audio_en>;
346 gpio = <&gpio0 1 GPIO_ACTIVE_HIGH>;
348 vin-supply = <&pp1800>;
351 pp1800_pcie: pp1800-pcie {
352 compatible = "regulator-fixed";
353 regulator-name = "pp1800_pcie";
354 pinctrl-names = "default";
355 pinctrl-0 = <&wlan_module_pd_l>;
357 regulator-always-on; // TODO: for bringup???
358 regulator-boot-on; // TODO: for bringup???
360 gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
362 vin-supply = <&pp1800>;
365 /* pp3000 aliases; these are always on for AP so just use alias */
367 /* Always on; plain and simple */
368 pp3000_ap: pp3000_emmc: pp3000 {
371 /* pp3000 children */
373 pp3000_sd_slot: pp3000-sd-slot {
374 compatible = "regulator-fixed";
375 regulator-name = "pp3000_sd_slot";
376 pinctrl-names = "default";
377 pinctrl-0 = <&sd_slot_pwr_en>;
379 // regulator-always-on; // TODO: for bringup???
380 // regulator-boot-on; // TODO: for bringup???
383 gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
385 vin-supply = <&pp3000>;
388 ppvar_sd_card_io: ppvar-sd-card-io {
389 compatible = "regulator-gpio";
390 regulator-name = "ppvar_sd_card_io";
391 pinctrl-names = "default";
392 pinctrl-0 = <&sd_io_pwr_en &sd_pwr_1800_sel>;
394 // regulator-always-on; // TODO: for bringup???
395 // regulator-boot-on; // TODO: for bringup???
398 enable-gpio = <&gpio2 2 GPIO_ACTIVE_HIGH>;
399 gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>;
400 states = <1800000 0x1
403 regulator-min-microvolt = <1800000>;
404 regulator-max-microvolt = <3000000>;
406 // TODO: add support in driver for input supplies.
407 // ...and specify pp3000 and pp1800.
410 /* pp3300 aliases; these are always on for AP so just use alias */
412 /* EC turns on w/ pp3300_trackpad_en_l */
413 pp3300_trackpad: pp3300-trackpad {
416 /* EC turns on w/ pp3300_usb_en_l */
420 /* pp3300 children */
422 pp3300_disp: pp3300-disp {
423 compatible = "regulator-fixed";
424 regulator-name = "pp3300_disp";
425 pinctrl-names = "default";
426 pinctrl-0 = <&pp3300_disp_en>;
429 gpio = <&gpio4 27 GPIO_ACTIVE_HIGH>;
431 vin-supply = <&pp3300>;
434 pp3300_wifi_bt:pp3300-wifi-bt {
435 compatible = "regulator-fixed";
436 regulator-name = "pp3300_wifi_bt";
437 /* NOTE: wlan_module_pd_l pinctrl in pp1800_pcie */
439 regulator-always-on; // TODO: for bringup???
440 regulator-boot-on; // TODO: for bringup???
443 // TODO: I _think_ it's OK to specify the same GPIO in two
444 // regulator-fixed regulators. See pp1800_pcie
445 gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
447 vin-supply = <&pp3300>;
454 compatible = "rockchip,rk3399-io-voltage-domain";
455 rockchip,grf = <&grf>;
457 bt656-supply = <&pp1800_ap_io>; /* APIO2_VDD; 2a 2b */
458 audio-supply = <&pp1800_audio>; /* APIO5_VDD; 3d 4a */
459 sdmmc-supply = <&ppvar_sd_card_io>; /* SDMMC0_VDD; 4b */
460 gpio1830-supply = <&pp3000_ap>; /* APIO4_VDD; 4c 4d */
464 compatible = "rockchip,rk3399-pmu-io-voltage-domain";
465 rockchip,grf = <&pmugrf>;
467 pmu1830-supply = <&pp1800_pmu>; /* PMUIO2_VDD */
472 cpu-supply = <&ppvar_litcpu>;
476 cpu-supply = <&ppvar_litcpu>;
480 cpu-supply = <&ppvar_litcpu>;
484 cpu-supply = <&ppvar_litcpu>;
488 cpu-supply = <&ppvar_bigcpu>;
492 cpu-supply = <&ppvar_bigcpu>;
503 // ...with no speed, it should just use 100kHz
504 // TODO: rise / fall times?
506 // TODO: This is in mainline, but not the Rockchip private kernel
507 // TODO: Need to hook this into the rest of audio stuff...
509 // TODO: any pinctrl needed for this codec???
510 headsetcodec: rt5514@57 {
511 compatible = "realtek,rt5514";
513 pinctrl-names = "default";
514 pinctrl-0 = <&mic_int>;
517 * NOTE: Interrupts aren't part of the binding and driver
518 * doesn't support it, but throw it in anyway.
520 interrupt-parent = <&gpio1>;
521 interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
529 // ...with no speed, it should just use 100kHz
530 // TODO: rise / fall times?
532 // TODO: Add the proper touchscreen reference...
535 // TODO: Might need to go in sub boards????
540 * Note strange pullup enable. Apparently this avoids leakage but
541 * still allows us to get nice 4.7K pullups for high speed i2c
542 * transfers. Basically we want the pullup on whenever the ap is
543 * alive, so the "en" pin just gets set to output high.
545 pinctrl-0 = <&i2c5_xfer &ap_i2c_tp_pu_en>;
550 // ...with no speed, it should just use 100kHz
551 // TODO: rise / fall times?
553 // TODO: Add the proper touchpanel reference...
556 ap_i2c_audio: &i2c8 {
560 // ...with no speed, it should just use 100kHz
561 // TODO: rise / fall times?
562 // ...on gru-gru this is on a sub board, so expect bad rise/fall times
564 // TODO: copied from sample. Double-check...
566 compatible = "dlg,da7219";
568 pinctrl-names = "default";
569 pinctrl-0 = <&headset_int_l>;
571 interrupt-parent = <&gpio1>;
572 interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
574 VDD-supply = <&pp1800>;
575 VDDMIC-supply = <&pp3300>;
576 VDDIO-supply = <&pp1800>;
578 // TODO: I THINK this is right, but it's a bit of a guess.
579 clocks = <&cru SCLK_I2S_8CH_OUT>;
580 clock-names = "mclk";
582 // Below is from bindings; we need to adjust for our SoC / board.
583 // dlg,ldo-lvl = <1200>;
584 // dlg,micbias-lvl = <2600>;
585 // dlg,mic-amp-in-sel = "diff";
588 // dlg,btn-cfg = <50>;
589 // dlg,mic-det-thr = <500>;
590 // dlg,jack-ins-deb = <20>;
591 // dlg,jack-det-rate = "32ms_64ms";
592 // dlg,jack-rem-deb = <1>;
594 // dlg,a-d-btn-thr = <0xa>;
595 // dlg,d-b-btn-thr = <0x16>;
596 // dlg,b-c-btn-thr = <0x21>;
597 // dlg,c-mic-btn-thr = <0x3E>;
599 // dlg,btn-avg = <4>;
600 // dlg,adc-1bit-rpt = <1>;
628 // HACK: supports-emmc is not mainline.
631 // HACK: limit to 50MHz to avoid tuning during bringup.
632 max-frequency = <50000000>;
642 vmmc-supply = <&pp3000>;
643 vqmmc-supply = <&pp1800_emmc>;
650 * Note: configure "sdmmc_cd" as card detect even though it's actually
651 * hooked to ground. Because we specified "cd-gpios" below dw_mmc
652 * should be ignoring card detect anyway. Specifying the pin as
653 * sdmmc_cd means that even if you've got GRF_SOC_CON7[12] (force_jtag)
654 * turned on that the system will still make sure the port is
655 * configured as SDMMC and not JTAG.
657 pinctrl-names = "default";
658 pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_cd_gpio
661 // HACK: supports-sd is not in mainline.
664 // HACK: Limit freq for now
665 // ...as of 160330 confirmed that things break if you remove this.
666 clock-frequency = <37500000>;
667 clock-freq-min-max = <400000 37500000>;
670 cd-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>;
672 rockchip,default-sample-phase = <90>;
677 // TODO: enable once tested...
683 // Comment out until we turn on gpio-regulator config
684 vmmc-supply = <&pp3000_sd_slot>;
685 vqmmc-supply = <&ppvar_sd_card_io>;
691 // TODO: more properly. Hacky spidev for now???
693 // - We either have a Haven here or a Infineon SLB9670. The SLB9670
694 // is supposed to be a fallback if Haven is broken.
695 // - Either TPM is supposed to be TPM 2.0 hooked up to SPI. I see some
696 // kernel support for TPM 2.0 on x86 (hooked up with ACPI) but no
697 // generic way to say "we have a SPI TPM 2.0". We'll need to add
698 // a driver for whichever way we go.
699 // - wfrichar@ says that for Haven if it has gone to sleep we might
700 // need to add a delay after asserting chip select. Presumably
701 // haven-specific driver will need to handle this logic (keeping
702 // track when we last talked and adding an extra delay if it's been
705 compatible = "spidev";
706 // TODO: can run faster once verified.
707 // TODO: add rx-sample-delay-ns.
708 spi-max-frequency = <10000000>;
716 // TODO: Ideally we want to use MTD for this, but presumably
717 // we'll wait until we can test it and also bring it up in our
720 compatible = "spidev";
721 // TODO: can run faster once verified.
722 // TODO: add rx-sample-delay-ns.
723 spi-max-frequency = <10000000>;
731 // TODO: more properly. Hacky spidev for now???
733 compatible = "spidev";
735 // TODO: can run faster once verified.
736 // TODO: add rx-sample-delay-ns.
737 spi-max-frequency = <10000000>;
746 compatible = "google,cros-ec-spi";
748 pinctrl-names = "default";
749 pinctrl-0 = <&ec_ap_int_l>;
751 google,cros-ec-spi-pre-delay = <30>; // TODO: check
752 interrupt-parent = <&gpio0>;
753 interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
754 spi-max-frequency = <3000000>; // TODO: check; TODO: rx-sample-delay-ns?
756 i2c_tunnel: i2c-tunnel {
757 compatible = "google,cros-ec-i2c-tunnel";
758 google,remote-bus = <0>;
759 #address-cells = <1>;
766 // - double-check that hw-tshut-mode is same as EVB
767 // - double check that hw-tshut-polarity is the same as EVB
771 rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
772 rockchip,hw-tshut-polarity = <0>; /* tshut polarity 0:LOW 1:HIGH */
801 dr_mode = "host"; // TODO: needed?
810 dr_mode = "host"; // TODO: needed?
837 /* PINCTRL: always below everything else */
840 pcfg_output_high: pcfg-output-high {
845 ec_ap_int_l: ec-ap-int-l {
846 rockchip,pins = <0 2 RK_FUNC_GPIO &pcfg_pull_up>;
850 discrete-regulators {
851 pp1500_en: pp1500-en {
852 rockchip,pins = <RK_GPIO1 11 RK_FUNC_GPIO
856 pp1800_audio_en: pp1800-audio-en {
857 rockchip,pins = <RK_GPIO0 1 RK_FUNC_GPIO
861 pp3300_disp_en: pp3300-disp-en {
862 rockchip,pins = <RK_GPIO4 27 RK_FUNC_GPIO
866 pp3000_en: pp3000-en {
867 rockchip,pins = <RK_GPIO1 12 RK_FUNC_GPIO
871 sd_io_pwr_en: sd-io-pwr-en {
872 rockchip,pins = <RK_GPIO2 2 RK_FUNC_GPIO
876 sd_pwr_1800_sel: sd-pwr-1800-sel {
877 rockchip,pins = <RK_GPIO2 28 RK_FUNC_GPIO
881 sd_slot_pwr_en: sd-slot-pwr-en {
882 rockchip,pins = <RK_GPIO4 29 RK_FUNC_GPIO
886 wlan_module_pd_l: wlan-module-pd-l {
887 rockchip,pins = <RK_GPIO0 8 RK_FUNC_GPIO
893 /* Has external pullup */
894 headset_int_l: headset-int-l {
895 rockchip,pins = <1 23 RK_FUNC_GPIO &pcfg_pull_none>;
898 // TODO: check pull. From signal name assume active high.
900 rockchip,pins = <1 13 RK_FUNC_GPIO &pcfg_pull_down>;
906 * We have external pulls on SDMMC, so diable internals
909 * - On veyron we found that we needed to drive at 8mA. Do we
910 * need to that here? If so, 8mA or 12mA?
912 sdmmc_bus4: sdmmc-bus4 {
914 <4 8 RK_FUNC_1 &pcfg_pull_none>,
915 <4 9 RK_FUNC_1 &pcfg_pull_none>,
916 <4 10 RK_FUNC_1 &pcfg_pull_none>,
917 <4 11 RK_FUNC_1 &pcfg_pull_none>;
920 sdmmc_clk: sdmmc-clk {
922 <4 12 RK_FUNC_1 &pcfg_pull_none>;
925 sdmmc_cmd: sdmmc-cmd {
927 <4 13 RK_FUNC_1 &pcfg_pull_none>;
931 * In our case the official card detect is hooked to ground
932 * to avoid getting access to JTAG just by sticking something
933 * in the SD card slot (see the force_jtag bit in the TRM).
935 * We still configure it as card detect because it doesn't
936 * hurt and dw_mmc will ignore it. We make sure to disable
937 * the pull though so we don't burn needless power.
941 <0 7 RK_FUNC_1 &pcfg_pull_none>;
944 /* This is where we actually hook up CD; has external pull */
945 sdmmc_cd_gpio: sdmmc-cd-gpio {
946 rockchip,pins = <4 26 RK_FUNC_GPIO &pcfg_pull_none>;
951 ap_i2c_tp_pu_en: ap-i2c-tp-pu-en {
952 rockchip,pins = <3 12 RK_FUNC_GPIO &pcfg_output_high>;
957 /* DON'T PUT ANYTHING BELOW HERE. PUT IT ABOVE PINCTRL */
958 /* DON'T PUT ANYTHING BELOW HERE. PUT IT ABOVE PINCTRL */
959 /* DON'T PUT ANYTHING BELOW HERE. PUT IT ABOVE PINCTRL */