1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-04 02:02:08 +02:00

dm: fix ofnode_read_addr/size_cells()

In the case of the live tree ofnode_read_addr_cells() and
ofnode_read_size_cells() return the #address-cells and #size-cells defined
in the parent node. With the patch the same is done for a non-live tree.

The only consumer of these functions is currently the CFI flash driver.

This patch fixes the incorrect parsing of the device tree leading to
'saveenv' failing on qemu_arm64_defconfig.

For testing qemu-system-aarch64 has to be called with

    -drive if=pflash,format=raw,index=1,file=envstore.img

to provide the flash memory. envstore.img must be 64 MiB large.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
Heinrich Schuchardt
2020-07-25 21:38:49 +02:00
committed by Simon Glass
parent 2e6132d835
commit ae6b33dcc3
2 changed files with 20 additions and 10 deletions

View File

@@ -878,14 +878,16 @@ static inline int dev_count_phandle_with_args(const struct udevice *dev,
static inline int dev_read_addr_cells(const struct udevice *dev)
{
/* NOTE: this call should walk up the parent stack */
return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev));
int parent = fdt_parent_offset(gd->fdt_blob, dev_of_offset(dev));
return fdt_address_cells(gd->fdt_blob, parent);
}
static inline int dev_read_size_cells(const struct udevice *dev)
{
/* NOTE: this call should walk up the parent stack */
return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev));
int parent = fdt_parent_offset(gd->fdt_blob, dev_of_offset(dev));
return fdt_size_cells(gd->fdt_blob, parent);
}
static inline int dev_read_simple_addr_cells(const struct udevice *dev)