[U-Boot-Users] [RFC] CFI Driver Little-Endian write Issue

Wolfgang Denk wd at denx.de
Fri Aug 4 15:44:57 CEST 2006


Dear Sam,

in message <20060804123231.77800.qmail at web15908.mail.cnb.yahoo.com> you wrote:
> 
> Once I removed little endian stuff in 
> flash_add_byte(), CFI Driver was funtional
> for MPC7448 HPC-II with/without 
> CFG_FLASH_USE_BUFFER_WRITE. So I'd like to 
> make sure whether my fix is a general thing 
> or just a luck. 

Ummm... did you try running the resulting code on any real LE system?

>  static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c)
>  {
> -#if defined(__LITTLE_ENDIAN)
> -	unsigned short	w;
> -	unsigned int	l;
> -	unsigned long long ll;
> -#endif
...

I understand that removing this code  will  break  all  real  little-
endian systems.

> diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h
> index ea5b0d2..3d3c96f 100644
> --- a/include/asm-ppc/processor.h
> +++ b/include/asm-ppc/processor.h
> @@ -12,6 +12,12 @@ #include <linux/config.h>
>  #include <asm/ptrace.h>
>  #include <asm/types.h>
>  
> +#ifdef  CONFIG_MPC7448HPC2
> +#ifndef __LITTLE_ENDIAN
> +#define __LITTLE_ENDIAN
> +#endif  /* __LITTLE_ENDIAN ** USI-SS  */
> +#endif  /* CONFIG_MPC7448HPC2 */
> +

And this is definitely inappropirate, too.  All  PowerPC  systems  we
have  so  far  are BE, including yours, event hough it performs funny
(read: broken) memory accesses.

Defining __LITTLE_ENDIAN on  a  big-endian  system  is  fundamentally
broken. I will never accept such a patch.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Crash programs fail because they are based on the theory  that,  with
nine women pregnant, you can get a baby a month.  - Wernher von Braun




More information about the U-Boot mailing list