mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rtc: sun6i: disable automatic clock input switching
@ 2024-07-30 19:49 Michael Walle
  2024-09-04 14:46 ` Chen-Yu Tsai
  2024-09-11 22:30 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Walle @ 2024-07-30 19:49 UTC (permalink / raw)
  To: Alexandre Belloni, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: linux-rtc, linux-arm-kernel, linux-sunxi, linux-kernel, Michael Walle

The V3(s) will detect a valid external low frequency clock and if it is
not present will automatically switch to the internal one. This might
hide bugs and (hardware) configuration errors. It's even worse because
the internal RTC runs significantly slower (32.000Hz vs 32.768Hz).
Fortunately for us, the V3(s) has an (undocumented) bypass of this
switching and the driver already supports it by setting the
.has_auto_swt flag.

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
This is not tagged as a Fixes commit, because it might break boards with
an incorrect device tree. That is, if the device tree lists the external
crystal but the board doesn't have it the RTC will stop running. I don't
think this is likely though, because the user manual requires the
external clock.
---
 drivers/rtc/rtc-sun6i.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index 8e0c66906103..e681c1745866 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -402,6 +402,7 @@ CLK_OF_DECLARE_DRIVER(sun8i_r40_rtc_clk, "allwinner,sun8i-r40-rtc",
 static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = {
 	.rc_osc_rate = 32000,
 	.has_out_clk = 1,
+	.has_auto_swt = 1,
 };
 
 static void __init sun8i_v3_rtc_clk_init(struct device_node *node)
-- 
2.39.2


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

* Re: [PATCH] rtc: sun6i: disable automatic clock input switching
  2024-07-30 19:49 [PATCH] rtc: sun6i: disable automatic clock input switching Michael Walle
@ 2024-09-04 14:46 ` Chen-Yu Tsai
  2024-09-11 22:30 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Chen-Yu Tsai @ 2024-09-04 14:46 UTC (permalink / raw)
  To: Michael Walle
  Cc: Alexandre Belloni, Jernej Skrabec, Samuel Holland, linux-rtc,
	linux-arm-kernel, linux-sunxi, linux-kernel

On Wed, Jul 31, 2024 at 3:49 AM Michael Walle <mwalle@kernel.org> wrote:
>
> The V3(s) will detect a valid external low frequency clock and if it is
> not present will automatically switch to the internal one. This might
> hide bugs and (hardware) configuration errors. It's even worse because
> the internal RTC runs significantly slower (32.000Hz vs 32.768Hz).
> Fortunately for us, the V3(s) has an (undocumented) bypass of this
> switching and the driver already supports it by setting the
> .has_auto_swt flag.
>
> Signed-off-by: Michael Walle <mwalle@kernel.org>

Acked-by: Chen-Yu Tsai <wens@csie.org>

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

* Re: [PATCH] rtc: sun6i: disable automatic clock input switching
  2024-07-30 19:49 [PATCH] rtc: sun6i: disable automatic clock input switching Michael Walle
  2024-09-04 14:46 ` Chen-Yu Tsai
@ 2024-09-11 22:30 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2024-09-11 22:30 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Michael Walle
  Cc: linux-rtc, linux-arm-kernel, linux-sunxi, linux-kernel

On Tue, 30 Jul 2024 21:49:05 +0200, Michael Walle wrote:
> The V3(s) will detect a valid external low frequency clock and if it is
> not present will automatically switch to the internal one. This might
> hide bugs and (hardware) configuration errors. It's even worse because
> the internal RTC runs significantly slower (32.000Hz vs 32.768Hz).
> Fortunately for us, the V3(s) has an (undocumented) bypass of this
> switching and the driver already supports it by setting the
> .has_auto_swt flag.
> 
> [...]

Applied, thanks!

[1/1] rtc: sun6i: disable automatic clock input switching
      https://git.kernel.org/abelloni/c/2cd71297070b

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2024-09-11 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-30 19:49 [PATCH] rtc: sun6i: disable automatic clock input switching Michael Walle
2024-09-04 14:46 ` Chen-Yu Tsai
2024-09-11 22:30 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®