[U-Boot-Users] Little Endian Flash

Ed Okerson eokerson at texasconnect.net
Thu Mar 4 15:53:04 CET 2004


Wolfgang,

The intent is not to swap data.  This function shifts data in one byte at
a time.  Without the patch the data is shifted in on the wrong end of the
buffer for little endian systems.

Ed Okerson

On Thu, 4 Mar 2004, Wolfgang Denk wrote:

> In message <Pine.LNX.4.44.0403032205330.14523-200000 at dallas.texasconnect.net> you wrote:
> >
> > The attached patch fixes CFI flash writes for little endian systems.
>
> Did you test this on 32 or 64 bit systems?
>
>   	case FLASH_CFI_32BIT:
> + #if defined(__LITTLE_ENDIAN)
> + 		l = c;
> + 		l <<= 24;
> + 		cword->l = (cword->l >> 8) | l;
> + #else
>   		cword->l = (cword->l << 8) | c;
> + #endif
>   		break;
>   	case FLASH_CFI_64BIT:
> + #if defined(__LITTLE_ENDIAN)
> + 		ll = c;
> + 		ll <<= 56;
> + 		cword->ll = (cword->ll >> 8) | ll;
> + #else
>   		cword->ll = (cword->ll << 8) | c;
> + #endif
>
>
> I don't think that this correctly swaps 32 or 64 bit data.
>
> Best regards,
>
> Wolfgang Denk
>
> --
> Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
> Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
> "An organization dries up if you don't challenge it with growth."
>        - Mark Shepherd, former President and CEO of Texas Instruments
>





More information about the U-Boot mailing list