diff options
Diffstat (limited to 'drivers/rtc/rtc-pl031.c')
-rw-r--r-- | drivers/rtc/rtc-pl031.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 684ef4bbfce4..f027c063fb20 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -312,6 +312,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
312 | int ret; | 312 | int ret; |
313 | struct pl031_local *ldata; | 313 | struct pl031_local *ldata; |
314 | struct rtc_class_ops *ops = id->data; | 314 | struct rtc_class_ops *ops = id->data; |
315 | unsigned long time; | ||
315 | 316 | ||
316 | ret = amba_request_regions(adev, NULL); | 317 | ret = amba_request_regions(adev, NULL); |
317 | if (ret) | 318 | if (ret) |
@@ -343,6 +344,23 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
343 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, | 344 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, |
344 | ldata->base + RTC_CR); | 345 | ldata->base + RTC_CR); |
345 | 346 | ||
347 | /* | ||
348 | * On ST PL031 variants, the RTC reset value does not provide correct | ||
349 | * weekday for 2000-01-01. Correct the erroneous sunday to saturday. | ||
350 | */ | ||
351 | if (ldata->hw_designer == AMBA_VENDOR_ST) { | ||
352 | if (readl(ldata->base + RTC_YDR) == 0x2000) { | ||
353 | time = readl(ldata->base + RTC_DR); | ||
354 | if ((time & | ||
355 | (RTC_MON_MASK | RTC_MDAY_MASK | RTC_WDAY_MASK)) | ||
356 | == 0x02120000) { | ||
357 | time = time | (0x7 << RTC_WDAY_SHIFT); | ||
358 | writel(0x2000, ldata->base + RTC_YLR); | ||
359 | writel(time, ldata->base + RTC_LR); | ||
360 | } | ||
361 | } | ||
362 | } | ||
363 | |||
346 | ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, | 364 | ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, |
347 | THIS_MODULE); | 365 | THIS_MODULE); |
348 | if (IS_ERR(ldata->rtc)) { | 366 | if (IS_ERR(ldata->rtc)) { |