rtc-omap.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. /*
  2. * TI OMAP1 Real Time Clock interface for Linux
  3. *
  4. * Copyright (C) 2003 MontaVista Software, Inc.
  5. * Author: George G. Davis <gdavis@mvista.com> or <source@mvista.com>
  6. *
  7. * Copyright (C) 2006 David Brownell (new RTC framework)
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/module.h>
  17. #include <linux/ioport.h>
  18. #include <linux/delay.h>
  19. #include <linux/rtc.h>
  20. #include <linux/bcd.h>
  21. #include <linux/platform_device.h>
  22. #include <asm/io.h>
  23. #include <asm/mach/time.h>
  24. /* The OMAP1 RTC is a year/month/day/hours/minutes/seconds BCD clock
  25. * with century-range alarm matching, driven by the 32kHz clock.
  26. *
  27. * The main user-visible ways it differs from PC RTCs are by omitting
  28. * "don't care" alarm fields and sub-second periodic IRQs, and having
  29. * an autoadjust mechanism to calibrate to the true oscillator rate.
  30. *
  31. * Board-specific wiring options include using split power mode with
  32. * RTC_OFF_NOFF used as the reset signal (so the RTC won't be reset),
  33. * and wiring RTC_WAKE_INT (so the RTC alarm can wake the system from
  34. * low power modes). See the BOARD-SPECIFIC CUSTOMIZATION comment.
  35. */
  36. #define OMAP_RTC_BASE 0xfffb4800
  37. /* RTC registers */
  38. #define OMAP_RTC_SECONDS_REG 0x00
  39. #define OMAP_RTC_MINUTES_REG 0x04
  40. #define OMAP_RTC_HOURS_REG 0x08
  41. #define OMAP_RTC_DAYS_REG 0x0C
  42. #define OMAP_RTC_MONTHS_REG 0x10
  43. #define OMAP_RTC_YEARS_REG 0x14
  44. #define OMAP_RTC_WEEKS_REG 0x18
  45. #define OMAP_RTC_ALARM_SECONDS_REG 0x20
  46. #define OMAP_RTC_ALARM_MINUTES_REG 0x24
  47. #define OMAP_RTC_ALARM_HOURS_REG 0x28
  48. #define OMAP_RTC_ALARM_DAYS_REG 0x2c
  49. #define OMAP_RTC_ALARM_MONTHS_REG 0x30
  50. #define OMAP_RTC_ALARM_YEARS_REG 0x34
  51. #define OMAP_RTC_CTRL_REG 0x40
  52. #define OMAP_RTC_STATUS_REG 0x44
  53. #define OMAP_RTC_INTERRUPTS_REG 0x48
  54. #define OMAP_RTC_COMP_LSB_REG 0x4c
  55. #define OMAP_RTC_COMP_MSB_REG 0x50
  56. #define OMAP_RTC_OSC_REG 0x54
  57. /* OMAP_RTC_CTRL_REG bit fields: */
  58. #define OMAP_RTC_CTRL_SPLIT (1<<7)
  59. #define OMAP_RTC_CTRL_DISABLE (1<<6)
  60. #define OMAP_RTC_CTRL_SET_32_COUNTER (1<<5)
  61. #define OMAP_RTC_CTRL_TEST (1<<4)
  62. #define OMAP_RTC_CTRL_MODE_12_24 (1<<3)
  63. #define OMAP_RTC_CTRL_AUTO_COMP (1<<2)
  64. #define OMAP_RTC_CTRL_ROUND_30S (1<<1)
  65. #define OMAP_RTC_CTRL_STOP (1<<0)
  66. /* OMAP_RTC_STATUS_REG bit fields: */
  67. #define OMAP_RTC_STATUS_POWER_UP (1<<7)
  68. #define OMAP_RTC_STATUS_ALARM (1<<6)
  69. #define OMAP_RTC_STATUS_1D_EVENT (1<<5)
  70. #define OMAP_RTC_STATUS_1H_EVENT (1<<4)
  71. #define OMAP_RTC_STATUS_1M_EVENT (1<<3)
  72. #define OMAP_RTC_STATUS_1S_EVENT (1<<2)
  73. #define OMAP_RTC_STATUS_RUN (1<<1)
  74. #define OMAP_RTC_STATUS_BUSY (1<<0)
  75. /* OMAP_RTC_INTERRUPTS_REG bit fields: */
  76. #define OMAP_RTC_INTERRUPTS_IT_ALARM (1<<3)
  77. #define OMAP_RTC_INTERRUPTS_IT_TIMER (1<<2)
  78. #define rtc_read(addr) omap_readb(OMAP_RTC_BASE + (addr))
  79. #define rtc_write(val, addr) omap_writeb(val, OMAP_RTC_BASE + (addr))
  80. /* platform_bus isn't hotpluggable, so for static linkage it'd be safe
  81. * to get rid of probe() and remove() code ... too bad the driver struct
  82. * remembers probe(), that's about 25% of the runtime footprint!!
  83. */
  84. #ifndef MODULE
  85. #undef __devexit
  86. #undef __devexit_p
  87. #define __devexit __exit
  88. #define __devexit_p __exit_p
  89. #endif
  90. /* we rely on the rtc framework to handle locking (rtc->ops_lock),
  91. * so the only other requirement is that register accesses which
  92. * require BUSY to be clear are made with IRQs locally disabled
  93. */
  94. static void rtc_wait_not_busy(void)
  95. {
  96. int count = 0;
  97. u8 status;
  98. /* BUSY may stay active for 1/32768 second (~30 usec) */
  99. for (count = 0; count < 50; count++) {
  100. status = rtc_read(OMAP_RTC_STATUS_REG);
  101. if ((status & (u8)OMAP_RTC_STATUS_BUSY) == 0)
  102. break;
  103. udelay(1);
  104. }
  105. /* now we have ~15 usec to read/write various registers */
  106. }
  107. static irqreturn_t rtc_irq(int irq, void *class_dev)
  108. {
  109. unsigned long events = 0;
  110. u8 irq_data;
  111. irq_data = rtc_read(OMAP_RTC_STATUS_REG);
  112. /* alarm irq? */
  113. if (irq_data & OMAP_RTC_STATUS_ALARM) {
  114. rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG);
  115. events |= RTC_IRQF | RTC_AF;
  116. }
  117. /* 1/sec periodic/update irq? */
  118. if (irq_data & OMAP_RTC_STATUS_1S_EVENT)
  119. events |= RTC_IRQF | RTC_UF;
  120. rtc_update_irq(class_dev, 1, events);
  121. return IRQ_HANDLED;
  122. }
  123. #ifdef CONFIG_RTC_INTF_DEV
  124. static int
  125. omap_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
  126. {
  127. u8 reg;
  128. switch (cmd) {
  129. case RTC_AIE_OFF:
  130. case RTC_AIE_ON:
  131. case RTC_UIE_OFF:
  132. case RTC_UIE_ON:
  133. break;
  134. default:
  135. return -ENOIOCTLCMD;
  136. }
  137. local_irq_disable();
  138. rtc_wait_not_busy();
  139. reg = rtc_read(OMAP_RTC_INTERRUPTS_REG);
  140. switch (cmd) {
  141. /* AIE = Alarm Interrupt Enable */
  142. case RTC_AIE_OFF:
  143. reg &= ~OMAP_RTC_INTERRUPTS_IT_ALARM;
  144. break;
  145. case RTC_AIE_ON:
  146. reg |= OMAP_RTC_INTERRUPTS_IT_ALARM;
  147. break;
  148. /* UIE = Update Interrupt Enable (1/second) */
  149. case RTC_UIE_OFF:
  150. reg &= ~OMAP_RTC_INTERRUPTS_IT_TIMER;
  151. break;
  152. case RTC_UIE_ON:
  153. reg |= OMAP_RTC_INTERRUPTS_IT_TIMER;
  154. break;
  155. }
  156. rtc_wait_not_busy();
  157. rtc_write(reg, OMAP_RTC_INTERRUPTS_REG);
  158. local_irq_enable();
  159. return 0;
  160. }
  161. #else
  162. #define omap_rtc_ioctl NULL
  163. #endif
  164. /* this hardware doesn't support "don't care" alarm fields */
  165. static int tm2bcd(struct rtc_time *tm)
  166. {
  167. if (rtc_valid_tm(tm) != 0)
  168. return -EINVAL;
  169. tm->tm_sec = BIN2BCD(tm->tm_sec);
  170. tm->tm_min = BIN2BCD(tm->tm_min);
  171. tm->tm_hour = BIN2BCD(tm->tm_hour);
  172. tm->tm_mday = BIN2BCD(tm->tm_mday);
  173. tm->tm_mon = BIN2BCD(tm->tm_mon + 1);
  174. /* epoch == 1900 */
  175. if (tm->tm_year < 100 || tm->tm_year > 199)
  176. return -EINVAL;
  177. tm->tm_year = BIN2BCD(tm->tm_year - 100);
  178. return 0;
  179. }
  180. static void bcd2tm(struct rtc_time *tm)
  181. {
  182. tm->tm_sec = BCD2BIN(tm->tm_sec);
  183. tm->tm_min = BCD2BIN(tm->tm_min);
  184. tm->tm_hour = BCD2BIN(tm->tm_hour);
  185. tm->tm_mday = BCD2BIN(tm->tm_mday);
  186. tm->tm_mon = BCD2BIN(tm->tm_mon) - 1;
  187. /* epoch == 1900 */
  188. tm->tm_year = BCD2BIN(tm->tm_year) + 100;
  189. }
  190. static int omap_rtc_read_time(struct device *dev, struct rtc_time *tm)
  191. {
  192. /* we don't report wday/yday/isdst ... */
  193. local_irq_disable();
  194. rtc_wait_not_busy();
  195. tm->tm_sec = rtc_read(OMAP_RTC_SECONDS_REG);
  196. tm->tm_min = rtc_read(OMAP_RTC_MINUTES_REG);
  197. tm->tm_hour = rtc_read(OMAP_RTC_HOURS_REG);
  198. tm->tm_mday = rtc_read(OMAP_RTC_DAYS_REG);
  199. tm->tm_mon = rtc_read(OMAP_RTC_MONTHS_REG);
  200. tm->tm_year = rtc_read(OMAP_RTC_YEARS_REG);
  201. local_irq_enable();
  202. bcd2tm(tm);
  203. return 0;
  204. }
  205. static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm)
  206. {
  207. if (tm2bcd(tm) < 0)
  208. return -EINVAL;
  209. local_irq_disable();
  210. rtc_wait_not_busy();
  211. rtc_write(tm->tm_year, OMAP_RTC_YEARS_REG);
  212. rtc_write(tm->tm_mon, OMAP_RTC_MONTHS_REG);
  213. rtc_write(tm->tm_mday, OMAP_RTC_DAYS_REG);
  214. rtc_write(tm->tm_hour, OMAP_RTC_HOURS_REG);
  215. rtc_write(tm->tm_min, OMAP_RTC_MINUTES_REG);
  216. rtc_write(tm->tm_sec, OMAP_RTC_SECONDS_REG);
  217. local_irq_enable();
  218. return 0;
  219. }
  220. static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
  221. {
  222. local_irq_disable();
  223. rtc_wait_not_busy();
  224. alm->time.tm_sec = rtc_read(OMAP_RTC_ALARM_SECONDS_REG);
  225. alm->time.tm_min = rtc_read(OMAP_RTC_ALARM_MINUTES_REG);
  226. alm->time.tm_hour = rtc_read(OMAP_RTC_ALARM_HOURS_REG);
  227. alm->time.tm_mday = rtc_read(OMAP_RTC_ALARM_DAYS_REG);
  228. alm->time.tm_mon = rtc_read(OMAP_RTC_ALARM_MONTHS_REG);
  229. alm->time.tm_year = rtc_read(OMAP_RTC_ALARM_YEARS_REG);
  230. local_irq_enable();
  231. bcd2tm(&alm->time);
  232. alm->pending = !!(rtc_read(OMAP_RTC_INTERRUPTS_REG)
  233. & OMAP_RTC_INTERRUPTS_IT_ALARM);
  234. alm->enabled = alm->pending && device_may_wakeup(dev);
  235. return 0;
  236. }
  237. static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
  238. {
  239. u8 reg;
  240. /* Much userspace code uses RTC_ALM_SET, thus "don't care" for
  241. * day/month/year specifies alarms up to 24 hours in the future.
  242. * So we need to handle that ... but let's ignore the "don't care"
  243. * values for hours/minutes/seconds.
  244. */
  245. if (alm->time.tm_mday <= 0
  246. && alm->time.tm_mon < 0
  247. && alm->time.tm_year < 0) {
  248. struct rtc_time tm;
  249. unsigned long now, then;
  250. omap_rtc_read_time(dev, &tm);
  251. rtc_tm_to_time(&tm, &now);
  252. alm->time.tm_mday = tm.tm_mday;
  253. alm->time.tm_mon = tm.tm_mon;
  254. alm->time.tm_year = tm.tm_year;
  255. rtc_tm_to_time(&alm->time, &then);
  256. /* sometimes the alarm wraps into tomorrow */
  257. if (then < now) {
  258. rtc_time_to_tm(now + 24 * 60 * 60, &tm);
  259. alm->time.tm_mday = tm.tm_mday;
  260. alm->time.tm_mon = tm.tm_mon;
  261. alm->time.tm_year = tm.tm_year;
  262. }
  263. }
  264. if (tm2bcd(&alm->time) < 0)
  265. return -EINVAL;
  266. local_irq_disable();
  267. rtc_wait_not_busy();
  268. rtc_write(alm->time.tm_year, OMAP_RTC_ALARM_YEARS_REG);
  269. rtc_write(alm->time.tm_mon, OMAP_RTC_ALARM_MONTHS_REG);
  270. rtc_write(alm->time.tm_mday, OMAP_RTC_ALARM_DAYS_REG);
  271. rtc_write(alm->time.tm_hour, OMAP_RTC_ALARM_HOURS_REG);
  272. rtc_write(alm->time.tm_min, OMAP_RTC_ALARM_MINUTES_REG);
  273. rtc_write(alm->time.tm_sec, OMAP_RTC_ALARM_SECONDS_REG);
  274. reg = rtc_read(OMAP_RTC_INTERRUPTS_REG);
  275. if (alm->enabled)
  276. reg |= OMAP_RTC_INTERRUPTS_IT_ALARM;
  277. else
  278. reg &= ~OMAP_RTC_INTERRUPTS_IT_ALARM;
  279. rtc_write(reg, OMAP_RTC_INTERRUPTS_REG);
  280. local_irq_enable();
  281. return 0;
  282. }
  283. static struct rtc_class_ops omap_rtc_ops = {
  284. .ioctl = omap_rtc_ioctl,
  285. .read_time = omap_rtc_read_time,
  286. .set_time = omap_rtc_set_time,
  287. .read_alarm = omap_rtc_read_alarm,
  288. .set_alarm = omap_rtc_set_alarm,
  289. };
  290. static int omap_rtc_alarm;
  291. static int omap_rtc_timer;
  292. static int __devinit omap_rtc_probe(struct platform_device *pdev)
  293. {
  294. struct resource *res, *mem;
  295. struct rtc_device *rtc;
  296. u8 reg, new_ctrl;
  297. omap_rtc_timer = platform_get_irq(pdev, 0);
  298. if (omap_rtc_timer <= 0) {
  299. pr_debug("%s: no update irq?\n", pdev->name);
  300. return -ENOENT;
  301. }
  302. omap_rtc_alarm = platform_get_irq(pdev, 1);
  303. if (omap_rtc_alarm <= 0) {
  304. pr_debug("%s: no alarm irq?\n", pdev->name);
  305. return -ENOENT;
  306. }
  307. /* NOTE: using static mapping for RTC registers */
  308. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  309. if (res && res->start != OMAP_RTC_BASE) {
  310. pr_debug("%s: RTC registers at %08x, expected %08x\n",
  311. pdev->name, (unsigned) res->start, OMAP_RTC_BASE);
  312. return -ENOENT;
  313. }
  314. if (res)
  315. mem = request_mem_region(res->start,
  316. res->end - res->start + 1,
  317. pdev->name);
  318. else
  319. mem = NULL;
  320. if (!mem) {
  321. pr_debug("%s: RTC registers at %08x are not free\n",
  322. pdev->name, OMAP_RTC_BASE);
  323. return -EBUSY;
  324. }
  325. rtc = rtc_device_register(pdev->name, &pdev->dev,
  326. &omap_rtc_ops, THIS_MODULE);
  327. if (IS_ERR(rtc)) {
  328. pr_debug("%s: can't register RTC device, err %ld\n",
  329. pdev->name, PTR_ERR(rtc));
  330. goto fail;
  331. }
  332. platform_set_drvdata(pdev, rtc);
  333. class_set_devdata(&rtc->class_dev, mem);
  334. /* clear pending irqs, and set 1/second periodic,
  335. * which we'll use instead of update irqs
  336. */
  337. rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
  338. /* clear old status */
  339. reg = rtc_read(OMAP_RTC_STATUS_REG);
  340. if (reg & (u8) OMAP_RTC_STATUS_POWER_UP) {
  341. pr_info("%s: RTC power up reset detected\n",
  342. pdev->name);
  343. rtc_write(OMAP_RTC_STATUS_POWER_UP, OMAP_RTC_STATUS_REG);
  344. }
  345. if (reg & (u8) OMAP_RTC_STATUS_ALARM)
  346. rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG);
  347. /* handle periodic and alarm irqs */
  348. if (request_irq(omap_rtc_timer, rtc_irq, SA_INTERRUPT,
  349. rtc->class_dev.class_id, &rtc->class_dev)) {
  350. pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n",
  351. pdev->name, omap_rtc_timer);
  352. goto fail0;
  353. }
  354. if (request_irq(omap_rtc_alarm, rtc_irq, SA_INTERRUPT,
  355. rtc->class_dev.class_id, &rtc->class_dev)) {
  356. pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n",
  357. pdev->name, omap_rtc_alarm);
  358. goto fail1;
  359. }
  360. /* On boards with split power, RTC_ON_NOFF won't reset the RTC */
  361. reg = rtc_read(OMAP_RTC_CTRL_REG);
  362. if (reg & (u8) OMAP_RTC_CTRL_STOP)
  363. pr_info("%s: already running\n", pdev->name);
  364. /* force to 24 hour mode */
  365. new_ctrl = reg & ~(OMAP_RTC_CTRL_SPLIT|OMAP_RTC_CTRL_AUTO_COMP);
  366. new_ctrl |= OMAP_RTC_CTRL_STOP;
  367. /* BOARD-SPECIFIC CUSTOMIZATION CAN GO HERE:
  368. *
  369. * - Boards wired so that RTC_WAKE_INT does something, and muxed
  370. * right (W13_1610_RTC_WAKE_INT is the default after chip reset),
  371. * should initialize the device wakeup flag appropriately.
  372. *
  373. * - Boards wired so RTC_ON_nOFF is used as the reset signal,
  374. * rather than nPWRON_RESET, should forcibly enable split
  375. * power mode. (Some chip errata report that RTC_CTRL_SPLIT
  376. * is write-only, and always reads as zero...)
  377. */
  378. device_init_wakeup(&pdev->dev, 0);
  379. if (new_ctrl & (u8) OMAP_RTC_CTRL_SPLIT)
  380. pr_info("%s: split power mode\n", pdev->name);
  381. if (reg != new_ctrl)
  382. rtc_write(new_ctrl, OMAP_RTC_CTRL_REG);
  383. return 0;
  384. fail1:
  385. free_irq(omap_rtc_timer, NULL);
  386. fail0:
  387. rtc_device_unregister(rtc);
  388. fail:
  389. release_resource(mem);
  390. return -EIO;
  391. }
  392. static int __devexit omap_rtc_remove(struct platform_device *pdev)
  393. {
  394. struct rtc_device *rtc = platform_get_drvdata(pdev);;
  395. device_init_wakeup(&pdev->dev, 0);
  396. /* leave rtc running, but disable irqs */
  397. rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
  398. free_irq(omap_rtc_timer, rtc);
  399. free_irq(omap_rtc_alarm, rtc);
  400. release_resource(class_get_devdata(&rtc->class_dev));
  401. rtc_device_unregister(rtc);
  402. return 0;
  403. }
  404. #ifdef CONFIG_PM
  405. static struct timespec rtc_delta;
  406. static u8 irqstat;
  407. static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
  408. {
  409. struct rtc_time rtc_tm;
  410. struct timespec time;
  411. time.tv_nsec = 0;
  412. omap_rtc_read_time(NULL, &rtc_tm);
  413. rtc_tm_to_time(&rtc_tm, &time.tv_sec);
  414. save_time_delta(&rtc_delta, &time);
  415. irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG);
  416. /* FIXME the RTC alarm is not currently acting as a wakeup event
  417. * source, and in fact this enable() call is just saving a flag
  418. * that's never used...
  419. */
  420. if (device_may_wakeup(&pdev->dev))
  421. enable_irq_wake(omap_rtc_alarm);
  422. else
  423. rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
  424. return 0;
  425. }
  426. static int omap_rtc_resume(struct platform_device *pdev)
  427. {
  428. struct rtc_time rtc_tm;
  429. struct timespec time;
  430. time.tv_nsec = 0;
  431. omap_rtc_read_time(NULL, &rtc_tm);
  432. rtc_tm_to_time(&rtc_tm, &time.tv_sec);
  433. restore_time_delta(&rtc_delta, &time);
  434. if (device_may_wakeup(&pdev->dev))
  435. disable_irq_wake(omap_rtc_alarm);
  436. else
  437. rtc_write(irqstat, OMAP_RTC_INTERRUPTS_REG);
  438. return 0;
  439. }
  440. #else
  441. #define omap_rtc_suspend NULL
  442. #define omap_rtc_resume NULL
  443. #endif
  444. static void omap_rtc_shutdown(struct platform_device *pdev)
  445. {
  446. rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
  447. }
  448. MODULE_ALIAS("omap_rtc");
  449. static struct platform_driver omap_rtc_driver = {
  450. .probe = omap_rtc_probe,
  451. .remove = __devexit_p(omap_rtc_remove),
  452. .suspend = omap_rtc_suspend,
  453. .resume = omap_rtc_resume,
  454. .shutdown = omap_rtc_shutdown,
  455. .driver = {
  456. .name = "omap_rtc",
  457. .owner = THIS_MODULE,
  458. },
  459. };
  460. static int __init rtc_init(void)
  461. {
  462. return platform_driver_register(&omap_rtc_driver);
  463. }
  464. module_init(rtc_init);
  465. static void __exit rtc_exit(void)
  466. {
  467. platform_driver_unregister(&omap_rtc_driver);
  468. }
  469. module_exit(rtc_exit);
  470. MODULE_AUTHOR("George G. Davis (and others)");
  471. MODULE_LICENSE("GPL");