All of lore.kernel.org
 help / color / mirror / Atom feed
* Bootcount device-model I2C EEPROM partition
@ 2021-07-21 16:59 Richard Forro
  0 siblings, 0 replies; only message in thread
From: Richard Forro @ 2021-07-21 16:59 UTC (permalink / raw)
  To: u-boot

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@0 {
                                               reg = <0 800>;
                               };

                               bootcount: bootcount@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@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@50 {
                compatible = "atmel,24c02"; /* our at34c02d is semi-compatible */
                reg = <0x50>;
                pagesize = <16>;
        };
};




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-21 17:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 16:59 Bootcount device-model I2C EEPROM partition Richard Forro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.