diff options
author | Krzysztof Mazur <krzysiek@podlesie.net> | 2013-02-22 09:51:05 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2013-04-05 07:24:39 -0400 |
commit | e534ee4f9ca29fdb38eea4b0c53f2154fbd8c1ee (patch) | |
tree | 30380bb99c78f964da11d2ec090d19cb27e626c5 /drivers/mtd/devices/m25p80.c | |
parent | 05ff8c258c76dd469232a03ec8d45f7e7267e0ac (diff) |
mtd: m25p80: introduce SST_WRITE flag for SST byte programming
Not all SST devices implement the SST byte programming command.
Some devices (like SST25VF064C) implement only standard m25p80 page
write command.
Now SPI flash devices that need sst_write() are explicitly marked
with new SST_WRITE flag and the decision to use sst_write() is based
on this flag instead of manufacturer id.
Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/devices/m25p80.c')
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 45f143ac5b93..2d0d7d35d8dc 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -681,6 +681,7 @@ struct flash_info { | |||
681 | u16 flags; | 681 | u16 flags; |
682 | #define SECT_4K 0x01 /* OPCODE_BE_4K works uniformly */ | 682 | #define SECT_4K 0x01 /* OPCODE_BE_4K works uniformly */ |
683 | #define M25P_NO_ERASE 0x02 /* No erase command needed */ | 683 | #define M25P_NO_ERASE 0x02 /* No erase command needed */ |
684 | #define SST_WRITE 0x04 /* use SST byte programming */ | ||
684 | }; | 685 | }; |
685 | 686 | ||
686 | #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ | 687 | #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ |
@@ -783,14 +784,14 @@ static const struct spi_device_id m25p_ids[] = { | |||
783 | { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, | 784 | { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) }, |
784 | 785 | ||
785 | /* SST -- large erase sizes are "overlays", "sectors" are 4K */ | 786 | /* SST -- large erase sizes are "overlays", "sectors" are 4K */ |
786 | { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K) }, | 787 | { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, |
787 | { "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, SECT_4K) }, | 788 | { "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, SECT_4K | SST_WRITE) }, |
788 | { "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, SECT_4K) }, | 789 | { "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, SECT_4K | SST_WRITE) }, |
789 | { "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, SECT_4K) }, | 790 | { "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, SECT_4K | SST_WRITE) }, |
790 | { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, SECT_4K) }, | 791 | { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE) }, |
791 | { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, SECT_4K) }, | 792 | { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE) }, |
792 | { "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, SECT_4K) }, | 793 | { "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE) }, |
793 | { "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, SECT_4K) }, | 794 | { "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, |
794 | 795 | ||
795 | /* ST Microelectronics -- newer production may have feature updates */ | 796 | /* ST Microelectronics -- newer production may have feature updates */ |
796 | { "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) }, | 797 | { "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) }, |
@@ -1002,7 +1003,7 @@ static int m25p_probe(struct spi_device *spi) | |||
1002 | } | 1003 | } |
1003 | 1004 | ||
1004 | /* sst flash chips use AAI word program */ | 1005 | /* sst flash chips use AAI word program */ |
1005 | if (JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) | 1006 | if (info->flags & SST_WRITE) |
1006 | flash->mtd._write = sst_write; | 1007 | flash->mtd._write = sst_write; |
1007 | else | 1008 | else |
1008 | flash->mtd._write = m25p80_write; | 1009 | flash->mtd._write = m25p80_write; |