From: wdenk Date: Tue, 14 May 2002 15:23:09 +0000 (+0000) Subject: * Fixed flash problems on OXC board. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=10ee566f6df48aaca211ffbefbbb2bf25627ed91;p=users%2Frw%2Fppcboot.git * Fixed flash problems on OXC board. * That ugly bug raised it's head again: Fixed mkimage bug that caused bad headers when image was on NFS mounted filesystem (reported for RH-7.1 on client and server) --- diff --git a/CHANGELOG b/CHANGELOG index 3566ca1..3f0671d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,12 @@ Modifications for 1.1.6: ====================================================================== +* Fixed flash problems on OXC board. + +* That ugly bug raised it's head again: Fixed mkimage bug that caused + bad headers when image was on NFS mounted filesystem (reported for + RH-7.1 on client and server) + * Added MVS1 configuration (Howard Gray, 23 Apr 2002) diff --git a/board/oxc/flash.c b/board/oxc/flash.c index c9d684b..d4d4c09 100644 --- a/board/oxc/flash.c +++ b/board/oxc/flash.c @@ -53,11 +53,16 @@ unsigned long flash_init (void) flash_info[i].flash_id = FLASH_UNKNOWN; } - size = flash_get_size((vu_char *)CFG_FLASH0_BASE, &flash_info[0]); - if (!size || (flash_info[0].flash_id != FLASH_STM800DB && - flash_info[0].flash_id != FLASH_STM800DT)) + /* + * We use the following trick here: since flash is cyclically + * mapped in the 0xFF800000-0xFFFFFFFF area, we detect the type + * and the size of flash using 0xFF800000 as the base address, + * and then call flash_get_size() again to fill flash_info. + */ + size = flash_get_size((vu_char *)CFG_FLASH_PRELIMBASE, &flash_info[0]); + if (size) { - size = flash_get_size((vu_char *)CFG_FLASH1_BASE, &flash_info[0]); + flash_get_size((vu_char *)(-size), &flash_info[0]); } #if (CFG_MONITOR_BASE >= CFG_FLASH0_BASE) || \ @@ -93,8 +98,8 @@ void flash_print_info (flash_info_t *info) return; } - switch (info->flash_id >> 16) { - case 0x20: + switch (info->flash_id & FLASH_VENDMASK) { + case FLASH_MAN_STM: printf ("ST "); break; default: @@ -154,7 +159,7 @@ static ulong flash_get_size (vu_char *addr, flash_info_t *info) devid = addr[2]; /* only support STM */ - if (vendor != 0x20) { + if ((vendor << 16) != FLASH_MAN_STM) { return 0; } diff --git a/tools/mkimage.c b/tools/mkimage.c index 86ada76..2909e94 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -466,6 +466,13 @@ NXTARG: ; (void) munmap((void *)ptr, sbuf.st_size); + /* We're a bit of paranoid */ +#if defined(_POSIX_SYNCHRONIZED_IO) && !defined(__sun__) + (void) fdatasync (ifd); +#else + (void) fsync (ifd); +#endif + if (close(ifd)) { fprintf (stderr, "%s: Write error on %s: %s\n", cmdname, imagefile, strerror(errno));