Skip to contentSkip to conversation

clockevents for 5.6

GIT PULL New Daniel Lezcano 2 participants 7 messages Nov 4, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Thomas,

here are the changes for v5.6 timer drivers.

Thanks

-- Daniel

The following changes since commit b9023b91dd020ad7e093baa5122b6968c48cc9e0:

tick: broadcast-hrtimer: Fix a race in bc_set_next (2019-09-27
14:45:55 +0200)

are available in the Git repository at:

https://git.linaro.org/people/daniel.lezcano/linux.git tags/timers-v5.6

for you to fetch changes up to 6e001f6a4cc73cd06fc7b8c633bc4906c33dd8ad:

clocksource/drivers/asm9260: Add a check for of_clk_get (2019-11-04
10:40:10 +0100)

----------------------------------------------------------------
- Some cleanups for the timer-of, use %p0F and the unique device name (Geert Uytterhoeven)

- Use timer-of for the renesas-ostm and the device name to prevent name collision in case of multiple timers (Geert Uytterhoeven)

- Check if there is an error after calling of_clk_get in asm9260 (Chuhong Yuan)

----------------------------------------------------------------
Chuhong Yuan (1):
clocksource/drivers/asm9260: Add a check for of_clk_get

Geert Uytterhoeven (4):
clocksource/drivers/timer-of: Convert last full_name to %pOF clocksource/drivers/timer-of: Use unique device name instead of timer clocksource/drivers/renesas-ostm: Convert to timer_of clocksource/drivers/renesas-ostm: Use unique device name instead
of ostm

 drivers/clocksource/Kconfig         |   1 +
 drivers/clocksource/asm9260_timer.c |   4 ++++
 drivers/clocksource/renesas-ostm.c  | 189
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------
 drivers/clocksource/timer-of.c      |   6 +++---
 4 files changed, 80 insertions(+), 120 deletions(-)
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#1 lore raw

PATCH 1/5 clocksource/drivers/timer-of: Convert last full_name to %pOF

From: Geert Uytterhoeven <[email protected]>

Commit 469869d18a886e04 ("clocksource: Convert to using %pOF instead of full_name") converted all but the one just added before by commit 32f2fea6e77e64cd ("clocksource/drivers/timer-of: Handle of_irq_get_byname() result correctly").

---
 drivers/clocksource/timer-of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/timer-of.c +2 -2
index d8c2bd4391d0..384394205a12 100644
@@ -55,8 +55,8 @@ static __init int timer_of_irq_init(struct device_node *np,
 	if (of_irq->name) {
 		of_irq->irq = ret = of_irq_get_byname(np, of_irq->name);
 		if (ret < 0) {
-			pr_err("Failed to get interrupt %s for %s\n",
-			       of_irq->name, np->full_name);
+			pr_err("Failed to get interrupt %s for %pOF\n",
+			       of_irq->name, np);
 			return ret;
 		}
 	} else	{
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/5 clocksource/drivers/timer-of: Use unique device name instead of timer

From: Geert Uytterhoeven <[email protected]>

If a hardware-specific driver does not provide a name, the timer-of core falls back to device_node.name. Due to generic DT node naming policies, that name is almost always "timer", and thus doesn't identify the actual timer used.

Fix this by using device_node.full_name instead, which includes the unit addrees.

Example impact on /proc/timer_list:

-Clock Event Device: timer
+Clock Event Device: timer@fcfec400

---
 drivers/clocksource/timer-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-of.c +1 -1
index 384394205a12..8c11bd743dd0 100644
@@ -190,7 +190,7 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)
 	}
 
 	if (!to->clkevt.name)
-		to->clkevt.name = np->name;
+		to->clkevt.name = np->full_name;
 
 	to->np = np;
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/5 clocksource/drivers/renesas-ostm: Convert to timer_of

In reply to Daniel Lezcano

From: Geert Uytterhoeven <[email protected]>

Convert the Renesas OSTM driver to use the timer_of framework. This reduces the driver object size by 367 bytes (with gcc 7.4.0).

---
 drivers/clocksource/Kconfig        |   1 +
 drivers/clocksource/renesas-ostm.c | 189 +++++++++++------------------
 2 files changed, 73 insertions(+), 117 deletions(-)
drivers/clocksource/Kconfig +1 -0
index f35a53ce8988..5fdd76cb1768 100644
@@ -528,6 +528,7 @@ config SH_TIMER_MTU2
 config RENESAS_OSTM
 	bool "Renesas OSTM timer driver" if COMPILE_TEST
 	select CLKSRC_MMIO
+	select TIMER_OF
 	help
 	  Enables the support for the Renesas OSTM.
 
drivers/clocksource/renesas-ostm.c +72 -117

305 lines not on this page · raw message

Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw

PATCH 4/5 clocksource/drivers/renesas-ostm: Use unique device name instead of ostm

In reply to Daniel Lezcano

From: Geert Uytterhoeven <[email protected]>

Currently all OSTM devices are called "ostm", also in kernel messages.

As there can be multiple instances in an SoC, this can confuse the user. Hence construct a unique name from the DT node name, like is done for platform devices.

On RSK+RZA1, the boot log changes like:

-clocksource: ostm: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 57352151442 ns +clocksource: timer@fcfec000: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 57352151442 ns
sched_clock: 32 bits at 33MHz, resolution 30ns, wraps every 64440619504ns
-ostm: used for clocksource
-ostm: used for clock events
+/soc/timer@fcfec000: used for clocksource
+/soc/timer@fcfec400: used for clock events
...
-clocksource: Switched to clocksource ostm
+clocksource: Switched to clocksource timer@fcfec000

---
 drivers/clocksource/renesas-ostm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clocksource/renesas-ostm.c +5 -5
index 46012d905604..3d06ba66008c 100644
@@ -64,9 +64,9 @@ static int __init ostm_init_clksrc(struct timer_of *to)
 	writeb(CTL_FREERUN, timer_of_base(to) + OSTM_CTL);
 	writeb(TS, timer_of_base(to) + OSTM_TS);
 
-	return clocksource_mmio_init(timer_of_base(to) + OSTM_CNT, "ostm",
-				     timer_of_rate(to), 300, 32,
-				     clocksource_mmio_readl_up);
+	return clocksource_mmio_init(timer_of_base(to) + OSTM_CNT,
+				     to->np->full_name, timer_of_rate(to), 300,
+				     32, clocksource_mmio_readl_up);
 }
 
 static u64 notrace ostm_read_sched_clock(void)
@@ -190,13 +190,13 @@ static int __init ostm_init(struct device_node *np)
 			goto err_cleanup;
 
 		ostm_init_sched_clock(to);
-		pr_info("ostm: used for clocksource\n");
+		pr_info("%pOF: used for clocksource\n", np);
 	} else {
 		ret = ostm_init_clkevt(to);
 		if (ret)
 			goto err_cleanup;
 
-		pr_info("ostm: used for clock events\n");
+		pr_info("%pOF: used for clock events\n", np);
 	}
 
 	return 0;
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/5 clocksource/drivers/asm9260: Add a check for of_clk_get

In reply to Daniel Lezcano

From: Chuhong Yuan <[email protected]>

asm9260_timer_init misses a check for of_clk_get.
Add a check for it and print errors like other clocksource drivers.

---
 drivers/clocksource/asm9260_timer.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/clocksource/asm9260_timer.c +4 -0
index 9f09a59161e7..5b39d3701fa3 100644
@@ -194,6 +194,10 @@ static int __init asm9260_timer_init(struct device_node *np)
 	}
 
 	clk = of_clk_get(np, 0);
+	if (IS_ERR(clk)) {
+		pr_err("Failed to get clk!\n");
+		return PTR_ERR(clk);
+	}
 
 	ret = clk_prepare_enable(clk);
 	if (ret) {
Signature · 1 line
2.17.1
#6 lore raw
In reply to Daniel Lezcano
Quoted 2 lines · Daniel Lezcano

here are the changes for v5.6 timer drivers.

I assume this is targeted at 5.5. If not let me know and I put the commits into the fridge to keep them fresh until next year :)

Thanks,

tglx