blob: 41f62ca68dc45c1322c5166bb5d33b7082bfb0a5 [file] [log] [blame]
Richard Purdiee842f1c2006-03-27 01:16:46 -08001/*
2 * Real Time Clock interface for StrongARM SA1x00 and XScale PXA2xx
3 *
4 * Copyright (c) 2000 Nils Faerber
5 *
6 * Based on rtc.c by Paul Gortmaker
7 *
8 * Original Driver by Nils Faerber <nils@kernelconcepts.de>
9 *
10 * Modifications from:
11 * CIH <cih@coventive.com>
Nicolas Pitre2f82af02009-09-14 03:25:28 -040012 * Nicolas Pitre <nico@fluxnic.net>
Richard Purdiee842f1c2006-03-27 01:16:46 -080013 * Andrew Christian <andrew.christian@hp.com>
14 *
15 * Converted to the RTC subsystem and Driver Model
16 * by Richard Purdie <rpurdie@rpsys.net>
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 */
23
24#include <linux/platform_device.h>
25#include <linux/module.h>
26#include <linux/rtc.h>
27#include <linux/init.h>
28#include <linux/fs.h>
29#include <linux/interrupt.h>
30#include <linux/string.h>
31#include <linux/pm.h>
Jiri Slaby1977f032007-10-18 23:40:25 -070032#include <linux/bitops.h>
Richard Purdiee842f1c2006-03-27 01:16:46 -080033
Russell Kinga09e64f2008-08-05 16:14:15 +010034#include <mach/hardware.h>
Richard Purdiee842f1c2006-03-27 01:16:46 -080035#include <asm/irq.h>
Richard Purdiee842f1c2006-03-27 01:16:46 -080036
37#ifdef CONFIG_ARCH_PXA
Eric Miao5bf3df32009-01-20 11:04:16 +080038#include <mach/regs-rtc.h>
39#include <mach/regs-ost.h>
Richard Purdiee842f1c2006-03-27 01:16:46 -080040#endif
41
Marcelo Roberto Jimeneza404ad12010-10-18 22:33:53 +010042#define RTC_DEF_DIVIDER (32768 - 1)
Richard Purdiee842f1c2006-03-27 01:16:46 -080043#define RTC_DEF_TRIM 0
44
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +010045static const unsigned long RTC_FREQ = 1024;
Eric Miao67697172008-12-18 11:10:32 +080046static unsigned long timer_freq;
Richard Purdiee842f1c2006-03-27 01:16:46 -080047static struct rtc_time rtc_alarm;
Ingo Molnar34af9462006-06-27 02:53:55 -070048static DEFINE_SPINLOCK(sa1100_rtc_lock);
Richard Purdiee842f1c2006-03-27 01:16:46 -080049
Russell King797276e2008-04-20 12:30:41 +010050static inline int rtc_periodic_alarm(struct rtc_time *tm)
51{
52 return (tm->tm_year == -1) ||
53 ((unsigned)tm->tm_mon >= 12) ||
54 ((unsigned)(tm->tm_mday - 1) >= 31) ||
55 ((unsigned)tm->tm_hour > 23) ||
56 ((unsigned)tm->tm_min > 59) ||
57 ((unsigned)tm->tm_sec > 59);
58}
59
60/*
61 * Calculate the next alarm time given the requested alarm time mask
62 * and the current time.
63 */
Marcelo Roberto Jimeneza404ad12010-10-18 22:33:53 +010064static void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now,
65 struct rtc_time *alrm)
Russell King797276e2008-04-20 12:30:41 +010066{
67 unsigned long next_time;
68 unsigned long now_time;
69
70 next->tm_year = now->tm_year;
71 next->tm_mon = now->tm_mon;
72 next->tm_mday = now->tm_mday;
73 next->tm_hour = alrm->tm_hour;
74 next->tm_min = alrm->tm_min;
75 next->tm_sec = alrm->tm_sec;
76
77 rtc_tm_to_time(now, &now_time);
78 rtc_tm_to_time(next, &next_time);
79
80 if (next_time < now_time) {
81 /* Advance one day */
82 next_time += 60 * 60 * 24;
83 rtc_time_to_tm(next_time, next);
84 }
85}
86
Richard Purdiee842f1c2006-03-27 01:16:46 -080087static int rtc_update_alarm(struct rtc_time *alrm)
88{
89 struct rtc_time alarm_tm, now_tm;
90 unsigned long now, time;
91 int ret;
92
93 do {
94 now = RCNR;
95 rtc_time_to_tm(now, &now_tm);
96 rtc_next_alarm_time(&alarm_tm, &now_tm, alrm);
97 ret = rtc_tm_to_time(&alarm_tm, &time);
98 if (ret != 0)
99 break;
100
101 RTSR = RTSR & (RTSR_HZE|RTSR_ALE|RTSR_AL);
102 RTAR = time;
103 } while (now != RCNR);
104
105 return ret;
106}
107
David Howells7d12e782006-10-05 14:55:46 +0100108static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id)
Richard Purdiee842f1c2006-03-27 01:16:46 -0800109{
110 struct platform_device *pdev = to_platform_device(dev_id);
111 struct rtc_device *rtc = platform_get_drvdata(pdev);
112 unsigned int rtsr;
113 unsigned long events = 0;
114
115 spin_lock(&sa1100_rtc_lock);
116
117 rtsr = RTSR;
118 /* clear interrupt sources */
119 RTSR = 0;
Marcelo Roberto Jimenez7decaa52010-10-18 22:35:54 +0100120 /* Fix for a nasty initialization problem the in SA11xx RTSR register.
121 * See also the comments in sa1100_rtc_probe(). */
122 if (rtsr & (RTSR_ALE | RTSR_HZE)) {
123 /* This is the original code, before there was the if test
124 * above. This code does not clear interrupts that were not
125 * enabled. */
126 RTSR = (RTSR_AL | RTSR_HZ) & (rtsr >> 2);
127 } else {
128 /* For some reason, it is possible to enter this routine
129 * without interruptions enabled, it has been tested with
130 * several units (Bug in SA11xx chip?).
131 *
132 * This situation leads to an infinite "loop" of interrupt
133 * routine calling and as a result the processor seems to
134 * lock on its first call to open(). */
135 RTSR = RTSR_AL | RTSR_HZ;
136 }
Richard Purdiee842f1c2006-03-27 01:16:46 -0800137
138 /* clear alarm interrupt if it has occurred */
139 if (rtsr & RTSR_AL)
140 rtsr &= ~RTSR_ALE;
141 RTSR = rtsr & (RTSR_ALE | RTSR_HZE);
142
143 /* update irq data & counter */
144 if (rtsr & RTSR_AL)
145 events |= RTC_AF | RTC_IRQF;
146 if (rtsr & RTSR_HZ)
147 events |= RTC_UF | RTC_IRQF;
148
David Brownellab6a2d72007-05-08 00:33:30 -0700149 rtc_update_irq(rtc, 1, events);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800150
151 if (rtsr & RTSR_AL && rtc_periodic_alarm(&rtc_alarm))
152 rtc_update_alarm(&rtc_alarm);
153
154 spin_unlock(&sa1100_rtc_lock);
155
156 return IRQ_HANDLED;
157}
158
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100159static int sa1100_irq_set_freq(struct device *dev, int freq)
160{
161 if (freq < 1 || freq > timer_freq) {
162 return -EINVAL;
163 } else {
164 struct rtc_device *rtc = (struct rtc_device *)dev;
165
166 rtc->irq_freq = freq;
167
168 return 0;
169 }
170}
171
Richard Purdiee842f1c2006-03-27 01:16:46 -0800172static int rtc_timer1_count;
173
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100174static inline int sa1100_timer1_retrigger(struct rtc_device *rtc)
175{
176 unsigned long diff;
177 unsigned long period = timer_freq / rtc->irq_freq;
178
179 spin_lock_irq(&sa1100_rtc_lock);
180
181 do {
182 OSMR1 += period;
183 diff = OSMR1 - OSCR;
184 /* If OSCR > OSMR1, diff is a very large number (unsigned
185 * math). This means we have a lost interrupt. */
186 } while (diff > period);
187 OIER |= OIER_E1;
188
189 spin_unlock_irq(&sa1100_rtc_lock);
190
191 return 0;
192}
193
David Howells7d12e782006-10-05 14:55:46 +0100194static irqreturn_t timer1_interrupt(int irq, void *dev_id)
Richard Purdiee842f1c2006-03-27 01:16:46 -0800195{
196 struct platform_device *pdev = to_platform_device(dev_id);
197 struct rtc_device *rtc = platform_get_drvdata(pdev);
198
199 /*
200 * If we match for the first time, rtc_timer1_count will be 1.
201 * Otherwise, we wrapped around (very unlikely but
202 * still possible) so compute the amount of missed periods.
203 * The match reg is updated only when the data is actually retrieved
204 * to avoid unnecessary interrupts.
205 */
206 OSSR = OSSR_M1; /* clear match on timer1 */
207
David Brownellab6a2d72007-05-08 00:33:30 -0700208 rtc_update_irq(rtc, rtc_timer1_count, RTC_PF | RTC_IRQF);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800209
210 if (rtc_timer1_count == 1)
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100211 rtc_timer1_count =
212 (rtc->irq_freq * ((1 << 30) / (timer_freq >> 2)));
213
214 /* retrigger. */
215 sa1100_timer1_retrigger(rtc);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800216
217 return IRQ_HANDLED;
218}
219
220static int sa1100_rtc_read_callback(struct device *dev, int data)
221{
222 if (data & RTC_PF) {
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100223 struct rtc_device *rtc = (struct rtc_device *)dev;
224
Richard Purdiee842f1c2006-03-27 01:16:46 -0800225 /* interpolate missed periods and set match for the next */
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100226 unsigned long period = timer_freq / rtc->irq_freq;
Richard Purdiee842f1c2006-03-27 01:16:46 -0800227 unsigned long oscr = OSCR;
228 unsigned long osmr1 = OSMR1;
229 unsigned long missed = (oscr - osmr1)/period;
230 data += missed << 8;
231 OSSR = OSSR_M1; /* clear match on timer 1 */
232 OSMR1 = osmr1 + (missed + 1)*period;
233 /* Ensure we didn't miss another match in the mean time.
234 * Here we compare (match - OSCR) 8 instead of 0 --
235 * see comment in pxa_timer_interrupt() for explanation.
236 */
Marcelo Roberto Jimeneza404ad12010-10-18 22:33:53 +0100237 while ((signed long)((osmr1 = OSMR1) - OSCR) <= 8) {
Richard Purdiee842f1c2006-03-27 01:16:46 -0800238 data += 0x100;
239 OSSR = OSSR_M1; /* clear match on timer 1 */
240 OSMR1 = osmr1 + period;
241 }
242 }
243 return data;
244}
245
246static int sa1100_rtc_open(struct device *dev)
247{
248 int ret;
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100249 struct rtc_device *rtc = (struct rtc_device *)dev;
Richard Purdiee842f1c2006-03-27 01:16:46 -0800250
Thomas Gleixnerdace1452006-07-01 19:29:38 -0700251 ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, IRQF_DISABLED,
Marcelo Roberto Jimeneza404ad12010-10-18 22:33:53 +0100252 "rtc 1Hz", dev);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800253 if (ret) {
Alessandro Zummo2260a252006-04-10 22:54:46 -0700254 dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800255 goto fail_ui;
256 }
Thomas Gleixnerdace1452006-07-01 19:29:38 -0700257 ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, IRQF_DISABLED,
Marcelo Roberto Jimeneza404ad12010-10-18 22:33:53 +0100258 "rtc Alrm", dev);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800259 if (ret) {
Alessandro Zummo2260a252006-04-10 22:54:46 -0700260 dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800261 goto fail_ai;
262 }
Thomas Gleixnerdace1452006-07-01 19:29:38 -0700263 ret = request_irq(IRQ_OST1, timer1_interrupt, IRQF_DISABLED,
Marcelo Roberto Jimeneza404ad12010-10-18 22:33:53 +0100264 "rtc timer", dev);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800265 if (ret) {
Alessandro Zummo2260a252006-04-10 22:54:46 -0700266 dev_err(dev, "IRQ %d already in use.\n", IRQ_OST1);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800267 goto fail_pi;
268 }
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100269 rtc->max_user_freq = RTC_FREQ;
270 sa1100_irq_set_freq(dev, RTC_FREQ);
271
Richard Purdiee842f1c2006-03-27 01:16:46 -0800272 return 0;
273
274 fail_pi:
Russell Kingf1226702006-05-06 11:29:21 +0100275 free_irq(IRQ_RTCAlrm, dev);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800276 fail_ai:
Russell Kingf1226702006-05-06 11:29:21 +0100277 free_irq(IRQ_RTC1Hz, dev);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800278 fail_ui:
279 return ret;
280}
281
282static void sa1100_rtc_release(struct device *dev)
283{
284 spin_lock_irq(&sa1100_rtc_lock);
285 RTSR = 0;
286 OIER &= ~OIER_E1;
287 OSSR = OSSR_M1;
288 spin_unlock_irq(&sa1100_rtc_lock);
289
290 free_irq(IRQ_OST1, dev);
291 free_irq(IRQ_RTCAlrm, dev);
292 free_irq(IRQ_RTC1Hz, dev);
293}
294
295
John Stultz16380c12011-02-02 17:02:41 -0800296static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
297{
298 spin_lock_irq(&sa1100_rtc_lock);
299 if (enabled)
300 RTSR |= RTSR_ALE;
301 else
302 RTSR &= ~RTSR_ALE;
303 spin_unlock_irq(&sa1100_rtc_lock);
304 return 0;
305}
306
Richard Purdiee842f1c2006-03-27 01:16:46 -0800307static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm)
308{
309 rtc_time_to_tm(RCNR, tm);
310 return 0;
311}
312
313static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm)
314{
315 unsigned long time;
316 int ret;
317
318 ret = rtc_tm_to_time(tm, &time);
319 if (ret == 0)
320 RCNR = time;
321 return ret;
322}
323
324static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
325{
David Brownell32b49da2007-02-20 13:58:13 -0800326 u32 rtsr;
327
Richard Purdiee842f1c2006-03-27 01:16:46 -0800328 memcpy(&alrm->time, &rtc_alarm, sizeof(struct rtc_time));
David Brownell32b49da2007-02-20 13:58:13 -0800329 rtsr = RTSR;
330 alrm->enabled = (rtsr & RTSR_ALE) ? 1 : 0;
331 alrm->pending = (rtsr & RTSR_AL) ? 1 : 0;
Richard Purdiee842f1c2006-03-27 01:16:46 -0800332 return 0;
333}
334
335static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
336{
337 int ret;
338
339 spin_lock_irq(&sa1100_rtc_lock);
340 ret = rtc_update_alarm(&alrm->time);
341 if (ret == 0) {
Richard Purdiee842f1c2006-03-27 01:16:46 -0800342 if (alrm->enabled)
David Brownell32b49da2007-02-20 13:58:13 -0800343 RTSR |= RTSR_ALE;
Richard Purdiee842f1c2006-03-27 01:16:46 -0800344 else
David Brownell32b49da2007-02-20 13:58:13 -0800345 RTSR &= ~RTSR_ALE;
Richard Purdiee842f1c2006-03-27 01:16:46 -0800346 }
347 spin_unlock_irq(&sa1100_rtc_lock);
348
349 return ret;
350}
351
352static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq)
353{
Marcelo Roberto Jimenez4cebe7a2011-02-07 19:16:06 -0200354 seq_printf(seq, "trim/divider\t\t: 0x%08x\n", (u32) RTTR);
355 seq_printf(seq, "RTSR\t\t\t: 0x%08x\n", (u32)RTSR);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800356
357 return 0;
358}
359
David Brownellff8371a2006-09-30 23:28:17 -0700360static const struct rtc_class_ops sa1100_rtc_ops = {
Richard Purdiee842f1c2006-03-27 01:16:46 -0800361 .open = sa1100_rtc_open,
362 .read_callback = sa1100_rtc_read_callback,
363 .release = sa1100_rtc_release,
Richard Purdiee842f1c2006-03-27 01:16:46 -0800364 .read_time = sa1100_rtc_read_time,
365 .set_time = sa1100_rtc_set_time,
366 .read_alarm = sa1100_rtc_read_alarm,
367 .set_alarm = sa1100_rtc_set_alarm,
368 .proc = sa1100_rtc_proc,
John Stultz16380c12011-02-02 17:02:41 -0800369 .alarm_irq_enable = sa1100_rtc_alarm_irq_enable,
Richard Purdiee842f1c2006-03-27 01:16:46 -0800370};
371
372static int sa1100_rtc_probe(struct platform_device *pdev)
373{
374 struct rtc_device *rtc;
375
Eric Miao67697172008-12-18 11:10:32 +0800376 timer_freq = get_clock_tick_rate();
377
Richard Purdiee842f1c2006-03-27 01:16:46 -0800378 /*
379 * According to the manual we should be able to let RTTR be zero
380 * and then a default diviser for a 32.768KHz clock is used.
381 * Apparently this doesn't work, at least for my SA1110 rev 5.
382 * If the clock divider is uninitialized then reset it to the
383 * default value to get the 1Hz clock.
384 */
385 if (RTTR == 0) {
386 RTTR = RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16);
Marcelo Roberto Jimeneza404ad12010-10-18 22:33:53 +0100387 dev_warn(&pdev->dev, "warning: "
388 "initializing default clock divider/trim value\n");
Richard Purdiee842f1c2006-03-27 01:16:46 -0800389 /* The current RTC value probably doesn't make sense either */
390 RCNR = 0;
391 }
392
Uli Luckase5a2c9c2008-06-18 09:54:03 +0100393 device_init_wakeup(&pdev->dev, 1);
394
Richard Purdiee842f1c2006-03-27 01:16:46 -0800395 rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops,
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100396 THIS_MODULE);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800397
Alessandro Zummo2260a252006-04-10 22:54:46 -0700398 if (IS_ERR(rtc))
Richard Purdiee842f1c2006-03-27 01:16:46 -0800399 return PTR_ERR(rtc);
Richard Purdiee842f1c2006-03-27 01:16:46 -0800400
401 platform_set_drvdata(pdev, rtc);
402
Marcelo Roberto Jimenezd2ccb522010-12-16 21:31:32 +0100403 /* Set the irq_freq */
404 /*TODO: Find out who is messing with this value after we initialize
405 * it here.*/
406 rtc->irq_freq = RTC_FREQ;
407
Marcelo Roberto Jimenez7decaa52010-10-18 22:35:54 +0100408 /* Fix for a nasty initialization problem the in SA11xx RTSR register.
409 * See also the comments in sa1100_rtc_interrupt().
410 *
411 * Sometimes bit 1 of the RTSR (RTSR_HZ) will wake up 1, which means an
412 * interrupt pending, even though interrupts were never enabled.
413 * In this case, this bit it must be reset before enabling
414 * interruptions to avoid a nonexistent interrupt to occur.
415 *
416 * In principle, the same problem would apply to bit 0, although it has
417 * never been observed to happen.
418 *
419 * This issue is addressed both here and in sa1100_rtc_interrupt().
420 * If the issue is not addressed here, in the times when the processor
421 * wakes up with the bit set there will be one spurious interrupt.
422 *
423 * The issue is also dealt with in sa1100_rtc_interrupt() to be on the
424 * safe side, once the condition that lead to this strange
425 * initialization is unknown and could in principle happen during
426 * normal processing.
427 *
428 * Notice that clearing bit 1 and 0 is accomplished by writting ONES to
429 * the corresponding bits in RTSR. */
430 RTSR = RTSR_AL | RTSR_HZ;
431
Richard Purdiee842f1c2006-03-27 01:16:46 -0800432 return 0;
433}
434
435static int sa1100_rtc_remove(struct platform_device *pdev)
436{
437 struct rtc_device *rtc = platform_get_drvdata(pdev);
438
Marcelo Roberto Jimeneza404ad12010-10-18 22:33:53 +0100439 if (rtc)
Richard Purdiee842f1c2006-03-27 01:16:46 -0800440 rtc_device_unregister(rtc);
441
442 return 0;
443}
444
Russell King6bc54e62007-11-12 22:49:58 +0000445#ifdef CONFIG_PM
Haojian Zhuang5d027cd2009-07-21 14:31:09 +0800446static int sa1100_rtc_suspend(struct device *dev)
Russell King6bc54e62007-11-12 22:49:58 +0000447{
Haojian Zhuang5d027cd2009-07-21 14:31:09 +0800448 if (device_may_wakeup(dev))
David Brownellf6182582008-02-06 01:38:57 -0800449 enable_irq_wake(IRQ_RTCAlrm);
Russell King6bc54e62007-11-12 22:49:58 +0000450 return 0;
451}
452
Haojian Zhuang5d027cd2009-07-21 14:31:09 +0800453static int sa1100_rtc_resume(struct device *dev)
Russell King6bc54e62007-11-12 22:49:58 +0000454{
Haojian Zhuang5d027cd2009-07-21 14:31:09 +0800455 if (device_may_wakeup(dev))
David Brownellf6182582008-02-06 01:38:57 -0800456 disable_irq_wake(IRQ_RTCAlrm);
Russell King6bc54e62007-11-12 22:49:58 +0000457 return 0;
458}
Haojian Zhuang5d027cd2009-07-21 14:31:09 +0800459
Alexey Dobriyan47145212009-12-14 18:00:08 -0800460static const struct dev_pm_ops sa1100_rtc_pm_ops = {
Haojian Zhuang5d027cd2009-07-21 14:31:09 +0800461 .suspend = sa1100_rtc_suspend,
462 .resume = sa1100_rtc_resume,
463};
Russell King6bc54e62007-11-12 22:49:58 +0000464#endif
465
Richard Purdiee842f1c2006-03-27 01:16:46 -0800466static struct platform_driver sa1100_rtc_driver = {
467 .probe = sa1100_rtc_probe,
468 .remove = sa1100_rtc_remove,
Richard Purdiee842f1c2006-03-27 01:16:46 -0800469 .driver = {
Haojian Zhuang5d027cd2009-07-21 14:31:09 +0800470 .name = "sa1100-rtc",
471#ifdef CONFIG_PM
472 .pm = &sa1100_rtc_pm_ops,
473#endif
Richard Purdiee842f1c2006-03-27 01:16:46 -0800474 },
475};
476
477static int __init sa1100_rtc_init(void)
478{
479 return platform_driver_register(&sa1100_rtc_driver);
480}
481
482static void __exit sa1100_rtc_exit(void)
483{
484 platform_driver_unregister(&sa1100_rtc_driver);
485}
486
487module_init(sa1100_rtc_init);
488module_exit(sa1100_rtc_exit);
489
490MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
491MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)");
492MODULE_LICENSE("GPL");
Kay Sieversad28a072008-04-10 21:29:25 -0700493MODULE_ALIAS("platform:sa1100-rtc");