[U-Boot-Users] Little Endian Flash

Wolfgang Denk wd at denx.de
Thu Mar 4 08:57:30 CET 2004


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