Skip to content

Commit 111bf02

Browse files
wensalexandrebelloni
authored andcommitted
rtc: sun6i: Add support for RTC clocks on R40
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: d6624cc ("rtc: sun6i: Add R40 compatible") Cc: <stable@vger.kernel.org> # 5.3.x Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20191205085054.6049-1-wens@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent e42617b commit 111bf02

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎drivers/rtc/rtc-sun6i.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,22 @@ static void __init sun50i_h6_rtc_clk_init(struct device_node *node)
379379
CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc",
380380
sun50i_h6_rtc_clk_init);
381381

382+
/*
383+
* The R40 user manual is self-conflicting on whether the prescaler is
384+
* fixed or configurable. The clock diagram shows it as fixed, but there
385+
* is also a configurable divider in the RTC block.
386+
*/
387+
static const struct sun6i_rtc_clk_data sun8i_r40_rtc_data = {
388+
.rc_osc_rate = 16000000,
389+
.fixed_prescaler = 512,
390+
};
391+
static void __init sun8i_r40_rtc_clk_init(struct device_node *node)
392+
{
393+
sun6i_rtc_clk_init(node, &sun8i_r40_rtc_data);
394+
}
395+
CLK_OF_DECLARE_DRIVER(sun8i_r40_rtc_clk, "allwinner,sun8i-r40-rtc",
396+
sun8i_r40_rtc_clk_init);
397+
382398
static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = {
383399
.rc_osc_rate = 32000,
384400
.has_out_clk = 1,

0 commit comments

Comments
 (0)