summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-01-29 05:13:43 -0500
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-02-01 06:44:24 -0500
commit15829cf4b3f8dd3849446138830e629715848d7f (patch)
treee42d4879e2af0ea6ca0d0a68be18f9e143425184 /drivers/rtc
parent7bb633b1a9812a6b9f3e49d0cf17f60a633914e5 (diff)
rtc: sun6i: Fix compatibility with old DT binding
Commit 847b8bf62eb4 ("rtc: sun6i: Expose the 32kHz oscillator") adds a new clock for the rtc block with a 2 step probe mechanism. To share the register region between both the clock and rtc instance, a static pointer is used to keep the related data structure. To preserve compatibility with the old binding, the data structure should be saved as soon as the registers are mapped in, regardless of the presence of the clock bindings, so that the rtc device can retrieve it when it is probed. This fixes the rtc device not probing when we use the updated driver with an old device tree blob. Fixes: 847b8bf62eb4 ("rtc: sun6i: Expose the 32kHz oscillator") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-sun6i.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index 613f42ade533..08510ca58996 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -211,6 +211,9 @@ static void __init sun6i_rtc_clk_init(struct device_node *node)
211 writel(SUN6I_LOSC_CTRL_KEY | SUN6I_LOSC_CTRL_EXT_OSC, 211 writel(SUN6I_LOSC_CTRL_KEY | SUN6I_LOSC_CTRL_EXT_OSC,
212 rtc->base + SUN6I_LOSC_CTRL); 212 rtc->base + SUN6I_LOSC_CTRL);
213 213
214 /* Yes, I know, this is ugly. */
215 sun6i_rtc = rtc;
216
214 /* Deal with old DTs */ 217 /* Deal with old DTs */
215 if (!of_get_property(node, "clocks", NULL)) 218 if (!of_get_property(node, "clocks", NULL))
216 return; 219 return;
@@ -243,9 +246,6 @@ static void __init sun6i_rtc_clk_init(struct device_node *node)
243 clk_data->num = 1; 246 clk_data->num = 1;
244 clk_data->hws[0] = &rtc->hw; 247 clk_data->hws[0] = &rtc->hw;
245 of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); 248 of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
246
247 /* Yes, I know, this is ugly. */
248 sun6i_rtc = rtc;
249} 249}
250CLK_OF_DECLARE_DRIVER(sun6i_rtc_clk, "allwinner,sun6i-a31-rtc", 250CLK_OF_DECLARE_DRIVER(sun6i_rtc_clk, "allwinner,sun6i-a31-rtc",
251 sun6i_rtc_clk_init); 251 sun6i_rtc_clk_init);