[PATCH] NUC900/rtc: change the waiting for device ready implement

Wan ZongShun mcuos.com at gmail.com
Tue Jun 1 01:03:26 EDT 2010


Hi Andrew,

How about this patch?
Do you think this change is necessary?

在 2010年5月27日 下午2:59,Wan ZongShun <mcuos.com at gmail.com> 写道:
> Dear Andrew,
>
> This patch is only to change the waiting for device ready implement
> for winbond nuc900 platform.
>
> Signed-off-by:Wan ZongShun<mcuos.com at gmail.com>
>
> ---
>  drivers/rtc/rtc-nuc900.c |   15 +++++++--------
>  1 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c
> index a351bd5..21d1330 100644
> --- a/drivers/rtc/rtc-nuc900.c
> +++ b/drivers/rtc/rtc-nuc900.c
> @@ -85,22 +85,21 @@ static irqreturn_t nuc900_rtc_interrupt(int irq, void *_rtc)
>
>  static int *check_rtc_access_enable(struct nuc900_rtc *nuc900_rtc)
>  {
> -       unsigned int i;
> +       unsigned int i, timeout = 0x1000;
>        __raw_writel(INIRRESET, nuc900_rtc->rtc_reg + REG_RTC_INIR);
>
>        mdelay(10);
>
>        __raw_writel(AERPOWERON, nuc900_rtc->rtc_reg + REG_RTC_AER);
>
> -       for (i = 0; i < 1000; i++) {
> -               if (__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB)
> -                       return 0;
> -       }
> +       while (!(__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB)
> +                                                               && timeout--)
> +               mdelay(1);
>
> -       if ((__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB) == 0x0)
> -               return ERR_PTR(-ENODEV);
> +       if (!timeout)
> +               return ERR_PTR(-EPERM);
>
> -       return ERR_PTR(-EPERM);
> +       return 0;
>  }
>
>  static void nuc900_rtc_bcd2bin(unsigned int timereg,
> --
> 1.6.3.3
>



-- 
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel at lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900 at googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com at gmail.com



More information about the linux-arm-kernel mailing list