All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Fix dm9000 receive status and len little endian issue
Date: Wed, 25 Jun 2008 14:01:00 -0700	[thread overview]
Message-ID: <4862B20C.3090605@gmail.com> (raw)
In-Reply-To: <1214426932-14881-1-git-send-email-Tsi-Chung.Liew@freescale.com>

Tsi-Chung Liew wrote:
> From: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
>
> The received status and len was in little endian
> format and caused the ethernet unable to proceed
> further. Add __le16_to_cpu() in dm9000_rx_status_8/16/32bit().
>
> Signed-off-by: TsiChung Liew <Tsi-Chung.Liew@freescale.com>
> ---
>  drivers/net/dm9000x.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
> index 844fb76..e7365fe 100644
> --- a/drivers/net/dm9000x.c
> +++ b/drivers/net/dm9000x.c
> @@ -214,24 +214,28 @@ static void dm9000_rx_status_32bit(u16 *RxStatus, u16 *RxLen)
>  	DM9000_outb(DM9000_MRCMD, DM9000_IO);
>  
>  	tmpdata = DM9000_inl(DM9000_DATA);
> -	*RxStatus = tmpdata;
> -	*RxLen = tmpdata >> 16;
> +	*RxStatus = __le16_to_cpu(tmpdata);
> +	*RxLen = __le16_to_cpu(tmpdata >> 16);
>  }
>  
>  static void dm9000_rx_status_16bit(u16 *RxStatus, u16 *RxLen)
>  {
>  	DM9000_outb(DM9000_MRCMD, DM9000_IO);
>  
> -	*RxStatus = DM9000_inw(DM9000_DATA);
> -	*RxLen = DM9000_inw(DM9000_DATA);
> +	*RxStatus = __le16_to_cpu(DM9000_inw(DM9000_DATA));
> +	*RxLen = __le16_to_cpu(DM9000_inw(DM9000_DATA));
>  }
>  
>  static void dm9000_rx_status_8bit(u16 *RxStatus, u16 *RxLen)
>  {
>  	DM9000_outb(DM9000_MRCMD, DM9000_IO);
>  
> -	*RxStatus = DM9000_inb(DM9000_DATA) + (DM9000_inb(DM9000_DATA) << 8);
> -	*RxLen = DM9000_inb(DM9000_DATA) + (DM9000_inb(DM9000_DATA) << 8);
> +	*RxStatus =
> +	    __le16_to_cpu(DM9000_inb(DM9000_DATA) +
> +			  (DM9000_inb(DM9000_DATA) << 8));
> +	*RxLen =
> +	    __le16_to_cpu(DM9000_inb(DM9000_DATA) +
> +			  (DM9000_inb(DM9000_DATA) << 8));
>  }
>  
>  /*
>   
Sorry for opening Pandora's box, but wouldn't it be better to redefine 
the DM9000_x macros instead of where they're called?

regards,
Ben

  reply	other threads:[~2008-06-25 21:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-25 20:48 [U-Boot-Users] [PATCH] Fix dm9000 receive status and len little endian issue Tsi-Chung Liew
2008-06-25 21:01 ` Ben Warren [this message]
2008-06-25 21:48   ` Liew Tsi Chung
2008-07-01 17:45   ` Liew Tsi Chung
2008-07-01 18:03     ` Ben Warren
2008-07-02  7:17 ` Ben Warren
  -- strict thread matches above, loose matches on Subject: below --
2008-06-25 19:42 Tsi-Chung Liew
2008-06-25 19:50 ` Remy Bohmer
2008-06-25 19:58   ` Liew Tsi Chung
2008-06-25 15:01 Tsi-Chung Liew
2008-06-25 17:00 ` Ben Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4862B20C.3090605@gmail.com \
    --to=biggerbadderben@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.