blob: 3128be5e36444ceb6b5a8f2a61d9a76bd7b1a427 [file] [log] [blame]
David Brownelldb68b182006-12-06 20:38:36 -08001/*
Johan Hovold10211ae2014-12-10 15:53:19 -08002 * TI OMAP Real Time Clock interface for Linux
David Brownelldb68b182006-12-06 20:38:36 -08003 *
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
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/ioport.h>
19#include <linux/delay.h>
20#include <linux/rtc.h>
21#include <linux/bcd.h>
22#include <linux/platform_device.h>
Afzal Mohammed9e0344d2012-12-17 16:02:15 -080023#include <linux/of.h>
24#include <linux/of_device.h>
Vaibhav Hiremathfc9bd902012-12-17 16:02:18 -080025#include <linux/pm_runtime.h>
Sachin Kamat4b30c9f2013-07-03 15:06:00 -070026#include <linux/io.h>
David Brownelldb68b182006-12-06 20:38:36 -080027
Johan Hovold10211ae2014-12-10 15:53:19 -080028/*
29 * The OMAP RTC is a year/month/day/hours/minutes/seconds BCD clock
David Brownelldb68b182006-12-06 20:38:36 -080030 * with century-range alarm matching, driven by the 32kHz clock.
31 *
32 * The main user-visible ways it differs from PC RTCs are by omitting
33 * "don't care" alarm fields and sub-second periodic IRQs, and having
34 * an autoadjust mechanism to calibrate to the true oscillator rate.
35 *
36 * Board-specific wiring options include using split power mode with
37 * RTC_OFF_NOFF used as the reset signal (so the RTC won't be reset),
38 * and wiring RTC_WAKE_INT (so the RTC alarm can wake the system from
Sekhar Norifa5b0782010-10-27 15:33:05 -070039 * low power modes) for OMAP1 boards (OMAP-L138 has this built into
40 * the SoC). See the BOARD-SPECIFIC CUSTOMIZATION comment.
David Brownelldb68b182006-12-06 20:38:36 -080041 */
42
David Brownelldb68b182006-12-06 20:38:36 -080043/* RTC registers */
44#define OMAP_RTC_SECONDS_REG 0x00
45#define OMAP_RTC_MINUTES_REG 0x04
46#define OMAP_RTC_HOURS_REG 0x08
47#define OMAP_RTC_DAYS_REG 0x0C
48#define OMAP_RTC_MONTHS_REG 0x10
49#define OMAP_RTC_YEARS_REG 0x14
50#define OMAP_RTC_WEEKS_REG 0x18
51
52#define OMAP_RTC_ALARM_SECONDS_REG 0x20
53#define OMAP_RTC_ALARM_MINUTES_REG 0x24
54#define OMAP_RTC_ALARM_HOURS_REG 0x28
55#define OMAP_RTC_ALARM_DAYS_REG 0x2c
56#define OMAP_RTC_ALARM_MONTHS_REG 0x30
57#define OMAP_RTC_ALARM_YEARS_REG 0x34
58
59#define OMAP_RTC_CTRL_REG 0x40
60#define OMAP_RTC_STATUS_REG 0x44
61#define OMAP_RTC_INTERRUPTS_REG 0x48
62
63#define OMAP_RTC_COMP_LSB_REG 0x4c
64#define OMAP_RTC_COMP_MSB_REG 0x50
65#define OMAP_RTC_OSC_REG 0x54
66
Afzal Mohammedcab14582012-12-17 16:02:11 -080067#define OMAP_RTC_KICK0_REG 0x6c
68#define OMAP_RTC_KICK1_REG 0x70
69
Hebbar Gururaja8af750e2013-09-11 14:24:18 -070070#define OMAP_RTC_IRQWAKEEN 0x7c
71
Johan Hovold222a12f2014-12-10 15:53:13 -080072#define OMAP_RTC_ALARM2_SECONDS_REG 0x80
73#define OMAP_RTC_ALARM2_MINUTES_REG 0x84
74#define OMAP_RTC_ALARM2_HOURS_REG 0x88
75#define OMAP_RTC_ALARM2_DAYS_REG 0x8c
76#define OMAP_RTC_ALARM2_MONTHS_REG 0x90
77#define OMAP_RTC_ALARM2_YEARS_REG 0x94
78
79#define OMAP_RTC_PMIC_REG 0x98
80
David Brownelldb68b182006-12-06 20:38:36 -080081/* OMAP_RTC_CTRL_REG bit fields: */
Sekhar Nori92adb962014-06-06 14:36:05 -070082#define OMAP_RTC_CTRL_SPLIT BIT(7)
83#define OMAP_RTC_CTRL_DISABLE BIT(6)
84#define OMAP_RTC_CTRL_SET_32_COUNTER BIT(5)
85#define OMAP_RTC_CTRL_TEST BIT(4)
86#define OMAP_RTC_CTRL_MODE_12_24 BIT(3)
87#define OMAP_RTC_CTRL_AUTO_COMP BIT(2)
88#define OMAP_RTC_CTRL_ROUND_30S BIT(1)
89#define OMAP_RTC_CTRL_STOP BIT(0)
David Brownelldb68b182006-12-06 20:38:36 -080090
91/* OMAP_RTC_STATUS_REG bit fields: */
Sekhar Nori92adb962014-06-06 14:36:05 -070092#define OMAP_RTC_STATUS_POWER_UP BIT(7)
Johan Hovold222a12f2014-12-10 15:53:13 -080093#define OMAP_RTC_STATUS_ALARM2 BIT(7)
Sekhar Nori92adb962014-06-06 14:36:05 -070094#define OMAP_RTC_STATUS_ALARM BIT(6)
95#define OMAP_RTC_STATUS_1D_EVENT BIT(5)
96#define OMAP_RTC_STATUS_1H_EVENT BIT(4)
97#define OMAP_RTC_STATUS_1M_EVENT BIT(3)
98#define OMAP_RTC_STATUS_1S_EVENT BIT(2)
99#define OMAP_RTC_STATUS_RUN BIT(1)
100#define OMAP_RTC_STATUS_BUSY BIT(0)
David Brownelldb68b182006-12-06 20:38:36 -0800101
102/* OMAP_RTC_INTERRUPTS_REG bit fields: */
Johan Hovold222a12f2014-12-10 15:53:13 -0800103#define OMAP_RTC_INTERRUPTS_IT_ALARM2 BIT(4)
Sekhar Nori92adb962014-06-06 14:36:05 -0700104#define OMAP_RTC_INTERRUPTS_IT_ALARM BIT(3)
105#define OMAP_RTC_INTERRUPTS_IT_TIMER BIT(2)
David Brownelldb68b182006-12-06 20:38:36 -0800106
Sekhar Noricd914bb2014-06-06 14:36:06 -0700107/* OMAP_RTC_OSC_REG bit fields: */
108#define OMAP_RTC_OSC_32KCLK_EN BIT(6)
109
Hebbar Gururaja8af750e2013-09-11 14:24:18 -0700110/* OMAP_RTC_IRQWAKEEN bit fields: */
Sekhar Nori92adb962014-06-06 14:36:05 -0700111#define OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN BIT(1)
Hebbar Gururaja8af750e2013-09-11 14:24:18 -0700112
Johan Hovold222a12f2014-12-10 15:53:13 -0800113/* OMAP_RTC_PMIC bit fields: */
114#define OMAP_RTC_PMIC_POWER_EN_EN BIT(16)
115
Afzal Mohammedcab14582012-12-17 16:02:11 -0800116/* OMAP_RTC_KICKER values */
117#define KICK0_VALUE 0x83e70b13
118#define KICK1_VALUE 0x95a4f1e0
119
Johan Hovold2153f942014-12-10 15:53:01 -0800120struct omap_rtc_device_type {
121 bool has_32kclk_en;
122 bool has_kicker;
123 bool has_irqwakeen;
Johan Hovold222a12f2014-12-10 15:53:13 -0800124 bool has_pmic_mode;
Johan Hovold9291e342014-12-10 15:53:04 -0800125 bool has_power_up_reset;
Johan Hovold2153f942014-12-10 15:53:01 -0800126};
Sekhar Noricd914bb2014-06-06 14:36:06 -0700127
Johan Hovold55ba9532014-12-10 15:52:55 -0800128struct omap_rtc {
129 struct rtc_device *rtc;
130 void __iomem *base;
131 int irq_alarm;
132 int irq_timer;
133 u8 interrupts_reg;
Johan Hovold222a12f2014-12-10 15:53:13 -0800134 bool is_pmic_controller;
Johan Hovold2153f942014-12-10 15:53:01 -0800135 const struct omap_rtc_device_type *type;
Johan Hovold55ba9532014-12-10 15:52:55 -0800136};
David Brownelldb68b182006-12-06 20:38:36 -0800137
Johan Hovold55ba9532014-12-10 15:52:55 -0800138static inline u8 rtc_read(struct omap_rtc *rtc, unsigned int reg)
139{
140 return readb(rtc->base + reg);
141}
Afzal Mohammedcab14582012-12-17 16:02:11 -0800142
Johan Hovoldc253a892014-12-10 15:53:10 -0800143static inline u32 rtc_readl(struct omap_rtc *rtc, unsigned int reg)
144{
145 return readl(rtc->base + reg);
146}
147
Johan Hovold55ba9532014-12-10 15:52:55 -0800148static inline void rtc_write(struct omap_rtc *rtc, unsigned int reg, u8 val)
149{
150 writeb(val, rtc->base + reg);
151}
David Brownelldb68b182006-12-06 20:38:36 -0800152
Johan Hovold55ba9532014-12-10 15:52:55 -0800153static inline void rtc_writel(struct omap_rtc *rtc, unsigned int reg, u32 val)
154{
155 writel(val, rtc->base + reg);
156}
David Brownelldb68b182006-12-06 20:38:36 -0800157
Johan Hovold10211ae2014-12-10 15:53:19 -0800158/*
159 * We rely on the rtc framework to handle locking (rtc->ops_lock),
David Brownelldb68b182006-12-06 20:38:36 -0800160 * so the only other requirement is that register accesses which
161 * require BUSY to be clear are made with IRQs locally disabled
162 */
Johan Hovold55ba9532014-12-10 15:52:55 -0800163static void rtc_wait_not_busy(struct omap_rtc *rtc)
David Brownelldb68b182006-12-06 20:38:36 -0800164{
Johan Hovold10211ae2014-12-10 15:53:19 -0800165 int count;
166 u8 status;
David Brownelldb68b182006-12-06 20:38:36 -0800167
168 /* BUSY may stay active for 1/32768 second (~30 usec) */
169 for (count = 0; count < 50; count++) {
Johan Hovold55ba9532014-12-10 15:52:55 -0800170 status = rtc_read(rtc, OMAP_RTC_STATUS_REG);
Johan Hovold10211ae2014-12-10 15:53:19 -0800171 if (!(status & OMAP_RTC_STATUS_BUSY))
David Brownelldb68b182006-12-06 20:38:36 -0800172 break;
173 udelay(1);
174 }
175 /* now we have ~15 usec to read/write various registers */
176}
177
Johan Hovold55ba9532014-12-10 15:52:55 -0800178static irqreturn_t rtc_irq(int irq, void *dev_id)
David Brownelldb68b182006-12-06 20:38:36 -0800179{
Johan Hovold10211ae2014-12-10 15:53:19 -0800180 struct omap_rtc *rtc = dev_id;
181 unsigned long events = 0;
182 u8 irq_data;
David Brownelldb68b182006-12-06 20:38:36 -0800183
Johan Hovold55ba9532014-12-10 15:52:55 -0800184 irq_data = rtc_read(rtc, OMAP_RTC_STATUS_REG);
David Brownelldb68b182006-12-06 20:38:36 -0800185
186 /* alarm irq? */
187 if (irq_data & OMAP_RTC_STATUS_ALARM) {
Johan Hovold55ba9532014-12-10 15:52:55 -0800188 rtc_write(rtc, OMAP_RTC_STATUS_REG, OMAP_RTC_STATUS_ALARM);
David Brownelldb68b182006-12-06 20:38:36 -0800189 events |= RTC_IRQF | RTC_AF;
190 }
191
192 /* 1/sec periodic/update irq? */
193 if (irq_data & OMAP_RTC_STATUS_1S_EVENT)
194 events |= RTC_IRQF | RTC_UF;
195
Johan Hovold55ba9532014-12-10 15:52:55 -0800196 rtc_update_irq(rtc->rtc, 1, events);
David Brownelldb68b182006-12-06 20:38:36 -0800197
198 return IRQ_HANDLED;
199}
200
John Stultz16380c12011-02-02 17:02:41 -0800201static int omap_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
202{
Johan Hovold55ba9532014-12-10 15:52:55 -0800203 struct omap_rtc *rtc = dev_get_drvdata(dev);
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700204 u8 reg, irqwake_reg = 0;
John Stultz16380c12011-02-02 17:02:41 -0800205
206 local_irq_disable();
Johan Hovold55ba9532014-12-10 15:52:55 -0800207 rtc_wait_not_busy(rtc);
208 reg = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
Johan Hovold2153f942014-12-10 15:53:01 -0800209 if (rtc->type->has_irqwakeen)
Johan Hovold55ba9532014-12-10 15:52:55 -0800210 irqwake_reg = rtc_read(rtc, OMAP_RTC_IRQWAKEEN);
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700211
212 if (enabled) {
John Stultz16380c12011-02-02 17:02:41 -0800213 reg |= OMAP_RTC_INTERRUPTS_IT_ALARM;
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700214 irqwake_reg |= OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN;
215 } else {
John Stultz16380c12011-02-02 17:02:41 -0800216 reg &= ~OMAP_RTC_INTERRUPTS_IT_ALARM;
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700217 irqwake_reg &= ~OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN;
218 }
Johan Hovold55ba9532014-12-10 15:52:55 -0800219 rtc_wait_not_busy(rtc);
220 rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, reg);
Johan Hovold2153f942014-12-10 15:53:01 -0800221 if (rtc->type->has_irqwakeen)
Johan Hovold55ba9532014-12-10 15:52:55 -0800222 rtc_write(rtc, OMAP_RTC_IRQWAKEEN, irqwake_reg);
John Stultz16380c12011-02-02 17:02:41 -0800223 local_irq_enable();
224
225 return 0;
226}
227
David Brownelldb68b182006-12-06 20:38:36 -0800228/* this hardware doesn't support "don't care" alarm fields */
229static int tm2bcd(struct rtc_time *tm)
230{
231 if (rtc_valid_tm(tm) != 0)
232 return -EINVAL;
233
Adrian Bunkfe20ba72008-10-18 20:28:41 -0700234 tm->tm_sec = bin2bcd(tm->tm_sec);
235 tm->tm_min = bin2bcd(tm->tm_min);
236 tm->tm_hour = bin2bcd(tm->tm_hour);
237 tm->tm_mday = bin2bcd(tm->tm_mday);
David Brownelldb68b182006-12-06 20:38:36 -0800238
Adrian Bunkfe20ba72008-10-18 20:28:41 -0700239 tm->tm_mon = bin2bcd(tm->tm_mon + 1);
David Brownelldb68b182006-12-06 20:38:36 -0800240
241 /* epoch == 1900 */
242 if (tm->tm_year < 100 || tm->tm_year > 199)
243 return -EINVAL;
Adrian Bunkfe20ba72008-10-18 20:28:41 -0700244 tm->tm_year = bin2bcd(tm->tm_year - 100);
David Brownelldb68b182006-12-06 20:38:36 -0800245
246 return 0;
247}
248
249static void bcd2tm(struct rtc_time *tm)
250{
Adrian Bunkfe20ba72008-10-18 20:28:41 -0700251 tm->tm_sec = bcd2bin(tm->tm_sec);
252 tm->tm_min = bcd2bin(tm->tm_min);
253 tm->tm_hour = bcd2bin(tm->tm_hour);
254 tm->tm_mday = bcd2bin(tm->tm_mday);
255 tm->tm_mon = bcd2bin(tm->tm_mon) - 1;
David Brownelldb68b182006-12-06 20:38:36 -0800256 /* epoch == 1900 */
Adrian Bunkfe20ba72008-10-18 20:28:41 -0700257 tm->tm_year = bcd2bin(tm->tm_year) + 100;
David Brownelldb68b182006-12-06 20:38:36 -0800258}
259
Johan Hovoldcbbe3262014-12-10 15:53:07 -0800260static void omap_rtc_read_time_raw(struct omap_rtc *rtc, struct rtc_time *tm)
261{
262 tm->tm_sec = rtc_read(rtc, OMAP_RTC_SECONDS_REG);
263 tm->tm_min = rtc_read(rtc, OMAP_RTC_MINUTES_REG);
264 tm->tm_hour = rtc_read(rtc, OMAP_RTC_HOURS_REG);
265 tm->tm_mday = rtc_read(rtc, OMAP_RTC_DAYS_REG);
266 tm->tm_mon = rtc_read(rtc, OMAP_RTC_MONTHS_REG);
267 tm->tm_year = rtc_read(rtc, OMAP_RTC_YEARS_REG);
268}
David Brownelldb68b182006-12-06 20:38:36 -0800269
270static int omap_rtc_read_time(struct device *dev, struct rtc_time *tm)
271{
Johan Hovold55ba9532014-12-10 15:52:55 -0800272 struct omap_rtc *rtc = dev_get_drvdata(dev);
273
David Brownelldb68b182006-12-06 20:38:36 -0800274 /* we don't report wday/yday/isdst ... */
275 local_irq_disable();
Johan Hovold55ba9532014-12-10 15:52:55 -0800276 rtc_wait_not_busy(rtc);
Johan Hovoldcbbe3262014-12-10 15:53:07 -0800277 omap_rtc_read_time_raw(rtc, tm);
David Brownelldb68b182006-12-06 20:38:36 -0800278 local_irq_enable();
279
280 bcd2tm(tm);
Johan Hovold10211ae2014-12-10 15:53:19 -0800281
David Brownelldb68b182006-12-06 20:38:36 -0800282 return 0;
283}
284
285static int omap_rtc_set_time(struct device *dev, struct rtc_time *tm)
286{
Johan Hovold55ba9532014-12-10 15:52:55 -0800287 struct omap_rtc *rtc = dev_get_drvdata(dev);
288
David Brownelldb68b182006-12-06 20:38:36 -0800289 if (tm2bcd(tm) < 0)
290 return -EINVAL;
Johan Hovold10211ae2014-12-10 15:53:19 -0800291
David Brownelldb68b182006-12-06 20:38:36 -0800292 local_irq_disable();
Johan Hovold55ba9532014-12-10 15:52:55 -0800293 rtc_wait_not_busy(rtc);
David Brownelldb68b182006-12-06 20:38:36 -0800294
Johan Hovold55ba9532014-12-10 15:52:55 -0800295 rtc_write(rtc, OMAP_RTC_YEARS_REG, tm->tm_year);
296 rtc_write(rtc, OMAP_RTC_MONTHS_REG, tm->tm_mon);
297 rtc_write(rtc, OMAP_RTC_DAYS_REG, tm->tm_mday);
298 rtc_write(rtc, OMAP_RTC_HOURS_REG, tm->tm_hour);
299 rtc_write(rtc, OMAP_RTC_MINUTES_REG, tm->tm_min);
300 rtc_write(rtc, OMAP_RTC_SECONDS_REG, tm->tm_sec);
David Brownelldb68b182006-12-06 20:38:36 -0800301
302 local_irq_enable();
303
304 return 0;
305}
306
307static int omap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
308{
Johan Hovold55ba9532014-12-10 15:52:55 -0800309 struct omap_rtc *rtc = dev_get_drvdata(dev);
Johan Hovold10211ae2014-12-10 15:53:19 -0800310 u8 interrupts;
David Brownelldb68b182006-12-06 20:38:36 -0800311
Johan Hovold55ba9532014-12-10 15:52:55 -0800312 local_irq_disable();
313 rtc_wait_not_busy(rtc);
314
315 alm->time.tm_sec = rtc_read(rtc, OMAP_RTC_ALARM_SECONDS_REG);
316 alm->time.tm_min = rtc_read(rtc, OMAP_RTC_ALARM_MINUTES_REG);
317 alm->time.tm_hour = rtc_read(rtc, OMAP_RTC_ALARM_HOURS_REG);
318 alm->time.tm_mday = rtc_read(rtc, OMAP_RTC_ALARM_DAYS_REG);
319 alm->time.tm_mon = rtc_read(rtc, OMAP_RTC_ALARM_MONTHS_REG);
320 alm->time.tm_year = rtc_read(rtc, OMAP_RTC_ALARM_YEARS_REG);
David Brownelldb68b182006-12-06 20:38:36 -0800321
322 local_irq_enable();
323
324 bcd2tm(&alm->time);
Johan Hovold10211ae2014-12-10 15:53:19 -0800325
326 interrupts = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
327 alm->enabled = !!(interrupts & OMAP_RTC_INTERRUPTS_IT_ALARM);
David Brownelldb68b182006-12-06 20:38:36 -0800328
329 return 0;
330}
331
332static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
333{
Johan Hovold55ba9532014-12-10 15:52:55 -0800334 struct omap_rtc *rtc = dev_get_drvdata(dev);
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700335 u8 reg, irqwake_reg = 0;
David Brownelldb68b182006-12-06 20:38:36 -0800336
David Brownelldb68b182006-12-06 20:38:36 -0800337 if (tm2bcd(&alm->time) < 0)
338 return -EINVAL;
339
340 local_irq_disable();
Johan Hovold55ba9532014-12-10 15:52:55 -0800341 rtc_wait_not_busy(rtc);
David Brownelldb68b182006-12-06 20:38:36 -0800342
Johan Hovold55ba9532014-12-10 15:52:55 -0800343 rtc_write(rtc, OMAP_RTC_ALARM_YEARS_REG, alm->time.tm_year);
344 rtc_write(rtc, OMAP_RTC_ALARM_MONTHS_REG, alm->time.tm_mon);
345 rtc_write(rtc, OMAP_RTC_ALARM_DAYS_REG, alm->time.tm_mday);
346 rtc_write(rtc, OMAP_RTC_ALARM_HOURS_REG, alm->time.tm_hour);
347 rtc_write(rtc, OMAP_RTC_ALARM_MINUTES_REG, alm->time.tm_min);
348 rtc_write(rtc, OMAP_RTC_ALARM_SECONDS_REG, alm->time.tm_sec);
David Brownelldb68b182006-12-06 20:38:36 -0800349
Johan Hovold55ba9532014-12-10 15:52:55 -0800350 reg = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
Johan Hovold2153f942014-12-10 15:53:01 -0800351 if (rtc->type->has_irqwakeen)
Johan Hovold55ba9532014-12-10 15:52:55 -0800352 irqwake_reg = rtc_read(rtc, OMAP_RTC_IRQWAKEEN);
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700353
354 if (alm->enabled) {
David Brownelldb68b182006-12-06 20:38:36 -0800355 reg |= OMAP_RTC_INTERRUPTS_IT_ALARM;
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700356 irqwake_reg |= OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN;
357 } else {
David Brownelldb68b182006-12-06 20:38:36 -0800358 reg &= ~OMAP_RTC_INTERRUPTS_IT_ALARM;
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700359 irqwake_reg &= ~OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN;
360 }
Johan Hovold55ba9532014-12-10 15:52:55 -0800361 rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, reg);
Johan Hovold2153f942014-12-10 15:53:01 -0800362 if (rtc->type->has_irqwakeen)
Johan Hovold55ba9532014-12-10 15:52:55 -0800363 rtc_write(rtc, OMAP_RTC_IRQWAKEEN, irqwake_reg);
David Brownelldb68b182006-12-06 20:38:36 -0800364
365 local_irq_enable();
366
367 return 0;
368}
369
Johan Hovold222a12f2014-12-10 15:53:13 -0800370static struct omap_rtc *omap_rtc_power_off_rtc;
371
372/*
373 * omap_rtc_poweroff: RTC-controlled power off
374 *
375 * The RTC can be used to control an external PMIC via the pmic_power_en pin,
376 * which can be configured to transition to OFF on ALARM2 events.
377 *
378 * Notes:
379 * The two-second alarm offset is the shortest offset possible as the alarm
380 * registers must be set before the next timer update and the offset
381 * calculation is too heavy for everything to be done within a single access
382 * period (~15 us).
383 *
384 * Called with local interrupts disabled.
385 */
386static void omap_rtc_power_off(void)
387{
388 struct omap_rtc *rtc = omap_rtc_power_off_rtc;
389 struct rtc_time tm;
390 unsigned long now;
391 u32 val;
392
393 /* enable pmic_power_en control */
394 val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
395 rtc_writel(rtc, OMAP_RTC_PMIC_REG, val | OMAP_RTC_PMIC_POWER_EN_EN);
396
397 /* set alarm two seconds from now */
398 omap_rtc_read_time_raw(rtc, &tm);
399 bcd2tm(&tm);
400 rtc_tm_to_time(&tm, &now);
401 rtc_time_to_tm(now + 2, &tm);
402
403 if (tm2bcd(&tm) < 0) {
404 dev_err(&rtc->rtc->dev, "power off failed\n");
405 return;
406 }
407
408 rtc_wait_not_busy(rtc);
409
410 rtc_write(rtc, OMAP_RTC_ALARM2_SECONDS_REG, tm.tm_sec);
411 rtc_write(rtc, OMAP_RTC_ALARM2_MINUTES_REG, tm.tm_min);
412 rtc_write(rtc, OMAP_RTC_ALARM2_HOURS_REG, tm.tm_hour);
413 rtc_write(rtc, OMAP_RTC_ALARM2_DAYS_REG, tm.tm_mday);
414 rtc_write(rtc, OMAP_RTC_ALARM2_MONTHS_REG, tm.tm_mon);
415 rtc_write(rtc, OMAP_RTC_ALARM2_YEARS_REG, tm.tm_year);
416
417 /*
418 * enable ALARM2 interrupt
419 *
420 * NOTE: this fails on AM3352 if rtc_write (writeb) is used
421 */
422 val = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
423 rtc_writel(rtc, OMAP_RTC_INTERRUPTS_REG,
424 val | OMAP_RTC_INTERRUPTS_IT_ALARM2);
425
426 /*
427 * Wait for alarm to trigger (within two seconds) and external PMIC to
428 * power off the system. Add a 500 ms margin for external latencies
429 * (e.g. debounce circuits).
430 */
431 mdelay(2500);
432}
433
David Brownelldb68b182006-12-06 20:38:36 -0800434static struct rtc_class_ops omap_rtc_ops = {
David Brownelldb68b182006-12-06 20:38:36 -0800435 .read_time = omap_rtc_read_time,
436 .set_time = omap_rtc_set_time,
437 .read_alarm = omap_rtc_read_alarm,
438 .set_alarm = omap_rtc_set_alarm,
John Stultz16380c12011-02-02 17:02:41 -0800439 .alarm_irq_enable = omap_rtc_alarm_irq_enable,
David Brownelldb68b182006-12-06 20:38:36 -0800440};
441
Johan Hovold2153f942014-12-10 15:53:01 -0800442static const struct omap_rtc_device_type omap_rtc_default_type = {
Johan Hovold9291e342014-12-10 15:53:04 -0800443 .has_power_up_reset = true,
Johan Hovold2153f942014-12-10 15:53:01 -0800444};
Afzal Mohammed9e0344d2012-12-17 16:02:15 -0800445
Johan Hovold2153f942014-12-10 15:53:01 -0800446static const struct omap_rtc_device_type omap_rtc_am3352_type = {
447 .has_32kclk_en = true,
448 .has_kicker = true,
449 .has_irqwakeen = true,
Johan Hovold222a12f2014-12-10 15:53:13 -0800450 .has_pmic_mode = true,
Johan Hovold2153f942014-12-10 15:53:01 -0800451};
452
453static const struct omap_rtc_device_type omap_rtc_da830_type = {
454 .has_kicker = true,
455};
456
457static const struct platform_device_id omap_rtc_id_table[] = {
Afzal Mohammedcab14582012-12-17 16:02:11 -0800458 {
Johan Hovolda430ca22014-12-10 15:52:58 -0800459 .name = "omap_rtc",
Johan Hovold2153f942014-12-10 15:53:01 -0800460 .driver_data = (kernel_ulong_t)&omap_rtc_default_type,
461 }, {
Hebbar Gururaja8af750e2013-09-11 14:24:18 -0700462 .name = "am3352-rtc",
Johan Hovold2153f942014-12-10 15:53:01 -0800463 .driver_data = (kernel_ulong_t)&omap_rtc_am3352_type,
464 }, {
Afzal Mohammedcab14582012-12-17 16:02:11 -0800465 .name = "da830-rtc",
Johan Hovold2153f942014-12-10 15:53:01 -0800466 .driver_data = (kernel_ulong_t)&omap_rtc_da830_type,
467 }, {
468 /* sentinel */
469 }
Afzal Mohammedcab14582012-12-17 16:02:11 -0800470};
Johan Hovold2153f942014-12-10 15:53:01 -0800471MODULE_DEVICE_TABLE(platform, omap_rtc_id_table);
Afzal Mohammedcab14582012-12-17 16:02:11 -0800472
Afzal Mohammed9e0344d2012-12-17 16:02:15 -0800473static const struct of_device_id omap_rtc_of_match[] = {
Johan Hovold2153f942014-12-10 15:53:01 -0800474 {
475 .compatible = "ti,am3352-rtc",
476 .data = &omap_rtc_am3352_type,
477 }, {
478 .compatible = "ti,da830-rtc",
479 .data = &omap_rtc_da830_type,
480 }, {
481 /* sentinel */
482 }
Afzal Mohammed9e0344d2012-12-17 16:02:15 -0800483};
484MODULE_DEVICE_TABLE(of, omap_rtc_of_match);
485
David Brownell71fc8222008-07-23 21:30:38 -0700486static int __init omap_rtc_probe(struct platform_device *pdev)
David Brownelldb68b182006-12-06 20:38:36 -0800487{
Johan Hovold10211ae2014-12-10 15:53:19 -0800488 struct omap_rtc *rtc;
489 struct resource *res;
490 u8 reg, mask, new_ctrl;
Afzal Mohammedcab14582012-12-17 16:02:11 -0800491 const struct platform_device_id *id_entry;
Afzal Mohammed9e0344d2012-12-17 16:02:15 -0800492 const struct of_device_id *of_id;
Johan Hovold437b37a2014-12-10 15:52:40 -0800493 int ret;
Afzal Mohammed9e0344d2012-12-17 16:02:15 -0800494
Johan Hovold55ba9532014-12-10 15:52:55 -0800495 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
496 if (!rtc)
497 return -ENOMEM;
498
Afzal Mohammed9e0344d2012-12-17 16:02:15 -0800499 of_id = of_match_device(omap_rtc_of_match, &pdev->dev);
Johan Hovold2153f942014-12-10 15:53:01 -0800500 if (of_id) {
501 rtc->type = of_id->data;
Johan Hovold222a12f2014-12-10 15:53:13 -0800502 rtc->is_pmic_controller = rtc->type->has_pmic_mode &&
503 of_property_read_bool(pdev->dev.of_node,
504 "ti,system-power-controller");
Johan Hovold2153f942014-12-10 15:53:01 -0800505 } else {
506 id_entry = platform_get_device_id(pdev);
507 rtc->type = (void *)id_entry->driver_data;
Sekhar Nori337b6002014-06-06 14:36:04 -0700508 }
509
Johan Hovold55ba9532014-12-10 15:52:55 -0800510 rtc->irq_timer = platform_get_irq(pdev, 0);
511 if (rtc->irq_timer <= 0)
David Brownelldb68b182006-12-06 20:38:36 -0800512 return -ENOENT;
David Brownelldb68b182006-12-06 20:38:36 -0800513
Johan Hovold55ba9532014-12-10 15:52:55 -0800514 rtc->irq_alarm = platform_get_irq(pdev, 1);
515 if (rtc->irq_alarm <= 0)
David Brownelldb68b182006-12-06 20:38:36 -0800516 return -ENOENT;
David Brownelldb68b182006-12-06 20:38:36 -0800517
David Brownelldb68b182006-12-06 20:38:36 -0800518 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Johan Hovold55ba9532014-12-10 15:52:55 -0800519 rtc->base = devm_ioremap_resource(&pdev->dev, res);
520 if (IS_ERR(rtc->base))
521 return PTR_ERR(rtc->base);
522
523 platform_set_drvdata(pdev, rtc);
Mark A. Greer8cfde8c2009-12-15 16:46:11 -0800524
Vaibhav Hiremathfc9bd902012-12-17 16:02:18 -0800525 /* Enable the clock/module so that we can access the registers */
526 pm_runtime_enable(&pdev->dev);
527 pm_runtime_get_sync(&pdev->dev);
528
Johan Hovold2153f942014-12-10 15:53:01 -0800529 if (rtc->type->has_kicker) {
Johan Hovold55ba9532014-12-10 15:52:55 -0800530 rtc_writel(rtc, OMAP_RTC_KICK0_REG, KICK0_VALUE);
531 rtc_writel(rtc, OMAP_RTC_KICK1_REG, KICK1_VALUE);
Afzal Mohammedcab14582012-12-17 16:02:11 -0800532 }
533
Johan Hovold1ed8b5d2014-12-10 15:52:36 -0800534 /*
535 * disable interrupts
536 *
537 * NOTE: ALARM2 is not cleared on AM3352 if rtc_write (writeb) is used
David Brownelldb68b182006-12-06 20:38:36 -0800538 */
Johan Hovold55ba9532014-12-10 15:52:55 -0800539 rtc_writel(rtc, OMAP_RTC_INTERRUPTS_REG, 0);
David Brownelldb68b182006-12-06 20:38:36 -0800540
Sekhar Noricd914bb2014-06-06 14:36:06 -0700541 /* enable RTC functional clock */
Johan Hovold2153f942014-12-10 15:53:01 -0800542 if (rtc->type->has_32kclk_en) {
Johan Hovold55ba9532014-12-10 15:52:55 -0800543 reg = rtc_read(rtc, OMAP_RTC_OSC_REG);
544 rtc_writel(rtc, OMAP_RTC_OSC_REG,
545 reg | OMAP_RTC_OSC_32KCLK_EN);
Johan Hovold44c63a52014-12-10 15:52:30 -0800546 }
Sekhar Noricd914bb2014-06-06 14:36:06 -0700547
David Brownelldb68b182006-12-06 20:38:36 -0800548 /* clear old status */
Johan Hovold55ba9532014-12-10 15:52:55 -0800549 reg = rtc_read(rtc, OMAP_RTC_STATUS_REG);
Johan Hovold9291e342014-12-10 15:53:04 -0800550
551 mask = OMAP_RTC_STATUS_ALARM;
552
Johan Hovold222a12f2014-12-10 15:53:13 -0800553 if (rtc->type->has_pmic_mode)
554 mask |= OMAP_RTC_STATUS_ALARM2;
555
Johan Hovold9291e342014-12-10 15:53:04 -0800556 if (rtc->type->has_power_up_reset) {
557 mask |= OMAP_RTC_STATUS_POWER_UP;
558 if (reg & OMAP_RTC_STATUS_POWER_UP)
559 dev_info(&pdev->dev, "RTC power up reset detected\n");
David Brownelldb68b182006-12-06 20:38:36 -0800560 }
Johan Hovold9291e342014-12-10 15:53:04 -0800561
562 if (reg & mask)
563 rtc_write(rtc, OMAP_RTC_STATUS_REG, reg & mask);
David Brownelldb68b182006-12-06 20:38:36 -0800564
David Brownelldb68b182006-12-06 20:38:36 -0800565 /* On boards with split power, RTC_ON_NOFF won't reset the RTC */
Johan Hovold55ba9532014-12-10 15:52:55 -0800566 reg = rtc_read(rtc, OMAP_RTC_CTRL_REG);
Johan Hovold10211ae2014-12-10 15:53:19 -0800567 if (reg & OMAP_RTC_CTRL_STOP)
Johan Hovold397b6302014-12-10 15:52:49 -0800568 dev_info(&pdev->dev, "already running\n");
David Brownelldb68b182006-12-06 20:38:36 -0800569
570 /* force to 24 hour mode */
Johan Hovold10211ae2014-12-10 15:53:19 -0800571 new_ctrl = reg & (OMAP_RTC_CTRL_SPLIT | OMAP_RTC_CTRL_AUTO_COMP);
David Brownelldb68b182006-12-06 20:38:36 -0800572 new_ctrl |= OMAP_RTC_CTRL_STOP;
573
Johan Hovold10211ae2014-12-10 15:53:19 -0800574 /*
575 * BOARD-SPECIFIC CUSTOMIZATION CAN GO HERE:
David Brownelldb68b182006-12-06 20:38:36 -0800576 *
Sekhar Norifa5b0782010-10-27 15:33:05 -0700577 * - Device wake-up capability setting should come through chip
578 * init logic. OMAP1 boards should initialize the "wakeup capable"
579 * flag in the platform device if the board is wired right for
580 * being woken up by RTC alarm. For OMAP-L138, this capability
581 * is built into the SoC by the "Deep Sleep" capability.
David Brownelldb68b182006-12-06 20:38:36 -0800582 *
583 * - Boards wired so RTC_ON_nOFF is used as the reset signal,
584 * rather than nPWRON_RESET, should forcibly enable split
585 * power mode. (Some chip errata report that RTC_CTRL_SPLIT
586 * is write-only, and always reads as zero...)
587 */
David Brownelldb68b182006-12-06 20:38:36 -0800588
Johan Hovold10211ae2014-12-10 15:53:19 -0800589 if (new_ctrl & OMAP_RTC_CTRL_SPLIT)
Johan Hovold397b6302014-12-10 15:52:49 -0800590 dev_info(&pdev->dev, "split power mode\n");
David Brownelldb68b182006-12-06 20:38:36 -0800591
592 if (reg != new_ctrl)
Johan Hovold55ba9532014-12-10 15:52:55 -0800593 rtc_write(rtc, OMAP_RTC_CTRL_REG, new_ctrl);
David Brownelldb68b182006-12-06 20:38:36 -0800594
Johan Hovold4390ce02014-12-10 15:52:43 -0800595 device_init_wakeup(&pdev->dev, true);
596
Johan Hovold55ba9532014-12-10 15:52:55 -0800597 rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
Johan Hovold4390ce02014-12-10 15:52:43 -0800598 &omap_rtc_ops, THIS_MODULE);
Johan Hovold55ba9532014-12-10 15:52:55 -0800599 if (IS_ERR(rtc->rtc)) {
600 ret = PTR_ERR(rtc->rtc);
Johan Hovold4390ce02014-12-10 15:52:43 -0800601 goto err;
602 }
Johan Hovold4390ce02014-12-10 15:52:43 -0800603
604 /* handle periodic and alarm irqs */
Johan Hovold55ba9532014-12-10 15:52:55 -0800605 ret = devm_request_irq(&pdev->dev, rtc->irq_timer, rtc_irq, 0,
606 dev_name(&rtc->rtc->dev), rtc);
Johan Hovold4390ce02014-12-10 15:52:43 -0800607 if (ret)
608 goto err;
609
Johan Hovold55ba9532014-12-10 15:52:55 -0800610 if (rtc->irq_timer != rtc->irq_alarm) {
611 ret = devm_request_irq(&pdev->dev, rtc->irq_alarm, rtc_irq, 0,
612 dev_name(&rtc->rtc->dev), rtc);
Johan Hovold4390ce02014-12-10 15:52:43 -0800613 if (ret)
614 goto err;
615 }
616
Johan Hovold222a12f2014-12-10 15:53:13 -0800617 if (rtc->is_pmic_controller) {
618 if (!pm_power_off) {
619 omap_rtc_power_off_rtc = rtc;
620 pm_power_off = omap_rtc_power_off;
621 }
622 }
623
David Brownelldb68b182006-12-06 20:38:36 -0800624 return 0;
625
Johan Hovold437b37a2014-12-10 15:52:40 -0800626err:
Johan Hovold7ecd9a32014-12-10 15:52:33 -0800627 device_init_wakeup(&pdev->dev, false);
Johan Hovold2153f942014-12-10 15:53:01 -0800628 if (rtc->type->has_kicker)
Johan Hovold55ba9532014-12-10 15:52:55 -0800629 rtc_writel(rtc, OMAP_RTC_KICK0_REG, 0);
Vaibhav Hiremathfc9bd902012-12-17 16:02:18 -0800630 pm_runtime_put_sync(&pdev->dev);
631 pm_runtime_disable(&pdev->dev);
Johan Hovold437b37a2014-12-10 15:52:40 -0800632
633 return ret;
David Brownelldb68b182006-12-06 20:38:36 -0800634}
635
David Brownell71fc8222008-07-23 21:30:38 -0700636static int __exit omap_rtc_remove(struct platform_device *pdev)
David Brownelldb68b182006-12-06 20:38:36 -0800637{
Johan Hovold55ba9532014-12-10 15:52:55 -0800638 struct omap_rtc *rtc = platform_get_drvdata(pdev);
David Brownelldb68b182006-12-06 20:38:36 -0800639
Johan Hovold222a12f2014-12-10 15:53:13 -0800640 if (pm_power_off == omap_rtc_power_off &&
641 omap_rtc_power_off_rtc == rtc) {
642 pm_power_off = NULL;
643 omap_rtc_power_off_rtc = NULL;
644 }
645
David Brownelldb68b182006-12-06 20:38:36 -0800646 device_init_wakeup(&pdev->dev, 0);
647
648 /* leave rtc running, but disable irqs */
Johan Hovold55ba9532014-12-10 15:52:55 -0800649 rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, 0);
David Brownelldb68b182006-12-06 20:38:36 -0800650
Johan Hovold2153f942014-12-10 15:53:01 -0800651 if (rtc->type->has_kicker)
Johan Hovold55ba9532014-12-10 15:52:55 -0800652 rtc_writel(rtc, OMAP_RTC_KICK0_REG, 0);
Vaibhav Hiremathfc9bd902012-12-17 16:02:18 -0800653
654 /* Disable the clock/module */
655 pm_runtime_put_sync(&pdev->dev);
656 pm_runtime_disable(&pdev->dev);
657
David Brownelldb68b182006-12-06 20:38:36 -0800658 return 0;
659}
660
Jingoo Han04ebc352013-04-29 16:21:01 -0700661#ifdef CONFIG_PM_SLEEP
Jingoo Han04ebc352013-04-29 16:21:01 -0700662static int omap_rtc_suspend(struct device *dev)
David Brownelldb68b182006-12-06 20:38:36 -0800663{
Johan Hovold55ba9532014-12-10 15:52:55 -0800664 struct omap_rtc *rtc = dev_get_drvdata(dev);
665
666 rtc->interrupts_reg = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
David Brownelldb68b182006-12-06 20:38:36 -0800667
Johan Hovold10211ae2014-12-10 15:53:19 -0800668 /*
669 * FIXME: the RTC alarm is not currently acting as a wakeup event
Hebbar Gururaja8af750e2013-09-11 14:24:18 -0700670 * source on some platforms, and in fact this enable() call is just
671 * saving a flag that's never used...
David Brownelldb68b182006-12-06 20:38:36 -0800672 */
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700673 if (device_may_wakeup(dev))
Johan Hovold55ba9532014-12-10 15:52:55 -0800674 enable_irq_wake(rtc->irq_alarm);
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700675 else
Johan Hovold55ba9532014-12-10 15:52:55 -0800676 rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, 0);
David Brownelldb68b182006-12-06 20:38:36 -0800677
Vaibhav Hiremathfc9bd902012-12-17 16:02:18 -0800678 /* Disable the clock/module */
Jingoo Han04ebc352013-04-29 16:21:01 -0700679 pm_runtime_put_sync(dev);
Vaibhav Hiremathfc9bd902012-12-17 16:02:18 -0800680
David Brownelldb68b182006-12-06 20:38:36 -0800681 return 0;
682}
683
Jingoo Han04ebc352013-04-29 16:21:01 -0700684static int omap_rtc_resume(struct device *dev)
David Brownelldb68b182006-12-06 20:38:36 -0800685{
Johan Hovold55ba9532014-12-10 15:52:55 -0800686 struct omap_rtc *rtc = dev_get_drvdata(dev);
687
Vaibhav Hiremathfc9bd902012-12-17 16:02:18 -0800688 /* Enable the clock/module so that we can access the registers */
Jingoo Han04ebc352013-04-29 16:21:01 -0700689 pm_runtime_get_sync(dev);
Vaibhav Hiremathfc9bd902012-12-17 16:02:18 -0800690
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700691 if (device_may_wakeup(dev))
Johan Hovold55ba9532014-12-10 15:52:55 -0800692 disable_irq_wake(rtc->irq_alarm);
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700693 else
Johan Hovold55ba9532014-12-10 15:52:55 -0800694 rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, rtc->interrupts_reg);
Lokesh Vutlaab7f5802014-06-06 14:36:12 -0700695
David Brownelldb68b182006-12-06 20:38:36 -0800696 return 0;
697}
David Brownelldb68b182006-12-06 20:38:36 -0800698#endif
699
Jingoo Han04ebc352013-04-29 16:21:01 -0700700static SIMPLE_DEV_PM_OPS(omap_rtc_pm_ops, omap_rtc_suspend, omap_rtc_resume);
701
David Brownelldb68b182006-12-06 20:38:36 -0800702static void omap_rtc_shutdown(struct platform_device *pdev)
703{
Johan Hovold55ba9532014-12-10 15:52:55 -0800704 struct omap_rtc *rtc = platform_get_drvdata(pdev);
Johan Hovold8ad5c722014-12-10 15:53:16 -0800705 u8 mask;
Johan Hovold55ba9532014-12-10 15:52:55 -0800706
Johan Hovold8ad5c722014-12-10 15:53:16 -0800707 /*
708 * Keep the ALARM interrupt enabled to allow the system to power up on
709 * alarm events.
710 */
711 mask = rtc_read(rtc, OMAP_RTC_INTERRUPTS_REG);
712 mask &= OMAP_RTC_INTERRUPTS_IT_ALARM;
713 rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, mask);
David Brownelldb68b182006-12-06 20:38:36 -0800714}
715
David Brownelldb68b182006-12-06 20:38:36 -0800716static struct platform_driver omap_rtc_driver = {
David Brownell71fc8222008-07-23 21:30:38 -0700717 .remove = __exit_p(omap_rtc_remove),
David Brownelldb68b182006-12-06 20:38:36 -0800718 .shutdown = omap_rtc_shutdown,
719 .driver = {
Johan Hovolda430ca22014-12-10 15:52:58 -0800720 .name = "omap_rtc",
David Brownelldb68b182006-12-06 20:38:36 -0800721 .owner = THIS_MODULE,
Jingoo Han04ebc352013-04-29 16:21:01 -0700722 .pm = &omap_rtc_pm_ops,
Sachin Kamat616b7342013-11-12 15:10:55 -0800723 .of_match_table = omap_rtc_of_match,
David Brownelldb68b182006-12-06 20:38:36 -0800724 },
Johan Hovold2153f942014-12-10 15:53:01 -0800725 .id_table = omap_rtc_id_table,
David Brownelldb68b182006-12-06 20:38:36 -0800726};
727
Jingoo Han09c5a362013-04-29 16:18:46 -0700728module_platform_driver_probe(omap_rtc_driver, omap_rtc_probe);
David Brownelldb68b182006-12-06 20:38:36 -0800729
Johan Hovolda430ca22014-12-10 15:52:58 -0800730MODULE_ALIAS("platform:omap_rtc");
David Brownelldb68b182006-12-06 20:38:36 -0800731MODULE_AUTHOR("George G. Davis (and others)");
732MODULE_LICENSE("GPL");