]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
* Fixed flash problems on OXC board.
authorwdenk <wdenk>
Tue, 14 May 2002 15:23:09 +0000 (15:23 +0000)
committerwdenk <wdenk>
Tue, 14 May 2002 15:23:09 +0000 (15:23 +0000)
* 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)

CHANGELOG
board/oxc/flash.c
tools/mkimage.c

index 3566ca120539522edf9a79899b1358d956656712..3f0671dd467c45b61d3220f2e5174e96c7c6520b 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
 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)
 
index c9d684bd8a8f415f9825d176d8d1cb6a32f5ec42..d4d4c09229bfcd6ed2cbb153009c8fd613c553fd 100644 (file)
@@ -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;
     }
 
index 86ada76fc18084a698644b9d9d3f29ee21262a90..2909e9457783629d8cefc39ceb74011138680a8a 100644 (file)
@@ -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));