support for broken EON chips
PATCH 1/1 support for broken EON chips
Ok, here goes nothing. Go ahead, kill me :)
Comments very welcome, since i don't have a clue atm about how to do this nicely. If all goes well i might have some time to add more EON chips to jedec_probe soon. The patch below is against cvs..
drivers/mtd/chips/cfi_probe.c +12 -0
@@ -231,7 +231,19 @@cfi_send_gen_cmd (0x55 ,0x2aa , base, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x90 ,0x555 , base, map, cfi, cfi->device_type,NULL ); cfi->mfr =cfi_read_query (map, base); +#ifdef CONFIG_MTD_EON +if (cfi->mfr==0x7f ) { + cfi->mfr =cfi_read_query (map, base + (0x100 *ofs_factor)); + } +#endif cfi->id =cfi_read_query (map, base + ofs_factor); +#ifdef CONFIG_MTD_EON +if (cfi->mfr==0x1c && (cfi->id==0xb9 || cfi->id==0xba )) { +kfree (cfi->cfiq); +return 0 ; + } +#endif +/* Put it back into Read Mode */ cfi_send_gen_cmd (0xF0 ,0 , base, map, cfi, cfi->device_type,NULL );
drivers/mtd/chips/jedec_probe.c +28 -0
@@ -38,6 +38,7 @@#define MANUFACTURER_ST 0x0020#define MANUFACTURER_TOSHIBA 0x0098#define MANUFACTURER_WINBOND 0x00da +#define MANUFACTURER_EON 0x001c/* AMD */
@@ -166,6 +167,8 @@/* Winbond */ #define W49V002A 0x00b0 +/* EON */ +#define EON29LV400BB 0x22BA/* * Unlock address sets for AMD command sets.
@@ -1710,6 +1713,23 @@ ERASEINFO(0x02000, 2), ERASEINFO(0x04000, 1), } + },{ + .mfr_id = MANUFACTURER_EON, /* TomTom GO */ + .dev_id = EON29LV400BB, + .name = "EON AM29LV400BB", + .uaddr = { + [1] = MTD_UADDR_0x0AAA_0x0555, /* x16 */ + [0 ] = MTD_UADDR_0x0555_0x02AA,/* x8 */ + }, + .DevSize = SIZE_512KiB, + .CmdSet = P_ID_AMD_STD, + .NumEraseRegions= 4, + .regions = { +ERASEINFO (0x04000 ,1 ), +ERASEINFO (0x02000 ,2 ), +ERASEINFO (0x08000 ,1 ), + ERASEINFO(0x10000,7), + } } };
@@ -1729,6 +1749,14 @@u32 ofs =cfi_build_cmd_addr (0 ,cfi_interleave (cfi), cfi->device_type); mask = (1 << (cfi->device_type *8 )) -1 ; result =map_read (map, base + ofs); +#ifdef CONFIG_MTD_EON +if ( (result.x[0 ] & mask) ==0x7f ) { + ofs =cfi_build_cmd_addr (0x100 ,cfi_interleave (cfi), cfi->device_type); + mask = (1 << (cfi->device_type *8 )) -1 ; + result =map_read (map, base + ofs); + } +#endif +return result.x[0 ] & mask; }
drivers/mtd/chips/Kconfig +10 -0
@@ -221,6 +221,16 @@ be set to at least 1. This can also be adjusted at driver load time with the retry_cmd_max module parameter. +config MTD_EON + depends on MTD_CFI_AMDSTD + bool "Work-arounds for broken EON chips" + help + This option enables workarounds for the broken chips produced + by EON. Chips for which this workaround is necessary include + EN29LV400AB/T and EN29LV800BB/T. If you have such a chip, and + are experiencing problems (eg. incorrect CFI detection), say + 'Y' here. Otherwise you should probably say 'N' here. + config MTD_CFI_STAA tristate "Support for ST (Advanced Architecture) flash chips" depends on MTD_GEN_PROBE
Quoted 2 lines · Koen Martens
Ok, here goes nothing. Go ahead, kill me :)
Boom, you're dead. :)
Quoted 1 line
Comments very welcome, since i don't have a clue atm about how to do this nicely. If all goes well i might have some time to add more EON chips to
jedec_probesoon. The patch below is against cvs..
Patch is quite small, that's good.
Quoted 13 lines
diff -Naur
mtd-orig/drivers/mtd/chips/cfi_probe.cmtd/drivers/mtd/chips/cfi_probe.cdrivers/mtd/chips/cfi_probe.c +5
-0@@ -231,7 +231,19 @@cfi_send_gen_cmd (0x55 ,0x2aa , base, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x90 ,0x555 , base, map, cfi, cfi->device_type,NULL ); cfi->mfr =cfi_read_query (map, base); +#ifdef CONFIG_MTD_EON +if (cfi->mfr==0x7f ) { + cfi->mfr =cfi_read_query (map, base + (0x100 *ofs_factor)); + } +#endif cfi->id =cfi_read_query (map, base + ofs_factor);
drivers/mtd/chips/cfi_probe.c line 249
Quoted 10 lines
drivers/mtd/chips/cfi_probe.c +7
-0+#ifdef CONFIG_MTD_EON +if (cfi->mfr==0x1c && (cfi->id==0xb9 || cfi->id==0xba )) { +kfree (cfi->cfiq); +return 0 ; + } +#endif +/* Put it back into Read Mode */ cfi_send_gen_cmd (0xF0 ,0 , base, map, cfi, cfi->device_type,NULL );
This is an ugly ugly hack. But also a nice starting point. As you already know from irc, I'd prefer something like:
cfi_probe \
>---> register_chipjedec_probe /
But that is clearly more work and a much larger patch. For the moment, I'm fine with the hack.
Quoted 34 lines
diff -Naur
mtd-orig/drivers/mtd/chips/jedec_probe.cmtd/drivers/mtd/chips/jedec_probe.cdrivers/mtd/chips/jedec_probe.c +13
-0@@ -38,6 +38,7 @@#define MANUFACTURER_ST 0x0020#define MANUFACTURER_TOSHIBA 0x0098#define MANUFACTURER_WINBOND 0x00da +#define MANUFACTURER_EON 0x001c/* AMD */ @@ -166,6 +167,8 @@/* Winbond */ #define W49V002A 0x00b0 +/* EON */ +#define EON29LV400BB 0x22BA/* * Unlock address sets for AMD command sets. @@ -1710,6 +1713,23 @@ERASEINFO (0x02000 ,2 ), ERASEINFO(0x04000, 1), } + },{ + .mfr_id =MANUFACTURER_EON ,/* TomTom GO */ + .dev_id = EON29LV400BB, + .name = "EON AM29LV400BB", + .uaddr = { + [1] = MTD_UADDR_0x0AAA_0x0555, /* x16 */ + [0 ] = MTD_UADDR_0x0555_0x02AA,/* x8 */ + }, + .DevSize = SIZE_512KiB, + .CmdSet = P_ID_AMD_STD,
drivers/mtd/chips/jedec_probe.c line 1735
Quoted 10 lines
drivers/mtd/chips/jedec_probe.c +7
-0+ .NumEraseRegions= 4, + .regions = { +ERASEINFO (0x04000 ,1 ), +ERASEINFO (0x02000 ,2 ), +ERASEINFO (0x08000 ,1 ), + ERASEINFO(0x10000,7), + } } };
Sane.
Quoted 5 lines
drivers/mtd/chips/jedec_probe.c +1
-0@@ -1729,6 +1749,14 @@u32 ofs =cfi_build_cmd_addr (0 ,cfi_interleave (cfi), cfi->device_type); mask = (1 << (cfi->device_type *8 )) -1 ; result =map_read (map, base + ofs); +#ifdef CONFIG_MTD_EON
drivers/mtd/chips/jedec_probe.c line 1762
Quoted 10 lines
drivers/mtd/chips/jedec_probe.c +7
-0+if ( (result.x[0 ] & mask) ==0x7f ) { + ofs =cfi_build_cmd_addr (0x100 ,cfi_interleave (cfi), cfi->device_type); + mask = (1 << (cfi->device_type *8 )) -1 ; + result =map_read (map, base + ofs); + } +#endif +return result.x[0 ] & mask; }
Second part of the hack.
Quoted 10 lines
diff -Naur mtd-orig/drivers/mtd/chips/Kconfig mtd/drivers/mtd/chips/Kconfig
drivers/mtd/chips/Kconfig +3
-0@@ -221,6 +221,16 @@ be set to at least 1. This can also be adjusted at driver load time with the retry_cmd_max module parameter. +config MTD_EON + depends on MTD_CFI_AMDSTD + bool "Work-arounds for broken EON chips"
drivers/mtd/chips/Kconfig line 236
Quoted 10 lines
drivers/mtd/chips/Kconfig +7
-0+ help + This option enables workarounds for the broken chips produced + by EON. Chips for which this workaround is necessary include + EN29LV400AB/T and EN29LV800BB/T. If you have such a chip, and + are experiencing problems (eg. incorrect CFI detection), say + 'Y' here. Otherwise you should probably say 'N' here. + config MTD_CFI_STAA tristate "Support for ST (Advanced Architecture) flash chips" depends on MTD_GEN_PROBE
"default n" please.
Jörn
Signature · 4 lines
To recognize individual spam features you have to try to get into the mind of the spammer, and frankly I want to spend as little time inside the minds of spammers as possible. -- Paul Graham