diff options
author | Dario Binacchi <dariobin@libero.it> | 2021-05-01 18:05:26 +0300 |
---|---|---|
committer | Lokesh Vutla <lokeshvutla@ti.com> | 2021-05-12 13:57:57 +0300 |
commit | a47abd7bf4b87e4bd5cbdaf88bbece6810d8c837 (patch) | |
tree | 041bf77db28e7e3659ee632e08bd104d1bcdd736 /drivers/core | |
parent | 5a6caf916cb302a6b83edce8c60d830d9261956d (diff) | |
download | u-boot-a47abd7bf4b87e4bd5cbdaf88bbece6810d8c837.tar.xz |
Revert "fdt: translate address if #size-cells = <0>"
This reverts commit d64b9cdcd475eb7f07b49741ded87e24dae4a5fc.
As pointed by [1] and [2], the reverted patch made every DT 'reg'
property translatable. What the patch was trying to fix was fixed in a
different way from previously submitted patches which instead of
correcting the generic address translation function fixed the issue with
appropriate platform code.
[1] https://patchwork.ozlabs.org/project/uboot/patch/1614324949-61314-1-git-send-email-bmeng.cn@gmail.com/
[2] https://lore.kernel.org/linux-clk/20210402192054.7934-1-dariobin@libero.it/T/
Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/Kconfig | 12 | ||||
-rw-r--r-- | drivers/core/fdtaddr.c | 2 | ||||
-rw-r--r-- | drivers/core/of_addr.c | 13 | ||||
-rw-r--r-- | drivers/core/ofnode.c | 7 | ||||
-rw-r--r-- | drivers/core/root.c | 3 |
5 files changed, 13 insertions, 24 deletions
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index a7c3120860..d618e1637b 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -271,18 +271,6 @@ config OF_TRANSLATE used for the address translation. This function is faster and smaller in size than fdt_translate_address(). -config OF_TRANSLATE_ZERO_SIZE_CELLS - bool "Enable translation for zero size cells" - depends on OF_TRANSLATE - default n - help - The routine used to translate an FDT address into a physical CPU - address was developed by IBM. It considers that crossing any level - with #size-cells = <0> makes translation impossible, even if it is - not the way it was specified. - Enabling this option makes translation possible even in the case - of crossing levels with #size-cells = <0>. - config SPL_OF_TRANSLATE bool "Translate addresses using fdt_translate_address in SPL" depends on SPL_DM && SPL_OF_CONTROL diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c index 83a50b6a3a..b9874c743d 100644 --- a/drivers/core/fdtaddr.c +++ b/drivers/core/fdtaddr.c @@ -50,7 +50,7 @@ fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index) reg += index * (na + ns); - if (ns || gd_size_cells_0()) { + if (ns) { /* * Use the full-fledged translate function for complex * bus setups. diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c index b3e384d2ee..9b77308182 100644 --- a/drivers/core/of_addr.c +++ b/drivers/core/of_addr.c @@ -18,8 +18,7 @@ /* Max address size we deal with */ #define OF_MAX_ADDR_CELLS 4 #define OF_CHECK_ADDR_COUNT(na) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS) -#define OF_CHECK_COUNTS(na, ns) (OF_CHECK_ADDR_COUNT(na) && \ - ((ns) > 0 || gd_size_cells_0())) +#define OF_CHECK_COUNTS(na, ns) (OF_CHECK_ADDR_COUNT(na) && (ns) > 0) static struct of_bus *of_match_bus(struct device_node *np); @@ -163,6 +162,11 @@ const __be32 *of_get_address(const struct device_node *dev, int index, } EXPORT_SYMBOL(of_get_address); +static int of_empty_ranges_quirk(const struct device_node *np) +{ + return false; +} + static int of_translate_one(const struct device_node *parent, struct of_bus *bus, struct of_bus *pbus, __be32 *addr, int na, int ns, int pna, @@ -189,8 +193,11 @@ static int of_translate_one(const struct device_node *parent, * As far as we know, this damage only exists on Apple machines, so * This code is only enabled on powerpc. --gcl */ - ranges = of_get_property(parent, rprop, &rlen); + if (ranges == NULL && !of_empty_ranges_quirk(parent)) { + debug("no ranges; cannot translate\n"); + return 1; + } if (ranges == NULL || rlen == 0) { offset = of_read_number(addr, na); memset(addr, 0, pna * 4); diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index d50533338e..6c771e364f 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -319,8 +319,7 @@ fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size) ns = of_n_size_cells(ofnode_to_np(node)); - if (IS_ENABLED(CONFIG_OF_TRANSLATE) && - (ns > 0 || gd_size_cells_0())) { + if (IS_ENABLED(CONFIG_OF_TRANSLATE) && ns > 0) { return of_translate_address(ofnode_to_np(node), prop_val); } else { na = of_n_addr_cells(ofnode_to_np(node)); @@ -703,10 +702,8 @@ fdt_addr_t ofnode_get_addr_size(ofnode node, const char *property, ns = of_n_size_cells(np); *sizep = of_read_number(prop + na, ns); - if (CONFIG_IS_ENABLED(OF_TRANSLATE) && - (ns > 0 || gd_size_cells_0())) { + if (CONFIG_IS_ENABLED(OF_TRANSLATE) && ns > 0) return of_translate_address(np, prop); - } else return of_read_number(prop, na); } else { diff --git a/drivers/core/root.c b/drivers/core/root.c index f852d867db..fe0562cd6f 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -164,9 +164,6 @@ int dm_init(bool of_live) { int ret; - if (IS_ENABLED(CONFIG_OF_TRANSLATE_ZERO_SIZE_CELLS)) - gd->dm_flags |= GD_DM_FLG_SIZE_CELLS_0; - if (gd->dm_root) { dm_warn("Virtual root driver already exists!\n"); return -EINVAL; |