Wacky JEDEC probes

Thayne Harbaugh tharbaugh at lnxi.com
Tue Apr 1 12:15:36 EST 2003


On Tue, 2003-04-01 at 07:18, Stefan Roese wrote:
> Hi!
> 
> I am trying to use "jedec_probe.c" on our ppc based board to support two
> different flash types (AMD AM29VL160xT and SSTI SST39LF160). Both are used
> in 16bit mode. Since the SST flash is not really CFI compliant, I have to
> use jedec_probe, right?

BTW, it looks like you can simplify switch statement in your patch if
cfi->device_type is a good way to represent the byte width of a device. 
Then again, the intention of cfi->device_type might be intended to be an
opaque symbol only and using it as a byte width value might be an abuse.

@@ -1171,9 +1229,25 @@
               "MTD %s(): check ID's in every block: %dx%d\n",
               __func__, blk_size, blocks );
 
+       /*
+        * Don't check for ID in every block on SST devices.
+        */
+       if (cfi->mfr == MANUFACTURER_SST)
+               blocks = 1;
+
        for ( blk = 0; blk < blocks; blk++ ) {
                mfr = cfi_read( map, blk * blk_size );
-               id  = cfi_read( map, blk * blk_size + 1 );
+               switch (cfi->device_type) {
+               case CFI_DEVICETYPE_X8:
+                       id  = cfi_read( map, blk * blk_size + 1 );
+                       break;
+               case CFI_DEVICETYPE_X16:
+                       id  = cfi_read( map, blk * blk_size + 2 );
+                       break;
+               case CFI_DEVICETYPE_X32:
+                       id  = cfi_read( map, blk * blk_size + 4 );
+                       break;
+               }
 
                if ( cfi->mfr != mfr || cfi->id != id ) {
                        DEBUG( MTD_DEBUG_LEVEL3,


Could be changed to

@@ -1171,9 +1229,15 @@
               "MTD %s(): check ID's in every block: %dx%d\n",
               __func__, blk_size, blocks );
 
+       /*
+        * Don't check for ID in every block on SST devices.
+        */
+       if (cfi->mfr == MANUFACTURER_SST)
+               blocks = 1;
+
        for ( blk = 0; blk < blocks; blk++ ) {
                mfr = cfi_read( map, blk * blk_size );
-               id  = cfi_read( map, blk * blk_size + 1 );
+               id  = cfi_read( map, blk * blk_size + cfi->device_type
);

                if ( cfi->mfr != mfr || cfi->id != id ) {
                        DEBUG( MTD_DEBUG_LEVEL3,


-- 
Thayne Harbaugh
Linux Networx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20030401/d18f0af4/attachment.bin 


More information about the linux-mtd mailing list