dm: core: Correctly read <ranges> of simple-bus
authorBin Meng <bmeng.cn@gmail.com>
Sun, 14 Mar 2021 12:15:02 +0000 (20:15 +0800)
committerPriyanka Jain <priyanka.jain@nxp.com>
Mon, 26 Apr 2021 06:48:36 +0000 (12:18 +0530)
commit8e0fe24ddc4143068bf65afbeedf28bb2d911b2f
tree322c6b2299a1febe85acd44900173cec65e8a0b0
parent6b26a74fbb1f1081ea1dd4f0905435bec4b1c052
dm: core: Correctly read <ranges> of simple-bus

At present we decode simple bus <ranges> using the following assumption:

- parent #address-cells 1
- child #address-cells 1
- child #size-cells 1

However this might not always be the case.

Update to use fdt_addr_t and fdt_size_t in 'struct simple_bus_plat', and
use fdt_read_ranges() to correctly decode it according to the actual
parent and child #address-cells / #size-cells under a Kconfig option
CONFIG_SIMPLE_BUS_CORRECT_RANGE which can be turned on for any board
that needs it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/core/Kconfig
drivers/core/simple-bus.c
include/dm/simple_bus.h