aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:34 -0400
commit27c1ee3f929555b71fa39ec0d81a7e7185de1b16 (patch)
tree42e40bdfe4efac660d650658019391536ce67a42 /drivers/rtc
parent37cd9600a9e20359b0283983c9e3a55d84347168 (diff)
parent086ff4b3a7fb9cdf41e6a5d0ccd99b86d84633a1 (diff)
Merge branch 'akpm' (Andrew's patch-bomb)
Merge Andrew's first set of patches: "Non-MM patches: - lots of misc bits - tree-wide have_clk() cleanups - quite a lot of printk tweaks. I draw your attention to "printk: convert the format for KERN_<LEVEL> to a 2 byte pattern" which looks a bit scary. But afaict it's solid. - backlight updates - lib/ feature work (notably the addition and use of memweight()) - checkpatch updates - rtc updates - nilfs updates - fatfs updates (partial, still waiting for acks) - kdump, proc, fork, IPC, sysctl, taskstats, pps, etc - new fault-injection feature work" * Merge emailed patches from Andrew Morton <akpm@linux-foundation.org>: (128 commits) drivers/misc/lkdtm.c: fix missing allocation failure check lib/scatterlist: do not re-write gfp_flags in __sg_alloc_table() fault-injection: add tool to run command with failslab or fail_page_alloc fault-injection: add selftests for cpu and memory hotplug powerpc: pSeries reconfig notifier error injection module memory: memory notifier error injection module PM: PM notifier error injection module cpu: rewrite cpu-notifier-error-inject module fault-injection: notifier error injection c/r: fcntl: add F_GETOWNER_UIDS option resource: make sure requested range is included in the root range include/linux/aio.h: cpp->C conversions fs: cachefiles: add support for large files in filesystem caching pps: return PTR_ERR on error in device_create taskstats: check nla_reserve() return sysctl: suppress kmemleak messages ipc: use Kconfig options for __ARCH_WANT_[COMPAT_]IPC_PARSE_VERSION ipc: compat: use signed size_t types for msgsnd and msgrcv ipc: allow compat IPC version field parsing if !ARCH_WANT_OLD_COMPAT_IPC ipc: add COMPAT_SHMLBA support ...
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/Kconfig1
-rw-r--r--drivers/rtc/rtc-ab8500.c42
-rw-r--r--drivers/rtc/rtc-coh901331.c61
-rw-r--r--drivers/rtc/rtc-da9052.c5
-rw-r--r--drivers/rtc/rtc-mc13xxx.c6
-rw-r--r--drivers/rtc/rtc-pcf8563.c11
-rw-r--r--drivers/rtc/rtc-pl031.c95
-rw-r--r--drivers/rtc/rtc-r9701.c6
-rw-r--r--drivers/rtc/rtc-s3c.c4
9 files changed, 133 insertions, 98 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index f049c02413c..fabc99a75c6 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -704,6 +704,7 @@ config RTC_DRV_AB3100
704config RTC_DRV_AB8500 704config RTC_DRV_AB8500
705 tristate "ST-Ericsson AB8500 RTC" 705 tristate "ST-Ericsson AB8500 RTC"
706 depends on AB8500_CORE 706 depends on AB8500_CORE
707 select RTC_INTF_DEV_UIE_EMUL
707 help 708 help
708 Select this to enable the ST-Ericsson AB8500 power management IC RTC 709 Select this to enable the ST-Ericsson AB8500 power management IC RTC
709 support. This chip contains a battery- and capacitor-backed RTC. 710 support. This chip contains a battery- and capacitor-backed RTC.
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 370889d0489..bf3c2f669c3 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -89,22 +89,17 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm)
89 if (retval < 0) 89 if (retval < 0)
90 return retval; 90 return retval;
91 91
92 /* Early AB8500 chips will not clear the rtc read request bit */ 92 /* Wait for some cycles after enabling the rtc read in ab8500 */
93 if (abx500_get_chip_id(dev) == 0) { 93 while (time_before(jiffies, timeout)) {
94 usleep_range(1000, 1000); 94 retval = abx500_get_register_interruptible(dev,
95 } else { 95 AB8500_RTC, AB8500_RTC_READ_REQ_REG, &value);
96 /* Wait for some cycles after enabling the rtc read in ab8500 */ 96 if (retval < 0)
97 while (time_before(jiffies, timeout)) { 97 return retval;
98 retval = abx500_get_register_interruptible(dev, 98
99 AB8500_RTC, AB8500_RTC_READ_REQ_REG, &value); 99 if (!(value & RTC_READ_REQUEST))
100 if (retval < 0) 100 break;
101 return retval; 101
102 102 usleep_range(1000, 5000);
103 if (!(value & RTC_READ_REQUEST))
104 break;
105
106 usleep_range(1000, 5000);
107 }
108 } 103 }
109 104
110 /* Read the Watchtime registers */ 105 /* Read the Watchtime registers */
@@ -225,7 +220,8 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
225{ 220{
226 int retval, i; 221 int retval, i;
227 unsigned char buf[ARRAY_SIZE(ab8500_rtc_alarm_regs)]; 222 unsigned char buf[ARRAY_SIZE(ab8500_rtc_alarm_regs)];
228 unsigned long mins, secs = 0; 223 unsigned long mins, secs = 0, cursec = 0;
224 struct rtc_time curtm;
229 225
230 if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) { 226 if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) {
231 dev_dbg(dev, "year should be equal to or greater than %d\n", 227 dev_dbg(dev, "year should be equal to or greater than %d\n",
@@ -237,6 +233,18 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
237 rtc_tm_to_time(&alarm->time, &secs); 233 rtc_tm_to_time(&alarm->time, &secs);
238 234
239 /* 235 /*
236 * Check whether alarm is set less than 1min.
237 * Since our RTC doesn't support alarm resolution less than 1min,
238 * return -EINVAL, so UIE EMUL can take it up, incase of UIE_ON
239 */
240 ab8500_rtc_read_time(dev, &curtm); /* Read current time */
241 rtc_tm_to_time(&curtm, &cursec);
242 if ((secs - cursec) < 59) {
243 dev_dbg(dev, "Alarm less than 1 minute not supported\r\n");
244 return -EINVAL;
245 }
246
247 /*
240 * Convert it to the number of seconds since 01-01-2000 00:00:00, since 248 * Convert it to the number of seconds since 01-01-2000 00:00:00, since
241 * we only have a small counter in the RTC. 249 * we only have a small counter in the RTC.
242 */ 250 */
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
index a5b8a0c4ea8..76b2156d3c6 100644
--- a/drivers/rtc/rtc-coh901331.c
+++ b/drivers/rtc/rtc-coh901331.c
@@ -155,13 +155,10 @@ static int __exit coh901331_remove(struct platform_device *pdev)
155 struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); 155 struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev);
156 156
157 if (rtap) { 157 if (rtap) {
158 free_irq(rtap->irq, rtap);
159 rtc_device_unregister(rtap->rtc); 158 rtc_device_unregister(rtap->rtc);
159 clk_unprepare(rtap->clk);
160 clk_put(rtap->clk); 160 clk_put(rtap->clk);
161 iounmap(rtap->virtbase);
162 release_mem_region(rtap->phybase, rtap->physize);
163 platform_set_drvdata(pdev, NULL); 161 platform_set_drvdata(pdev, NULL);
164 kfree(rtap);
165 } 162 }
166 163
167 return 0; 164 return 0;
@@ -174,49 +171,43 @@ static int __init coh901331_probe(struct platform_device *pdev)
174 struct coh901331_port *rtap; 171 struct coh901331_port *rtap;
175 struct resource *res; 172 struct resource *res;
176 173
177 rtap = kzalloc(sizeof(struct coh901331_port), GFP_KERNEL); 174 rtap = devm_kzalloc(&pdev->dev,
175 sizeof(struct coh901331_port), GFP_KERNEL);
178 if (!rtap) 176 if (!rtap)
179 return -ENOMEM; 177 return -ENOMEM;
180 178
181 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 179 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
182 if (!res) { 180 if (!res)
183 ret = -ENOENT; 181 return -ENOENT;
184 goto out_no_resource; 182
185 }
186 rtap->phybase = res->start; 183 rtap->phybase = res->start;
187 rtap->physize = resource_size(res); 184 rtap->physize = resource_size(res);
188 185
189 if (request_mem_region(rtap->phybase, rtap->physize, 186 if (devm_request_mem_region(&pdev->dev, rtap->phybase, rtap->physize,
190 "rtc-coh901331") == NULL) { 187 "rtc-coh901331") == NULL)
191 ret = -EBUSY; 188 return -EBUSY;
192 goto out_no_memregion;
193 }
194 189
195 rtap->virtbase = ioremap(rtap->phybase, rtap->physize); 190 rtap->virtbase = devm_ioremap(&pdev->dev, rtap->phybase, rtap->physize);
196 if (!rtap->virtbase) { 191 if (!rtap->virtbase)
197 ret = -ENOMEM; 192 return -ENOMEM;
198 goto out_no_remap;
199 }
200 193
201 rtap->irq = platform_get_irq(pdev, 0); 194 rtap->irq = platform_get_irq(pdev, 0);
202 if (request_irq(rtap->irq, coh901331_interrupt, 0, 195 if (devm_request_irq(&pdev->dev, rtap->irq, coh901331_interrupt, 0,
203 "RTC COH 901 331 Alarm", rtap)) { 196 "RTC COH 901 331 Alarm", rtap))
204 ret = -EIO; 197 return -EIO;
205 goto out_no_irq;
206 }
207 198
208 rtap->clk = clk_get(&pdev->dev, NULL); 199 rtap->clk = clk_get(&pdev->dev, NULL);
209 if (IS_ERR(rtap->clk)) { 200 if (IS_ERR(rtap->clk)) {
210 ret = PTR_ERR(rtap->clk); 201 ret = PTR_ERR(rtap->clk);
211 dev_err(&pdev->dev, "could not get clock\n"); 202 dev_err(&pdev->dev, "could not get clock\n");
212 goto out_no_clk; 203 return ret;
213 } 204 }
214 205
215 /* We enable/disable the clock only to assure it works */ 206 /* We enable/disable the clock only to assure it works */
216 ret = clk_enable(rtap->clk); 207 ret = clk_prepare_enable(rtap->clk);
217 if (ret) { 208 if (ret) {
218 dev_err(&pdev->dev, "could not enable clock\n"); 209 dev_err(&pdev->dev, "could not enable clock\n");
219 goto out_no_clk_enable; 210 goto out_no_clk_prepenable;
220 } 211 }
221 clk_disable(rtap->clk); 212 clk_disable(rtap->clk);
222 213
@@ -232,18 +223,9 @@ static int __init coh901331_probe(struct platform_device *pdev)
232 223
233 out_no_rtc: 224 out_no_rtc:
234 platform_set_drvdata(pdev, NULL); 225 platform_set_drvdata(pdev, NULL);
235 out_no_clk_enable: 226 clk_unprepare(rtap->clk);
227 out_no_clk_prepenable:
236 clk_put(rtap->clk); 228 clk_put(rtap->clk);
237 out_no_clk:
238 free_irq(rtap->irq, rtap);
239 out_no_irq:
240 iounmap(rtap->virtbase);
241 out_no_remap:
242 platform_set_drvdata(pdev, NULL);
243 out_no_memregion:
244 release_mem_region(rtap->phybase, SZ_4K);
245 out_no_resource:
246 kfree(rtap);
247 return ret; 229 return ret;
248} 230}
249 231
@@ -265,6 +247,7 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state)
265 writel(0, rtap->virtbase + COH901331_IRQ_MASK); 247 writel(0, rtap->virtbase + COH901331_IRQ_MASK);
266 clk_disable(rtap->clk); 248 clk_disable(rtap->clk);
267 } 249 }
250 clk_unprepare(rtap->clk);
268 return 0; 251 return 0;
269} 252}
270 253
@@ -272,6 +255,7 @@ static int coh901331_resume(struct platform_device *pdev)
272{ 255{
273 struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); 256 struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev);
274 257
258 clk_prepare(rtap->clk);
275 if (device_may_wakeup(&pdev->dev)) { 259 if (device_may_wakeup(&pdev->dev)) {
276 disable_irq_wake(rtap->irq); 260 disable_irq_wake(rtap->irq);
277 } else { 261 } else {
@@ -293,6 +277,7 @@ static void coh901331_shutdown(struct platform_device *pdev)
293 clk_enable(rtap->clk); 277 clk_enable(rtap->clk);
294 writel(0, rtap->virtbase + COH901331_IRQ_MASK); 278 writel(0, rtap->virtbase + COH901331_IRQ_MASK);
295 clk_disable(rtap->clk); 279 clk_disable(rtap->clk);
280 clk_unprepare(rtap->clk);
296} 281}
297 282
298static struct platform_driver coh901331_driver = { 283static struct platform_driver coh901331_driver = {
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index da6ab5291a4..78070255bd3 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -245,7 +245,7 @@ static int __devinit da9052_rtc_probe(struct platform_device *pdev)
245 "ALM", rtc); 245 "ALM", rtc);
246 if (ret != 0) { 246 if (ret != 0) {
247 rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); 247 rtc_err(rtc->da9052, "irq registration failed: %d\n", ret);
248 goto err_mem; 248 return ret;
249 } 249 }
250 250
251 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, 251 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
@@ -259,8 +259,6 @@ static int __devinit da9052_rtc_probe(struct platform_device *pdev)
259 259
260err_free_irq: 260err_free_irq:
261 free_irq(rtc->irq, rtc); 261 free_irq(rtc->irq, rtc);
262err_mem:
263 devm_kfree(&pdev->dev, rtc);
264 return ret; 262 return ret;
265} 263}
266 264
@@ -271,7 +269,6 @@ static int __devexit da9052_rtc_remove(struct platform_device *pdev)
271 rtc_device_unregister(rtc->rtc); 269 rtc_device_unregister(rtc->rtc);
272 free_irq(rtc->irq, rtc); 270 free_irq(rtc->irq, rtc);
273 platform_set_drvdata(pdev, NULL); 271 platform_set_drvdata(pdev, NULL);
274 devm_kfree(&pdev->dev, rtc);
275 272
276 return 0; 273 return 0;
277} 274}
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index 546f6850bff..2643d887492 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -404,9 +404,12 @@ static const struct platform_device_id mc13xxx_rtc_idtable[] = {
404 .name = "mc13783-rtc", 404 .name = "mc13783-rtc",
405 }, { 405 }, {
406 .name = "mc13892-rtc", 406 .name = "mc13892-rtc",
407 }, {
408 .name = "mc34708-rtc",
407 }, 409 },
408 { } 410 { /* sentinel */ }
409}; 411};
412MODULE_DEVICE_TABLE(platform, mc13xxx_rtc_idtable);
410 413
411static struct platform_driver mc13xxx_rtc_driver = { 414static struct platform_driver mc13xxx_rtc_driver = {
412 .id_table = mc13xxx_rtc_idtable, 415 .id_table = mc13xxx_rtc_idtable,
@@ -432,4 +435,3 @@ module_exit(mc13xxx_rtc_exit);
432MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); 435MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
433MODULE_DESCRIPTION("RTC driver for Freescale MC13XXX PMIC"); 436MODULE_DESCRIPTION("RTC driver for Freescale MC13XXX PMIC");
434MODULE_LICENSE("GPL v2"); 437MODULE_LICENSE("GPL v2");
435MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 97a3284bb7c..c2fe426a6ef 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -19,6 +19,7 @@
19#include <linux/rtc.h> 19#include <linux/rtc.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/of.h>
22 23
23#define DRV_VERSION "0.4.3" 24#define DRV_VERSION "0.4.3"
24 25
@@ -285,9 +286,19 @@ static const struct i2c_device_id pcf8563_id[] = {
285}; 286};
286MODULE_DEVICE_TABLE(i2c, pcf8563_id); 287MODULE_DEVICE_TABLE(i2c, pcf8563_id);
287 288
289#ifdef CONFIG_OF
290static const struct of_device_id pcf8563_of_match[] __devinitconst = {
291 { .compatible = "nxp,pcf8563" },
292 {}
293};
294MODULE_DEVICE_TABLE(of, pcf8563_of_match);
295#endif
296
288static struct i2c_driver pcf8563_driver = { 297static struct i2c_driver pcf8563_driver = {
289 .driver = { 298 .driver = {
290 .name = "rtc-pcf8563", 299 .name = "rtc-pcf8563",
300 .owner = THIS_MODULE,
301 .of_match_table = of_match_ptr(pcf8563_of_match),
291 }, 302 },
292 .probe = pcf8563_probe, 303 .probe = pcf8563_probe,
293 .remove = pcf8563_remove, 304 .remove = pcf8563_remove,
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index cc0533994f6..08378e3cc21 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -68,11 +68,26 @@
68 68
69#define RTC_TIMER_FREQ 32768 69#define RTC_TIMER_FREQ 32768
70 70
71/**
72 * struct pl031_vendor_data - per-vendor variations
73 * @ops: the vendor-specific operations used on this silicon version
74 * @clockwatch: if this is an ST Microelectronics silicon version with a
75 * clockwatch function
76 * @st_weekday: if this is an ST Microelectronics silicon version that need
77 * the weekday fix
78 * @irqflags: special IRQ flags per variant
79 */
80struct pl031_vendor_data {
81 struct rtc_class_ops ops;
82 bool clockwatch;
83 bool st_weekday;
84 unsigned long irqflags;
85};
86
71struct pl031_local { 87struct pl031_local {
88 struct pl031_vendor_data *vendor;
72 struct rtc_device *rtc; 89 struct rtc_device *rtc;
73 void __iomem *base; 90 void __iomem *base;
74 u8 hw_designer;
75 u8 hw_revision:4;
76}; 91};
77 92
78static int pl031_alarm_irq_enable(struct device *dev, 93static int pl031_alarm_irq_enable(struct device *dev,
@@ -303,7 +318,8 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
303{ 318{
304 int ret; 319 int ret;
305 struct pl031_local *ldata; 320 struct pl031_local *ldata;
306 struct rtc_class_ops *ops = id->data; 321 struct pl031_vendor_data *vendor = id->data;
322 struct rtc_class_ops *ops = &vendor->ops;
307 unsigned long time; 323 unsigned long time;
308 324
309 ret = amba_request_regions(adev, NULL); 325 ret = amba_request_regions(adev, NULL);
@@ -315,6 +331,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
315 ret = -ENOMEM; 331 ret = -ENOMEM;
316 goto out; 332 goto out;
317 } 333 }
334 ldata->vendor = vendor;
318 335
319 ldata->base = ioremap(adev->res.start, resource_size(&adev->res)); 336 ldata->base = ioremap(adev->res.start, resource_size(&adev->res));
320 337
@@ -325,14 +342,11 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
325 342
326 amba_set_drvdata(adev, ldata); 343 amba_set_drvdata(adev, ldata);
327 344
328 ldata->hw_designer = amba_manf(adev); 345 dev_dbg(&adev->dev, "designer ID = 0x%02x\n", amba_manf(adev));
329 ldata->hw_revision = amba_rev(adev); 346 dev_dbg(&adev->dev, "revision = 0x%01x\n", amba_rev(adev));
330
331 dev_dbg(&adev->dev, "designer ID = 0x%02x\n", ldata->hw_designer);
332 dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision);
333 347
334 /* Enable the clockwatch on ST Variants */ 348 /* Enable the clockwatch on ST Variants */
335 if (ldata->hw_designer == AMBA_VENDOR_ST) 349 if (vendor->clockwatch)
336 writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, 350 writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN,
337 ldata->base + RTC_CR); 351 ldata->base + RTC_CR);
338 352
@@ -340,7 +354,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
340 * On ST PL031 variants, the RTC reset value does not provide correct 354 * On ST PL031 variants, the RTC reset value does not provide correct
341 * weekday for 2000-01-01. Correct the erroneous sunday to saturday. 355 * weekday for 2000-01-01. Correct the erroneous sunday to saturday.
342 */ 356 */
343 if (ldata->hw_designer == AMBA_VENDOR_ST) { 357 if (vendor->st_weekday) {
344 if (readl(ldata->base + RTC_YDR) == 0x2000) { 358 if (readl(ldata->base + RTC_YDR) == 0x2000) {
345 time = readl(ldata->base + RTC_DR); 359 time = readl(ldata->base + RTC_DR);
346 if ((time & 360 if ((time &
@@ -361,7 +375,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
361 } 375 }
362 376
363 if (request_irq(adev->irq[0], pl031_interrupt, 377 if (request_irq(adev->irq[0], pl031_interrupt,
364 0, "rtc-pl031", ldata)) { 378 vendor->irqflags, "rtc-pl031", ldata)) {
365 ret = -EIO; 379 ret = -EIO;
366 goto out_no_irq; 380 goto out_no_irq;
367 } 381 }
@@ -383,48 +397,65 @@ err_req:
383} 397}
384 398
385/* Operations for the original ARM version */ 399/* Operations for the original ARM version */
386static struct rtc_class_ops arm_pl031_ops = { 400static struct pl031_vendor_data arm_pl031 = {
387 .read_time = pl031_read_time, 401 .ops = {
388 .set_time = pl031_set_time, 402 .read_time = pl031_read_time,
389 .read_alarm = pl031_read_alarm, 403 .set_time = pl031_set_time,
390 .set_alarm = pl031_set_alarm, 404 .read_alarm = pl031_read_alarm,
391 .alarm_irq_enable = pl031_alarm_irq_enable, 405 .set_alarm = pl031_set_alarm,
406 .alarm_irq_enable = pl031_alarm_irq_enable,
407 },
408 .irqflags = IRQF_NO_SUSPEND,
392}; 409};
393 410
394/* The First ST derivative */ 411/* The First ST derivative */
395static struct rtc_class_ops stv1_pl031_ops = { 412static struct pl031_vendor_data stv1_pl031 = {
396 .read_time = pl031_read_time, 413 .ops = {
397 .set_time = pl031_set_time, 414 .read_time = pl031_read_time,
398 .read_alarm = pl031_read_alarm, 415 .set_time = pl031_set_time,
399 .set_alarm = pl031_set_alarm, 416 .read_alarm = pl031_read_alarm,
400 .alarm_irq_enable = pl031_alarm_irq_enable, 417 .set_alarm = pl031_set_alarm,
418 .alarm_irq_enable = pl031_alarm_irq_enable,
419 },
420 .clockwatch = true,
421 .st_weekday = true,
422 .irqflags = IRQF_NO_SUSPEND,
401}; 423};
402 424
403/* And the second ST derivative */ 425/* And the second ST derivative */
404static struct rtc_class_ops stv2_pl031_ops = { 426static struct pl031_vendor_data stv2_pl031 = {
405 .read_time = pl031_stv2_read_time, 427 .ops = {
406 .set_time = pl031_stv2_set_time, 428 .read_time = pl031_stv2_read_time,
407 .read_alarm = pl031_stv2_read_alarm, 429 .set_time = pl031_stv2_set_time,
408 .set_alarm = pl031_stv2_set_alarm, 430 .read_alarm = pl031_stv2_read_alarm,
409 .alarm_irq_enable = pl031_alarm_irq_enable, 431 .set_alarm = pl031_stv2_set_alarm,
432 .alarm_irq_enable = pl031_alarm_irq_enable,
433 },
434 .clockwatch = true,
435 .st_weekday = true,
436 /*
437 * This variant shares the IRQ with another block and must not
438 * suspend that IRQ line.
439 */
440 .irqflags = IRQF_SHARED | IRQF_NO_SUSPEND,
410}; 441};
411 442
412static struct amba_id pl031_ids[] = { 443static struct amba_id pl031_ids[] = {
413 { 444 {
414 .id = 0x00041031, 445 .id = 0x00041031,
415 .mask = 0x000fffff, 446 .mask = 0x000fffff,
416 .data = &arm_pl031_ops, 447 .data = &arm_pl031,
417 }, 448 },
418 /* ST Micro variants */ 449 /* ST Micro variants */
419 { 450 {
420 .id = 0x00180031, 451 .id = 0x00180031,
421 .mask = 0x00ffffff, 452 .mask = 0x00ffffff,
422 .data = &stv1_pl031_ops, 453 .data = &stv1_pl031,
423 }, 454 },
424 { 455 {
425 .id = 0x00280031, 456 .id = 0x00280031,
426 .mask = 0x00ffffff, 457 .mask = 0x00ffffff,
427 .data = &stv2_pl031_ops, 458 .data = &stv2_pl031,
428 }, 459 },
429 {0, 0}, 460 {0, 0},
430}; 461};
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 33b6ba0afa0..2c183ebff71 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -138,8 +138,7 @@ static int __devinit r9701_probe(struct spi_device *spi)
138 * contain invalid values. If so, try to write a default date: 138 * contain invalid values. If so, try to write a default date:
139 * 2000/1/1 00:00:00 139 * 2000/1/1 00:00:00
140 */ 140 */
141 r9701_get_datetime(&spi->dev, &dt); 141 if (r9701_get_datetime(&spi->dev, &dt)) {
142 if (rtc_valid_tm(&dt)) {
143 dev_info(&spi->dev, "trying to repair invalid date/time\n"); 142 dev_info(&spi->dev, "trying to repair invalid date/time\n");
144 dt.tm_sec = 0; 143 dt.tm_sec = 0;
145 dt.tm_min = 0; 144 dt.tm_min = 0;
@@ -148,7 +147,8 @@ static int __devinit r9701_probe(struct spi_device *spi)
148 dt.tm_mon = 0; 147 dt.tm_mon = 0;
149 dt.tm_year = 100; 148 dt.tm_year = 100;
150 149
151 if (r9701_set_datetime(&spi->dev, &dt)) { 150 if (r9701_set_datetime(&spi->dev, &dt) ||
151 r9701_get_datetime(&spi->dev, &dt)) {
152 dev_err(&spi->dev, "cannot repair RTC register\n"); 152 dev_err(&spi->dev, "cannot repair RTC register\n");
153 return -ENODEV; 153 return -ENODEV;
154 } 154 }
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 7e6af0b22f1..bfbd92c8d1c 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -26,10 +26,10 @@
26#include <linux/log2.h> 26#include <linux/log2.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/uaccess.h>
30#include <linux/io.h>
29 31
30#include <mach/hardware.h> 32#include <mach/hardware.h>
31#include <asm/uaccess.h>
32#include <asm/io.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <plat/regs-rtc.h> 34#include <plat/regs-rtc.h>
35 35