Rockchip RK3588 kernel dts解析之电源模块

Rockchip RK3588 kernel dts解析之电源模块

RK3588搭配的电源方案有2种

  • 单PMIC方案:1个PMIC(RK806)+3个DCDC(RK860)
  • 双PMIC方案:2个PMIC(RK806)

注意单PIMC核双PMIC的软件不能兼容

单PIMC核双PMIC的软件不能兼容,固件不能互烧,否则可能会烧坏芯片。RK的代码中有做了拦截,如果软件烧错会无法开机,并且在uboot阶段有如下提示log:

spi2: RK806: 2
HW single pmic, the firmware dual pmic(0xe8)!

单pmic方案

  • 硬件设计方案可以参考RK的硬件参考设计
  • 对应的参考完成dts参考:rk3588-evb7-lp4-v10.dts
  • 软件dts的电源配置:rk3588-rk806-single.dtsi
    PMIC(RK806)的配置是在:rk3588-rk806-single.dtsi中,如下:

&spi2 { //RK3588与RK806通信是才用spi接口
	status = "okay";
	//spi的配置,不可修改
	assigned-clocks = <&cru CLK_SPI2>;
	assigned-clock-rates = <200000000>;
	pinctrl-names = "default";
	pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>;
	num-cs = <1>;
//rk806的配置
	rk806single: rk806single@0 {
		compatible = "rockchip,rk806";
		spi-max-frequency = <1000000>;
		reg = <0x0>;

//配置中断脚
		interrupt-parent = <&gpio0>;
		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;

		pinctrl-names = "default", "pmic-power-off";
		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, <&rk806_dvs2_null>, <&rk806_dvs3_null>;
		pinctrl-1 = <&rk806_dvs1_pwrdn>;

		/* 2800mv-3500mv */
		low_voltage_threshold = <3000>;
		/* 2700mv-3400mv */
		shutdown_voltage_threshold = <2700>;
		/* 140 160 */
		shutdown_temperture_threshold = <160>;
		hotdie_temperture_threshold = <115>;

		/* 0: restart PMU;
		 * 1: reset all the power off reset registers,
		 *    forcing the state to switch to ACTIVE mode;
		 * 2: Reset all the power off reset registers,
		 *    forcing the state to switch to ACTIVE mode,
		 *    and simultaneously pull down the RESETB PIN for 5mS before releasing
		 */
		pmic-reset-func = <1>;
		
		//下面是pmic rk806需要依赖的外部电源:vcc5v0_sys、vcc_2v0_pldo_s3、vcc_1v1_nldo_s3,注意这三个电源的dts配置需要在最前面,否则可能出现开机的时候由于依赖的电源初始化太慢导致电源初始化异常,表现出来的问题是cpu的变频dvfs没有初始化成功,即cat /d//opp/opp_summary中没有cpu的频率信息。
		vcc1-supply = <&vcc5v0_sys>;
		vcc2-supply = <&vcc5v0_sys>;
		vcc3-supply = <&vcc5v0_sys>;
		vcc4-supply = <&vcc5v0_sys>;
		vcc5-supply = <&vcc5v0_sys>;
		vcc6-supply = <&vcc5v0_sys>;
		vcc7-supply = <&vcc5v0_sys>;
		vcc8-supply = <&vcc5v0_sys>;
		vcc9-supply = <&vcc5v0_sys>;
		vcc10-supply = <&vcc5v0_sys>;
		vcc11-supply = <&vcc_2v0_pldo_s3>;
		vcc12-supply = <&vcc5v0_sys>;
		vcc13-supply = <&vcc_1v1_nldo_s3>;
		vcc14-supply = <&vcc_1v1_nldo_s3>;
		vcca-supply = <&vcc5v0_sys>;
//项目中若没有用到pwerkey或者gpio功能,可以在 dts 里增加pwrkey、gpio 节点,并且显式指明状态为 status = "disabled",这样就不会使能驱动,但是开机信息会有错误 log 报出,可以忽略。
		pwrkey {
			status = "okay";
		};

		pinctrl_rk806: pinctrl_rk806 {
			gpio-controller;
			#gpio-cells = <2>;

			rk806_dvs1_null: rk806_dvs1_null {
				pins = "gpio_pwrctrl2";
				function = "pin_fun0";
			};

			rk806_dvs1_slp: rk806_dvs1_slp {
				pins = "gpio_pwrctrl1";
				function = "pin_fun1";
			};

			rk806_dvs1_pwrdn: rk806_dvs1_pwrdn {
				pins = "gpio_pwrctrl1";
				function = "pin_fun2";
			};

			rk806_dvs1_rst: rk806_dvs1_rst {
				pins = "gpio_pwrctrl1";
				function = "pin_fun3";
			};

			rk806_dvs2_null: rk806_dvs2_null {
				pins = "gpio_pwrctrl2";
				function = "pin_fun0";
			};

			rk806_dvs2_slp: rk806_dvs2_slp {
				pins = "gpio_pwrctrl2";
				function = "pin_fun1";
			};

			rk806_dvs2_pwrdn: rk806_dvs2_pwrdn {
				pins = "gpio_pwrctrl2";
				function = "pin_fun2";
			};

			rk806_dvs2_rst: rk806_dvs2_rst {
				pins = "gpio_pwrctrl2";
				function = "pin_fun3";
			};

			rk806_dvs2_dvs: rk806_dvs2_dvs {
				pins = "gpio_pwrctrl2";
				function = "pin_fun4";
			};

			rk806_dvs2_gpio: rk806_dvs2_gpio {
				pins = "gpio_pwrctrl2";
				function = "pin_fun5";
			};

			rk806_dvs3_null: rk806_dvs3_null {
				pins = "gpio_pwrctrl3";
				function = "pin_fun0";
			};

			rk806_dvs3_slp: rk806_dvs3_slp {
				pins = "gpio_pwrctrl3";
				function = "pin_fun1";
			};

			rk806_dvs3_pwrdn: rk806_dvs3_pwrdn {
				pins = "gpio_pwrctrl3";
				function = "pin_fun2";
			};

			rk806_dvs3_rst: rk806_dvs3_rst {
				pins = "gpio_pwrctrl3";
				function = "pin_fun3";
			};

			rk806_dvs3_dvs: rk806_dvs3_dvs {
				pins = "gpio_pwrctrl3";
				function = "pin_fun4";
			};

			rk806_dvs3_gpio: rk806_dvs3_gpio {
				pins = "gpio_pwrctrl3";
				function = "pin_fun5";
			};
		};
//下面是根据硬件图进行对应的软件配置,以硬件设计一一对应
		regulators {
		//给gpu供电的配置,对应的硬件是RK806的BUCK1
			vdd_gpu_s0: vdd_gpu_mem_s0: DCDC_REG1 { 
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <550000>;
				regulator-max-microvolt = <950000>;
				regulator-ramp-delay = <12500>;
				regulator-name = "vdd_gpu_s0";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

	........
	//avcc_1v8_s0供电的配置,对应的硬件是RK806的PLDO1	
			avcc_1v8_s0: PLDO_REG1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "avcc_1v8_s0";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

		........
//vdd_0v75_s3供电的配置,对应的硬件是RK806的NLDO1	
			vdd_0v75_s3: NLDO_REG1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <750000>;
				regulator-max-microvolt = <750000>;
				regulator-name = "vdd_0v75_s3";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <750000>;
				};
			};

		........
		};
	};
};

3个DCDC(RK860)的配置在:rk3588-evb7-lp4-v10.dtsi中,如下:

//I2C0上面挂这1一个RK860-2和一个RK860-3,分别给大核cpu4-5和大核cpu6-7供电
&i2c0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c0m2_xfer>;

	vdd_cpu_big0_s0: vdd_cpu_big0_mem_s0: rk8602@42 {
		compatible = "rockchip,rk8602";
		reg = <0x42>;
		vin-supply = <&vcc5v0_sys>;
		regulator-compatible = "rk860x-reg";
		regulator-name = "vdd_cpu_big0_s0";
		regulator-min-microvolt = <550000>;
		regulator-max-microvolt = <1050000>;
		regulator-ramp-delay = <2300>;
		rockchip,suspend-voltage-selector = <1>;
		regulator-boot-on;
		regulator-always-on;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};

	vdd_cpu_big1_s0: vdd_cpu_big1_mem_s0: rk8603@43 {
		compatible = "rockchip,rk8603";
		reg = <0x43>;
		vin-supply = <&vcc5v0_sys>;
		regulator-compatible = "rk860x-reg";
		regulator-name = "vdd_cpu_big1_s0";
		regulator-min-microvolt = <550000>;
		regulator-max-microvolt = <1050000>;
		regulator-ramp-delay = <2300>;
		rockchip,suspend-voltage-selector = <1>;
		regulator-boot-on;
		regulator-always-on;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};
};
//I2C1上面挂这1一个RK860-2给NPU供电
&i2c1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c1m2_xfer>;

	vdd_npu_s0: vdd_npu_mem_s0: rk8602@42 {
		compatible = "rockchip,rk8602";
		reg = <0x42>;
		vin-supply = <&vcc5v0_sys>;
		regulator-compatible = "rk860x-reg";
		regulator-name = "vdd_npu_s0";
		regulator-min-microvolt = <550000>;
		regulator-max-microvolt = <950000>;
		regulator-ramp-delay = <2300>;
		rockchip,suspend-voltage-selector = <1>;
		regulator-boot-on;
		regulator-always-on;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};
};

外部电源配置
外部电源是指pmic依赖的电源,在dts配置的时候这些电源的配置需要在pmic的配置前面,这样开机是才能正常初始化,否则可能出现CPU电源异常的问题,表现为CPU变频无法正常使用,cat /d/opp/opp_summary里面没有cpu的频率信息。
这部分配置在rk3588-evb.dtsirk3588-evb7-lp4.dtsi中:

rk3588-evb.dtsi
//对应硬件图上面12V DC输入电源
vcc12v_dcin: vcc12v-dcin {
		compatible = "regulator-fixed";
		regulator-name = "vcc12v_dcin";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
	};

//对应硬件图上面5V 系统电源
	vcc5v0_sys: vcc5v0-sys {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc12v_dcin>;
	};
rk3588-evb7-lp4.dts
	vcc_1v1_nldo_s3: vcc-1v1-nldo-s3 {
		compatible = "regulator-fixed";
		regulator-name = "vcc_1v1_nldo_s3";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <1100000>;
		regulator-max-microvolt = <1100000>;
		vin-supply = <&vcc5v0_sys>;
	};

双pmic方案

  • 硬件设计方案可以参考RK的RK3588 EVB1的硬件参考设计
  • 对应的参考完成dts参考:rk3588-evb1-lp4-v10.dts
  • 软件dts的电源配置:
    rk3588-rk806-dual.dtsi (针对RK3588芯片)
    rk3588s-rk806-dual.dtsi (针对RK3588芯片)

2个PMIC(RK806)的配置在rk3588-rk806-dual.dtsi中如下:

&spi2 {//RK3588与RK806通信是才用spi接口
//spi配置,不可修改
        status = "okay";
        assigned-clocks = <&cru CLK_SPI2>;
        assigned-clock-rates = <200000000>;
        num-cs = <2>;
        rk806master@0 {
                compatible = "rockchip,rk806";
                spi-max-frequency = <1000000>;
                reg = <0x0>;
	//配置power脚中断
                interrupt-parent = <&gpio0>;
                interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
                /* 0: restart PMU;
                 * 1: reset all the power off reset registers,
                 *    forcing the state to switch to ACTIVE mode;
                 * 2: Reset all the power off reset registers,
                 *    forcing the state to switch to ACTIVE mode,
                 *    and simultaneously pull down the RESETB PIN for 5mS before releasing
                 */
                pmic-reset-func = <1>;

                vcc1-supply = <&vcc5v0_sys>;
                vcc2-supply = <&vcc5v0_sys>;
                .................
                vcca-supply = <&vcc5v0_sys>;
                regulators {
                        vdd_gpu_s0: DCDC_REG1 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <550000>;
                                regulator-max-microvolt = <950000>;
                                regulator-ramp-delay = <12500>;
                                regulator-name = "vdd_gpu_s0";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                      };
                        vdd_npu_s0: DCDC_REG2 {
                        .................
                        };
                        .................
              };
       };
       rk806slave@1 {
                compatible = "rockchip,rk806";
                spi-max-frequency = <1000000>;
                reg = <0x01>;

                interrupt-parent = <&gpio0>;
                interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
                /* 0: restart PMU;
                 * 1: reset all the power off reset registers,
                 *    forcing the state to switch to ACTIVE mode;
                 * 2: Reset all the power off reset registers,
                 *    forcing the state to switch to ACTIVE mode,
                 *    and simultaneously pull down the RESETB PIN for 5mS before releasing
               */
                pmic-reset-func = <1>;

                vcc1-supply = <&vcc5v0_sys>;
                vcc2-supply = <&vcc5v0_sys>;
                .................
                vcca-supply = <&vcc5v0_sys>;

                pwrkey {
                        status = "disabled";
                };
                regulators {
                        vdd_cpu_big1_s0: DCDC_REG1 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <550000>;
                                regulator-max-microvolt = <950000>;
                                regulator-ramp-delay = <12500>;
                                regulator-name = "vdd_cpu_big1_s0";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
                        vdd_cpu_big0_s0: DCDC_REG2 {
                        .................
                        };
                        .................
                };
       };
};

上一篇:Rockchip RK3588 kernel dts解析之显示模块
下一篇:Rockchip RK3588 kernel dts解析之USB模块

  • 14
    点赞
  • 56
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 31
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 31
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

loitawu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值