From patchwork Wed Jun 10 13:18:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 242080 List-Id: U-Boot discussion From: michal.simek at xilinx.com (Michal Simek) Date: Wed, 10 Jun 2020 15:18:24 +0200 Subject: [PATCH] i2c: eeprom: Use reg property instead of offset and size Message-ID: <6310cfaca2ee5d9168de4aef051a0fdfc5e47a00.1591795100.git.michal.simek@xilinx.com> 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 --- 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 at 0 { + reg = <0 1022>; }; - bootcount: bootcount { - offset = <1022>; - size = <2>; + bootcount: bootcount at 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 at 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; }