rtc: pl031: restore ST variant functionality

Submitted by Linus Walleij on Feb. 5, 2013, 12:50 p.m.

Details

Message ID 1360068612-30592-1-git-send-email-linus.walleij@stericsson.com
State Accepted
Headers show

Commit Message

Linus Walleij Feb. 5, 2013, 12:50 p.m.
From: Linus Walleij <linus.walleij@linaro.org>

The patch titled:
"drivers/rtc/rtc-pl031.c: fix the missing operation on enable"
accidentally broke the ST variants of PL031.

The bit that is being poked as "clockwatch" enable bit
for the ST variants does the work of bit 0 on this variant.
Bit 0 is used for a clock divider on the ST variants, and
setting it to 1 will affect timekeeping in a real bad way.

Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Mian Yousaf KAUKAB <mian.yousaf.kaukab@stericsson.com>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/rtc/rtc-pl031.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Haojian Zhuang Feb. 5, 2013, 12:51 p.m.
On 5 February 2013 20:50, Linus Walleij <linus.walleij@stericsson.com> wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
>
> The patch titled:
> "drivers/rtc/rtc-pl031.c: fix the missing operation on enable"
> accidentally broke the ST variants of PL031.
>
> The bit that is being poked as "clockwatch" enable bit
> for the ST variants does the work of bit 0 on this variant.
> Bit 0 is used for a clock divider on the ST variants, and
> setting it to 1 will affect timekeeping in a real bad way.
>
> Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
> Cc: Mian Yousaf KAUKAB <mian.yousaf.kaukab@stericsson.com>
> Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: stable@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/rtc/rtc-pl031.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
> index fe467c3..8900ea7 100644
> --- a/drivers/rtc/rtc-pl031.c
> +++ b/drivers/rtc/rtc-pl031.c
> @@ -350,7 +350,9 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
>         /* Enable the clockwatch on ST Variants */
>         if (vendor->clockwatch)
>                 data |= RTC_CR_CWEN;
> -       writel(data | RTC_CR_EN, ldata->base + RTC_CR);
> +       else
> +               data |= RTC_CR_EN;
> +       writel(data, ldata->base + RTC_CR);
>
>         /*
>          * On ST PL031 variants, the RTC reset value does not provide correct
> --
> 1.7.11.3
>

Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>

Patch hide | download patch | download mbox

diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index fe467c3..8900ea7 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -350,7 +350,9 @@  static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
 	/* Enable the clockwatch on ST Variants */
 	if (vendor->clockwatch)
 		data |= RTC_CR_CWEN;
-	writel(data | RTC_CR_EN, ldata->base + RTC_CR);
+	else
+		data |= RTC_CR_EN;
+	writel(data, ldata->base + RTC_CR);
 
 	/*
 	 * On ST PL031 variants, the RTC reset value does not provide correct