]> git.sur5r.net Git - u-boot/blobdiff - board/esd/common/flash.c
Merge branch 'master' of /home/wd/git/u-boot/master/
[u-boot] / board / esd / common / flash.c
index d032b001fd86580f1c3d68bfe5e4de569595f7fc..bda361ead949ec5c63988729e6b3cd9f2ab15c1c 100644 (file)
@@ -22,7 +22,9 @@
  */
 
 #include <common.h>
+#ifdef __PPC__
 #include <ppc4xx.h>
+#endif
 #include <asm/processor.h>
 
 flash_info_t   flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips        */
@@ -117,6 +119,7 @@ void flash_print_info  (flash_info_t *info)
        case FLASH_MAN_AMD:     printf ("AMD ");                break;
        case FLASH_MAN_FUJ:     printf ("FUJITSU ");            break;
        case FLASH_MAN_SST:     printf ("SST ");                break;
+       case FLASH_MAN_EXCEL:   printf ("Excel Semiconductor "); break;
        default:                printf ("Unknown Vendor ");     break;
        }
 
@@ -151,6 +154,10 @@ void flash_print_info  (flash_info_t *info)
                                break;
        case FLASH_SST160A:     printf ("SST39LF/VF160 (16 Mbit, uniform sector size)\n");
                                break;
+       case FLASH_SST320:      printf ("SST39LF/VF320 (32 Mbit, uniform sector size)\n");
+                               break;
+       case FLASH_SST640:      printf ("SST39LF/VF640 (64 Mbit, uniform sector size)\n");
+                               break;
        default:                printf ("Unknown Chip Type\n");
                                break;
        }
@@ -235,6 +242,9 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
        case (CFG_FLASH_WORD_SIZE)SST_MANUFACT:
                info->flash_id = FLASH_MAN_SST;
                break;
+       case (CFG_FLASH_WORD_SIZE)EXCEL_MANUFACT:
+               info->flash_id = FLASH_MAN_EXCEL;
+               break;
        default:
                info->flash_id = FLASH_UNKNOWN;
                info->sector_count = 0;
@@ -316,6 +326,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
                info->sector_count = 128;
                info->size = 0x00800000;  break;        /* => 8 MB      */
 
+#if !(defined(CONFIG_ADCIOP) || defined(CONFIG_DASA_SIM))
        case (CFG_FLASH_WORD_SIZE)SST_ID_xF800A:
                info->flash_id += FLASH_SST800A;
                info->sector_count = 16;
@@ -323,11 +334,28 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
                break;                          /* => 1 MB              */
 
        case (CFG_FLASH_WORD_SIZE)SST_ID_xF160A:
+       case (CFG_FLASH_WORD_SIZE)SST_ID_xF1601:
+       case (CFG_FLASH_WORD_SIZE)SST_ID_xF1602:
                info->flash_id += FLASH_SST160A;
                info->sector_count = 32;
                info->size = 0x00200000;
                break;                          /* => 2 MB              */
 
+       case (CFG_FLASH_WORD_SIZE)SST_ID_xF3201:
+       case (CFG_FLASH_WORD_SIZE)SST_ID_xF3202:
+               info->flash_id += FLASH_SST320;
+               info->sector_count = 64;
+               info->size = 0x00400000;
+               break;                          /* => 4 MB              */
+
+       case (CFG_FLASH_WORD_SIZE)SST_ID_xF6401:
+       case (CFG_FLASH_WORD_SIZE)SST_ID_xF6402:
+               info->flash_id += FLASH_SST640;
+               info->sector_count = 128;
+               info->size = 0x00800000;
+               break;                          /* => 8 MB              */
+#endif
+
        default:
                info->flash_id = FLASH_UNKNOWN;
                return (0);                     /* => no or unknown flash */
@@ -397,7 +425,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
                /* read sector protection at sector address, (A7 .. A0) = 0x02 */
                /* D0 = 1 if protected */
                addr2 = (volatile CFG_FLASH_WORD_SIZE *)(info->start[i]);
-               if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST)
+               if ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_AMD)
                  info->protect[i] = 0;
                else
                  info->protect[i] = addr2[CFG_FLASH_READ2] & 1;
@@ -610,10 +638,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
        int i;
 
        /* Check if Flash is (sufficiently) erased */
-       if ((*((volatile CFG_FLASH_WORD_SIZE *)dest) &
-            (CFG_FLASH_WORD_SIZE)data) != (CFG_FLASH_WORD_SIZE)data) {
+       if ((*((vu_long *)dest) & data) != data) {
                return (2);
        }
+
        /* Disable interrupts which might cause a timeout here */
        flag = disable_interrupts();