Fixes to support ST 29W320DB in cfi_cmdset_002
PATCH 1/1 Fixes to support ST 29W320DB in cfi_cmdset_002
We have an embedded Linux product which uses an ST 29W320DB flash part. To get this to work we needed to make the changes below to the driver.
- Turned off the AMD_BOOTLOC_BUG fix. This chip matches the bug test criteria in the code which was then swapping the sectors. This chip does not suffer from this bug so it it doesn't work with the bug fix enabled. It would be a good idea to make the bug test criteria test against a specific list of vendor & deviceid's which chips require the bug fix the current check is too broad. Unfortunately the present fix does not provide enough information to create this list.
- Added a 3-byte reset sequence in addition to the normal 1-byte command. The documentation for the chip suggests that the 1-byte command should work, but the chip gets left in the id-mode after the probe. Hopefully this extra reset should not cause problems for any other devices.
Jon Burgess
mtd/chips/cfi_cmdset_0002.c Wed Jul 17 13:51:48 2002 renamed from mtd/chips/cfi_cmdset_0002.c~ Tue Nov 6 07:56:00 2001 +2 -1
@@ -26,7 +26,8 @@ #include <linux/mtd/map.h> #include <linux/mtd/cfi.h> -#define AMD_BOOTLOC_BUG +/* This bug work around doesn't seem necessary and breaks ST 29W320DB */ +#undef AMD_BOOTLOC_BUG static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int cfi_amdstd_write(struct mtd_info *, loff_t, size_t, size_t *, constu_char *);
@@ -137,7 +138,12 @@
map->fldrv = &cfi_amdstd_chipdrv;
MOD_INC_USE_COUNT;+ /* Short reset command */
cfi_send_gen_cmd(0xf0, 0x55, base, map, cfi, cfi->device_type, NULL);
+ /* Longer reset command - ST 29W320DB flash device seems to require this */
+ cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL);
+ cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL);
+ cfi_send_gen_cmd(0xf0, 0x555, base, map, cfi, cfi->device_type, NULL);
return cfi_amdstd_setup(map);}
(See attached file: cfi-sst.patch)
drivers/mtd/chips/cfi_cmdset_0002.c renamed from drivers/mtd/chips/cfi_cmdset_0002.c~ +7 -1
@@ -26,7 +26,8 @@#include <linux/mtd/map.h> #include <linux/mtd/cfi.h> -#define AMD_BOOTLOC_BUG +/* This bug work around doesn't seem necessary and breaks ST 29W320DB */ +#undef AMD_BOOTLOC_BUGstatic int cfi_amdstd_read (struct mtd_info *,loff_t ,size_t ,size_t *,u_char *);static int cfi_amdstd_write (struct mtd_info *,loff_t ,size_t ,size_t *,const u_char *);
@@ -137,7 +138,12 @@ map->fldrv = &cfi_amdstd_chipdrv;MOD_INC_USE_COUNT ; +/* Short reset command */ cfi_send_gen_cmd (0xf0 ,0x55 , base, map, cfi, cfi->device_type,NULL ); +/* Longer reset command - ST 29W320DB flash device seems to require this */ +cfi_send_gen_cmd (0xaa ,0x555 , base, map, cfi, cfi->device_type,NULL ); +cfi_send_gen_cmd (0x55 ,0x2aa , base, map, cfi, cfi->device_type,NULL ); +cfi_send_gen_cmd (0xf0 ,0x555 , base, map, cfi, cfi->device_type,NULL );return cfi_amdstd_setup (map); }