Skip to contentSkip to conversation

rtc: sun6i: Add support for RTC clocks on R40

PATCH Applied Chen-Yu Tsai 3 participants 4 messages Dec 5, 2019 – Dec 17, 2019 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Chen-Yu Tsai

author maintainer
#0 lore raw

PATCH 1/1 rtc: sun6i: Add support for RTC clocks on R40

From: Chen-Yu Tsai <[email protected]>

When support for the R40 in the rtc-sun6i driver was split out for a separate compatible string, only the RTC half was covered, and not the clock half. Unfortunately this results in the whole driver not working, as the RTC half expects the clock half to have been initialized.

Add support for the clock part as well. The clock part is like the H3, but does not need to export the internal oscillator, nor does it have a gateable LOSC external output.

This fixes issues with WiFi and Bluetooth not working on the BPI M2U.

Fixes d6624cc75021 ("rtc: sun6i: Add R40 compatible")
Cc <[email protected]> # 5.3.x

---

Please merge this for fixes.

---
 drivers/rtc/rtc-sun6i.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/rtc/rtc-sun6i.c +16 -0
index 5e2bd9f1d01e..fc32be687606 100644
@@ -380,6 +380,22 @@ static void __init sun50i_h6_rtc_clk_init(struct device_node *node)
 CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc",
 		      sun50i_h6_rtc_clk_init);
 
+/*
+ * The R40 user manual is self-conflicting on whether the prescaler is
+ * fixed or configurable. The clock diagram shows it as fixed, but there
+ * is also a configurable divider in the RTC block.
+ */
+static const struct sun6i_rtc_clk_data sun8i_r40_rtc_data = {
+	.rc_osc_rate = 16000000,
+	.fixed_prescaler = 512,
+};
+static void __init sun8i_r40_rtc_clk_init(struct device_node *node)
+{
+	sun6i_rtc_clk_init(node, &sun8i_r40_rtc_data);
+}
+CLK_OF_DECLARE_DRIVER(sun8i_r40_rtc_clk, "allwinner,sun8i-r40-rtc",
+		      sun8i_r40_rtc_clk_init);
+
 static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = {
 	.rc_osc_rate = 32000,
 	.has_out_clk = 1,
Signature · 1 line
2.24.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

When support for the R40 in the rtc-sun6i driver was split out for a separate compatible string, only the RTC half was covered, and not the clock half. Unfortunately this results in the whole driver not working, as the RTC half expects the clock half to have been initialized.

Add support for the clock part as well. The clock part is like the H3, but does not need to export the internal oscillator, nor does it have a gateable LOSC external output.

Quoted 5 lines

This fixes issues with WiFi and Bluetooth not working on the BPI M2U.

Fixes d6624cc75021 ("rtc: sun6i: Add R40 compatible")
Cc <[email protected]> # 5.3.x

Maxime

maintainer Applied
#2 lore raw
In reply to Chen-Yu Tsai
Quoted 16 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

When support for the R40 in the rtc-sun6i driver was split out for a separate compatible string, only the RTC half was covered, and not the clock half. Unfortunately this results in the whole driver not working, as the RTC half expects the clock half to have been initialized.

Add support for the clock part as well. The clock part is like the H3, but does not need to export the internal oscillator, nor does it have a gateable LOSC external output.

This fixes issues with WiFi and Bluetooth not working on the BPI M2U.

Fixes d6624cc75021 ("rtc: sun6i: Add R40 compatible")
Cc <[email protected]> # 5.3.x
Quoted 8 lines

---

Please merge this for fixes.

---
 drivers/rtc/rtc-sun6i.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#4 lore raw

Hi,

Quoted 10 lines · Sasha Levin

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag, fixing commit: d6624cc75021 ("rtc: sun6i: Add R40 compatible").

The bot has tested the following trees: v5.4.2, v5.3.15.

Quoted 8 lines

v5.4.2: Build OK!
v5.3.15: Failed to apply! Possible dependencies:

    b60ff2cfb598 ("rtc: sun6i: Add support for H6 RTC")

NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

This can be queued for v5.4.

I'll send a separate backport for v5.3.

ChenYu