Commit 0fabf9f3 authored by Rob Herring's avatar Rob Herring Committed by Daniel Lezcano

clocksource/drivers/timer-ti-dm: Use of_address_to_resource()

Replace of_get_address() and of_translate_address() calls with single
call to of_address_to_resource().
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230319163220.226273-1-robh@kernel.org
parent f68a40ee
...@@ -251,24 +251,22 @@ static void __init dmtimer_systimer_assign_alwon(void) ...@@ -251,24 +251,22 @@ static void __init dmtimer_systimer_assign_alwon(void)
counter_32k = -ENODEV; counter_32k = -ENODEV;
for_each_matching_node(np, dmtimer_match_table) { for_each_matching_node(np, dmtimer_match_table) {
struct resource res;
if (!dmtimer_is_preferred(np)) if (!dmtimer_is_preferred(np))
continue; continue;
if (of_property_read_bool(np, "ti,timer-alwon")) { if (!of_property_read_bool(np, "ti,timer-alwon"))
const __be32 *addr; continue;
addr = of_get_address(np, 0, NULL, NULL); if (of_address_to_resource(np, 0, &res))
pa = of_translate_address(np, addr); continue;
if (pa) {
/* Quirky omap3 boards must use dmtimer12 */ /* Quirky omap3 boards must use dmtimer12 */
if (quirk_unreliable_oscillator && if (quirk_unreliable_oscillator && res.start == 0x48318000)
pa == 0x48318000) continue;
continue;
of_node_put(np);
of_node_put(np); break;
break;
}
}
} }
/* Usually no need for dmtimer clocksource if we have counter32 */ /* Usually no need for dmtimer clocksource if we have counter32 */
...@@ -285,24 +283,22 @@ static void __init dmtimer_systimer_assign_alwon(void) ...@@ -285,24 +283,22 @@ static void __init dmtimer_systimer_assign_alwon(void)
static u32 __init dmtimer_systimer_find_first_available(void) static u32 __init dmtimer_systimer_find_first_available(void)
{ {
struct device_node *np; struct device_node *np;
const __be32 *addr;
u32 pa = 0; u32 pa = 0;
for_each_matching_node(np, dmtimer_match_table) { for_each_matching_node(np, dmtimer_match_table) {
struct resource res;
if (!dmtimer_is_preferred(np)) if (!dmtimer_is_preferred(np))
continue; continue;
addr = of_get_address(np, 0, NULL, NULL); if (of_address_to_resource(np, 0, &res))
pa = of_translate_address(np, addr); continue;
if (pa) {
if (pa == clocksource || pa == clockevent) { if (res.start == clocksource || res.start == clockevent)
pa = 0; continue;
continue;
} pa = res.start;
of_node_put(np);
of_node_put(np); break;
break;
}
} }
return pa; return pa;
...@@ -812,7 +808,7 @@ static int __init dmtimer_clocksource_init(struct device_node *np) ...@@ -812,7 +808,7 @@ static int __init dmtimer_clocksource_init(struct device_node *np)
*/ */
static int __init dmtimer_systimer_init(struct device_node *np) static int __init dmtimer_systimer_init(struct device_node *np)
{ {
const __be32 *addr; struct resource res;
u32 pa; u32 pa;
/* One time init for the preferred timer configuration */ /* One time init for the preferred timer configuration */
...@@ -826,8 +822,9 @@ static int __init dmtimer_systimer_init(struct device_node *np) ...@@ -826,8 +822,9 @@ static int __init dmtimer_systimer_init(struct device_node *np)
return -EINVAL; return -EINVAL;
} }
addr = of_get_address(np, 0, NULL, NULL);
pa = of_translate_address(np, addr); of_address_to_resource(np, 0, &res);
pa = (u32)res.start;
if (!pa) if (!pa)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment