aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2011-05-08 13:48:00 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2011-05-24 21:02:30 -0400
commitaa0846534b9c7238187b4276e83efb9969d4c6e3 (patch)
tree383b75dea9fa0f79862c387fb415a118cd80b8be /drivers/mtd
parent16004f3685541c57a280bae3fde6562256fd0ba5 (diff)
mtd: m25p80: Clean up JEDEC manufacturer checks
Use the manufacturer ID names from cfi.h instead of hard-coding hex constants. Introduce a JEDEC_MFR macro for clarity. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/devices/m25p80.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 15231d6d7012..16adfaa78018 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -27,6 +27,7 @@
27#include <linux/sched.h> 27#include <linux/sched.h>
28#include <linux/mod_devicetable.h> 28#include <linux/mod_devicetable.h>
29 29
30#include <linux/mtd/cfi.h>
30#include <linux/mtd/mtd.h> 31#include <linux/mtd/mtd.h>
31#include <linux/mtd/partitions.h> 32#include <linux/mtd/partitions.h>
32 33
@@ -76,6 +77,8 @@
76#define FAST_READ_DUMMY_BYTE 0 77#define FAST_READ_DUMMY_BYTE 0
77#endif 78#endif
78 79
80#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
81
79/****************************************************************************/ 82/****************************************************************************/
80 83
81struct m25p { 84struct m25p {
@@ -872,9 +875,9 @@ static int __devinit m25p_probe(struct spi_device *spi)
872 * up with the software protection bits set 875 * up with the software protection bits set
873 */ 876 */
874 877
875 if (info->jedec_id >> 16 == 0x1f || 878 if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL ||
876 info->jedec_id >> 16 == 0x89 || 879 JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL ||
877 info->jedec_id >> 16 == 0xbf) { 880 JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) {
878 write_enable(flash); 881 write_enable(flash);
879 write_sr(flash, 0); 882 write_sr(flash, 0);
880 } 883 }
@@ -892,7 +895,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
892 flash->mtd.read = m25p80_read; 895 flash->mtd.read = m25p80_read;
893 896
894 /* sst flash chips use AAI word program */ 897 /* sst flash chips use AAI word program */
895 if (info->jedec_id >> 16 == 0xbf) 898 if (JEDEC_MFR(info->jedec_id) == CFI_MFR_SST)
896 flash->mtd.write = sst_write; 899 flash->mtd.write = sst_write;
897 else 900 else
898 flash->mtd.write = m25p80_write; 901 flash->mtd.write = m25p80_write;