소스 검색

Optimize flash_make_cmd in drivers/cfi_flash.c for little endian
Fix "WARNING: flash_make_cmd: unsuppported LittleEndian mode"
message when probing for nonexistent flash in little endian mode.
As a side effect more efficient and smaller code is generated,
which is always a Good Thing (TM).
Patch by Ladislav Michl, 24 Sep 2005

Wolfgang Denk 19 년 전
부모
커밋
dafbe3790e
2개의 변경된 파일11개의 추가작업 그리고 23개의 파일을 삭제
  1. 7 0
      CHANGELOG
  2. 4 23
      drivers/cfi_flash.c

+ 7 - 0
CHANGELOG

@@ -2,6 +2,13 @@
 Changes for U-Boot 1.1.4:
 Changes for U-Boot 1.1.4:
 ======================================================================
 ======================================================================
 
 
+* Optimize flash_make_cmd in drivers/cfi_flash.c for little endian
+  Fix "WARNING: flash_make_cmd: unsuppported LittleEndian mode"
+  message when probing for nonexistent flash in little endian mode.
+  As a side effect more efficient and smaller code is generated,
+  which is always a Good Thing (TM).
+  Patch by Ladislav Michl, 24 Sep 2005
+
 * Update for TFTP using a fixed UDP port
 * Update for TFTP using a fixed UDP port
   Use the approved environment variable names. Added "tftpdstp" to
   Use the approved environment variable names. Added "tftpdstp" to
   allow ports other than 69 per Tolunay Orkun's recommendation.
   allow ports other than 69 per Tolunay Orkun's recommendation.

+ 4 - 23
drivers/cfi_flash.c

@@ -47,7 +47,6 @@
 #include <common.h>
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/processor.h>
 #include <asm/byteorder.h>
 #include <asm/byteorder.h>
-#include <linux/byteorder/swab.h>
 #include <environment.h>
 #include <environment.h>
 #ifdef	CFG_FLASH_CFI_DRIVER
 #ifdef	CFG_FLASH_CFI_DRIVER
 
 
@@ -797,32 +796,14 @@ static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c)
 static void flash_make_cmd (flash_info_t * info, uchar cmd, void *cmdbuf)
 static void flash_make_cmd (flash_info_t * info, uchar cmd, void *cmdbuf)
 {
 {
 	int i;
 	int i;
-
-#if defined(__LITTLE_ENDIAN)
-	ushort stmpw;
-	uint   stmpi;
-#endif
 	uchar *cp = (uchar *) cmdbuf;
 	uchar *cp = (uchar *) cmdbuf;
 
 
-	for (i = 0; i < info->portwidth; i++)
-		*cp++ = ((i + 1) & (info->chipwidth - 1)) ? '\0' : cmd;
 #if defined(__LITTLE_ENDIAN)
 #if defined(__LITTLE_ENDIAN)
-	switch (info->portwidth) {
-	case FLASH_CFI_8BIT:
-		break;
-	case FLASH_CFI_16BIT:
-		stmpw = *(ushort *) cmdbuf;
-		*(ushort *) cmdbuf = __swab16 (stmpw);
-		break;
-	case FLASH_CFI_32BIT:
-		stmpi = *(uint *) cmdbuf;
-		*(uint *) cmdbuf = __swab32 (stmpi);
-		break;
-	default:
-		puts ("WARNING: flash_make_cmd: unsuppported LittleEndian mode\n");
-		break;
-	}
+	for (i = info->portwidth; i > 0; i--)
+#else
+	for (i = 1; i <= info->portwidth; i++)
 #endif
 #endif
+		*cp++ = (i % info->chipwidth) ? '\0' : cmd;
 }
 }
 
 
 /*
 /*