diff options
| author | Dmitry Torokhov <[email protected]> | 2023-08-30 16:06:38 -0700 | 
|---|---|---|
| committer | Dmitry Torokhov <[email protected]> | 2023-08-30 16:06:38 -0700 | 
| commit | 1ac731c529cd4d6adbce134754b51ff7d822b145 (patch) | |
| tree | 143ab3f35ca5f3b69f583c84e6964b17139c2ec1 /drivers/clocksource/timer-ti-dm-systimer.c | |
| parent | 07b4c950f27bef0362dc6ad7ee713aab61d58149 (diff) | |
| parent | 54116d442e001e1b6bd482122043b1870998a1f3 (diff) | |
Merge branch 'next' into for-linus
Prepare input updates for 6.6 merge window.
Diffstat (limited to 'drivers/clocksource/timer-ti-dm-systimer.c')
| -rw-r--r-- | drivers/clocksource/timer-ti-dm-systimer.c | 63 | 
1 files changed, 31 insertions, 32 deletions
diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c index 632523c1232f..c2dcd8d68e45 100644 --- a/drivers/clocksource/timer-ti-dm-systimer.c +++ b/drivers/clocksource/timer-ti-dm-systimer.c @@ -251,24 +251,24 @@ static void __init dmtimer_systimer_assign_alwon(void)  		counter_32k = -ENODEV;  	for_each_matching_node(np, dmtimer_match_table) { +		struct resource res;  		if (!dmtimer_is_preferred(np))  			continue; -		if (of_property_read_bool(np, "ti,timer-alwon")) { -			const __be32 *addr; - -			addr = of_get_address(np, 0, NULL, NULL); -			pa = of_translate_address(np, addr); -			if (pa) { -				/* Quirky omap3 boards must use dmtimer12 */ -				if (quirk_unreliable_oscillator && -				    pa == 0x48318000) -					continue; - -				of_node_put(np); -				break; -			} -		} +		if (!of_property_read_bool(np, "ti,timer-alwon")) +			continue; + +		if (of_address_to_resource(np, 0, &res)) +			continue; + +		pa = res.start; + +		/* Quirky omap3 boards must use dmtimer12 */ +		if (quirk_unreliable_oscillator && pa == 0x48318000) +			continue; + +		of_node_put(np); +		break;  	}  	/* Usually no need for dmtimer clocksource if we have counter32 */ @@ -285,24 +285,22 @@ static void __init dmtimer_systimer_assign_alwon(void)  static u32 __init dmtimer_systimer_find_first_available(void)  {  	struct device_node *np; -	const __be32 *addr;  	u32 pa = 0;  	for_each_matching_node(np, dmtimer_match_table) { +		struct resource res;  		if (!dmtimer_is_preferred(np))  			continue; -		addr = of_get_address(np, 0, NULL, NULL); -		pa = of_translate_address(np, addr); -		if (pa) { -			if (pa == clocksource || pa == clockevent) { -				pa = 0; -				continue; -			} - -			of_node_put(np); -			break; -		} +		if (of_address_to_resource(np, 0, &res)) +			continue; + +		if (res.start == clocksource || res.start == clockevent) +			continue; + +		pa = res.start; +		of_node_put(np); +		break;  	}  	return pa; @@ -586,7 +584,7 @@ static int __init dmtimer_clkevt_init_common(struct dmtimer_clockevent *clkevt,  	writel_relaxed(OMAP_TIMER_INT_OVERFLOW, t->base + t->wakeup);  	pr_info("TI gptimer %s: %s%lu Hz at %pOF\n", -		name, of_find_property(np, "ti,timer-alwon", NULL) ? +		name, of_property_read_bool(np, "ti,timer-alwon") ?  		"always-on " : "", t->rate, np->parent);  	return 0; @@ -787,7 +785,7 @@ static int __init dmtimer_clocksource_init(struct device_node *np)  		       t->base + t->ctrl);  	pr_info("TI gptimer clocksource: %s%pOF\n", -		of_find_property(np, "ti,timer-alwon", NULL) ? +		of_property_read_bool(np, "ti,timer-alwon") ?  		"always-on " : "", np->parent);  	if (!dmtimer_sched_clock_counter) { @@ -812,7 +810,7 @@ err_out_free:   */  static int __init dmtimer_systimer_init(struct device_node *np)  { -	const __be32 *addr; +	struct resource res;  	u32 pa;  	/* One time init for the preferred timer configuration */ @@ -826,8 +824,9 @@ static int __init dmtimer_systimer_init(struct device_node *np)  		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)  		return -EINVAL;  |