From: Richard Forro <Richard.Forro@habemus.com>
To: "u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: Bootcount device-model I2C EEPROM partition
Date: Wed, 21 Jul 2021 16:59:40 +0000 [thread overview]
Message-ID: <ca8be7ea318a43dead3e710d2d38ee24@habemus.com> (raw)
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>;
};
};
reply other threads:[~2021-07-21 17:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca8be7ea318a43dead3e710d2d38ee24@habemus.com \
--to=richard.forro@habemus.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox