[U-Boot] [PATCH 0/2] misc: i2c_eeprom: add paritioning and size query

Michal Simek monstr at monstr.eu
Thu May 28 11:38:00 CEST 2020


On 28. 05. 20 11:27, Michal Simek wrote:
> HI Robert and Heiko,
> 
> po 28. 10. 2019 v 19:32 odesílatel Robert Beckett 
> <bob.beckett at collabora.com> napsal:
>> 
>> Add ability to specify paritions for eeprom in device tree, and
>> query eeprom device sizes. Each partition creates a child device,
>> allowing board code to find the eeprom parition by name.
>> 
>> 
>> Robert Beckett (2): misc: i2c_eeprom: add fixed partitions
>> support misc: i2c_eeprom: add size query
>> 
>> drivers/misc/i2c_eeprom.c | 243
>> +++++++++++++++++++++++++++++++++++--- include/i2c_eeprom.h
>> |  12 ++ 2 files changed, 236 insertions(+), 19 deletions(-)
> 
> What's the recommended way to work with i2c_eeprom_partitions?
> 
> I have them probed but curious how I should work with them. i2c
> 1  [ + ]   i2c_mux_bus_drv       |   |       |-- 
> i2c at ff030000->i2c-mux at 74->i2c at 0 i2c_eeprom    0  [ + ]   i2c_eeprom
> |   |       |   `-- eeprom at 54 i2c_eeprom    1  [   ]
> i2c_eeprom_partition  |   |       | |-- board-sn at 0 i2c_eeprom    2
> [   ]   i2c_eeprom_partition  |   |       | |-- eth-mac at 20 
> i2c_eeprom    3  [   ]   i2c_eeprom_partition  |   |       | |--
> board-name at d0 i2c_eeprom    4  [   ]   i2c_eeprom_partition  |   |
> | `-- board-revision at e0
> 
> Is there any u-boot command for reading values from these
> partitions? Or are you just referencing them by 
> fdt_path_offset/uclass_get_device_by_of_offset?

I think I found that path you use.

 13         bootcount {
 14                 compatible = "u-boot,bootcount-i2c-eeprom";
 15                 i2c-eeprom = <&bootcount>;
 16         };

 24 &eeprom {
 25         partitions {
 26                 compatible = "fixed-partitions";
 27
 28                 vpd {
 29                         offset = <0>;
 30                         size = <1022>;
 31                 };
 32
 32
 33                 bootcount: bootcount {
 34                         offset = <1022>;
 35                         size = <2>;
 36                 };
 37         };
 38 };

I am curious about these offset/size properties which you are using
here which are out of dt spec in the kernel.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/mtd/partition.txt?h=next-20200526

Why not just to use reg property which does exactly it?

Anyway and then you use link to bootcount and code in
drivers/bootcount/i2c-eeprom.c to read it.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200528/c3e99801/attachment.sig>


More information about the U-Boot mailing list