* [PATCH 1/6] mtd: spi-nor: Add quad page program support
@ 2016-08-09 20:40 Jagan Teki
2016-08-09 20:40 ` [PATCH 2/6] mtd: m25p80: Use spi-nor quad page program Jagan Teki
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Jagan Teki @ 2016-08-09 20:40 UTC (permalink / raw)
To: linux-mtd; +Cc: David Woodhouse, linux-kernel, Jagan Teki, Brian Norris
Add quad page program support with the use of nor->flags
and then controller will use 4 lines for data transmission
which is quite faster than page program(02h)
Cc: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
---
drivers/mtd/spi-nor/spi-nor.c | 13 +++++++++++++
include/linux/mtd/spi-nor.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index d0fc165..f88bd7e 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -75,6 +75,7 @@ struct flash_info {
* bit. Must be used with
* SPI_NOR_HAS_LOCK.
*/
+#define SPI_NOR_QUAD_WRITE BIT(10) /* Flash supports Quad Write */
};
#define JEDEC_MFR(info) ((info)->id[0])
@@ -1306,6 +1307,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
struct device *dev = nor->dev;
struct mtd_info *mtd = &nor->mtd;
struct device_node *np = spi_nor_get_flash_node(nor);
+ bool need_quad = false;
int ret;
int i;
@@ -1441,6 +1443,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
return ret;
}
nor->flash_read = SPI_NOR_QUAD;
+ need_quad = true;
} else if (mode == SPI_NOR_DUAL && info->flags & SPI_NOR_DUAL_READ) {
nor->flash_read = SPI_NOR_DUAL;
}
@@ -1465,6 +1468,16 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
}
nor->program_opcode = SPINOR_OP_PP;
+ if (nor->flags == SNOR_F_USE_QPP && info->flags & SPI_NOR_QUAD_WRITE) {
+ if (!need_quad)
+ ret = set_quad_mode(nor, info);
+ if (ret) {
+ dev_err(dev, "quad mode not supported\n");
+ return ret;
+ }
+ }
+ nor->program_opcode = SPINOR_OP_QPP;
+ }
if (info->addr_width)
nor->addr_width = info->addr_width;
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index c425c7b..aa0e6cd 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -46,6 +46,7 @@
#define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */
#define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */
#define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */
+#define SPINOR_OP_QPP 0x32 /* Quad Page program */
#define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */
#define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
#define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */
@@ -119,6 +120,7 @@ enum spi_nor_ops {
enum spi_nor_option_flags {
SNOR_F_USE_FSR = BIT(0),
SNOR_F_HAS_SR_TB = BIT(1),
+ SNOR_F_USE_QPP = BIT(2),
};
/**
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/6] mtd: m25p80: Use spi-nor quad page program
2016-08-09 20:40 [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
@ 2016-08-09 20:40 ` Jagan Teki
2016-08-09 20:40 ` [PATCH 3/6] mtd: spi-nor: Enable QPP for macronix parts Jagan Teki
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Jagan Teki @ 2016-08-09 20:40 UTC (permalink / raw)
To: linux-mtd; +Cc: David Woodhouse, linux-kernel, Jagan Teki, Brian Norris
Identify the 4-wire tx transfer from spi controller mode
value and then assign QPP support to nor->flags to make use
of that.
Cc: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
---
drivers/mtd/devices/m25p80.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 9cf7fcd..1033595 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -224,6 +224,8 @@ static int m25p_probe(struct spi_device *spi)
mode = SPI_NOR_QUAD;
else if (spi->mode & SPI_RX_DUAL)
mode = SPI_NOR_DUAL;
+ else if (spi->mode & SPI_TX_QUAD)
+ nor->flags = SNOR_F_USE_QPP;
if (data && data->name)
nor->mtd.name = data->name;
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/6] mtd: spi-nor: Enable QPP for macronix parts
2016-08-09 20:40 [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
2016-08-09 20:40 ` [PATCH 2/6] mtd: m25p80: Use spi-nor quad page program Jagan Teki
@ 2016-08-09 20:40 ` Jagan Teki
2016-08-09 20:40 ` [PATCH 4/6] mtd: spi-nor: Enable QPP for micron parts Jagan Teki
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Jagan Teki @ 2016-08-09 20:40 UTC (permalink / raw)
To: linux-mtd; +Cc: David Woodhouse, linux-kernel, Jagan Teki, Brian Norris
Enable QPP support for micronix flash parts.
Cc: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
---
drivers/mtd/spi-nor/spi-nor.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index f88bd7e..24a077d 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -870,12 +870,12 @@ static const struct flash_info spi_nor_ids[] = {
{ "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) },
{ "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) },
{ "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) },
- { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
- { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
- { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
- { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
- { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ) },
- { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) },
+ { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, SPI_NOR_QUAD_WRITE) },
+ { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, SPI_NOR_QUAD_WRITE) },
+ { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, SPI_NOR_QUAD_WRITE) },
+ { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, SPI_NOR_QUAD_WRITE) },
+ { "mx66l51235l", INFO(0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
/* Micron */
{ "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) },
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/6] mtd: spi-nor: Enable QPP for micron parts
2016-08-09 20:40 [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
2016-08-09 20:40 ` [PATCH 2/6] mtd: m25p80: Use spi-nor quad page program Jagan Teki
2016-08-09 20:40 ` [PATCH 3/6] mtd: spi-nor: Enable QPP for macronix parts Jagan Teki
@ 2016-08-09 20:40 ` Jagan Teki
2016-08-09 20:40 ` [PATCH 5/6] mtd: spi-nor: Enable QPP for spansion parts Jagan Teki
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Jagan Teki @ 2016-08-09 20:40 UTC (permalink / raw)
To: linux-mtd; +Cc: David Woodhouse, linux-kernel, Jagan Teki, Brian Norris
Enable QPP support for micron flash parts.
Cc: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
---
drivers/mtd/spi-nor/spi-nor.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 24a077d..05596cf 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -878,17 +878,17 @@ static const struct flash_info spi_nor_ids[] = {
{ "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
/* Micron */
- { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) },
- { "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) },
- { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) },
- { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) },
- { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) },
- { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) },
- { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) },
- { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
- { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
- { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
- { "n25q00a", INFO(0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
+ { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "n25q00a", INFO(0x20bb21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
/* PMC */
{ "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/6] mtd: spi-nor: Enable QPP for spansion parts
2016-08-09 20:40 [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
` (2 preceding siblings ...)
2016-08-09 20:40 ` [PATCH 4/6] mtd: spi-nor: Enable QPP for micron parts Jagan Teki
@ 2016-08-09 20:40 ` Jagan Teki
2016-08-09 20:40 ` [PATCH 6/6] mtd: spi-nor: Enable QPP for winbond parts Jagan Teki
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Jagan Teki @ 2016-08-09 20:40 UTC (permalink / raw)
To: linux-mtd; +Cc: David Woodhouse, linux-kernel, Jagan Teki, Brian Norris
Enable QPP support for spansion flash parts.
Cc: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
---
drivers/mtd/spi-nor/spi-nor.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 05596cf..66d6e0b 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -898,17 +898,17 @@ static const struct flash_info spi_nor_ids[] = {
/* Spansion -- single (large) sector size only, at least
* for the chips listed here (without boot sectors).
*/
- { "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
- { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
- { "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) },
- { "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
- { "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
- { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) },
- { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
- { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
- { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) },
- { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
- { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+ { "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, SPI_NOR_QUAD_WRITE) },
+ { "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, SPI_NOR_QUAD_WRITE) },
+ { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, SPI_NOR_QUAD_WRITE) },
+ { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, SPI_NOR_QUAD_WRITE) },
+ { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
+ { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_QUAD_WRITE) },
{ "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) },
{ "s25sl008a", INFO(0x010213, 0, 64 * 1024, 16, 0) },
{ "s25sl016a", INFO(0x010214, 0, 64 * 1024, 32, 0) },
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/6] mtd: spi-nor: Enable QPP for winbond parts
2016-08-09 20:40 [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
` (3 preceding siblings ...)
2016-08-09 20:40 ` [PATCH 5/6] mtd: spi-nor: Enable QPP for spansion parts Jagan Teki
@ 2016-08-09 20:40 ` Jagan Teki
2016-08-29 13:24 ` [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
2016-09-22 15:51 ` Cyrille Pitchen
6 siblings, 0 replies; 10+ messages in thread
From: Jagan Teki @ 2016-08-09 20:40 UTC (permalink / raw)
To: linux-mtd; +Cc: David Woodhouse, linux-kernel, Jagan Teki, Brian Norris
Enable QPP support for winbond flash parts.
Cc: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
---
drivers/mtd/spi-nor/spi-nor.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 66d6e0b..838f6ea 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -981,28 +981,28 @@ static const struct flash_info spi_nor_ids[] = {
{ "w25x80", INFO(0xef3014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) },
{ "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) },
- { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) },
+ { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_QUAD_WRITE) },
{
"w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
- SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+ SPI_NOR_QUAD_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
},
{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
- { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
+ { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_WRITE) },
{
"w25q64dw", INFO(0xef6017, 0, 64 * 1024, 128,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
- SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+ SPI_NOR_QUAD_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
},
{
"w25q128fw", INFO(0xef6018, 0, 64 * 1024, 256,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
- SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
+ SPI_NOR_QUAD_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
},
- { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
- { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
- { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
- { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K) },
+ { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_QUAD_WRITE) },
+ { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_QUAD_WRITE) },
+ { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_WRITE) },
+ { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_WRITE) },
/* Catalyst / On Semiconductor -- non-JEDEC */
{ "cat25c11", CAT25_INFO( 16, 8, 16, 1, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] mtd: spi-nor: Add quad page program support
2016-08-09 20:40 [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
` (4 preceding siblings ...)
2016-08-09 20:40 ` [PATCH 6/6] mtd: spi-nor: Enable QPP for winbond parts Jagan Teki
@ 2016-08-29 13:24 ` Jagan Teki
2016-09-22 14:29 ` Jagan Teki
2016-09-22 15:51 ` Cyrille Pitchen
6 siblings, 1 reply; 10+ messages in thread
From: Jagan Teki @ 2016-08-29 13:24 UTC (permalink / raw)
To: linux-mtd; +Cc: David Woodhouse, linux-kernel, Jagan Teki, Brian Norris
On Wed, Aug 10, 2016 at 2:10 AM, Jagan Teki <jteki@openedev.com> wrote:
> Add quad page program support with the use of nor->flags
> and then controller will use 4 lines for data transmission
> which is quite faster than page program(02h)
>
> Cc: Brian Norris <computersforpeace@gmail.com>
> Signed-off-by: Jagan Teki <jteki@openedev.com>
> ---
> drivers/mtd/spi-nor/spi-nor.c | 13 +++++++++++++
> include/linux/mtd/spi-nor.h | 2 ++
> 2 files changed, 15 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index d0fc165..f88bd7e 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -75,6 +75,7 @@ struct flash_info {
> * bit. Must be used with
> * SPI_NOR_HAS_LOCK.
> */
> +#define SPI_NOR_QUAD_WRITE BIT(10) /* Flash supports Quad Write */
> };
>
> #define JEDEC_MFR(info) ((info)->id[0])
> @@ -1306,6 +1307,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> struct device *dev = nor->dev;
> struct mtd_info *mtd = &nor->mtd;
> struct device_node *np = spi_nor_get_flash_node(nor);
> + bool need_quad = false;
> int ret;
> int i;
>
> @@ -1441,6 +1443,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> return ret;
> }
> nor->flash_read = SPI_NOR_QUAD;
> + need_quad = true;
> } else if (mode == SPI_NOR_DUAL && info->flags & SPI_NOR_DUAL_READ) {
> nor->flash_read = SPI_NOR_DUAL;
> }
> @@ -1465,6 +1468,16 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> }
>
> nor->program_opcode = SPINOR_OP_PP;
> + if (nor->flags == SNOR_F_USE_QPP && info->flags & SPI_NOR_QUAD_WRITE) {
> + if (!need_quad)
> + ret = set_quad_mode(nor, info);
> + if (ret) {
> + dev_err(dev, "quad mode not supported\n");
> + return ret;
> + }
> + }
> + nor->program_opcode = SPINOR_OP_QPP;
> + }
>
> if (info->addr_width)
> nor->addr_width = info->addr_width;
> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> index c425c7b..aa0e6cd 100644
> --- a/include/linux/mtd/spi-nor.h
> +++ b/include/linux/mtd/spi-nor.h
> @@ -46,6 +46,7 @@
> #define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */
> #define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */
> #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */
> +#define SPINOR_OP_QPP 0x32 /* Quad Page program */
> #define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */
> #define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
> #define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */
> @@ -119,6 +120,7 @@ enum spi_nor_ops {
> enum spi_nor_option_flags {
> SNOR_F_USE_FSR = BIT(0),
> SNOR_F_HAS_SR_TB = BIT(1),
> + SNOR_F_USE_QPP = BIT(2),
> };
>
> /**
> --
> 2.7.4
>
Ping!
--
Jagan Teki
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] mtd: spi-nor: Add quad page program support
2016-08-29 13:24 ` [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
@ 2016-09-22 14:29 ` Jagan Teki
2016-09-22 15:37 ` Boris Brezillon
0 siblings, 1 reply; 10+ messages in thread
From: Jagan Teki @ 2016-09-22 14:29 UTC (permalink / raw)
To: linux-mtd, Brian Norris; +Cc: David Woodhouse, linux-kernel, Jagan Teki
On Mon, Aug 29, 2016 at 6:54 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> On Wed, Aug 10, 2016 at 2:10 AM, Jagan Teki <jteki@openedev.com> wrote:
>> Add quad page program support with the use of nor->flags
>> and then controller will use 4 lines for data transmission
>> which is quite faster than page program(02h)
>>
>> Cc: Brian Norris <computersforpeace@gmail.com>
>> Signed-off-by: Jagan Teki <jteki@openedev.com>
>> ---
>> drivers/mtd/spi-nor/spi-nor.c | 13 +++++++++++++
>> include/linux/mtd/spi-nor.h | 2 ++
>> 2 files changed, 15 insertions(+)
>>
>> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
>> index d0fc165..f88bd7e 100644
>> --- a/drivers/mtd/spi-nor/spi-nor.c
>> +++ b/drivers/mtd/spi-nor/spi-nor.c
>> @@ -75,6 +75,7 @@ struct flash_info {
>> * bit. Must be used with
>> * SPI_NOR_HAS_LOCK.
>> */
>> +#define SPI_NOR_QUAD_WRITE BIT(10) /* Flash supports Quad Write */
>> };
>>
>> #define JEDEC_MFR(info) ((info)->id[0])
>> @@ -1306,6 +1307,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
>> struct device *dev = nor->dev;
>> struct mtd_info *mtd = &nor->mtd;
>> struct device_node *np = spi_nor_get_flash_node(nor);
>> + bool need_quad = false;
>> int ret;
>> int i;
>>
>> @@ -1441,6 +1443,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
>> return ret;
>> }
>> nor->flash_read = SPI_NOR_QUAD;
>> + need_quad = true;
>> } else if (mode == SPI_NOR_DUAL && info->flags & SPI_NOR_DUAL_READ) {
>> nor->flash_read = SPI_NOR_DUAL;
>> }
>> @@ -1465,6 +1468,16 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
>> }
>>
>> nor->program_opcode = SPINOR_OP_PP;
>> + if (nor->flags == SNOR_F_USE_QPP && info->flags & SPI_NOR_QUAD_WRITE) {
>> + if (!need_quad)
>> + ret = set_quad_mode(nor, info);
>> + if (ret) {
>> + dev_err(dev, "quad mode not supported\n");
>> + return ret;
>> + }
>> + }
>> + nor->program_opcode = SPINOR_OP_QPP;
>> + }
>>
>> if (info->addr_width)
>> nor->addr_width = info->addr_width;
>> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
>> index c425c7b..aa0e6cd 100644
>> --- a/include/linux/mtd/spi-nor.h
>> +++ b/include/linux/mtd/spi-nor.h
>> @@ -46,6 +46,7 @@
>> #define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */
>> #define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */
>> #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */
>> +#define SPINOR_OP_QPP 0x32 /* Quad Page program */
>> #define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */
>> #define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
>> #define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */
>> @@ -119,6 +120,7 @@ enum spi_nor_ops {
>> enum spi_nor_option_flags {
>> SNOR_F_USE_FSR = BIT(0),
>> SNOR_F_HAS_SR_TB = BIT(1),
>> + SNOR_F_USE_QPP = BIT(2),
>> };
>>
>> /**
>> --
>> 2.7.4
>>
>
> Ping!
Any comments? will resend rebased v2 if it is OK?
thanks!
--
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] mtd: spi-nor: Add quad page program support
2016-09-22 14:29 ` Jagan Teki
@ 2016-09-22 15:37 ` Boris Brezillon
0 siblings, 0 replies; 10+ messages in thread
From: Boris Brezillon @ 2016-09-22 15:37 UTC (permalink / raw)
To: Jagan Teki
Cc: linux-mtd, Brian Norris, Jagan Teki, David Woodhouse,
linux-kernel, Cyrille Pitchen
On Thu, 22 Sep 2016 19:59:13 +0530
Jagan Teki <jagannadh.teki@gmail.com> wrote:
> On Mon, Aug 29, 2016 at 6:54 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> > On Wed, Aug 10, 2016 at 2:10 AM, Jagan Teki <jteki@openedev.com> wrote:
> >> Add quad page program support with the use of nor->flags
> >> and then controller will use 4 lines for data transmission
> >> which is quite faster than page program(02h)
> >>
> >> Cc: Brian Norris <computersforpeace@gmail.com>
> >> Signed-off-by: Jagan Teki <jteki@openedev.com>
> >> ---
> >> drivers/mtd/spi-nor/spi-nor.c | 13 +++++++++++++
> >> include/linux/mtd/spi-nor.h | 2 ++
> >> 2 files changed, 15 insertions(+)
> >>
> >> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> >> index d0fc165..f88bd7e 100644
> >> --- a/drivers/mtd/spi-nor/spi-nor.c
> >> +++ b/drivers/mtd/spi-nor/spi-nor.c
> >> @@ -75,6 +75,7 @@ struct flash_info {
> >> * bit. Must be used with
> >> * SPI_NOR_HAS_LOCK.
> >> */
> >> +#define SPI_NOR_QUAD_WRITE BIT(10) /* Flash supports Quad Write */
> >> };
> >>
> >> #define JEDEC_MFR(info) ((info)->id[0])
> >> @@ -1306,6 +1307,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> >> struct device *dev = nor->dev;
> >> struct mtd_info *mtd = &nor->mtd;
> >> struct device_node *np = spi_nor_get_flash_node(nor);
> >> + bool need_quad = false;
> >> int ret;
> >> int i;
> >>
> >> @@ -1441,6 +1443,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> >> return ret;
> >> }
> >> nor->flash_read = SPI_NOR_QUAD;
> >> + need_quad = true;
> >> } else if (mode == SPI_NOR_DUAL && info->flags & SPI_NOR_DUAL_READ) {
> >> nor->flash_read = SPI_NOR_DUAL;
> >> }
> >> @@ -1465,6 +1468,16 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> >> }
> >>
> >> nor->program_opcode = SPINOR_OP_PP;
> >> + if (nor->flags == SNOR_F_USE_QPP && info->flags & SPI_NOR_QUAD_WRITE) {
> >> + if (!need_quad)
> >> + ret = set_quad_mode(nor, info);
> >> + if (ret) {
> >> + dev_err(dev, "quad mode not supported\n");
> >> + return ret;
> >> + }
> >> + }
> >> + nor->program_opcode = SPINOR_OP_QPP;
> >> + }
> >>
> >> if (info->addr_width)
> >> nor->addr_width = info->addr_width;
> >> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> >> index c425c7b..aa0e6cd 100644
> >> --- a/include/linux/mtd/spi-nor.h
> >> +++ b/include/linux/mtd/spi-nor.h
> >> @@ -46,6 +46,7 @@
> >> #define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */
> >> #define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */
> >> #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */
> >> +#define SPINOR_OP_QPP 0x32 /* Quad Page program */
> >> #define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */
> >> #define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
> >> #define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */
> >> @@ -119,6 +120,7 @@ enum spi_nor_ops {
> >> enum spi_nor_option_flags {
> >> SNOR_F_USE_FSR = BIT(0),
> >> SNOR_F_HAS_SR_TB = BIT(1),
> >> + SNOR_F_USE_QPP = BIT(2),
> >> };
> >>
> >> /**
> >> --
> >> 2.7.4
> >>
> >
> > Ping!
>
> Any comments? will resend rebased v2 if it is OK?
Did you look at Cyrille's work [1]?
It seems you're trying to support the same kind of features.
Can you sync with him?
[1]http://lkml.iu.edu/hypermail/linux/kernel/1606.2/03302.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] mtd: spi-nor: Add quad page program support
2016-08-09 20:40 [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
` (5 preceding siblings ...)
2016-08-29 13:24 ` [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
@ 2016-09-22 15:51 ` Cyrille Pitchen
6 siblings, 0 replies; 10+ messages in thread
From: Cyrille Pitchen @ 2016-09-22 15:51 UTC (permalink / raw)
To: Jagan Teki, linux-mtd; +Cc: Brian Norris, David Woodhouse, linux-kernel
Hi Jagan,
The support of Quad Page Program is already addressed by the series for
SPI x-2-2 and x-4-4 protocols and SFDP parsing:
http://lists.infradead.org/pipermail/linux-mtd/2016-June/068212.html
especially patch 5 and 9
http://lists.infradead.org/pipermail/linux-mtd/2016-June/068217.html
http://lists.infradead.org/pipermail/linux-mtd/2016-June/068220.html
Since then, I've tested the series with a small bug fix in
spi_nor_init_params() for the SPI_NOR_NO_FR case:
/* (Fast) Read settings. */
- params->rd_modes = SNOR_MODE_1_1_1;
- spi_nor_set_read_settings(¶ms->reads[SNOR_PINDEX_1_1_1],
- 0, 8, SPINOR_OP_READ_FAST);
- if (!(info->flags & SPI_NOR_NO_FR)) {
- params->rd_modes |= SNOR_MODE_SLOW;
- spi_nor_set_read_settings(¶ms->reads[SNOR_PINDEX_SLOW],
- 0, 0, SPINOR_OP_READ);
- }
+ params->rd_modes = SNOR_MODE_SLOW;
+ spi_nor_set_read_settings(¶ms->reads[SNOR_PINDEX_SLOW],
+ 0, 0, SPINOR_OP_READ);
+ if (!(info->flags & SPI_NOR_NO_FR)) {
+ params->rd_modes |= SNOR_MODE_1_1_1;
+ spi_nor_set_read_settings(¶ms->reads[SNOR_PINDEX_1_1_1],
+ 0, 8, SPINOR_OP_READ_FAST);
+ }
I've tested it with more memory samples (Micron, Spansion, Macronix, SST)
and it seems reliable so I should send a new version soon.
Best regards,
Cyrille
Le 09/08/2016 à 22:40, Jagan Teki a écrit :
> Add quad page program support with the use of nor->flags
> and then controller will use 4 lines for data transmission
> which is quite faster than page program(02h)
>
> Cc: Brian Norris <computersforpeace@gmail.com>
> Signed-off-by: Jagan Teki <jteki@openedev.com>
> ---
> drivers/mtd/spi-nor/spi-nor.c | 13 +++++++++++++
> include/linux/mtd/spi-nor.h | 2 ++
> 2 files changed, 15 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index d0fc165..f88bd7e 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -75,6 +75,7 @@ struct flash_info {
> * bit. Must be used with
> * SPI_NOR_HAS_LOCK.
> */
> +#define SPI_NOR_QUAD_WRITE BIT(10) /* Flash supports Quad Write */
> };
>
> #define JEDEC_MFR(info) ((info)->id[0])
> @@ -1306,6 +1307,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> struct device *dev = nor->dev;
> struct mtd_info *mtd = &nor->mtd;
> struct device_node *np = spi_nor_get_flash_node(nor);
> + bool need_quad = false;
> int ret;
> int i;
>
> @@ -1441,6 +1443,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> return ret;
> }
> nor->flash_read = SPI_NOR_QUAD;
> + need_quad = true;
> } else if (mode == SPI_NOR_DUAL && info->flags & SPI_NOR_DUAL_READ) {
> nor->flash_read = SPI_NOR_DUAL;
> }
> @@ -1465,6 +1468,16 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
> }
>
> nor->program_opcode = SPINOR_OP_PP;
> + if (nor->flags == SNOR_F_USE_QPP && info->flags & SPI_NOR_QUAD_WRITE) {
> + if (!need_quad)
> + ret = set_quad_mode(nor, info);
> + if (ret) {
> + dev_err(dev, "quad mode not supported\n");
> + return ret;
> + }
> + }
> + nor->program_opcode = SPINOR_OP_QPP;
> + }
>
> if (info->addr_width)
> nor->addr_width = info->addr_width;
> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> index c425c7b..aa0e6cd 100644
> --- a/include/linux/mtd/spi-nor.h
> +++ b/include/linux/mtd/spi-nor.h
> @@ -46,6 +46,7 @@
> #define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */
> #define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */
> #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */
> +#define SPINOR_OP_QPP 0x32 /* Quad Page program */
> #define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */
> #define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
> #define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */
> @@ -119,6 +120,7 @@ enum spi_nor_ops {
> enum spi_nor_option_flags {
> SNOR_F_USE_FSR = BIT(0),
> SNOR_F_HAS_SR_TB = BIT(1),
> + SNOR_F_USE_QPP = BIT(2),
> };
>
> /**
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-09-22 15:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-09 20:40 [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
2016-08-09 20:40 ` [PATCH 2/6] mtd: m25p80: Use spi-nor quad page program Jagan Teki
2016-08-09 20:40 ` [PATCH 3/6] mtd: spi-nor: Enable QPP for macronix parts Jagan Teki
2016-08-09 20:40 ` [PATCH 4/6] mtd: spi-nor: Enable QPP for micron parts Jagan Teki
2016-08-09 20:40 ` [PATCH 5/6] mtd: spi-nor: Enable QPP for spansion parts Jagan Teki
2016-08-09 20:40 ` [PATCH 6/6] mtd: spi-nor: Enable QPP for winbond parts Jagan Teki
2016-08-29 13:24 ` [PATCH 1/6] mtd: spi-nor: Add quad page program support Jagan Teki
2016-09-22 14:29 ` Jagan Teki
2016-09-22 15:37 ` Boris Brezillon
2016-09-22 15:51 ` Cyrille Pitchen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.