diff options
author | Sekhar Nori <nsekhar@ti.com> | 2014-06-06 17:36:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-06 19:08:08 -0400 |
commit | cd914bba03d8a2ba30bf7385c5e2da9ac30f574f (patch) | |
tree | 7b73e34438ddd61455a537901881eb4c695e39f2 /drivers/rtc/rtc-omap.c | |
parent | 92adb96aa4fcb460c6b174384cc74418e3d95cda (diff) |
drivers/rtc/rtc-omap.c: add support for enabling 32khz clock
Newer versions of OMAP RTC IP such as those found in AM335x and DRA7x
need an explicit enable of 32khz functional clock which ticks the RTC.
AM335x support was working so far because of settings done in U-Boot.
However, the DRA7x U-Boot does no such enable of 32khz clock and this
patch is need to get the RTC to work on DRA7x at least. In general, it
is better to not depend on settings done in U-Boot.
Thanks to Lokesh Vutla for noticing this.
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-omap.c')
-rw-r--r-- | drivers/rtc/rtc-omap.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 734e40804732..03bce134414c 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
@@ -96,6 +96,9 @@ | |||
96 | #define OMAP_RTC_INTERRUPTS_IT_ALARM BIT(3) | 96 | #define OMAP_RTC_INTERRUPTS_IT_ALARM BIT(3) |
97 | #define OMAP_RTC_INTERRUPTS_IT_TIMER BIT(2) | 97 | #define OMAP_RTC_INTERRUPTS_IT_TIMER BIT(2) |
98 | 98 | ||
99 | /* OMAP_RTC_OSC_REG bit fields: */ | ||
100 | #define OMAP_RTC_OSC_32KCLK_EN BIT(6) | ||
101 | |||
99 | /* OMAP_RTC_IRQWAKEEN bit fields: */ | 102 | /* OMAP_RTC_IRQWAKEEN bit fields: */ |
100 | #define OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN BIT(1) | 103 | #define OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN BIT(1) |
101 | 104 | ||
@@ -111,6 +114,12 @@ | |||
111 | */ | 114 | */ |
112 | #define OMAP_RTC_HAS_IRQWAKEEN BIT(1) | 115 | #define OMAP_RTC_HAS_IRQWAKEEN BIT(1) |
113 | 116 | ||
117 | /* | ||
118 | * Some RTC IP revisions (like those in AM335x and DRA7x) need | ||
119 | * the 32KHz clock to be explicitly enabled. | ||
120 | */ | ||
121 | #define OMAP_RTC_HAS_32KCLK_EN BIT(2) | ||
122 | |||
114 | static void __iomem *rtc_base; | 123 | static void __iomem *rtc_base; |
115 | 124 | ||
116 | #define rtc_read(addr) readb(rtc_base + (addr)) | 125 | #define rtc_read(addr) readb(rtc_base + (addr)) |
@@ -319,7 +328,8 @@ static struct platform_device_id omap_rtc_devtype[] = { | |||
319 | }, | 328 | }, |
320 | [OMAP_RTC_DATA_AM3352_IDX] = { | 329 | [OMAP_RTC_DATA_AM3352_IDX] = { |
321 | .name = "am3352-rtc", | 330 | .name = "am3352-rtc", |
322 | .driver_data = OMAP_RTC_HAS_KICKER | OMAP_RTC_HAS_IRQWAKEEN, | 331 | .driver_data = OMAP_RTC_HAS_KICKER | OMAP_RTC_HAS_IRQWAKEEN | |
332 | OMAP_RTC_HAS_32KCLK_EN, | ||
323 | }, | 333 | }, |
324 | [OMAP_RTC_DATA_DA830_IDX] = { | 334 | [OMAP_RTC_DATA_DA830_IDX] = { |
325 | .name = "da830-rtc", | 335 | .name = "da830-rtc", |
@@ -398,6 +408,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev) | |||
398 | */ | 408 | */ |
399 | rtc_write(0, OMAP_RTC_INTERRUPTS_REG); | 409 | rtc_write(0, OMAP_RTC_INTERRUPTS_REG); |
400 | 410 | ||
411 | /* enable RTC functional clock */ | ||
412 | if (id_entry->driver_data & OMAP_RTC_HAS_32KCLK_EN) | ||
413 | rtc_writel(OMAP_RTC_OSC_32KCLK_EN, OMAP_RTC_OSC_REG); | ||
414 | |||
401 | /* clear old status */ | 415 | /* clear old status */ |
402 | reg = rtc_read(OMAP_RTC_STATUS_REG); | 416 | reg = rtc_read(OMAP_RTC_STATUS_REG); |
403 | if (reg & (u8) OMAP_RTC_STATUS_POWER_UP) { | 417 | if (reg & (u8) OMAP_RTC_STATUS_POWER_UP) { |