[PATCH] i2c: eeprom: Use reg property instead of offset and size

Remove adhoc dt binding for fixed-partition definition for i2c eeprom. fixed-partition are using reg property instead of offset/size pair.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
Just build tested - ge_bx50v3_defconfig Definitely please retest on hardware. --- arch/arm/dts/imx53-ppd-uboot.dtsi | 12 ++++++------ arch/arm/dts/imx6q-bx50v3-uboot.dtsi | 10 +++++----- drivers/misc/i2c_eeprom.c | 15 +++++---------- 3 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/arch/arm/dts/imx53-ppd-uboot.dtsi b/arch/arm/dts/imx53-ppd-uboot.dtsi index d38a1bc264c9..d61b7cb87642 100644 --- a/arch/arm/dts/imx53-ppd-uboot.dtsi +++ b/arch/arm/dts/imx53-ppd-uboot.dtsi @@ -24,15 +24,15 @@ &eeprom { partitions { compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>;
- vpd { - offset = <0>; - size = <1022>; + vpd@0 { + reg = <0 1022>; };
- bootcount: bootcount { - offset = <1022>; - size = <2>; + bootcount: bootcount@1022 { + reg = <1022 2>; }; }; }; diff --git a/arch/arm/dts/imx6q-bx50v3-uboot.dtsi b/arch/arm/dts/imx6q-bx50v3-uboot.dtsi index df446e0ed149..01321cab781b 100644 --- a/arch/arm/dts/imx6q-bx50v3-uboot.dtsi +++ b/arch/arm/dts/imx6q-bx50v3-uboot.dtsi @@ -23,15 +23,15 @@ &eeprom { partitions { compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>;
- vpd { - offset = <0>; - size = <1022>; + vpd@0 { + reg = <0 1022>; };
bootcount: bootcount { - offset = <1022>; - size = <2>; + reg = <1022 2>; }; }; }; diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c index 45c34d388c8a..ad7c1f70e654 100644 --- a/drivers/misc/i2c_eeprom.c +++ b/drivers/misc/i2c_eeprom.c @@ -301,19 +301,14 @@ static int i2c_eeprom_partition_probe(struct udevice *dev) static int i2c_eeprom_partition_ofdata_to_platdata(struct udevice *dev) { struct i2c_eeprom_partition *priv = dev_get_priv(dev); - u32 offset, size; - int ret;
- ret = dev_read_u32(dev, "offset", &offset); - if (ret) - return ret; + priv->offset = dev_read_addr_index(dev, 0); + priv->size = dev_read_addr_index(dev, 1);
- ret = dev_read_u32(dev, "size", &size); - if (ret) - return ret; + if (!priv->size) + return -EINVAL;
- priv->offset = offset; - priv->size = size; + debug("%s: base %x, size %x\n", priv->offset, priv->size);
return 0; }

Hi Michal,
On Wed, 10 Jun 2020 at 07:18, Michal Simek michal.simek@xilinx.com wrote:
Remove adhoc dt binding for fixed-partition definition for i2c eeprom. fixed-partition are using reg property instead of offset/size pair.
Signed-off-by: Michal Simek michal.simek@xilinx.com
Just build tested - ge_bx50v3_defconfig Definitely please retest on hardware.
arch/arm/dts/imx53-ppd-uboot.dtsi | 12 ++++++------ arch/arm/dts/imx6q-bx50v3-uboot.dtsi | 10 +++++----- drivers/misc/i2c_eeprom.c | 15 +++++---------- 3 files changed, 16 insertions(+), 21 deletions(-)
Can the sandbox tests update for this?
Regards, Simon
participants (2)
-
Michal Simek
-
Simon Glass