Skip to main content
Visitor II
January 8, 2024
Question

error at PMIC I2C

  • January 8, 2024
  • 3 replies
  • 2264 views

We have set PB7 and PE15 for  I2c4 communication for PMIC in op-tee stm32mp135f-dk.dts.

but we keep getting pmic error like this -

I/TC: Embedded DTB found
I/TC: OP-TEE version: Unknown_3.19 (gcc version 12.2.0 (GCC)) #23 Mon Jan 8 10:50:26 UTC 2024 arm
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
I/TC: WARNING: All debug access are allowed
E/TC:0 0 Panic at core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pmic.c:183 <initialize_pmic_i2c>
E/TC:0 0 TEE load address @ 0xde000000
E/TC:0 0 Call stack:
E/TC:0 0 0xde0030f9
E/TC:0 0 0xde0193a7
E/TC:0 0 0xde006735
E/TC:0 0 0xde017fb9
E/TC:0 0 0xde018089
E/TC:0 0 0xde018773
E/TC:0 0 0xde01a095
E/TC:0 0 0xde002fbb
E/TC:0 0 0xde00019c

    This topic has been closed for replies.

    3 replies

    Explorer
    February 2, 2024

    I have the exact same issue with PB7 and PE15. Have you been able to solve this issue?

    Visitor II
    February 13, 2024

    Here is the PMIC and power related DeviceTree parts that works for me.

    optee-os dts:

    (Use this part same in tf-a dts file.)

    / { /* root */
        vin: vin {
            compatible = "regulator-fixed";
            regulator-name = "vin";
            regulator-min-microvolt = <5000000>;
            regulator-max-microvolt = <5000000>;
            regulator-always-on;
        };

        v3v3_ao: v3v3_ao {
            compatible = "regulator-fixed";
            regulator-name = "v3v3_ao";
            regulator-min-microvolt = <3300000>;
            regulator-max-microvolt = <3300000>;
            regulator-always-on;
        };
    };

    Check that under &etzpc node you have I2C4 secured

    DECPROT(STM32MP1_ETZPC_I2C4_ID, DECPROT_S_RW, DECPROT_UNLOCK)

    (Use this part (i2c4 node) same in tf-a dts file.)

    &i2c4{
        pinctrl-names = "default";
        pinctrl-0 = <&i2c4_pins_mx>;
        status = "okay";
        /* USER CODE BEGIN i2c4 */
        clock-frequency = <400000>;
        i2c-scl-rising-time-ns = <185>;
        i2c-scl-falling-time-ns = <20>;
        pmic: stpmic@33 {
            compatible = "st,stpmic1";
            reg = <0x33>;
            status = "okay";
            st,wakeup-pin-number = <1>;
            st,notif-it-id = <0>;
            wakeup-source;
            regulators {
                compatible = "st,stpmic1-regulators";
                buck1-supply = <&vin>;
                buck2-supply = <&vin>;
                buck3-supply = <&vin>;
                buck4-supply = <&vin>;
                ldo1-supply = <&vin>;
                ldo4-supply = <&vin>;
                ldo5-supply = <&vin>;
                ldo6-supply = <&vin>;
                vref_ddr-supply = <&vin>;
                pwr_sw1-supply = <&bst_out>;
                pwr_sw2-supply = <&v3v3_ao>;
                vddcpu: buck1 {
                    regulator-name = "vddcpu";
                    regulator-min-microvolt = <1250000>;
                    regulator-max-microvolt = <1350000>;
                    regulator-always-on;
                    regulator-over-current-protection;
                    lp-stop {
                        regulator-suspend-microvolt = <1250000>;
                    };
                    lplv-stop {
                        regulator-suspend-microvolt = <900000>;
                    };
                    lplv-stop2 {
                        regulator-off-in-suspend;
                    };
                    standby-ddr-sr {
                        regulator-off-in-suspend;
                    };
                    standby-ddr-off {
                        regulator-off-in-suspend;
                    };
                };
                vdd_ddr: buck2 {
                    regulator-name = "vdd_ddr";
                    regulator-min-microvolt = <1350000>;
                    regulator-max-microvolt = <1350000>;
                    regulator-always-on;
                    regulator-over-current-protection;
                    standby-ddr-off {
                        regulator-off-in-suspend;
                    };
                };
                vdd: buck3 {
                    regulator-name = "vdd";
                    regulator-min-microvolt = <3300000>;
                    regulator-max-microvolt = <3300000>;
                    regulator-always-on;
                    st,mask-reset;
                    regulator-over-current-protection;
                };
                vddcore: buck4 {
                    regulator-name = "vddcore";
                    regulator-min-microvolt = <1250000>;
                    regulator-max-microvolt = <1250000>;
                    regulator-always-on;
                    regulator-over-current-protection;
                    lplv-stop {
                        regulator-suspend-microvolt = <900000>;
                    };
                    lplv-stop2 {
                        regulator-suspend-microvolt = <900000>;
                    };
                    standby-ddr-sr {
                        regulator-off-in-suspend;
                    };
                    standby-ddr-off {
                        regulator-off-in-suspend;
                    };
                };
                vdd_adc: ldo1 {
                    regulator-name = "vdd_adc";
                    regulator-min-microvolt = <3300000>;
                    regulator-max-microvolt = <3300000>;
                    standby-ddr-sr {
                        regulator-off-in-suspend;
                    };
                    standby-ddr-off {
                        regulator-off-in-suspend;
                    };
                };
                unused1: ldo2 {
                    regulator-name = "ldo2";
                };
                unused2: ldo3 {
                    regulator-name = "ldo3";
                };
                vdd_usb: ldo4 {
                    regulator-name = "vdd_usb";
                    regulator-min-microvolt = <3300000>;
                    regulator-max-microvolt = <3300000>;
                    standby-ddr-sr {
                        regulator-off-in-suspend;
                    };
                    standby-ddr-off {
                        regulator-off-in-suspend;
                    };
                };
                vdd_sd: ldo5 {
                    regulator-name = "vdd_sd";
                    regulator-min-microvolt = <3300000>;
                    regulator-max-microvolt = <3300000>;
                    regulator-boot-on;
                    standby-ddr-sr {
                        regulator-off-in-suspend;
                    };
                    standby-ddr-off {
                        regulator-off-in-suspend;
                    };
                };
                v1v8_periph: ldo6 {
                    regulator-name = "v1v8_periph";
                    regulator-min-microvolt = <1800000>;
                    regulator-max-microvolt = <1800000>;
                    standby-ddr-sr {
                        regulator-off-in-suspend;
                    };
                    standby-ddr-off {
                        regulator-off-in-suspend;
                    };
                };
                vref_ddr: vref_ddr {
                    regulator-name = "vref_ddr";
                    regulator-always-on;
                    standby-ddr-sr {
                        regulator-off-in-suspend;
                    };
                    standby-ddr-off {
                        regulator-off-in-suspend;
                    };
                };
                bst_out: boost {
                    regulator-name = "bst_out";
                };
                v3v3_sw: pwr_sw2 {
                    regulator-name = "v3v3_sw";
                    regulator-active-discharge = <1>;
                    regulator-min-microvolt = <3300000>;
                    regulator-max-microvolt = <3300000>;
                };
            };
        };
        /* USER CODE END i2c4 */
    };

    I also have this node added but I don't think you need it to PMIC work:

    &pwr_regulators{
        status = "okay";
        /* USER CODE BEGIN pwr_regulators */
        system_suspend_supported_soc_modes = <
            STM32_PM_CSLEEP_RUN
            STM32_PM_CSTOP_ALLOW_LP_STOP
            STM32_PM_CSTOP_ALLOW_LPLV_STOP
            STM32_PM_CSTOP_ALLOW_LPLV_STOP2
            STM32_PM_CSTOP_ALLOW_STANDBY_DDR_SR
        >;
        system_off_soc_mode = <STM32_PM_SHUTDOWN>;
        vdd-supply = <&vdd>;
        vdd_3v3_usbfs-supply = <&vdd_usb>;
        /* USER CODE END pwr_regulators */
    };

    and make sure you have secured you I2C4 pins. For me:

    &gpiob {
        st,protreg = < (TZPROT(9)|TZPROT(13)) >;
    };

    but for you it shoud be something like this:

    &gpiob { /* PB7 */
        st, protreg = < (TZPROT(7))>;
    };
    &gpioe { /* PE15 */
        st, protreg = < (TZPROT(15))>;
    };
    /* Add this part also under the u-boot and kernel dts file /*
    &scmi_regu {
        scmi_vddcpu: voltd-vddcpu {
            reg = <VOLTD_SCMI_STPMIC1_BUCK1>;
            voltd-supply = <&vddcpu>;
        };
        scmi_vdd: voltd-vdd {
            reg = <VOLTD_SCMI_STPMIC1_BUCK3>;
            voltd-supply = <&vdd>;
        };
        scmi_vddcore: voltd-vddcore {
            reg = <VOLTD_SCMI_STPMIC1_BUCK4>;
            voltd-supply = <&vddcore>;
        };
        scmi_vdd_adc: voltd-vdd_adc {
            reg = <VOLTD_SCMI_STPMIC1_LDO1>;
            voltd-supply = <&vdd_adc>;
        };
        scmi_vdd_usb: voltd-vdd_usb {
            reg = <VOLTD_SCMI_STPMIC1_LDO4>;
            voltd-supply = <&vdd_usb>;
        };
        scmi_vdd_sd: voltd-vdd_sd {
            reg = <VOLTD_SCMI_STPMIC1_LDO5>;
            voltd-supply = <&vdd_sd>;
        };
        scmi_v1v8_periph: voltd-v1v8_periph {
            reg = <VOLTD_SCMI_STPMIC1_LDO6>;
            voltd-supply = <&v1v8_periph>;
        };
        scmi_v3v3_sw: voltd-v3v3_sw {
            reg = <VOLTD_SCMI_STPMIC1_PWR_SW2>;
            voltd-supply = <&v3v3_sw>;
        };
    };

    I hope it would solve your problem with PMIC.

    Visitor II
    February 27, 2024

    @manishee and @arifbalik  did you guys solved your issues?

    Explorer
    June 12, 2024

    Yes, it turns out the pin should be inside the secure context. Changing this solved the issue for me

    &gpiob{
        st,protreg = < (TZPROT(9) | TZPROT(7)) >;
    };