aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJohan Jonker <jbx6244@gmail.com>2023-03-13 01:32:04 +0100
committerKever Yang <kever.yang@rock-chips.com>2023-05-06 17:28:18 +0800
commita12a73b66476c48dfe5afd2c3711153d09feda6c (patch)
tree3a73c36e66587675ac707d82a8852653d4eaec65 /drivers/i2c
parente5822ecba2d73e64ca55c26fc4762d9e80b1f1b5 (diff)
downloadu-boot-a12a73b66476c48dfe5afd2c3711153d09feda6c.zip
u-boot-a12a73b66476c48dfe5afd2c3711153d09feda6c.tar.gz
u-boot-a12a73b66476c48dfe5afd2c3711153d09feda6c.tar.bz2
drivers: use dev_read_addr_ptr when cast to pointer
The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use dev_read_addr_ptr instead of the dev_read_addr function in the various files in the drivers directory that cast to a pointer. As we are there also streamline the error response to -EINVAL on return. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-cdns.c4
-rw-r--r--drivers/i2c/tegra_i2c.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c
index c1672ca..1a89207 100644
--- a/drivers/i2c/i2c-cdns.c
+++ b/drivers/i2c/i2c-cdns.c
@@ -479,9 +479,9 @@ static int cdns_i2c_of_to_plat(struct udevice *dev)
struct clk clk;
int ret;
- i2c_bus->regs = (struct cdns_i2c_regs *)dev_read_addr(dev);
+ i2c_bus->regs = dev_read_addr_ptr(dev);
if (!i2c_bus->regs)
- return -ENOMEM;
+ return -EINVAL;
if (pdata)
i2c_bus->quirks = pdata->quirks;
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 2394e9d..5864a1a 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -364,8 +364,8 @@ static int tegra_i2c_probe(struct udevice *dev)
i2c_bus->id = dev_seq(dev);
i2c_bus->type = dev_get_driver_data(dev);
- i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr(dev);
- if ((ulong)i2c_bus->regs == FDT_ADDR_T_NONE) {
+ i2c_bus->regs = dev_read_addr_ptr(dev);
+ if (!i2c_bus->regs) {
debug("%s: Cannot get regs address\n", __func__);
return -EINVAL;
}