aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-pl031.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index 575fbbf966db..e66afb816d61 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -71,17 +71,21 @@
71/** 71/**
72 * struct pl031_vendor_data - per-vendor variations 72 * struct pl031_vendor_data - per-vendor variations
73 * @ops: the vendor-specific operations used on this silicon version 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
74 */ 78 */
75struct pl031_vendor_data { 79struct pl031_vendor_data {
76 struct rtc_class_ops ops; 80 struct rtc_class_ops ops;
81 bool clockwatch;
82 bool st_weekday;
77}; 83};
78 84
79struct pl031_local { 85struct pl031_local {
80 struct pl031_vendor_data *vendor; 86 struct pl031_vendor_data *vendor;
81 struct rtc_device *rtc; 87 struct rtc_device *rtc;
82 void __iomem *base; 88 void __iomem *base;
83 u8 hw_designer;
84 u8 hw_revision:4;
85}; 89};
86 90
87static int pl031_alarm_irq_enable(struct device *dev, 91static int pl031_alarm_irq_enable(struct device *dev,
@@ -336,14 +340,11 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
336 340
337 amba_set_drvdata(adev, ldata); 341 amba_set_drvdata(adev, ldata);
338 342
339 ldata->hw_designer = amba_manf(adev); 343 dev_dbg(&adev->dev, "designer ID = 0x%02x\n", amba_manf(adev));
340 ldata->hw_revision = amba_rev(adev); 344 dev_dbg(&adev->dev, "revision = 0x%01x\n", amba_rev(adev));
341
342 dev_dbg(&adev->dev, "designer ID = 0x%02x\n", ldata->hw_designer);
343 dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision);
344 345
345 /* Enable the clockwatch on ST Variants */ 346 /* Enable the clockwatch on ST Variants */
346 if (ldata->hw_designer == AMBA_VENDOR_ST) 347 if (vendor->clockwatch)
347 writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, 348 writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN,
348 ldata->base + RTC_CR); 349 ldata->base + RTC_CR);
349 350
@@ -351,7 +352,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
351 * On ST PL031 variants, the RTC reset value does not provide correct 352 * On ST PL031 variants, the RTC reset value does not provide correct
352 * weekday for 2000-01-01. Correct the erroneous sunday to saturday. 353 * weekday for 2000-01-01. Correct the erroneous sunday to saturday.
353 */ 354 */
354 if (ldata->hw_designer == AMBA_VENDOR_ST) { 355 if (vendor->st_weekday) {
355 if (readl(ldata->base + RTC_YDR) == 0x2000) { 356 if (readl(ldata->base + RTC_YDR) == 0x2000) {
356 time = readl(ldata->base + RTC_DR); 357 time = readl(ldata->base + RTC_DR);
357 if ((time & 358 if ((time &
@@ -413,6 +414,8 @@ static struct pl031_vendor_data stv1_pl031 = {
413 .set_alarm = pl031_set_alarm, 414 .set_alarm = pl031_set_alarm,
414 .alarm_irq_enable = pl031_alarm_irq_enable, 415 .alarm_irq_enable = pl031_alarm_irq_enable,
415 }, 416 },
417 .clockwatch = true,
418 .st_weekday = true,
416}; 419};
417 420
418/* And the second ST derivative */ 421/* And the second ST derivative */
@@ -424,6 +427,8 @@ static struct pl031_vendor_data stv2_pl031 = {
424 .set_alarm = pl031_stv2_set_alarm, 427 .set_alarm = pl031_stv2_set_alarm,
425 .alarm_irq_enable = pl031_alarm_irq_enable, 428 .alarm_irq_enable = pl031_alarm_irq_enable,
426 }, 429 },
430 .clockwatch = true,
431 .st_weekday = true,
427}; 432};
428 433
429static struct amba_id pl031_ids[] = { 434static struct amba_id pl031_ids[] = {