From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Wed, 25 Jun 2008 10:00:59 -0700 Subject: [U-Boot-Users] [PATCH] Fix dm9000 receive status and len little endian issue In-Reply-To: <1214406118-15778-1-git-send-email-Tsi-Chung.Liew@freescale.com> References: <1214406118-15778-1-git-send-email-Tsi-Chung.Liew@freescale.com> Message-ID: <486279CB.2060305@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Tsi-Chung, Tsi-Chung Liew wrote: > From: TsiChung Liew > > 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 > --- > 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