[U-Boot-Users] [PATCH] Fix dm9000 receive status and len little endian issue

Ben Warren biggerbadderben at gmail.com
Wed Jun 25 19:00:59 CEST 2008


Hi Tsi-Chung,

Tsi-Chung Liew wrote:
> From: TsiChung Liew <Tsi-Chung.Liew at freescale.com>
>
> The received status and len was in little endian
> format and caused the ethernet unable to proceed
> further. Add define CFG_DM9000_BYTESWAP_STATUS_LEN in
> dm9000_rx_status_16bit() to byte swap RxStatus and RxLen
>
> Signed-off-by: TsiChung Liew <Tsi-Chung.Liew at freescale.com>
> ---
>  drivers/net/dm9000x.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
> index 844fb76..eff676c 100644
> --- a/drivers/net/dm9000x.c
> +++ b/drivers/net/dm9000x.c
> @@ -224,6 +224,10 @@ static void dm9000_rx_status_16bit(u16 *RxStatus, u16 *RxLen)
>  
>  	*RxStatus = DM9000_inw(DM9000_DATA);
>  	*RxLen = DM9000_inw(DM9000_DATA);
> +#ifdef CFG_DM9000_BYTESWAP_STATUS_LEN
> +	*RxStatus = __sw16(*RxStatus);
> +	*RxLen = __sw16(*RxLen);
> +#endif
>  }
>  
Instead of adding yet another kludgy CONFIG option, please consider 
changing the accessors to le16_to_cpu() or whatever is appropriate.  The 
definitions of DM9000_inX() are not very portable as it is and we should 
be striving to make the code better, not worse.

regards,
Ben




More information about the U-Boot mailing list