aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2018-12-03 09:58:18 -0500
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-12-06 12:13:44 -0500
commit7cd1acaeea4e72e2926c23ac8db5ab376b2819a4 (patch)
tree414c4041e89ed22b49bf898cbcc5408da256cd25 /drivers/rtc
parent403a3c3dd0ec93c2504b94667d16485729fc0393 (diff)
rtc: sun6i: Add support for all known pre-H6 variants
There are different variants to the RTC hardware first seen on sun6i (A31). The differences we care about in this driver are the clock rate for the internal oscillator, prescalers, and the presence of an external clock output. This patch adds support for all the known pre-H6 base compatibles using the variants data structure previously introduced. Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-sun6i.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index d1866d90b9ef..46609ae56ffd 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -312,6 +312,48 @@ static void __init sun6i_a31_rtc_clk_init(struct device_node *node)
312CLK_OF_DECLARE_DRIVER(sun6i_a31_rtc_clk, "allwinner,sun6i-a31-rtc", 312CLK_OF_DECLARE_DRIVER(sun6i_a31_rtc_clk, "allwinner,sun6i-a31-rtc",
313 sun6i_a31_rtc_clk_init); 313 sun6i_a31_rtc_clk_init);
314 314
315static const struct sun6i_rtc_clk_data sun8i_a23_rtc_data = {
316 .rc_osc_rate = 667000, /* datasheet says 600 ~ 700 KHz */
317 .has_prescaler = 1,
318 .has_out_clk = 1,
319};
320
321static void __init sun8i_a23_rtc_clk_init(struct device_node *node)
322{
323 sun6i_rtc_clk_init(node, &sun8i_a23_rtc_data);
324}
325CLK_OF_DECLARE_DRIVER(sun8i_a23_rtc_clk, "allwinner,sun8i-a23-rtc",
326 sun8i_a23_rtc_clk_init);
327
328static const struct sun6i_rtc_clk_data sun8i_h3_rtc_data = {
329 .rc_osc_rate = 16000000,
330 .fixed_prescaler = 32,
331 .has_prescaler = 1,
332 .has_out_clk = 1,
333};
334
335static void __init sun8i_h3_rtc_clk_init(struct device_node *node)
336{
337 sun6i_rtc_clk_init(node, &sun8i_h3_rtc_data);
338}
339CLK_OF_DECLARE_DRIVER(sun8i_h3_rtc_clk, "allwinner,sun8i-h3-rtc",
340 sun8i_h3_rtc_clk_init);
341/* As far as we are concerned, clocks for H5 are the same as H3 */
342CLK_OF_DECLARE_DRIVER(sun50i_h5_rtc_clk, "allwinner,sun50i-h5-rtc",
343 sun8i_h3_rtc_clk_init);
344
345static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = {
346 .rc_osc_rate = 32000,
347 .has_out_clk = 1,
348};
349
350static void __init sun8i_v3_rtc_clk_init(struct device_node *node)
351{
352 sun6i_rtc_clk_init(node, &sun8i_v3_rtc_data);
353}
354CLK_OF_DECLARE_DRIVER(sun8i_v3_rtc_clk, "allwinner,sun8i-v3-rtc",
355 sun8i_v3_rtc_clk_init);
356
315static irqreturn_t sun6i_rtc_alarmirq(int irq, void *id) 357static irqreturn_t sun6i_rtc_alarmirq(int irq, void *id)
316{ 358{
317 struct sun6i_rtc_dev *chip = (struct sun6i_rtc_dev *) id; 359 struct sun6i_rtc_dev *chip = (struct sun6i_rtc_dev *) id;
@@ -625,6 +667,10 @@ static int sun6i_rtc_probe(struct platform_device *pdev)
625 */ 667 */
626static const struct of_device_id sun6i_rtc_dt_ids[] = { 668static const struct of_device_id sun6i_rtc_dt_ids[] = {
627 { .compatible = "allwinner,sun6i-a31-rtc" }, 669 { .compatible = "allwinner,sun6i-a31-rtc" },
670 { .compatible = "allwinner,sun8i-a23-rtc" },
671 { .compatible = "allwinner,sun8i-h3-rtc" },
672 { .compatible = "allwinner,sun8i-v3-rtc" },
673 { .compatible = "allwinner,sun50i-h5-rtc" },
628 { /* sentinel */ }, 674 { /* sentinel */ },
629}; 675};
630MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids); 676MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids);