All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: nomadik-mtu: Handle 32kHz clock
@ 2020-06-28 22:01 Linus Walleij
  2020-07-17  3:40 ` Daniel Lezcano
  2020-07-23 19:09 ` [tip: timers/core] clocksource/drivers/nomadik-mtu: " tip-bot2 for Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2020-06-28 22:01 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner; +Cc: linux-kernel, Linus Walleij

It happens on the U8420-sysclk Ux500 PRCMU firmware
variant that the MTU clock is just 32768 Hz, and in this
mode the minimum ticks is 5 rather than two.

I think this is simply so that there is enough time
for the register write to propagate through the
interconnect to the registers.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/clocksource/nomadik-mtu.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c
index f49a631d8f58..1cf3304652d6 100644
--- a/drivers/clocksource/nomadik-mtu.c
+++ b/drivers/clocksource/nomadik-mtu.c
@@ -186,6 +186,7 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
 {
 	unsigned long rate;
 	int ret;
+	int min_ticks;
 
 	mtu_base = base;
 
@@ -194,7 +195,8 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
 
 	/*
 	 * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz
-	 * for ux500.
+	 * for ux500, and in one specific Ux500 case 32768 Hz.
+	 *
 	 * Use a divide-by-16 counter if the tick rate is more than 32MHz.
 	 * At 32 MHz, the timer (with 32 bit counter) can be programmed
 	 * to wake-up at a max 127s a head in time. Dividing a 2.4 MHz timer
@@ -230,7 +232,12 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
 		pr_err("%s: request_irq() failed\n", "Nomadik Timer Tick");
 	nmdk_clkevt.cpumask = cpumask_of(0);
 	nmdk_clkevt.irq = irq;
-	clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU);
+	if (rate < 100000)
+		min_ticks = 5;
+	else
+		min_ticks = 2;
+	clockevents_config_and_register(&nmdk_clkevt, rate, min_ticks,
+					0xffffffffU);
 
 	mtu_delay_timer.read_current_timer = &nmdk_timer_read_current_timer;
 	mtu_delay_timer.freq = rate;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] clocksource: nomadik-mtu: Handle 32kHz clock
  2020-06-28 22:01 [PATCH] clocksource: nomadik-mtu: Handle 32kHz clock Linus Walleij
@ 2020-07-17  3:40 ` Daniel Lezcano
  2020-07-23 19:09 ` [tip: timers/core] clocksource/drivers/nomadik-mtu: " tip-bot2 for Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2020-07-17  3:40 UTC (permalink / raw)
  To: Linus Walleij, Thomas Gleixner; +Cc: linux-kernel

On 29/06/2020 00:01, Linus Walleij wrote:
> It happens on the U8420-sysclk Ux500 PRCMU firmware
> variant that the MTU clock is just 32768 Hz, and in this
> mode the minimum ticks is 5 rather than two.
> 
> I think this is simply so that there is enough time
> for the register write to propagate through the
> interconnect to the registers.
> 
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---

Applied, thanks


-- 
<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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: timers/core] clocksource/drivers/nomadik-mtu: Handle 32kHz clock
  2020-06-28 22:01 [PATCH] clocksource: nomadik-mtu: Handle 32kHz clock Linus Walleij
  2020-07-17  3:40 ` Daniel Lezcano
@ 2020-07-23 19:09 ` tip-bot2 for Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Linus Walleij @ 2020-07-23 19:09 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Linus Walleij, Daniel Lezcano, x86, LKML

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     aaea0b83458cdb3467e27deb7403b4403152dbd6
Gitweb:        https://git.kernel.org/tip/aaea0b83458cdb3467e27deb7403b4403152dbd6
Author:        Linus Walleij <linus.walleij@linaro.org>
AuthorDate:    Mon, 29 Jun 2020 00:01:53 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 23 Jul 2020 16:57:43 +02:00

clocksource/drivers/nomadik-mtu: Handle 32kHz clock

It happens on the U8420-sysclk Ux500 PRCMU firmware
variant that the MTU clock is just 32768 Hz, and in this
mode the minimum ticks is 5 rather than two.

I think this is simply so that there is enough time
for the register write to propagate through the
interconnect to the registers.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200628220153.67011-1-linus.walleij@linaro.org
---
 drivers/clocksource/nomadik-mtu.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c
index f49a631..1cf3304 100644
--- a/drivers/clocksource/nomadik-mtu.c
+++ b/drivers/clocksource/nomadik-mtu.c
@@ -186,6 +186,7 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
 {
 	unsigned long rate;
 	int ret;
+	int min_ticks;
 
 	mtu_base = base;
 
@@ -194,7 +195,8 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
 
 	/*
 	 * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz
-	 * for ux500.
+	 * for ux500, and in one specific Ux500 case 32768 Hz.
+	 *
 	 * Use a divide-by-16 counter if the tick rate is more than 32MHz.
 	 * At 32 MHz, the timer (with 32 bit counter) can be programmed
 	 * to wake-up at a max 127s a head in time. Dividing a 2.4 MHz timer
@@ -230,7 +232,12 @@ static int __init nmdk_timer_init(void __iomem *base, int irq,
 		pr_err("%s: request_irq() failed\n", "Nomadik Timer Tick");
 	nmdk_clkevt.cpumask = cpumask_of(0);
 	nmdk_clkevt.irq = irq;
-	clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU);
+	if (rate < 100000)
+		min_ticks = 5;
+	else
+		min_ticks = 2;
+	clockevents_config_and_register(&nmdk_clkevt, rate, min_ticks,
+					0xffffffffU);
 
 	mtu_delay_timer.read_current_timer = &nmdk_timer_read_current_timer;
 	mtu_delay_timer.freq = rate;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-23 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 22:01 [PATCH] clocksource: nomadik-mtu: Handle 32kHz clock Linus Walleij
2020-07-17  3:40 ` Daniel Lezcano
2020-07-23 19:09 ` [tip: timers/core] clocksource/drivers/nomadik-mtu: " tip-bot2 for Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.