Hi Heiko,

On 11/04/2013 07:40 AM, Heiko Schocher wrote:
> add function for waiting if reset ends. If reset never ends,
> timeout and print an error message.
> 
> Signed-off-by: Heiko Schocher <[email protected]>
> Cc: Bo Shen <[email protected]>
> Cc: Andreas Bießmann <[email protected]>
> 
> ---
> - changes for v2:
>   - new in v2
> ---
>  arch/arm/cpu/arm926ejs/at91/reset.c        | 15 +++++++++++++++
>  arch/arm/include/asm/arch-at91/at91_rstc.h |  1 +
>  2 files changed, 16 insertions(+)
> 
> diff --git a/arch/arm/cpu/arm926ejs/at91/reset.c 
> b/arch/arm/cpu/arm926ejs/at91/reset.c
> index e67f47b..03b661c 100644
> --- a/arch/arm/cpu/arm926ejs/at91/reset.c
> +++ b/arch/arm/cpu/arm926ejs/at91/reset.c
> @@ -27,3 +27,18 @@ void reset_cpu(ulong ignored)
>       while (1)
>               ;
>  }
> +
> +void at91_wait_for_reset(int timeout)

this looks like millisecond timeout.

> +{
> +     struct at91_rstc *rstc = (struct at91_rstc *)ATMEL_BASE_RSTC;
> +     int count = 0;
> +
> +     while (!(readl(&rstc->sr) & AT91_RSTC_SR_NRSTL)) {
> +             if (count >= timeout) {
> +                     printf("reset timeout.\n");
> +                     return;
> +             }
> +             udelay(10);
> +             timeout++;
> +     }
> +}
> diff --git a/arch/arm/include/asm/arch-at91/at91_rstc.h 
> b/arch/arm/include/asm/arch-at91/at91_rstc.h
> index a942342..7f4e59f 100644
> --- a/arch/arm/include/asm/arch-at91/at91_rstc.h
> +++ b/arch/arm/include/asm/arch-at91/at91_rstc.h
> @@ -23,6 +23,7 @@ typedef struct at91_rstc {
>       u32     mr;     /* Reset Controller Mode Register */
>  } at91_rstc_t;
>  

Could you please add kernel-doc style documentation here to point that out?

> +void at91_wait_for_reset(int timeout);
>  #endif /* __ASSEMBLY__ */
>  
>  #define AT91_RSTC_KEY                0xA5000000
> 

Best regards

Andreas Bießmann
_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to