http://downloads.netgear.com/files/GPL/DM111PSP_v3.61d_GPL.tar.gz
[bcm963xx.git] / shared / opensource / flash / cfiflash.c
index e5cc0e9..6dd8ccc 100755 (executable)
 #define ID_SST39VF800A  0x2781
 #define ID_SST39VF1601  0x234B
 #define ID_SST39VF3201  0x235B
-// add SST and ST flash device id 
-#define ID_SST39VF3202  0x235A
-#define ID_M29W320ET    0x2256
 #define ID_SST39VF6401  0x236B
+
 /* A list of Intel compatible device ID's - add others as needed */
 #define ID_I28F160C3T   0x88C2
 #define ID_I28F160C3B   0x88C3
 #define ID_I28F320C3T   0x88C4
 #define ID_I28F320C3B   0x88C5
-#define ID_I28F640J3   0x0017
+#define ID_I28F640J3   0x8916
 
 #define CFI_FLASH_DEVICES                   \
          {{ID_AM29DL800T, "AM29DL800T"},    \
           {ID_SST39VF800A, "SST39VF800A"},  \
           {ID_SST39VF1601, "SST39VF1601"},  \
           {ID_SST39VF3201, "SST39VF3201"},  \
-          {ID_SST39VF3202, "SST39VF3202"},  \
-          {ID_M29W320ET,   "M29W320ET"},    \
           {ID_SST39VF6401, "SST39VF6401"},  \
           {ID_I28F160C3T, "I28F160C3T"},    \
           {ID_I28F160C3B, "I28F160C3B"},    \
@@ -376,9 +372,6 @@ int cfi_flash_init(flash_device_info_t **flash_info)
         case ID_AM29LV320MT:
         case ID_AM29LV200BT:
         case ID_MX29LV640BT:
-    // add ST flash device id  here
-        case ID_M29W320ET: 
-    // add ST flash device id  here
             flashFamily = FLASH_AMD;
             break;
         case ID_SST39VF200A:
@@ -386,9 +379,6 @@ int cfi_flash_init(flash_device_info_t **flash_info)
         case ID_SST39VF800A:
         case ID_SST39VF1601:
         case ID_SST39VF3201:
-    // add SST flash device id here
-        case ID_SST39VF3202:
-    // add SST flash device id here
         case ID_SST39VF6401:
             flashFamily = FLASH_SST;
             break;
@@ -445,10 +435,6 @@ int cfi_flash_init(flash_device_info_t **flash_info)
         case ID_AM29LV200BT:
         case ID_SST39VF1601:
         case ID_MX29LV640BT:
-    // add SST and ST flash device id here
-        case ID_SST39VF3202:
-        case ID_M29W320ET: 
-    // add SST and ST flash device id here
             flipCFIGeometry = TRUE;
             break;
         default:
@@ -512,7 +498,7 @@ static int cfi_flash_sector_erase_int(unsigned short sector)
         if (cfi_flash_wait(sector, 0, 0xffff) == STATUS_READY)
             break;
     }
+
     return(FLASH_API_OK);
 }
 
@@ -549,9 +535,7 @@ static int cfi_flash_write_buf(unsigned short sector, int offset,
     int ret = FLASH_API_ERROR;
     int i;
     unsigned char *p = cfi_flash_get_memptr(sector) + offset;
-#ifdef _CFE_                                                
-    printk("Flash writing sector %d %x\n", sector, p);
-#endif
+
     /* After writing the flash block, compare the contents to the source
      * buffer.  Try to write the sector successfully up to three times.
      */
@@ -563,10 +547,9 @@ static int cfi_flash_write_buf(unsigned short sector, int offset,
         flash_sector_erase_int(sector);
         ret = FLASH_API_ERROR;
     }
-    // printk( "%c", i==0 ? '*' : ' ' );
 
     if( ret == FLASH_API_ERROR )
-        printk( "Flash write sector %d error.  Verify failed\n", sector );
+        printk( "Flash write error.  Verify failed\n" );
 
     return( ret );
 }
@@ -752,8 +735,8 @@ static void cfi_flash_command(int command, unsigned short sector, int offset,
             flashptr[offset/2] = data;
             break;
         case FLASH_SERASE:
-            //flashptr[0] = 0x60; Block Unlock is not required.
-            //flashptr[0] = 0xD0;
+            flashptr[0] = 0x60;
+            flashptr[0] = 0xD0;
             flashptr[0] = 0x20;
             flashptr[0] = 0xD0;
             break;
@@ -902,7 +885,6 @@ static int cfi_flash_wait(unsigned short sector, int offset, unsigned short data
         while(!(*flashptr & 0x80));
         if (*flashptr & 0x30) {
             flashptr[0] = 0x50;
-            printk("CFI: Wait error &d\n", *flashptr);
             cfi_flash_command(FLASH_RESET, 0, 0, 0);
             return STATUS_TIMEOUT;
         }