Commit aa084653 authored by Kevin Cernekee's avatar Kevin Cernekee Committed by David Woodhouse

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: default avatarKevin Cernekee <cernekee@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 16004f36
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/mtd/cfi.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
...@@ -76,6 +77,8 @@ ...@@ -76,6 +77,8 @@
#define FAST_READ_DUMMY_BYTE 0 #define FAST_READ_DUMMY_BYTE 0
#endif #endif
#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
/****************************************************************************/ /****************************************************************************/
struct m25p { struct m25p {
...@@ -872,9 +875,9 @@ static int __devinit m25p_probe(struct spi_device *spi) ...@@ -872,9 +875,9 @@ static int __devinit m25p_probe(struct spi_device *spi)
* up with the software protection bits set * up with the software protection bits set
*/ */
if (info->jedec_id >> 16 == 0x1f || if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL ||
info->jedec_id >> 16 == 0x89 || JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL ||
info->jedec_id >> 16 == 0xbf) { JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) {
write_enable(flash); write_enable(flash);
write_sr(flash, 0); write_sr(flash, 0);
} }
...@@ -892,7 +895,7 @@ static int __devinit m25p_probe(struct spi_device *spi) ...@@ -892,7 +895,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
flash->mtd.read = m25p80_read; flash->mtd.read = m25p80_read;
/* sst flash chips use AAI word program */ /* sst flash chips use AAI word program */
if (info->jedec_id >> 16 == 0xbf) if (JEDEC_MFR(info->jedec_id) == CFI_MFR_SST)
flash->mtd.write = sst_write; flash->mtd.write = sst_write;
else else
flash->mtd.write = m25p80_write; flash->mtd.write = m25p80_write;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment