|
|
|
@ -234,7 +234,7 @@
|
|
|
|
|
spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_ERASE);
|
|
|
|
|
|
|
|
|
|
instr->state = MTD_ERASE_DONE;
|
|
|
|
|
@@ -341,11 +380,6 @@ static int spi_nor_lock(struct mtd_info
|
|
|
|
|
@@ -341,11 +380,6 @@ static int spi_nor_lock(struct mtd_info
|
|
|
|
|
if (ret)
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
@ -333,7 +333,7 @@
|
|
|
|
|
/* GigaDevice */
|
|
|
|
|
{ "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) },
|
|
|
|
|
{ "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) },
|
|
|
|
|
@@ -532,6 +560,7 @@ static const struct spi_device_id spi_no
|
|
|
|
|
@@ -536,6 +564,7 @@ static const struct spi_device_id spi_no
|
|
|
|
|
{ "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) },
|
|
|
|
|
|
|
|
|
|
/* Micron */
|
|
|
|
@ -341,7 +341,7 @@
|
|
|
|
|
{ "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, 0) },
|
|
|
|
|
{ "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, 0) },
|
|
|
|
|
{ "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, 0) },
|
|
|
|
|
@@ -556,6 +585,7 @@ static const struct spi_device_id spi_no
|
|
|
|
|
@@ -560,6 +589,7 @@ static const struct spi_device_id spi_no
|
|
|
|
|
{ "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) },
|
|
|
|
|
{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
|
|
|
|
|
{ "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
|
|
|
|
@ -349,7 +349,7 @@
|
|
|
|
|
{ "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, 0) },
|
|
|
|
|
{ "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, 0) },
|
|
|
|
|
{ "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) },
|
|
|
|
|
@@ -577,6 +607,7 @@ static const struct spi_device_id spi_no
|
|
|
|
|
@@ -581,6 +611,7 @@ static const struct spi_device_id spi_no
|
|
|
|
|
{ "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE) },
|
|
|
|
|
{ "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE) },
|
|
|
|
|
{ "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) },
|
|
|
|
@ -357,7 +357,7 @@
|
|
|
|
|
|
|
|
|
|
/* ST Microelectronics -- newer production may have feature updates */
|
|
|
|
|
{ "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) },
|
|
|
|
|
@@ -588,7 +619,6 @@ static const struct spi_device_id spi_no
|
|
|
|
|
@@ -592,7 +623,6 @@ static const struct spi_device_id spi_no
|
|
|
|
|
{ "m25p32", INFO(0x202016, 0, 64 * 1024, 64, 0) },
|
|
|
|
|
{ "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) },
|
|
|
|
|
{ "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) },
|
|
|
|
@ -365,7 +365,7 @@
|
|
|
|
|
|
|
|
|
|
{ "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) },
|
|
|
|
|
{ "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) },
|
|
|
|
|
@@ -644,32 +674,24 @@ static const struct spi_device_id spi_no
|
|
|
|
|
@@ -648,32 +678,24 @@ static const struct spi_device_id spi_no
|
|
|
|
|
static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
|
|
|
|
|
{
|
|
|
|
|
int tmp;
|
|
|
|
@ -404,7 +404,7 @@
|
|
|
|
|
return ERR_PTR(-ENODEV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -704,11 +726,6 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
@@ -708,11 +730,6 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
if (ret)
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
@ -416,7 +416,7 @@
|
|
|
|
|
write_enable(nor);
|
|
|
|
|
|
|
|
|
|
nor->sst_write_second = false;
|
|
|
|
|
@@ -720,7 +737,7 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
@@ -724,7 +741,7 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
|
|
|
|
|
/* write one byte. */
|
|
|
|
|
nor->write(nor, to, 1, retlen, buf);
|
|
|
|
@ -425,7 +425,7 @@
|
|
|
|
|
if (ret)
|
|
|
|
|
goto time_out;
|
|
|
|
|
}
|
|
|
|
|
@@ -732,7 +749,7 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
@@ -736,7 +753,7 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
|
|
|
|
|
/* write two bytes. */
|
|
|
|
|
nor->write(nor, to, 2, retlen, buf + actual);
|
|
|
|
@ -434,7 +434,7 @@
|
|
|
|
|
if (ret)
|
|
|
|
|
goto time_out;
|
|
|
|
|
to += 2;
|
|
|
|
|
@@ -741,7 +758,7 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
@@ -745,7 +762,7 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
nor->sst_write_second = false;
|
|
|
|
|
|
|
|
|
|
write_disable(nor);
|
|
|
|
@ -443,7 +443,7 @@
|
|
|
|
|
if (ret)
|
|
|
|
|
goto time_out;
|
|
|
|
|
|
|
|
|
|
@@ -752,7 +769,7 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
@@ -756,7 +773,7 @@ static int sst_write(struct mtd_info *mt
|
|
|
|
|
nor->program_opcode = SPINOR_OP_BP;
|
|
|
|
|
nor->write(nor, to, 1, retlen, buf + actual);
|
|
|
|
|
|
|
|
|
@ -452,7 +452,7 @@
|
|
|
|
|
if (ret)
|
|
|
|
|
goto time_out;
|
|
|
|
|
write_disable(nor);
|
|
|
|
|
@@ -780,11 +797,6 @@ static int spi_nor_write(struct mtd_info
|
|
|
|
|
@@ -784,11 +801,6 @@ static int spi_nor_write(struct mtd_info
|
|
|
|
|
if (ret)
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
@ -464,7 +464,7 @@
|
|
|
|
|
write_enable(nor);
|
|
|
|
|
|
|
|
|
|
page_offset = to & (nor->page_size - 1);
|
|
|
|
|
@@ -803,16 +815,20 @@ static int spi_nor_write(struct mtd_info
|
|
|
|
|
@@ -807,16 +819,20 @@ static int spi_nor_write(struct mtd_info
|
|
|
|
|
if (page_size > nor->page_size)
|
|
|
|
|
page_size = nor->page_size;
|
|
|
|
|
|
|
|
|
@ -487,7 +487,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int macronix_quad_enable(struct spi_nor *nor)
|
|
|
|
|
@@ -825,7 +841,7 @@ static int macronix_quad_enable(struct s
|
|
|
|
|
@@ -829,7 +845,7 @@ static int macronix_quad_enable(struct s
|
|
|
|
|
nor->cmd_buf[0] = val | SR_QUAD_EN_MX;
|
|
|
|
|
nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0);
|
|
|
|
|
|
|
|
|
@ -496,7 +496,7 @@
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
ret = read_sr(nor);
|
|
|
|
|
@@ -875,11 +891,11 @@ static int spansion_quad_enable(struct s
|
|
|
|
|
@@ -879,11 +895,11 @@ static int spansion_quad_enable(struct s
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -510,7 +510,7 @@
|
|
|
|
|
case CFI_MFR_MACRONIX:
|
|
|
|
|
status = macronix_quad_enable(nor);
|
|
|
|
|
if (status) {
|
|
|
|
|
@@ -905,11 +921,6 @@ static int spi_nor_check(struct spi_nor
|
|
|
|
|
@@ -909,11 +925,6 @@ static int spi_nor_check(struct spi_nor
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -522,7 +522,7 @@
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -927,16 +938,24 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
@@ -931,16 +942,24 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
if (ret)
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
@ -551,7 +551,7 @@
|
|
|
|
|
if (IS_ERR(jid)) {
|
|
|
|
|
return PTR_ERR(jid);
|
|
|
|
|
} else if (jid != id) {
|
|
|
|
|
@@ -961,9 +980,9 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
@@ -965,9 +984,9 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
* up with the software protection bits set
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
@ -564,7 +564,7 @@
|
|
|
|
|
write_enable(nor);
|
|
|
|
|
write_sr(nor, 0);
|
|
|
|
|
}
|
|
|
|
|
@@ -978,7 +997,7 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
@@ -982,7 +1001,7 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
mtd->_read = spi_nor_read;
|
|
|
|
|
|
|
|
|
|
/* nor protection support for STmicro chips */
|
|
|
|
@ -573,7 +573,7 @@
|
|
|
|
|
mtd->_lock = spi_nor_lock;
|
|
|
|
|
mtd->_unlock = spi_nor_unlock;
|
|
|
|
|
}
|
|
|
|
|
@@ -989,9 +1008,8 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
@@ -993,9 +1012,8 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
else
|
|
|
|
|
mtd->_write = spi_nor_write;
|
|
|
|
|
|
|
|
|
@ -585,7 +585,7 @@
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
|
|
|
|
|
/* prefer "small sector" erase if possible */
|
|
|
|
|
@@ -1032,7 +1050,7 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
@@ -1036,7 +1054,7 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
|
|
|
|
|
/* Quad/Dual-read mode takes precedence over fast/normal */
|
|
|
|
|
if (mode == SPI_NOR_QUAD && info->flags & SPI_NOR_QUAD_READ) {
|
|
|
|
@ -594,7 +594,7 @@
|
|
|
|
|
if (ret) {
|
|
|
|
|
dev_err(dev, "quad mode not supported\n");
|
|
|
|
|
return ret;
|
|
|
|
|
@@ -1068,7 +1086,7 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
@@ -1072,7 +1090,7 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
else if (mtd->size > 0x1000000) {
|
|
|
|
|
/* enable 4-byte addressing if the device exceeds 16MiB */
|
|
|
|
|
nor->addr_width = 4;
|
|
|
|
@ -603,7 +603,7 @@
|
|
|
|
|
/* Dedicated 4-byte command set */
|
|
|
|
|
switch (nor->flash_read) {
|
|
|
|
|
case SPI_NOR_QUAD:
|
|
|
|
|
@@ -1089,7 +1107,7 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
@@ -1093,7 +1111,7 @@ int spi_nor_scan(struct spi_nor *nor, co
|
|
|
|
|
nor->erase_opcode = SPINOR_OP_SE_4B;
|
|
|
|
|
mtd->erasesize = info->sector_size;
|
|
|
|
|
} else
|
|
|
|
|