[PATCH v2 17/21] dm: core: Correctly read of simple-bus

Simon Glass
2021-03-12T15:47:09Z

On Fri, 12 Mar 2021 at 06:37, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> 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>
>
> ---
>
> Changes in v2:
> - include <asm/global_data.h>
> - use a Kconfig option CONFIG_SIMPLE_BUS_CORRECT_RANGE to control the
> new behavior for boards that want this
>
> drivers/core/Kconfig | 13 +++++++++++++
> drivers/core/simple-bus.c | 32 +++++++++++++++++++++++++-------
> include/dm/simple_bus.h | 6 +++---
> 3 files changed, 41 insertions(+), 10 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>