Bootcount device-model I2C EEPROM partition

Richard Forro Richard.Forro at habemus.com
Wed Jul 21 18:59:40 CEST 2021


Hi,

I'm implementing device-model backed bootcount which uses I2C EEPROM chip. I've found following device tree, which I'm replicating: https://source.denx.de/u-boot/u-boot/-/blob/master/arch/arm/dts/imx53-ppd.dts
https://source.denx.de/u-boot/u-boot/-/blob/master/arch/arm/dts/imx53-ppd-uboot.dtsi

Here is the important code snippet from `imx53-ppd-uboot.dtsi`. As you can see, the `bootcount` partition from eeprom is referenced as the `i2c-eeprom` device in `bootcount` device.
/ {
                bootcount {
                               compatible = "u-boot,bootcount-i2c-eeprom";
                               i2c-eeprom = <&bootcount>;
                };
};

&eeprom {
                partitions {
                               compatible = "fixed-partitions";
                               #address-cells = <1>;
                               #size-cells = <1>;

                               vpd at 0 {
                                               reg = <0 800>;
                               };

                               bootcount: bootcount at 1022 {
                                               reg = <1022 2>;
                               };
                };
};

Here you can see my snippet from `imx7-colibri-u-boot.dtsi`, where that I have to reference not the partition but the whole eeprom device, because otherwise I'll get following error: "bootcount: could not get backing device".
/ {
        bootcount {
                compatible = "u-boot,bootcount-i2c-eeprom";
                i2c-eeprom = <&eeprom>;
        };
};

&eeprom {
        partitions {
                compatible = "fixed-partitions";
                #address-cells = <1>;
                #size-cells = <1>;

                bootcount: bootcount at 0 {
                        reg = <0 2>;
                };
        };
};

The question is what I'm missing? Why referencing the whole eeprom works, but referencing a single partition not. Do you have any idea?

Thank you very much
Richard Forro


P.S. there is no problem with the definition of eeprom inside the `imx7-colibri.dtsi` file. It is exactly the same as in `imx53-ppd.dts`.

&i2c4 {
        pinctrl-names = "default", "gpio";
        pinctrl-0 = <&pinctrl_i2c4>;
        pinctrl-1 = <&pinctrl_i2c4_gpio>;
        sda-gpios = <&gpio7 9 GPIO_ACTIVE_LOW>;
        scl-gpios = <&gpio7 8 GPIO_ACTIVE_LOW>;
        status = "okay";

        eeprom: eeprom at 50 {
                compatible = "atmel,24c02"; /* our at34c02d is semi-compatible */
                reg = <0x50>;
                pagesize = <16>;
        };
};





More information about the U-Boot mailing list