[U-Boot] [PATCH] net/net.c: correct timeout function

Ben Warren biggerbadderben at gmail.com
Fri Dec 5 07:48:47 CET 2008


Hi Daniel,

Daniel Mack wrote:
> the net/net.c implementation of timeouts assumes that get_timer() returns
> values in milliseconds. As this is true for most platforms, it does not
> apply to PXA3x where the OSCR register increments with more than 3MHz.
>
> The following patch fixes the problem by calculation with the
> CONFIG_SYS_HZ variable.
>
>   
I apologize for taking so long to respond to this.
> Signed-off-by: Daniel Mack <daniel at caiaq.de>
>
> ---
>  net.c |   15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/net/net.c b/net/net.c
> index 77e83b5..b9326de 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -206,6 +206,11 @@ uchar		NetArpWaitPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
>  ulong		NetArpWaitTimerStart;
>  int		NetArpWaitTry;
>  
> +static long net_get_timer(long base)
> +{
> +	return get_timer(base) / (CONFIG_SYS_HZ / 1000);
> +}
> +
>   
Please change this name to something more meaningful, maybe 
get_timer_ms(). Apart from that, looks good. If you re-submit soon I'll 
pull it in.

regards,
Ben


More information about the U-Boot mailing list