diff options
author | John Keeping <john@metanate.com> | 2023-06-01 15:11:19 +0100 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-07-20 14:10:57 -0600 |
commit | 77224320f05834344581f8b5d939907925876b3d (patch) | |
tree | 752af4557e379f54a7fd03ae1ef6aadfe86a2273 /drivers/core | |
parent | 15a2865515fdd77d1edbc10e275b7b5a4914aa79 (diff) | |
download | u-boot-77224320f05834344581f8b5d939907925876b3d.tar.gz u-boot-77224320f05834344581f8b5d939907925876b3d.tar.bz2 u-boot-77224320f05834344581f8b5d939907925876b3d.zip |
core: read: fix dev_read_addr_size()
The behaviour of dev_read_addr_size() is surprising as it does not
handle #address-cells and #size-cells but instead hardcodes the values
based on sizeof(fdt_addr_t).
This is different from dev_read_addr_size_index() and
dev_read_addr_size_name() both of which do read the cell sizes from the
device tree.
Since dev_read_addr_size() is only used by a single driver and this
driver is broken when CONFIG_FDT_64BIT does not match the address size
in the device tree, fix the function to behave like all of the other
similarly named functions. Drop the property name argument as the only
caller passes "reg" and this is the expected property name matching the
other similarly named functions.
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # chromebook_jerry
Tested-by: Simon Glass <sjg@chromium.org> # chromebook_bob
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/read.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/core/read.c b/drivers/core/read.c index 0289a2edb6..5749473a6c 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -211,10 +211,9 @@ void *dev_remap_addr(const struct udevice *dev) return dev_remap_addr_index(dev, 0); } -fdt_addr_t dev_read_addr_size(const struct udevice *dev, const char *property, - fdt_size_t *sizep) +fdt_addr_t dev_read_addr_size(const struct udevice *dev, fdt_size_t *sizep) { - return ofnode_get_addr_size(dev_ofnode(dev), property, sizep); + return dev_read_addr_size_index(dev, 0, sizep); } const char *dev_read_name(const struct udevice *dev) |