diff options
author | Rob Herring <robh@kernel.org> | 2023-06-09 12:32:38 -0600 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-06-21 15:13:56 +1000 |
commit | be0f9ca024b3ae17fac6b15c04519840f3418269 (patch) | |
tree | 92b6b50062d0283b4bdc0e270596b8051b67233e /arch/powerpc | |
parent | f892ac774b34a769318030f5febe5ce41d6e122e (diff) | |
download | linux-stable-be0f9ca024b3ae17fac6b15c04519840f3418269.tar.gz linux-stable-be0f9ca024b3ae17fac6b15c04519840f3418269.tar.bz2 linux-stable-be0f9ca024b3ae17fac6b15c04519840f3418269.zip |
powerpc: fsl_soc: Use of_range_to_resource() for "ranges" parsing
"ranges" is a standard property with common parsing functions. Users
shouldn't be implementing their own parsing of it. Refactor the FSL RapidIO
"ranges" parsing to use of_range_to_resource() instead.
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230609183238.1767186-1-robh@kernel.org
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 6ebbbca41065..68709743450e 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c @@ -51,18 +51,10 @@ phys_addr_t get_immrbase(void) soc = of_find_node_by_type(NULL, "soc"); if (soc) { - int size; - u32 naddr; - const __be32 *prop = of_get_property(soc, "#address-cells", &size); - - if (prop && size == 4) - naddr = be32_to_cpup(prop); - else - naddr = 2; - - prop = of_get_property(soc, "ranges", &size); - if (prop) - immrbase = of_translate_address(soc, prop + naddr); + struct resource res; + + if (!of_range_to_resource(soc, 0, &res)) + immrbase = res.start; of_node_put(soc); } |