From 4d13cbad1c81ad7901151fec381bae8c30f4338a Mon Sep 17 00:00:00 2001 From: wdenk Date: Sun, 14 Mar 2004 14:09:05 +0000 Subject: * 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 --- drivers/cfi_flash.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'drivers') 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; } } -- cgit