12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2e842f1c8SRichard Purdie /*
3e842f1c8SRichard Purdie * Real Time Clock interface for StrongARM SA1x00 and XScale PXA2xx
4e842f1c8SRichard Purdie *
5e842f1c8SRichard Purdie * Copyright (c) 2000 Nils Faerber
6e842f1c8SRichard Purdie *
7e842f1c8SRichard Purdie * Based on rtc.c by Paul Gortmaker
8e842f1c8SRichard Purdie *
9e842f1c8SRichard Purdie * Original Driver by Nils Faerber <nils@kernelconcepts.de>
10e842f1c8SRichard Purdie *
11e842f1c8SRichard Purdie * Modifications from:
12e842f1c8SRichard Purdie * CIH <cih@coventive.com>
132f82af08SNicolas Pitre * Nicolas Pitre <nico@fluxnic.net>
14e842f1c8SRichard Purdie * Andrew Christian <andrew.christian@hp.com>
15e842f1c8SRichard Purdie *
16e842f1c8SRichard Purdie * Converted to the RTC subsystem and Driver Model
17e842f1c8SRichard Purdie * by Richard Purdie <rpurdie@rpsys.net>
18e842f1c8SRichard Purdie */
19e842f1c8SRichard Purdie
20e842f1c8SRichard Purdie #include <linux/platform_device.h>
21e842f1c8SRichard Purdie #include <linux/module.h>
228e8bbcb3SHaojian Zhuang #include <linux/clk.h>
23e842f1c8SRichard Purdie #include <linux/rtc.h>
24e842f1c8SRichard Purdie #include <linux/init.h>
25e842f1c8SRichard Purdie #include <linux/fs.h>
26e842f1c8SRichard Purdie #include <linux/interrupt.h>
273888c090SHaojian Zhuang #include <linux/slab.h>
28a0164a57SRussell King #include <linux/string.h>
298bec2e9eSHaojian Zhuang #include <linux/of.h>
30e842f1c8SRichard Purdie #include <linux/pm.h>
31a0164a57SRussell King #include <linux/bitops.h>
3223019a73SRob Herring #include <linux/io.h>
33e842f1c8SRichard Purdie
3490d0ae8eSRob Herring #define RTSR_HZE BIT(3) /* HZ interrupt enable */
3590d0ae8eSRob Herring #define RTSR_ALE BIT(2) /* RTC alarm interrupt enable */
3690d0ae8eSRob Herring #define RTSR_HZ BIT(1) /* HZ rising-edge detected */
3790d0ae8eSRob Herring #define RTSR_AL BIT(0) /* RTC alarm detected */
38a0164a57SRussell King
398c0961baSRob Herring #include "rtc-sa1100.h"
408c0961baSRob Herring
41a404ad1fSMarcelo Roberto Jimenez #define RTC_DEF_DIVIDER (32768 - 1)
42e842f1c8SRichard Purdie #define RTC_DEF_TRIM 0
433888c090SHaojian Zhuang #define RTC_FREQ 1024
44e842f1c8SRichard Purdie
45e842f1c8SRichard Purdie
sa1100_rtc_interrupt(int irq,void * dev_id)467d12e780SDavid Howells static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id)
47e842f1c8SRichard Purdie {
483888c090SHaojian Zhuang struct sa1100_rtc *info = dev_get_drvdata(dev_id);
493888c090SHaojian Zhuang struct rtc_device *rtc = info->rtc;
50e842f1c8SRichard Purdie unsigned int rtsr;
51e842f1c8SRichard Purdie unsigned long events = 0;
52e842f1c8SRichard Purdie
533888c090SHaojian Zhuang spin_lock(&info->lock);
54e842f1c8SRichard Purdie
5590d0ae8eSRob Herring rtsr = readl_relaxed(info->rtsr);
56e842f1c8SRichard Purdie /* clear interrupt sources */
5790d0ae8eSRob Herring writel_relaxed(0, info->rtsr);
587decaa55SMarcelo Roberto Jimenez /* Fix for a nasty initialization problem the in SA11xx RTSR register.
597decaa55SMarcelo Roberto Jimenez * See also the comments in sa1100_rtc_probe(). */
607decaa55SMarcelo Roberto Jimenez if (rtsr & (RTSR_ALE | RTSR_HZE)) {
617decaa55SMarcelo Roberto Jimenez /* This is the original code, before there was the if test
627decaa55SMarcelo Roberto Jimenez * above. This code does not clear interrupts that were not
637decaa55SMarcelo Roberto Jimenez * enabled. */
6490d0ae8eSRob Herring writel_relaxed((RTSR_AL | RTSR_HZ) & (rtsr >> 2), info->rtsr);
657decaa55SMarcelo Roberto Jimenez } else {
667decaa55SMarcelo Roberto Jimenez /* For some reason, it is possible to enter this routine
677decaa55SMarcelo Roberto Jimenez * without interruptions enabled, it has been tested with
687decaa55SMarcelo Roberto Jimenez * several units (Bug in SA11xx chip?).
697decaa55SMarcelo Roberto Jimenez *
707decaa55SMarcelo Roberto Jimenez * This situation leads to an infinite "loop" of interrupt
717decaa55SMarcelo Roberto Jimenez * routine calling and as a result the processor seems to
727decaa55SMarcelo Roberto Jimenez * lock on its first call to open(). */
7390d0ae8eSRob Herring writel_relaxed(RTSR_AL | RTSR_HZ, info->rtsr);
747decaa55SMarcelo Roberto Jimenez }
75e842f1c8SRichard Purdie
76e842f1c8SRichard Purdie /* clear alarm interrupt if it has occurred */
77e842f1c8SRichard Purdie if (rtsr & RTSR_AL)
78e842f1c8SRichard Purdie rtsr &= ~RTSR_ALE;
7990d0ae8eSRob Herring writel_relaxed(rtsr & (RTSR_ALE | RTSR_HZE), info->rtsr);
80e842f1c8SRichard Purdie
81e842f1c8SRichard Purdie /* update irq data & counter */
82e842f1c8SRichard Purdie if (rtsr & RTSR_AL)
83e842f1c8SRichard Purdie events |= RTC_AF | RTC_IRQF;
84e842f1c8SRichard Purdie if (rtsr & RTSR_HZ)
85e842f1c8SRichard Purdie events |= RTC_UF | RTC_IRQF;
86e842f1c8SRichard Purdie
87a0164a57SRussell King rtc_update_irq(rtc, 1, events);
88e842f1c8SRichard Purdie
893888c090SHaojian Zhuang spin_unlock(&info->lock);
90e842f1c8SRichard Purdie
91e842f1c8SRichard Purdie return IRQ_HANDLED;
92e842f1c8SRichard Purdie }
93e842f1c8SRichard Purdie
sa1100_rtc_alarm_irq_enable(struct device * dev,unsigned int enabled)9416380c15SJohn Stultz static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
9516380c15SJohn Stultz {
9690d0ae8eSRob Herring u32 rtsr;
973888c090SHaojian Zhuang struct sa1100_rtc *info = dev_get_drvdata(dev);
983888c090SHaojian Zhuang
993888c090SHaojian Zhuang spin_lock_irq(&info->lock);
10090d0ae8eSRob Herring rtsr = readl_relaxed(info->rtsr);
10116380c15SJohn Stultz if (enabled)
10290d0ae8eSRob Herring rtsr |= RTSR_ALE;
10316380c15SJohn Stultz else
10490d0ae8eSRob Herring rtsr &= ~RTSR_ALE;
10590d0ae8eSRob Herring writel_relaxed(rtsr, info->rtsr);
1063888c090SHaojian Zhuang spin_unlock_irq(&info->lock);
10716380c15SJohn Stultz return 0;
10816380c15SJohn Stultz }
10916380c15SJohn Stultz
sa1100_rtc_read_time(struct device * dev,struct rtc_time * tm)110e842f1c8SRichard Purdie static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm)
111e842f1c8SRichard Purdie {
11290d0ae8eSRob Herring struct sa1100_rtc *info = dev_get_drvdata(dev);
11390d0ae8eSRob Herring
114eb8d9420SAlexandre Belloni rtc_time64_to_tm(readl_relaxed(info->rcnr), tm);
115e842f1c8SRichard Purdie return 0;
116e842f1c8SRichard Purdie }
117e842f1c8SRichard Purdie
sa1100_rtc_set_time(struct device * dev,struct rtc_time * tm)118e842f1c8SRichard Purdie static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm)
119e842f1c8SRichard Purdie {
12090d0ae8eSRob Herring struct sa1100_rtc *info = dev_get_drvdata(dev);
121e842f1c8SRichard Purdie
122eb8d9420SAlexandre Belloni writel_relaxed(rtc_tm_to_time64(tm), info->rcnr);
123eb8d9420SAlexandre Belloni
124eb8d9420SAlexandre Belloni return 0;
125e842f1c8SRichard Purdie }
126e842f1c8SRichard Purdie
sa1100_rtc_read_alarm(struct device * dev,struct rtc_wkalrm * alrm)127e842f1c8SRichard Purdie static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
128e842f1c8SRichard Purdie {
129a0164a57SRussell King u32 rtsr;
13090d0ae8eSRob Herring struct sa1100_rtc *info = dev_get_drvdata(dev);
13132b49da4SDavid Brownell
13290d0ae8eSRob Herring rtsr = readl_relaxed(info->rtsr);
13332b49da4SDavid Brownell alrm->enabled = (rtsr & RTSR_ALE) ? 1 : 0;
13432b49da4SDavid Brownell alrm->pending = (rtsr & RTSR_AL) ? 1 : 0;
135e842f1c8SRichard Purdie return 0;
136e842f1c8SRichard Purdie }
137e842f1c8SRichard Purdie
sa1100_rtc_set_alarm(struct device * dev,struct rtc_wkalrm * alrm)138e842f1c8SRichard Purdie static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
139e842f1c8SRichard Purdie {
1403888c090SHaojian Zhuang struct sa1100_rtc *info = dev_get_drvdata(dev);
141e842f1c8SRichard Purdie
1423888c090SHaojian Zhuang spin_lock_irq(&info->lock);
14390d0ae8eSRob Herring writel_relaxed(readl_relaxed(info->rtsr) &
14490d0ae8eSRob Herring (RTSR_HZE | RTSR_ALE | RTSR_AL), info->rtsr);
145eb8d9420SAlexandre Belloni writel_relaxed(rtc_tm_to_time64(&alrm->time), info->rtar);
146e842f1c8SRichard Purdie if (alrm->enabled)
14790d0ae8eSRob Herring writel_relaxed(readl_relaxed(info->rtsr) | RTSR_ALE, info->rtsr);
148e842f1c8SRichard Purdie else
14990d0ae8eSRob Herring writel_relaxed(readl_relaxed(info->rtsr) & ~RTSR_ALE, info->rtsr);
1503888c090SHaojian Zhuang spin_unlock_irq(&info->lock);
151e842f1c8SRichard Purdie
152eb8d9420SAlexandre Belloni return 0;
153e842f1c8SRichard Purdie }
154e842f1c8SRichard Purdie
sa1100_rtc_proc(struct device * dev,struct seq_file * seq)155e842f1c8SRichard Purdie static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq)
156e842f1c8SRichard Purdie {
15790d0ae8eSRob Herring struct sa1100_rtc *info = dev_get_drvdata(dev);
15890d0ae8eSRob Herring
15990d0ae8eSRob Herring seq_printf(seq, "trim/divider\t\t: 0x%08x\n", readl_relaxed(info->rttr));
16090d0ae8eSRob Herring seq_printf(seq, "RTSR\t\t\t: 0x%08x\n", readl_relaxed(info->rtsr));
161e842f1c8SRichard Purdie
162e842f1c8SRichard Purdie return 0;
163e842f1c8SRichard Purdie }
164e842f1c8SRichard Purdie
165ff8371acSDavid Brownell static const struct rtc_class_ops sa1100_rtc_ops = {
166e842f1c8SRichard Purdie .read_time = sa1100_rtc_read_time,
167e842f1c8SRichard Purdie .set_time = sa1100_rtc_set_time,
168e842f1c8SRichard Purdie .read_alarm = sa1100_rtc_read_alarm,
169e842f1c8SRichard Purdie .set_alarm = sa1100_rtc_set_alarm,
170e842f1c8SRichard Purdie .proc = sa1100_rtc_proc,
17116380c15SJohn Stultz .alarm_irq_enable = sa1100_rtc_alarm_irq_enable,
172e842f1c8SRichard Purdie };
173e842f1c8SRichard Purdie
sa1100_rtc_init(struct platform_device * pdev,struct sa1100_rtc * info)1748c0961baSRob Herring int sa1100_rtc_init(struct platform_device *pdev, struct sa1100_rtc *info)
175e842f1c8SRichard Purdie {
1768c0961baSRob Herring int ret;
1773888c090SHaojian Zhuang
1788c0961baSRob Herring spin_lock_init(&info->lock);
1793888c090SHaojian Zhuang
18055d735efSJingoo Han info->clk = devm_clk_get(&pdev->dev, NULL);
1818e8bbcb3SHaojian Zhuang if (IS_ERR(info->clk)) {
1828e8bbcb3SHaojian Zhuang dev_err(&pdev->dev, "failed to find rtc clock source\n");
18355d735efSJingoo Han return PTR_ERR(info->clk);
1848e8bbcb3SHaojian Zhuang }
185e842f1c8SRichard Purdie
1860cc0c38eSChao Xie ret = clk_prepare_enable(info->clk);
1870cc0c38eSChao Xie if (ret)
18866600bbeSJingoo Han return ret;
189e842f1c8SRichard Purdie /*
190e842f1c8SRichard Purdie * According to the manual we should be able to let RTTR be zero
191e842f1c8SRichard Purdie * and then a default diviser for a 32.768KHz clock is used.
192e842f1c8SRichard Purdie * Apparently this doesn't work, at least for my SA1110 rev 5.
193e842f1c8SRichard Purdie * If the clock divider is uninitialized then reset it to the
194e842f1c8SRichard Purdie * default value to get the 1Hz clock.
195e842f1c8SRichard Purdie */
19690d0ae8eSRob Herring if (readl_relaxed(info->rttr) == 0) {
19790d0ae8eSRob Herring writel_relaxed(RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16), info->rttr);
198a0164a57SRussell King dev_warn(&pdev->dev, "warning: "
199a0164a57SRussell King "initializing default clock divider/trim value\n");
200e842f1c8SRichard Purdie /* The current RTC value probably doesn't make sense either */
20190d0ae8eSRob Herring writel_relaxed(0, info->rcnr);
202e842f1c8SRichard Purdie }
203e842f1c8SRichard Purdie
204f2997775SAlexandre Belloni info->rtc->ops = &sa1100_rtc_ops;
205f2997775SAlexandre Belloni info->rtc->max_user_freq = RTC_FREQ;
206e877ab73SAlexandre Belloni info->rtc->range_max = U32_MAX;
207a0164a57SRussell King
208fdcfd854SBartosz Golaszewski ret = devm_rtc_register_device(info->rtc);
209f2997775SAlexandre Belloni if (ret) {
210f2997775SAlexandre Belloni clk_disable_unprepare(info->clk);
211f2997775SAlexandre Belloni return ret;
212f2997775SAlexandre Belloni }
213512053a4SAlexandre Belloni
2147decaa55SMarcelo Roberto Jimenez /* Fix for a nasty initialization problem the in SA11xx RTSR register.
2157decaa55SMarcelo Roberto Jimenez * See also the comments in sa1100_rtc_interrupt().
2167decaa55SMarcelo Roberto Jimenez *
2177decaa55SMarcelo Roberto Jimenez * Sometimes bit 1 of the RTSR (RTSR_HZ) will wake up 1, which means an
2187decaa55SMarcelo Roberto Jimenez * interrupt pending, even though interrupts were never enabled.
2197decaa55SMarcelo Roberto Jimenez * In this case, this bit it must be reset before enabling
2207decaa55SMarcelo Roberto Jimenez * interruptions to avoid a nonexistent interrupt to occur.
2217decaa55SMarcelo Roberto Jimenez *
2227decaa55SMarcelo Roberto Jimenez * In principle, the same problem would apply to bit 0, although it has
2237decaa55SMarcelo Roberto Jimenez * never been observed to happen.
2247decaa55SMarcelo Roberto Jimenez *
2257decaa55SMarcelo Roberto Jimenez * This issue is addressed both here and in sa1100_rtc_interrupt().
2267decaa55SMarcelo Roberto Jimenez * If the issue is not addressed here, in the times when the processor
2277decaa55SMarcelo Roberto Jimenez * wakes up with the bit set there will be one spurious interrupt.
2287decaa55SMarcelo Roberto Jimenez *
2297decaa55SMarcelo Roberto Jimenez * The issue is also dealt with in sa1100_rtc_interrupt() to be on the
2307decaa55SMarcelo Roberto Jimenez * safe side, once the condition that lead to this strange
2317decaa55SMarcelo Roberto Jimenez * initialization is unknown and could in principle happen during
2327decaa55SMarcelo Roberto Jimenez * normal processing.
2337decaa55SMarcelo Roberto Jimenez *
2347decaa55SMarcelo Roberto Jimenez * Notice that clearing bit 1 and 0 is accomplished by writting ONES to
2357decaa55SMarcelo Roberto Jimenez * the corresponding bits in RTSR. */
23690d0ae8eSRob Herring writel_relaxed(RTSR_AL | RTSR_HZ, info->rtsr);
2377decaa55SMarcelo Roberto Jimenez
238e842f1c8SRichard Purdie return 0;
2398c0961baSRob Herring }
2408c0961baSRob Herring EXPORT_SYMBOL_GPL(sa1100_rtc_init);
2418c0961baSRob Herring
sa1100_rtc_probe(struct platform_device * pdev)2428c0961baSRob Herring static int sa1100_rtc_probe(struct platform_device *pdev)
2438c0961baSRob Herring {
2448c0961baSRob Herring struct sa1100_rtc *info;
24590d0ae8eSRob Herring void __iomem *base;
2468c0961baSRob Herring int irq_1hz, irq_alarm;
247512053a4SAlexandre Belloni int ret;
2488c0961baSRob Herring
2498c0961baSRob Herring irq_1hz = platform_get_irq_byname(pdev, "rtc 1Hz");
2508c0961baSRob Herring irq_alarm = platform_get_irq_byname(pdev, "rtc alarm");
2518c0961baSRob Herring if (irq_1hz < 0 || irq_alarm < 0)
2528c0961baSRob Herring return -ENODEV;
2538c0961baSRob Herring
2548c0961baSRob Herring info = devm_kzalloc(&pdev->dev, sizeof(struct sa1100_rtc), GFP_KERNEL);
2558c0961baSRob Herring if (!info)
2568c0961baSRob Herring return -ENOMEM;
2578c0961baSRob Herring info->irq_1hz = irq_1hz;
2588c0961baSRob Herring info->irq_alarm = irq_alarm;
2598c0961baSRob Herring
260f2997775SAlexandre Belloni info->rtc = devm_rtc_allocate_device(&pdev->dev);
261f2997775SAlexandre Belloni if (IS_ERR(info->rtc))
262f2997775SAlexandre Belloni return PTR_ERR(info->rtc);
263f2997775SAlexandre Belloni
264512053a4SAlexandre Belloni ret = devm_request_irq(&pdev->dev, irq_1hz, sa1100_rtc_interrupt, 0,
265512053a4SAlexandre Belloni "rtc 1Hz", &pdev->dev);
266512053a4SAlexandre Belloni if (ret) {
267512053a4SAlexandre Belloni dev_err(&pdev->dev, "IRQ %d already in use.\n", irq_1hz);
268512053a4SAlexandre Belloni return ret;
269512053a4SAlexandre Belloni }
270512053a4SAlexandre Belloni ret = devm_request_irq(&pdev->dev, irq_alarm, sa1100_rtc_interrupt, 0,
271512053a4SAlexandre Belloni "rtc Alrm", &pdev->dev);
272512053a4SAlexandre Belloni if (ret) {
273512053a4SAlexandre Belloni dev_err(&pdev->dev, "IRQ %d already in use.\n", irq_alarm);
274512053a4SAlexandre Belloni return ret;
275512053a4SAlexandre Belloni }
276512053a4SAlexandre Belloni
27709ef18bcSYueHaibing base = devm_platform_ioremap_resource(pdev, 0);
27890d0ae8eSRob Herring if (IS_ERR(base))
27990d0ae8eSRob Herring return PTR_ERR(base);
28090d0ae8eSRob Herring
28190d0ae8eSRob Herring if (IS_ENABLED(CONFIG_ARCH_SA1100) ||
28290d0ae8eSRob Herring of_device_is_compatible(pdev->dev.of_node, "mrvl,sa1100-rtc")) {
28390d0ae8eSRob Herring info->rcnr = base + 0x04;
28490d0ae8eSRob Herring info->rtsr = base + 0x10;
28590d0ae8eSRob Herring info->rtar = base + 0x00;
28690d0ae8eSRob Herring info->rttr = base + 0x08;
28790d0ae8eSRob Herring } else {
28890d0ae8eSRob Herring info->rcnr = base + 0x0;
28990d0ae8eSRob Herring info->rtsr = base + 0x8;
29090d0ae8eSRob Herring info->rtar = base + 0x4;
29190d0ae8eSRob Herring info->rttr = base + 0xc;
29290d0ae8eSRob Herring }
29390d0ae8eSRob Herring
2948c0961baSRob Herring platform_set_drvdata(pdev, info);
2958c0961baSRob Herring device_init_wakeup(&pdev->dev, 1);
2968c0961baSRob Herring
2978c0961baSRob Herring return sa1100_rtc_init(pdev, info);
298e842f1c8SRichard Purdie }
299e842f1c8SRichard Purdie
sa1100_rtc_remove(struct platform_device * pdev)300*cf407e9fSUwe Kleine-König static void sa1100_rtc_remove(struct platform_device *pdev)
301e842f1c8SRichard Purdie {
3023888c090SHaojian Zhuang struct sa1100_rtc *info = platform_get_drvdata(pdev);
303e842f1c8SRichard Purdie
304512053a4SAlexandre Belloni if (info) {
305512053a4SAlexandre Belloni spin_lock_irq(&info->lock);
306512053a4SAlexandre Belloni writel_relaxed(0, info->rtsr);
307512053a4SAlexandre Belloni spin_unlock_irq(&info->lock);
3080cc0c38eSChao Xie clk_disable_unprepare(info->clk);
309512053a4SAlexandre Belloni }
310e842f1c8SRichard Purdie }
311e842f1c8SRichard Purdie
312aaa92faeSJingoo Han #ifdef CONFIG_PM_SLEEP
sa1100_rtc_suspend(struct device * dev)3135d027cd2SHaojian Zhuang static int sa1100_rtc_suspend(struct device *dev)
3146bc54e69SRussell King {
3153888c090SHaojian Zhuang struct sa1100_rtc *info = dev_get_drvdata(dev);
3165d027cd2SHaojian Zhuang if (device_may_wakeup(dev))
3173888c090SHaojian Zhuang enable_irq_wake(info->irq_alarm);
3186bc54e69SRussell King return 0;
3196bc54e69SRussell King }
3206bc54e69SRussell King
sa1100_rtc_resume(struct device * dev)3215d027cd2SHaojian Zhuang static int sa1100_rtc_resume(struct device *dev)
3226bc54e69SRussell King {
3233888c090SHaojian Zhuang struct sa1100_rtc *info = dev_get_drvdata(dev);
3245d027cd2SHaojian Zhuang if (device_may_wakeup(dev))
3253888c090SHaojian Zhuang disable_irq_wake(info->irq_alarm);
3266bc54e69SRussell King return 0;
3276bc54e69SRussell King }
3286bc54e69SRussell King #endif
3296bc54e69SRussell King
330aaa92faeSJingoo Han static SIMPLE_DEV_PM_OPS(sa1100_rtc_pm_ops, sa1100_rtc_suspend,
331aaa92faeSJingoo Han sa1100_rtc_resume);
332aaa92faeSJingoo Han
333c8a6046eSSachin Kamat #ifdef CONFIG_OF
334dee21a6fSJingoo Han static const struct of_device_id sa1100_rtc_dt_ids[] = {
3358bec2e9eSHaojian Zhuang { .compatible = "mrvl,sa1100-rtc", },
3368bec2e9eSHaojian Zhuang { .compatible = "mrvl,mmp-rtc", },
3378bec2e9eSHaojian Zhuang {}
3388bec2e9eSHaojian Zhuang };
3398bec2e9eSHaojian Zhuang MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids);
340c8a6046eSSachin Kamat #endif
3418bec2e9eSHaojian Zhuang
342e842f1c8SRichard Purdie static struct platform_driver sa1100_rtc_driver = {
343e842f1c8SRichard Purdie .probe = sa1100_rtc_probe,
344*cf407e9fSUwe Kleine-König .remove_new = sa1100_rtc_remove,
345e842f1c8SRichard Purdie .driver = {
346e842f1c8SRichard Purdie .name = "sa1100-rtc",
3475d027cd2SHaojian Zhuang .pm = &sa1100_rtc_pm_ops,
348c8a6046eSSachin Kamat .of_match_table = of_match_ptr(sa1100_rtc_dt_ids),
349e842f1c8SRichard Purdie },
350e842f1c8SRichard Purdie };
351e842f1c8SRichard Purdie
3520c4eae66SAxel Lin module_platform_driver(sa1100_rtc_driver);
353e842f1c8SRichard Purdie
354e842f1c8SRichard Purdie MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
355e842f1c8SRichard Purdie MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)");
356e842f1c8SRichard Purdie MODULE_LICENSE("GPL");
357ad28a07bSKay Sievers MODULE_ALIAS("platform:sa1100-rtc");
358