summaryrefslogtreecommitdiff
path: root/arch/powerpc/platforms/embedded6xx
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2023-03-30 01:03:36 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2023-04-04 15:11:03 +0300
commit2500763dd3db37fad94d9b506907c59c2f5e97c6 (patch)
treea4cd9241b504c57d5011764311a00c8062461f98 /arch/powerpc/platforms/embedded6xx
parent83a8fe569ef84d6eefcb99420a731cb87508f004 (diff)
downloadlinux-2500763dd3db37fad94d9b506907c59c2f5e97c6.tar.xz
powerpc: Use of_address_to_resource()
Replace open coded reading of "reg" or of_get_address()/ of_translate_address() calls with a single call to of_address_to_resource(). Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230329220337.141295-1-robh@kernel.org
Diffstat (limited to 'arch/powerpc/platforms/embedded6xx')
-rw-r--r--arch/powerpc/platforms/embedded6xx/holly.c7
-rw-r--r--arch/powerpc/platforms/embedded6xx/ls_uart.c17
2 files changed, 13 insertions, 11 deletions
diff --git a/arch/powerpc/platforms/embedded6xx/holly.c b/arch/powerpc/platforms/embedded6xx/holly.c
index a167ee88fbf9..02ff260ae1ee 100644
--- a/arch/powerpc/platforms/embedded6xx/holly.c
+++ b/arch/powerpc/platforms/embedded6xx/holly.c
@@ -205,16 +205,15 @@ static void __noreturn holly_restart(char *cmd)
__be32 __iomem *ocn_bar1 = NULL;
unsigned long bar;
struct device_node *bridge = NULL;
- const void *prop;
- int size;
+ struct resource res;
phys_addr_t addr = 0xc0000000;
local_irq_disable();
bridge = of_find_node_by_type(NULL, "tsi-bridge");
if (bridge) {
- prop = of_get_property(bridge, "reg", &size);
- addr = of_translate_address(bridge, prop);
+ of_address_to_resource(bridge, 0, &res);
+ addr = res.start;
of_node_put(bridge);
}
addr += (TSI108_PB_OFFSET + 0x414);
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c
index 4ecbc55b37c0..6c1dbf8ae718 100644
--- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
+++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
@@ -15,6 +15,7 @@
#include <linux/serial_reg.h>
#include <linux/serial_8250.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <asm/io.h>
#include <asm/termbits.h>
@@ -114,22 +115,24 @@ static void __init ls_uart_init(void)
static int __init ls_uarts_init(void)
{
struct device_node *avr;
- phys_addr_t phys_addr;
- int len;
+ struct resource res;
+ int len, ret;
avr = of_find_node_by_path("/soc10x/serial@80004500");
if (!avr)
return -EINVAL;
avr_clock = *(u32*)of_get_property(avr, "clock-frequency", &len);
- phys_addr = ((u32*)of_get_property(avr, "reg", &len))[0];
+ if (!avr_clock)
+ return -EINVAL;
- of_node_put(avr);
+ ret = of_address_to_resource(avr, 0, &res);
+ if (ret)
+ return ret;
- if (!avr_clock || !phys_addr)
- return -EINVAL;
+ of_node_put(avr);
- avr_addr = ioremap(phys_addr, 32);
+ avr_addr = ioremap(res.start, 32);
if (!avr_addr)
return -EFAULT;