[U-Boot-Users] [PATCH] Fixed cfi flash read uchar bug.

wei.zhang at freescale.com wei.zhang at freescale.com
Fri Dec 22 08:27:38 CET 2006


From: Zhang Wei <wei.zhang at freescale.com>

For the flash of port width more than 8bit, a completetly read must be performed. For example, 16bit port width flash must perform a ushort read. Otherwise, some flashes will get error data.

Signed-off-by: Zhang Wei <wei.zhang at freescale.com>
---
 drivers/cfi_flash.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c
index 9b10220..f02b047 100644
--- a/drivers/cfi_flash.c
+++ b/drivers/cfi_flash.c
@@ -250,9 +250,9 @@ #endif
  */
 inline uchar flash_read_uchar (flash_info_t * info, uint offset)
 {
-	uchar *cp;
+	uchar cp[FLASH_CFI_64BIT];
 
-	cp = flash_make_addr (info, 0, offset);
+	memcpy(cp, flash_make_addr (info, 0, offset), info->portwidth);
 #if defined(__LITTLE_ENDIAN)
 	return (cp[0]);
 #else
-- 
1.4.0





More information about the U-Boot mailing list