summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-03-14 14:09:05 +0000
committerwdenk <wdenk>2004-03-14 14:09:05 +0000
commit4d13cbad1c81ad7901151fec381bae8c30f4338a (patch)
treeecb8e4694a7a8ddea27f9f6838c61393cbd4c12b /drivers
parentc3f9d4939af90eb8e30119601c86c05bde6c7345 (diff)
* Patch by Tolunay Orkun, 5 Mar 2004:
Fix early board initialization for Cogent CSB272 board * Patch by Ed Okerson, 3 Mar 2004: fix CFI flash writes for little endian systems * Patch by Reinhard Meyer, 01 Mar 2004: generalize USB and IDE support for MPC5200 with according changes to IceCube.h and TOP5200.h add Am29LV256 256 MBit FLASH support for TOP5200 boards add info about USB and IDE to README
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cfi_flash.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c
index d31b38f1b4..7a7575b268 100644
--- a/drivers/cfi_flash.c
+++ b/drivers/cfi_flash.c
@@ -724,18 +724,42 @@ static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
*/
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
+
switch (info->portwidth) {
case FLASH_CFI_8BIT:
cword->c = c;
break;
case FLASH_CFI_16BIT:
+#if defined(__LITTLE_ENDIAN)
+ w = c;
+ w <<= 8;
+ cword->w = (cword->w >> 8) | w;
+#else
cword->w = (cword->w << 8) | c;
+#endif
break;
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
break;
}
}