* [PATCH 1/5] m25p80,spi-nor: Fix module aliases for m25p80
[not found] ` <1410714624.3040.38.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
@ 2014-09-14 17:11 ` Ben Hutchings
[not found] ` <1410714670.3040.39.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
2014-09-14 17:11 ` [PATCH 2/5] spi-nor: Remove spi_nor::read_id operation Ben Hutchings
` (5 subsequent siblings)
6 siblings, 1 reply; 25+ messages in thread
From: Ben Hutchings @ 2014-09-14 17:11 UTC (permalink / raw)
To: Brian Norris
Cc: Geert Uytterhoeven, Andrew Lunn, Jason Cooper, linux-spi,
Huang Shijie, MTD Maling List, Ian Campbell, debian-kernel,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 6476 bytes --]
m25p80's device ID table is now spi_nor_ids, defined in spi-nor. The
MODULE_DEVICE_TABLE() macro doesn't work with extern definitions, but
its use was also removed at the same time. Now if m25p80 is built as
a module it doesn't get the necessary aliases to be loaded
automatically.
A clean solution to this will involve defining the list of device
IDs in spi-nor.h and removing struct spi_device_id from the spi-nor
API, but this is quite a large change.
As a quick fix suitable for stable, copy the device IDs back into
m25p80.
Fixes: 03e296f613af ("mtd: m25p80: use the SPI nor framework")
Cc: stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # 3.16
Signed-off-by: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
---
drivers/mtd/devices/m25p80.c | 58 +++++++++++++++++++++++++++++++++++++++++--
drivers/mtd/spi-nor/spi-nor.c | 5 ++--
include/linux/mtd/spi-nor.h | 3 +--
3 files changed, 59 insertions(+), 7 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index ed7e0a1b..3f0fe86 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -196,6 +196,7 @@ static int m25p_probe(struct spi_device *spi)
struct m25p *flash;
struct spi_nor *nor;
enum read_mode mode = SPI_NOR_NORMAL;
+ const struct spi_device_id *id;
int ret;
flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL);
@@ -223,7 +224,10 @@ static int m25p_probe(struct spi_device *spi)
mode = SPI_NOR_QUAD;
else if (spi->mode & SPI_RX_DUAL)
mode = SPI_NOR_DUAL;
- ret = spi_nor_scan(nor, spi_get_device_id(spi), mode);
+ id = spi_nor_match_id(spi_get_device_id(spi)->name);
+ if (WARN_ON(!id))
+ return -ENODEV;
+ ret = spi_nor_scan(nor, id, mode);
if (ret)
return ret;
@@ -245,12 +249,62 @@ static int m25p_remove(struct spi_device *spi)
}
+/*
+ * XXX This needs to be kept in sync with spi_nor_ids. We can't share
+ * it with spi-nor, because if this is built as a module then modpost
+ * won't be able to read it and add appropriate aliases.
+ */
+static const struct spi_device_id m25p_ids[] = {
+ {"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"},
+ {"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"},
+ {"at26df321"}, {"at45db081d"},
+ {"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"},
+ {"en25q64"}, {"en25qh128"}, {"en25qh256"},
+ {"f25l32pa"},
+ {"mr25h256"}, {"mr25h10"},
+ {"gd25q32"}, {"gd25q64"},
+ {"160s33b"}, {"320s33b"}, {"640s33b"},
+ {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"},
+ {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"},
+ {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"},
+ {"mx66l1g55g"},
+ {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"},
+ {"n25q512a"}, {"n25q512ax3"}, {"n25q00"},
+ {"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"},
+ {"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"},
+ {"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"},
+ {"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"},
+ {"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"},
+ {"s25fl016k"}, {"s25fl064k"},
+ {"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"},
+ {"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"},
+ {"sst25wf040"},
+ {"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"},
+ {"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"},
+ {"m25p128"}, {"n25q032"},
+ {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"},
+ {"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"},
+ {"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"},
+ {"m45pe10"}, {"m45pe80"}, {"m45pe16"},
+ {"m25pe20"}, {"m25pe80"}, {"m25pe16"},
+ {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"},
+ {"m25px64"},
+ {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"},
+ {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"},
+ {"w25x64"}, {"w25q64"}, {"w25q128"}, {"w25q80"},
+ {"w25q80bl"}, {"w25q128"}, {"w25q256"}, {"cat25c11"},
+ {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"},
+ { },
+};
+MODULE_DEVICE_TABLE(spi, m25p_ids);
+
+
static struct spi_driver m25p80_driver = {
.driver = {
.name = "m25p80",
.owner = THIS_MODULE,
},
- .id_table = spi_nor_ids,
+ .id_table = m25p_ids,
.probe = m25p_probe,
.remove = m25p_remove,
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 03e0ab8..6b1bda2 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -473,7 +473,7 @@ struct flash_info {
* more nor chips. This current list focusses on newer chips, which
* have been converging on command sets which including JEDEC ID.
*/
-const struct spi_device_id spi_nor_ids[] = {
+static const struct spi_device_id spi_nor_ids[] = {
/* Atmel -- some are (confusingly) marketed as "DataFlash" */
{ "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
{ "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
@@ -637,7 +637,6 @@ const struct spi_device_id spi_nor_ids[] = {
{ "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
{ },
};
-EXPORT_SYMBOL_GPL(spi_nor_ids);
static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
{
@@ -1136,7 +1135,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
}
EXPORT_SYMBOL_GPL(spi_nor_scan);
-const struct spi_device_id *spi_nor_match_id(char *name)
+const struct spi_device_id *spi_nor_match_id(const char *name)
{
const struct spi_device_id *id = spi_nor_ids;
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 9e6294f..5ec84cc 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -201,7 +201,6 @@ struct spi_nor {
*/
int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
enum read_mode mode);
-extern const struct spi_device_id spi_nor_ids[];
/**
* spi_nor_match_id() - find the spi_device_id by the name
@@ -213,6 +212,6 @@ extern const struct spi_device_id spi_nor_ids[];
* Return: returns the right spi_device_id pointer on success,
* and returns NULL on failure.
*/
-const struct spi_device_id *spi_nor_match_id(char *name);
+const struct spi_device_id *spi_nor_match_id(const char *name);
#endif
--
Ben Hutchings
The world is coming to an end. Please log off.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 2/5] spi-nor: Remove spi_nor::read_id operation
[not found] ` <1410714624.3040.38.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
2014-09-14 17:11 ` [PATCH 1/5] m25p80,spi-nor: Fix module aliases for m25p80 Ben Hutchings
@ 2014-09-14 17:11 ` Ben Hutchings
[not found] ` <1410714676.3040.40.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
2014-09-14 17:11 ` [PATCH 3/5] spi-nor: Make spi_nor_scan() take a chip type name, not an spi_device_id Ben Hutchings
` (4 subsequent siblings)
6 siblings, 1 reply; 25+ messages in thread
From: Ben Hutchings @ 2014-09-14 17:11 UTC (permalink / raw)
To: Brian Norris
Cc: Geert Uytterhoeven, Andrew Lunn, Jason Cooper, linux-spi,
Huang Shijie, MTD Maling List, Ian Campbell, debian-kernel,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 2277 bytes --]
There is currently no useful way to override the default
implementation of this operation. The returned struct spi_device_id
must have a pointer to struct flash_info in its private data, but this
structure is defined inside spi-nor.
Signed-off-by: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
---
drivers/mtd/spi-nor/spi-nor.c | 4 +---
include/linux/mtd/spi-nor.h | 3 ---
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 6b1bda2..6f699c5 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -902,8 +902,6 @@ static int spi_nor_check(struct spi_nor *nor)
return -EINVAL;
}
- if (!nor->read_id)
- nor->read_id = spi_nor_read_id;
if (!nor->wait_till_ready)
nor->wait_till_ready = spi_nor_wait_till_ready;
@@ -952,7 +950,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
if (info->jedec_id) {
const struct spi_device_id *jid;
- jid = nor->read_id(nor);
+ jid = spi_nor_read_id(nor);
if (IS_ERR(jid)) {
return PTR_ERR(jid);
} else if (jid != id) {
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 5ec84cc..66af67a 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -139,8 +139,6 @@ enum spi_nor_ops {
* @write_xfer: [OPTIONAL] the writefundamental primitive
* @read_reg: [DRIVER-SPECIFIC] read out the register
* @write_reg: [DRIVER-SPECIFIC] write data to the register
- * @read_id: [REPLACEABLE] read out the ID data, and find
- * the proper spi_device_id
* @wait_till_ready: [REPLACEABLE] wait till the NOR becomes ready
* @read: [DRIVER-SPECIFIC] read data from the SPI NOR
* @write: [DRIVER-SPECIFIC] write data to the SPI NOR
@@ -172,7 +170,6 @@ struct spi_nor {
int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len,
int write_enable);
- const struct spi_device_id *(*read_id)(struct spi_nor *nor);
int (*wait_till_ready)(struct spi_nor *nor);
int (*read)(struct spi_nor *nor, loff_t from,
--
Ben Hutchings
The world is coming to an end. Please log off.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 3/5] spi-nor: Make spi_nor_scan() take a chip type name, not an spi_device_id
[not found] ` <1410714624.3040.38.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
2014-09-14 17:11 ` [PATCH 1/5] m25p80,spi-nor: Fix module aliases for m25p80 Ben Hutchings
2014-09-14 17:11 ` [PATCH 2/5] spi-nor: Remove spi_nor::read_id operation Ben Hutchings
@ 2014-09-14 17:11 ` Ben Hutchings
2014-09-14 17:11 ` [PATCH 4/5] spi-nor: Replace struct spi_device_id with struct flash_info Ben Hutchings
` (3 subsequent siblings)
6 siblings, 0 replies; 25+ messages in thread
From: Ben Hutchings @ 2014-09-14 17:11 UTC (permalink / raw)
To: Brian Norris
Cc: Geert Uytterhoeven, Andrew Lunn, Jason Cooper, linux-spi,
Huang Shijie, MTD Maling List, Ian Campbell, debian-kernel,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 6211 bytes --]
Drivers currently call spi_nor_match_id() and then spi_nor_scan().
This adds a dependency on struct spi_device_id which we want to
avoid. Make spi_nor_scan() do it for them.
Signed-off-by: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
---
drivers/mtd/devices/m25p80.c | 6 +-----
drivers/mtd/spi-nor/fsl-quadspi.c | 7 +------
drivers/mtd/spi-nor/spi-nor.c | 29 +++++++++++++----------------
include/linux/mtd/spi-nor.h | 21 ++++-----------------
4 files changed, 19 insertions(+), 44 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 3f0fe86..b547c39 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -196,7 +196,6 @@ static int m25p_probe(struct spi_device *spi)
struct m25p *flash;
struct spi_nor *nor;
enum read_mode mode = SPI_NOR_NORMAL;
- const struct spi_device_id *id;
int ret;
flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL);
@@ -224,10 +223,7 @@ static int m25p_probe(struct spi_device *spi)
mode = SPI_NOR_QUAD;
else if (spi->mode & SPI_RX_DUAL)
mode = SPI_NOR_DUAL;
- id = spi_nor_match_id(spi_get_device_id(spi)->name);
- if (WARN_ON(!id))
- return -ENODEV;
- ret = spi_nor_scan(nor, id, mode);
+ ret = spi_nor_scan(nor, spi_get_device_id(spi)->name, mode);
if (ret)
return ret;
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 8d659a2..d5269a2 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -881,7 +881,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
/* iterate the subnodes. */
for_each_available_child_of_node(dev->of_node, np) {
- const struct spi_device_id *id;
char modalias[40];
/* skip the holes */
@@ -909,10 +908,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
if (of_modalias_node(np, modalias, sizeof(modalias)) < 0)
goto map_failed;
- id = spi_nor_match_id(modalias);
- if (!id)
- goto map_failed;
-
ret = of_property_read_u32(np, "spi-max-frequency",
&q->clk_rate);
if (ret < 0)
@@ -921,7 +916,7 @@ static int fsl_qspi_probe(struct platform_device *pdev)
/* set the chip address for READID */
fsl_qspi_set_base_addr(q, nor);
- ret = spi_nor_scan(nor, id, SPI_NOR_QUAD);
+ ret = spi_nor_scan(nor, modalias, SPI_NOR_QUAD);
if (ret)
goto map_failed;
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 6f699c5..40d6f70 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -28,6 +28,8 @@
#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
+static const struct spi_device_id *spi_nor_match_id(const char *name);
+
/*
* Read the status register, returning its value in the location
* Return the status register value.
@@ -908,9 +910,9 @@ static int spi_nor_check(struct spi_nor *nor)
return 0;
}
-int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
- enum read_mode mode)
+int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
{
+ const struct spi_device_id *id = NULL;
struct flash_info *info;
struct flash_platform_data *data;
struct device *dev = nor->dev;
@@ -930,21 +932,17 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
*/
data = dev_get_platdata(dev);
if (data && data->type) {
- const struct spi_device_id *plat_id;
-
- for (i = 0; i < ARRAY_SIZE(spi_nor_ids) - 1; i++) {
- plat_id = &spi_nor_ids[i];
- if (strcmp(data->type, plat_id->name))
- continue;
- break;
- }
-
- if (i < ARRAY_SIZE(spi_nor_ids) - 1)
- id = plat_id;
- else
+ id = spi_nor_match_id(data->type);
+ if (!id)
dev_warn(dev, "unrecognized id %s\n", data->type);
}
+ if (!id && name)
+ id = spi_nor_match_id(name);
+
+ if (!id)
+ return -ENODEV;
+
info = (void *)id->driver_data;
if (info->jedec_id) {
@@ -1133,7 +1131,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
}
EXPORT_SYMBOL_GPL(spi_nor_scan);
-const struct spi_device_id *spi_nor_match_id(const char *name)
+static const struct spi_device_id *spi_nor_match_id(const char *name)
{
const struct spi_device_id *id = spi_nor_ids;
@@ -1144,7 +1142,6 @@ const struct spi_device_id *spi_nor_match_id(const char *name)
}
return NULL;
}
-EXPORT_SYMBOL_GPL(spi_nor_match_id);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Huang Shijie <shijie8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>");
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 66af67a..6f92b4b 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -184,31 +184,18 @@ struct spi_nor {
/**
* spi_nor_scan() - scan the SPI NOR
* @nor: the spi_nor structure
- * @id: the spi_device_id provided by the driver
+ * @name: the chip type name
* @mode: the read mode supported by the driver
*
* The drivers can use this fuction to scan the SPI NOR.
* In the scanning, it will try to get all the necessary information to
* fill the mtd_info{} and the spi_nor{}.
*
- * The board may assigns a spi_device_id with @id which be used to compared with
- * the spi_device_id detected by the scanning.
+ * The chip type name can be provided either through platform data or
+ * through the @name parameter. Platform data takes precedence.
*
* Return: 0 for success, others for failure.
*/
-int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
- enum read_mode mode);
-
-/**
- * spi_nor_match_id() - find the spi_device_id by the name
- * @name: the name of the spi_device_id
- *
- * The drivers use this function to find the spi_device_id
- * specified by the @name.
- *
- * Return: returns the right spi_device_id pointer on success,
- * and returns NULL on failure.
- */
-const struct spi_device_id *spi_nor_match_id(const char *name);
+int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
#endif
--
Ben Hutchings
The world is coming to an end. Please log off.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 4/5] spi-nor: Replace struct spi_device_id with struct flash_info
[not found] ` <1410714624.3040.38.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
` (2 preceding siblings ...)
2014-09-14 17:11 ` [PATCH 3/5] spi-nor: Make spi_nor_scan() take a chip type name, not an spi_device_id Ben Hutchings
@ 2014-09-14 17:11 ` Ben Hutchings
2014-09-14 17:11 ` [PATCH 5/5] m25p80,spi-nor: Share the list of supported chip type names again Ben Hutchings
` (2 subsequent siblings)
6 siblings, 0 replies; 25+ messages in thread
From: Ben Hutchings @ 2014-09-14 17:11 UTC (permalink / raw)
To: Brian Norris
Cc: Geert Uytterhoeven, Andrew Lunn, Jason Cooper, linux-spi,
Huang Shijie, MTD Maling List, Ian Campbell, debian-kernel,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 23412 bytes --]
spi-nor does not depend on the SPI layer, so its use of struct
spi_device_id adds an unnecessary indirection. Add the chip type name
to struct flash_info and remove the wrapping struct spi_device_id.
Signed-off-by: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
---
drivers/mtd/devices/m25p80.c | 2 +-
drivers/mtd/spi-nor/spi-nor.c | 344 +++++++++++++++++++++---------------------
2 files changed, 172 insertions(+), 174 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index b547c39..271d83f 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -246,7 +246,7 @@ static int m25p_remove(struct spi_device *spi)
/*
- * XXX This needs to be kept in sync with spi_nor_ids. We can't share
+ * XXX This needs to be kept in sync with spi_nor_info. We can't share
* it with spi-nor, because if this is built as a module then modpost
* won't be able to read it and add appropriate aliases.
*/
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 40d6f70..3b88c6b 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -28,8 +28,6 @@
#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
-static const struct spi_device_id *spi_nor_match_id(const char *name);
-
/*
* Read the status register, returning its value in the location
* Return the status register value.
@@ -425,6 +423,8 @@ err:
}
struct flash_info {
+ const char name[SPI_NAME_SIZE];
+
/* JEDEC id zero means "no ID" (most older chips); otherwise it has
* a high byte of zero plus three data bytes: the manufacturer id,
* then a two byte device id.
@@ -452,201 +452,215 @@ struct flash_info {
#define USE_FSR 0x80 /* use flag status register */
};
-#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
- ((kernel_ulong_t)&(struct flash_info) { \
+#define INFO(_name, _jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
+ { \
+ .name = (_name), \
.jedec_id = (_jedec_id), \
.ext_id = (_ext_id), \
.sector_size = (_sector_size), \
.n_sectors = (_n_sectors), \
.page_size = 256, \
.flags = (_flags), \
- })
+ }
-#define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width, _flags) \
- ((kernel_ulong_t)&(struct flash_info) { \
+#define CAT25_INFO(_name, _sector_size, _n_sectors, _page_size, \
+ _addr_width, _flags) \
+ { \
+ .name = (_name), \
.sector_size = (_sector_size), \
.n_sectors = (_n_sectors), \
.page_size = (_page_size), \
.addr_width = (_addr_width), \
.flags = (_flags), \
- })
+ }
/* NOTE: double check command sets and memory organization when you add
* more nor chips. This current list focusses on newer chips, which
* have been converging on command sets which including JEDEC ID.
*/
-static const struct spi_device_id spi_nor_ids[] = {
+static const struct flash_info spi_nor_info[] = {
/* Atmel -- some are (confusingly) marketed as "DataFlash" */
- { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
- { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
+ INFO("at25fs010", 0x1f6601, 0, 32 * 1024, 4, SECT_4K),
+ INFO("at25fs040", 0x1f6604, 0, 64 * 1024, 8, SECT_4K),
- { "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) },
- { "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) },
- { "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) },
+ INFO("at25df041a", 0x1f4401, 0, 64 * 1024, 8, SECT_4K),
+ INFO("at25df321a", 0x1f4701, 0, 64 * 1024, 64, SECT_4K),
+ INFO("at25df641", 0x1f4800, 0, 64 * 1024, 128, SECT_4K),
- { "at26f004", INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) },
- { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) },
- { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) },
- { "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K) },
+ INFO("at26f004", 0x1f0400, 0, 64 * 1024, 8, SECT_4K),
+ INFO("at26df081a", 0x1f4501, 0, 64 * 1024, 16, SECT_4K),
+ INFO("at26df161a", 0x1f4601, 0, 64 * 1024, 32, SECT_4K),
+ INFO("at26df321", 0x1f4700, 0, 64 * 1024, 64, SECT_4K),
- { "at45db081d", INFO(0x1f2500, 0, 64 * 1024, 16, SECT_4K) },
+ INFO("at45db081d", 0x1f2500, 0, 64 * 1024, 16, SECT_4K),
/* EON -- en25xxx */
- { "en25f32", INFO(0x1c3116, 0, 64 * 1024, 64, SECT_4K) },
- { "en25p32", INFO(0x1c2016, 0, 64 * 1024, 64, 0) },
- { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) },
- { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) },
- { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) },
- { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) },
- { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) },
+ INFO("en25f32", 0x1c3116, 0, 64 * 1024, 64, SECT_4K),
+ INFO("en25p32", 0x1c2016, 0, 64 * 1024, 64, 0),
+ INFO("en25q32b", 0x1c3016, 0, 64 * 1024, 64, 0),
+ INFO("en25p64", 0x1c2017, 0, 64 * 1024, 128, 0),
+ INFO("en25q64", 0x1c3017, 0, 64 * 1024, 128, SECT_4K),
+ INFO("en25qh128", 0x1c7018, 0, 64 * 1024, 256, 0),
+ INFO("en25qh256", 0x1c7019, 0, 64 * 1024, 512, 0),
/* ESMT */
- { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) },
+ INFO("f25l32pa", 0x8c2016, 0, 64 * 1024, 64, SECT_4K),
/* Everspin */
- { "mr25h256", CAT25_INFO( 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
- { "mr25h10", CAT25_INFO(128 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
+ CAT25_INFO("mr25h256", 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO("mr25h10", 128 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
/* GigaDevice */
- { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) },
- { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) },
+ INFO("gd25q32", 0xc84016, 0, 64 * 1024, 64, SECT_4K),
+ INFO("gd25q64", 0xc84017, 0, 64 * 1024, 128, SECT_4K),
/* Intel/Numonyx -- xxxs33b */
- { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) },
- { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) },
- { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) },
+ INFO("160s33b", 0x898911, 0, 64 * 1024, 32, 0),
+ INFO("320s33b", 0x898912, 0, 64 * 1024, 64, 0),
+ INFO("640s33b", 0x898913, 0, 64 * 1024, 128, 0),
/* Macronix */
- { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4, SECT_4K) },
- { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) },
- { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) },
- { "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) },
- { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) },
- { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) },
- { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, 0) },
- { "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) },
+ INFO("mx25l2005a", 0xc22012, 0, 64 * 1024, 4, SECT_4K),
+ INFO("mx25l4005a", 0xc22013, 0, 64 * 1024, 8, SECT_4K),
+ INFO("mx25l8005", 0xc22014, 0, 64 * 1024, 16, 0),
+ INFO("mx25l1606e", 0xc22015, 0, 64 * 1024, 32, SECT_4K),
+ INFO("mx25l3205d", 0xc22016, 0, 64 * 1024, 64, 0),
+ INFO("mx25l3255e", 0xc29e16, 0, 64 * 1024, 64, SECT_4K),
+ INFO("mx25l6405d", 0xc22017, 0, 64 * 1024, 128, 0),
+ INFO("mx25l12805d", 0xc22018, 0, 64 * 1024, 256, 0),
+ INFO("mx25l12855e", 0xc22618, 0, 64 * 1024, 256, 0),
+ INFO("mx25l25635e", 0xc22019, 0, 64 * 1024, 512, 0),
+ INFO("mx25l25655e", 0xc22619, 0, 64 * 1024, 512, 0),
+ INFO("mx66l51235l", 0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ),
+ INFO("mx66l1g55g", 0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ),
/* Micron */
- { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, 0) },
- { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, 0) },
- { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, 0) },
- { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K) },
- { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K) },
- { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, USE_FSR) },
- { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, USE_FSR) },
+ INFO("n25q064", 0x20ba17, 0, 64 * 1024, 128, 0),
+ INFO("n25q128a11", 0x20bb18, 0, 64 * 1024, 256, 0),
+ INFO("n25q128a13", 0x20ba18, 0, 64 * 1024, 256, 0),
+ INFO("n25q256a", 0x20ba19, 0, 64 * 1024, 512, SECT_4K),
+ INFO("n25q512a", 0x20bb20, 0, 64 * 1024, 1024, SECT_4K),
+ INFO("n25q512ax3", 0x20ba20, 0, 64 * 1024, 1024, USE_FSR),
+ INFO("n25q00", 0x20ba21, 0, 64 * 1024, 2048, USE_FSR),
/* PMC */
- { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
- { "pm25lv010", INFO(0, 0, 32 * 1024, 4, SECT_4K_PMC) },
- { "pm25lq032", INFO(0x7f9d46, 0, 64 * 1024, 64, SECT_4K) },
+ INFO("pm25lv512", 0, 0, 32 * 1024, 2, SECT_4K_PMC),
+ INFO("pm25lv010", 0, 0, 32 * 1024, 4, SECT_4K_PMC),
+ INFO("pm25lq032", 0x7f9d46, 0, 64 * 1024, 64, SECT_4K),
/* 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, 0) },
- { "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) },
- { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, 0) },
- { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, 0) },
- { "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) },
- { "s25sl008a", INFO(0x010213, 0, 64 * 1024, 16, 0) },
- { "s25sl016a", INFO(0x010214, 0, 64 * 1024, 32, 0) },
- { "s25sl032a", INFO(0x010215, 0, 64 * 1024, 64, 0) },
- { "s25sl064a", INFO(0x010216, 0, 64 * 1024, 128, 0) },
- { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
- { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K) },
- { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
+ INFO("s25sl032p", 0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
+ INFO("s25sl064p", 0x010216, 0x4d00, 64 * 1024, 128, 0),
+ INFO("s25fl256s0", 0x010219, 0x4d00, 256 * 1024, 128, 0),
+ INFO("s25fl256s1", 0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
+ INFO("s25fl512s", 0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
+ INFO("s70fl01gs", 0x010221, 0x4d00, 256 * 1024, 256, 0),
+ INFO("s25sl12800", 0x012018, 0x0300, 256 * 1024, 64, 0),
+ INFO("s25sl12801", 0x012018, 0x0301, 64 * 1024, 256, 0),
+ INFO("s25fl129p0", 0x012018, 0x4d00, 256 * 1024, 64, 0),
+ INFO("s25fl129p1", 0x012018, 0x4d01, 64 * 1024, 256, 0),
+ INFO("s25sl004a", 0x010212, 0, 64 * 1024, 8, 0),
+ INFO("s25sl008a", 0x010213, 0, 64 * 1024, 16, 0),
+ INFO("s25sl016a", 0x010214, 0, 64 * 1024, 32, 0),
+ INFO("s25sl032a", 0x010215, 0, 64 * 1024, 64, 0),
+ INFO("s25sl064a", 0x010216, 0, 64 * 1024, 128, 0),
+ INFO("s25fl008k", 0xef4014, 0, 64 * 1024, 16, SECT_4K),
+ INFO("s25fl016k", 0xef4015, 0, 64 * 1024, 32, SECT_4K),
+ INFO("s25fl064k", 0xef4017, 0, 64 * 1024, 128, SECT_4K),
/* SST -- large erase sizes are "overlays", "sectors" are 4K */
- { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) },
- { "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, SECT_4K | SST_WRITE) },
- { "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, SECT_4K | SST_WRITE) },
- { "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, SECT_4K | SST_WRITE) },
- { "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128, SECT_4K) },
- { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE) },
- { "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) },
+ INFO("sst25vf040b", 0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE),
+ INFO("sst25vf080b", 0xbf258e, 0, 64 * 1024, 16, SECT_4K | SST_WRITE),
+ INFO("sst25vf016b", 0xbf2541, 0, 64 * 1024, 32, SECT_4K | SST_WRITE),
+ INFO("sst25vf032b", 0xbf254a, 0, 64 * 1024, 64, SECT_4K | SST_WRITE),
+ INFO("sst25vf064c", 0xbf254b, 0, 64 * 1024, 128, SECT_4K),
+ INFO("sst25wf512", 0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE),
+ INFO("sst25wf010", 0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE),
+ INFO("sst25wf020", 0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE),
+ INFO("sst25wf040", 0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE),
/* ST Microelectronics -- newer production may have feature updates */
- { "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) },
- { "m25p10", INFO(0x202011, 0, 32 * 1024, 4, 0) },
- { "m25p20", INFO(0x202012, 0, 64 * 1024, 4, 0) },
- { "m25p40", INFO(0x202013, 0, 64 * 1024, 8, 0) },
- { "m25p80", INFO(0x202014, 0, 64 * 1024, 16, 0) },
- { "m25p16", INFO(0x202015, 0, 64 * 1024, 32, 0) },
- { "m25p32", INFO(0x202016, 0, 64 * 1024, 64, 0) },
- { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) },
- { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) },
- { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, 0) },
-
- { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) },
- { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) },
- { "m25p20-nonjedec", INFO(0, 0, 64 * 1024, 4, 0) },
- { "m25p40-nonjedec", INFO(0, 0, 64 * 1024, 8, 0) },
- { "m25p80-nonjedec", INFO(0, 0, 64 * 1024, 16, 0) },
- { "m25p16-nonjedec", INFO(0, 0, 64 * 1024, 32, 0) },
- { "m25p32-nonjedec", INFO(0, 0, 64 * 1024, 64, 0) },
- { "m25p64-nonjedec", INFO(0, 0, 64 * 1024, 128, 0) },
- { "m25p128-nonjedec", INFO(0, 0, 256 * 1024, 64, 0) },
-
- { "m45pe10", INFO(0x204011, 0, 64 * 1024, 2, 0) },
- { "m45pe80", INFO(0x204014, 0, 64 * 1024, 16, 0) },
- { "m45pe16", INFO(0x204015, 0, 64 * 1024, 32, 0) },
-
- { "m25pe20", INFO(0x208012, 0, 64 * 1024, 4, 0) },
- { "m25pe80", INFO(0x208014, 0, 64 * 1024, 16, 0) },
- { "m25pe16", INFO(0x208015, 0, 64 * 1024, 32, SECT_4K) },
-
- { "m25px16", INFO(0x207115, 0, 64 * 1024, 32, SECT_4K) },
- { "m25px32", INFO(0x207116, 0, 64 * 1024, 64, SECT_4K) },
- { "m25px32-s0", INFO(0x207316, 0, 64 * 1024, 64, SECT_4K) },
- { "m25px32-s1", INFO(0x206316, 0, 64 * 1024, 64, SECT_4K) },
- { "m25px64", INFO(0x207117, 0, 64 * 1024, 128, 0) },
- { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) },
+ INFO("m25p05", 0x202010, 0, 32 * 1024, 2, 0),
+ INFO("m25p10", 0x202011, 0, 32 * 1024, 4, 0),
+ INFO("m25p20", 0x202012, 0, 64 * 1024, 4, 0),
+ INFO("m25p40", 0x202013, 0, 64 * 1024, 8, 0),
+ INFO("m25p80", 0x202014, 0, 64 * 1024, 16, 0),
+ INFO("m25p16", 0x202015, 0, 64 * 1024, 32, 0),
+ INFO("m25p32", 0x202016, 0, 64 * 1024, 64, 0),
+ INFO("m25p64", 0x202017, 0, 64 * 1024, 128, 0),
+ INFO("m25p128", 0x202018, 0, 256 * 1024, 64, 0),
+ INFO("n25q032", 0x20ba16, 0, 64 * 1024, 64, 0),
+
+ INFO("m25p05-nonjedec", 0, 0, 32 * 1024, 2, 0),
+ INFO("m25p10-nonjedec", 0, 0, 32 * 1024, 4, 0),
+ INFO("m25p20-nonjedec", 0, 0, 64 * 1024, 4, 0),
+ INFO("m25p40-nonjedec", 0, 0, 64 * 1024, 8, 0),
+ INFO("m25p80-nonjedec", 0, 0, 64 * 1024, 16, 0),
+ INFO("m25p16-nonjedec", 0, 0, 64 * 1024, 32, 0),
+ INFO("m25p32-nonjedec", 0, 0, 64 * 1024, 64, 0),
+ INFO("m25p64-nonjedec", 0, 0, 64 * 1024, 128, 0),
+ INFO("m25p128-nonjedec", 0, 0, 256 * 1024, 64, 0),
+
+ INFO("m45pe10", 0x204011, 0, 64 * 1024, 2, 0),
+ INFO("m45pe80", 0x204014, 0, 64 * 1024, 16, 0),
+ INFO("m45pe16", 0x204015, 0, 64 * 1024, 32, 0),
+
+ INFO("m25pe20", 0x208012, 0, 64 * 1024, 4, 0),
+ INFO("m25pe80", 0x208014, 0, 64 * 1024, 16, 0),
+ INFO("m25pe16", 0x208015, 0, 64 * 1024, 32, SECT_4K),
+
+ INFO("m25px16", 0x207115, 0, 64 * 1024, 32, SECT_4K),
+ INFO("m25px32", 0x207116, 0, 64 * 1024, 64, SECT_4K),
+ INFO("m25px32-s0", 0x207316, 0, 64 * 1024, 64, SECT_4K),
+ INFO("m25px32-s1", 0x206316, 0, 64 * 1024, 64, SECT_4K),
+ INFO("m25px64", 0x207117, 0, 64 * 1024, 128, 0),
/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
- { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) },
- { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) },
- { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) },
- { "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) },
- { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K) },
- { "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
- { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
- { "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) },
+ INFO("w25x10", 0xef3011, 0, 64 * 1024, 2, SECT_4K),
+ INFO("w25x20", 0xef3012, 0, 64 * 1024, 4, SECT_4K),
+ INFO("w25x40", 0xef3013, 0, 64 * 1024, 8, SECT_4K),
+ INFO("w25x80", 0xef3014, 0, 64 * 1024, 16, SECT_4K),
+ INFO("w25x16", 0xef3015, 0, 64 * 1024, 32, SECT_4K),
+ INFO("w25x32", 0xef3016, 0, 64 * 1024, 64, SECT_4K),
+ INFO("w25q32", 0xef4016, 0, 64 * 1024, 64, SECT_4K),
+ INFO("w25q32dw", 0xef6016, 0, 64 * 1024, 64, SECT_4K),
+ INFO("w25x64", 0xef3017, 0, 64 * 1024, 128, SECT_4K),
+ INFO("w25q64", 0xef4017, 0, 64 * 1024, 128, SECT_4K),
+ INFO("w25q80", 0xef5014, 0, 64 * 1024, 16, SECT_4K),
+ INFO("w25q80bl", 0xef4014, 0, 64 * 1024, 16, SECT_4K),
+ INFO("w25q128", 0xef4018, 0, 64 * 1024, 256, SECT_4K),
+ INFO("w25q256", 0xef4019, 0, 64 * 1024, 512, SECT_4K),
/* Catalyst / On Semiconductor -- non-JEDEC */
- { "cat25c11", CAT25_INFO( 16, 8, 16, 1, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
- { "cat25c03", CAT25_INFO( 32, 8, 16, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
- { "cat25c09", CAT25_INFO( 128, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
- { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
- { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) },
+ CAT25_INFO("cat25c11", 16, 8, 16, 1, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO("cat25c03", 32, 8, 16, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO("cat25c09", 128, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO("cat25c17", 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO("cat25128", 2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
{ },
};
-static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
+static const struct flash_info *spi_nor_info_by_name(const char *name)
+{
+ const struct flash_info *info = spi_nor_info;
+
+ while (info->name[0]) {
+ if (!strcmp(name, info->name))
+ return info;
+ info++;
+ }
+ return NULL;
+}
+
+static const struct flash_info *spi_nor_info_probe(struct spi_nor *nor)
{
int tmp;
u8 id[5];
u32 jedec;
u16 ext_jedec;
- struct flash_info *info;
+ const struct flash_info *info;
tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, 5);
if (tmp < 0) {
@@ -661,11 +675,11 @@ static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor)
ext_jedec = id[3] << 8 | id[4];
- for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) {
- info = (void *)spi_nor_ids[tmp].driver_data;
+ for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_info) - 1; tmp++) {
+ info = &spi_nor_info[tmp];
if (info->jedec_id == jedec) {
if (info->ext_id == 0 || info->ext_id == ext_jedec)
- return &spi_nor_ids[tmp];
+ return info;
}
}
dev_err(nor->dev, "unrecognized JEDEC id %06x\n", jedec);
@@ -912,8 +926,7 @@ static int spi_nor_check(struct spi_nor *nor)
int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
{
- const struct spi_device_id *id = NULL;
- struct flash_info *info;
+ const struct flash_info *info = NULL;
struct flash_platform_data *data;
struct device *dev = nor->dev;
struct mtd_info *mtd = nor->mtd;
@@ -932,26 +945,24 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
*/
data = dev_get_platdata(dev);
if (data && data->type) {
- id = spi_nor_match_id(data->type);
- if (!id)
+ info = spi_nor_info_by_name(data->type);
+ if (!info)
dev_warn(dev, "unrecognized id %s\n", data->type);
}
- if (!id && name)
- id = spi_nor_match_id(name);
+ if (!info && name)
+ info = spi_nor_info_by_name(name);
- if (!id)
+ if (!info)
return -ENODEV;
- info = (void *)id->driver_data;
-
if (info->jedec_id) {
- const struct spi_device_id *jid;
+ const struct flash_info *jinfo;
- jid = spi_nor_read_id(nor);
- if (IS_ERR(jid)) {
- return PTR_ERR(jid);
- } else if (jid != id) {
+ jinfo = spi_nor_info_probe(nor);
+ if (IS_ERR(jinfo)) {
+ return PTR_ERR(jinfo);
+ } else if (jinfo != info) {
/*
* JEDEC knows better, so overwrite platform ID. We
* can't trust partitions any longer, but we'll let
@@ -960,9 +971,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
* information, even if it's not 100% accurate.
*/
dev_warn(dev, "found %s, expected %s\n",
- jid->name, id->name);
- id = jid;
- info = (void *)jid->driver_data;
+ jinfo->name, info->name);
+ info = jinfo;
}
}
@@ -1108,7 +1118,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
nor->read_dummy = spi_nor_read_dummy_cycles(nor);
- dev_info(dev, "%s (%lld Kbytes)\n", id->name,
+ dev_info(dev, "%s (%lld Kbytes)\n", info->name,
(long long)mtd->size >> 10);
dev_dbg(dev,
@@ -1131,18 +1141,6 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
}
EXPORT_SYMBOL_GPL(spi_nor_scan);
-static const struct spi_device_id *spi_nor_match_id(const char *name)
-{
- const struct spi_device_id *id = spi_nor_ids;
-
- while (id->name[0]) {
- if (!strcmp(name, id->name))
- return id;
- id++;
- }
- return NULL;
-}
-
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Huang Shijie <shijie8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>");
MODULE_AUTHOR("Mike Lavender");
--
Ben Hutchings
The world is coming to an end. Please log off.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 5/5] m25p80,spi-nor: Share the list of supported chip type names again
[not found] ` <1410714624.3040.38.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
` (3 preceding siblings ...)
2014-09-14 17:11 ` [PATCH 4/5] spi-nor: Replace struct spi_device_id with struct flash_info Ben Hutchings
@ 2014-09-14 17:11 ` Ben Hutchings
[not found] ` <1410714708.3040.43.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
2014-09-14 17:13 ` [PATCH 0/5] m25p80,spi-nor: Fix module aliases for m25p80; clean up chip identification Ben Hutchings
2014-09-28 11:35 ` Mark Brown
6 siblings, 1 reply; 25+ messages in thread
From: Ben Hutchings @ 2014-09-14 17:11 UTC (permalink / raw)
To: Brian Norris
Cc: Geert Uytterhoeven, Andrew Lunn, Jason Cooper, linux-spi,
Huang Shijie, MTD Maling List, Ian Campbell, debian-kernel,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 25042 bytes --]
Move the list of chip type names to spi-nor.h. To avoid putting all
the chip type information there, we define this list as a macro
SPI_NOR_ENUM_TYPES() that invokes another macro SPI_NOR_ENUM_TYPE()
that must be defined to expand each name to whatever form it's needed.
In spi-nor.c, use it to define enumerators, then use the enumerators
as indices when defining spi_nor_info so that we cannot accidentally
use a name that's not on the list.
This is somewhat complicated by the fact that some names include
hyphens. SPI_NOR_ENUM_TYPE() therefore takes separate string and C
identifier parameters.
Signed-off-by: Ben Hutchings <ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
---
drivers/mtd/devices/m25p80.c | 47 +------
drivers/mtd/spi-nor/spi-nor.c | 287 ++++++++++++++++++++++--------------------
include/linux/mtd/spi-nor.h | 72 +++++++++++
3 files changed, 227 insertions(+), 179 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 271d83f..368eb9a 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -245,51 +245,10 @@ static int m25p_remove(struct spi_device *spi)
}
-/*
- * XXX This needs to be kept in sync with spi_nor_info. We can't share
- * it with spi-nor, because if this is built as a module then modpost
- * won't be able to read it and add appropriate aliases.
- */
static const struct spi_device_id m25p_ids[] = {
- {"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"},
- {"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"},
- {"at26df321"}, {"at45db081d"},
- {"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"},
- {"en25q64"}, {"en25qh128"}, {"en25qh256"},
- {"f25l32pa"},
- {"mr25h256"}, {"mr25h10"},
- {"gd25q32"}, {"gd25q64"},
- {"160s33b"}, {"320s33b"}, {"640s33b"},
- {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"},
- {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"},
- {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"},
- {"mx66l1g55g"},
- {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"},
- {"n25q512a"}, {"n25q512ax3"}, {"n25q00"},
- {"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"},
- {"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"},
- {"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"},
- {"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"},
- {"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"},
- {"s25fl016k"}, {"s25fl064k"},
- {"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"},
- {"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"},
- {"sst25wf040"},
- {"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"},
- {"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"},
- {"m25p128"}, {"n25q032"},
- {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"},
- {"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"},
- {"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"},
- {"m45pe10"}, {"m45pe80"}, {"m45pe16"},
- {"m25pe20"}, {"m25pe80"}, {"m25pe16"},
- {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"},
- {"m25px64"},
- {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"},
- {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"},
- {"w25x64"}, {"w25q64"}, {"w25q128"}, {"w25q80"},
- {"w25q80bl"}, {"w25q128"}, {"w25q256"}, {"cat25c11"},
- {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"},
+#define SPI_NOR_ENUM_TYPE(s, c) { s },
+ SPI_NOR_ENUM_TYPES()
+#undef SPI_NOR_ENUM_TYPE
{ },
};
MODULE_DEVICE_TABLE(spi, m25p_ids);
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 3b88c6b..68fedce 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -452,9 +452,16 @@ struct flash_info {
#define USE_FSR 0x80 /* use flag status register */
};
+enum {
+#define SPI_NOR_ENUM_TYPE(s, c) CHIP_TYPE_ ## c,
+ SPI_NOR_ENUM_TYPES()
+#undef SPI_NOR_ENUM_TYPE
+ CHIP_TYPE_COUNT
+};
+
#define INFO(_name, _jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
+ [CHIP_TYPE_ ## _name] = \
{ \
- .name = (_name), \
.jedec_id = (_jedec_id), \
.ext_id = (_ext_id), \
.sector_size = (_sector_size), \
@@ -465,8 +472,8 @@ struct flash_info {
#define CAT25_INFO(_name, _sector_size, _n_sectors, _page_size, \
_addr_width, _flags) \
+ [CHIP_TYPE_ ## _name] = \
{ \
- .name = (_name), \
.sector_size = (_sector_size), \
.n_sectors = (_n_sectors), \
.page_size = (_page_size), \
@@ -477,169 +484,179 @@ struct flash_info {
/* NOTE: double check command sets and memory organization when you add
* more nor chips. This current list focusses on newer chips, which
* have been converging on command sets which including JEDEC ID.
+ *
+ * All chip type names must be added to __SPI_NOR_ENUM_TYPES in
+ * spi-nor.h before they can be used here (enforced by using the
+ * names to index this array).
*/
static const struct flash_info spi_nor_info[] = {
/* Atmel -- some are (confusingly) marketed as "DataFlash" */
- INFO("at25fs010", 0x1f6601, 0, 32 * 1024, 4, SECT_4K),
- INFO("at25fs040", 0x1f6604, 0, 64 * 1024, 8, SECT_4K),
+ INFO(at25fs010, 0x1f6601, 0, 32 * 1024, 4, SECT_4K),
+ INFO(at25fs040, 0x1f6604, 0, 64 * 1024, 8, SECT_4K),
- INFO("at25df041a", 0x1f4401, 0, 64 * 1024, 8, SECT_4K),
- INFO("at25df321a", 0x1f4701, 0, 64 * 1024, 64, SECT_4K),
- INFO("at25df641", 0x1f4800, 0, 64 * 1024, 128, SECT_4K),
+ INFO(at25df041a, 0x1f4401, 0, 64 * 1024, 8, SECT_4K),
+ INFO(at25df321a, 0x1f4701, 0, 64 * 1024, 64, SECT_4K),
+ INFO(at25df641, 0x1f4800, 0, 64 * 1024, 128, SECT_4K),
- INFO("at26f004", 0x1f0400, 0, 64 * 1024, 8, SECT_4K),
- INFO("at26df081a", 0x1f4501, 0, 64 * 1024, 16, SECT_4K),
- INFO("at26df161a", 0x1f4601, 0, 64 * 1024, 32, SECT_4K),
- INFO("at26df321", 0x1f4700, 0, 64 * 1024, 64, SECT_4K),
+ INFO(at26f004, 0x1f0400, 0, 64 * 1024, 8, SECT_4K),
+ INFO(at26df081a, 0x1f4501, 0, 64 * 1024, 16, SECT_4K),
+ INFO(at26df161a, 0x1f4601, 0, 64 * 1024, 32, SECT_4K),
+ INFO(at26df321, 0x1f4700, 0, 64 * 1024, 64, SECT_4K),
- INFO("at45db081d", 0x1f2500, 0, 64 * 1024, 16, SECT_4K),
+ INFO(at45db081d, 0x1f2500, 0, 64 * 1024, 16, SECT_4K),
/* EON -- en25xxx */
- INFO("en25f32", 0x1c3116, 0, 64 * 1024, 64, SECT_4K),
- INFO("en25p32", 0x1c2016, 0, 64 * 1024, 64, 0),
- INFO("en25q32b", 0x1c3016, 0, 64 * 1024, 64, 0),
- INFO("en25p64", 0x1c2017, 0, 64 * 1024, 128, 0),
- INFO("en25q64", 0x1c3017, 0, 64 * 1024, 128, SECT_4K),
- INFO("en25qh128", 0x1c7018, 0, 64 * 1024, 256, 0),
- INFO("en25qh256", 0x1c7019, 0, 64 * 1024, 512, 0),
+ INFO(en25f32, 0x1c3116, 0, 64 * 1024, 64, SECT_4K),
+ INFO(en25p32, 0x1c2016, 0, 64 * 1024, 64, 0),
+ INFO(en25q32b, 0x1c3016, 0, 64 * 1024, 64, 0),
+ INFO(en25p64, 0x1c2017, 0, 64 * 1024, 128, 0),
+ INFO(en25q64, 0x1c3017, 0, 64 * 1024, 128, SECT_4K),
+ INFO(en25qh128, 0x1c7018, 0, 64 * 1024, 256, 0),
+ INFO(en25qh256, 0x1c7019, 0, 64 * 1024, 512, 0),
/* ESMT */
- INFO("f25l32pa", 0x8c2016, 0, 64 * 1024, 64, SECT_4K),
+ INFO(f25l32pa, 0x8c2016, 0, 64 * 1024, 64, SECT_4K),
/* Everspin */
- CAT25_INFO("mr25h256", 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
- CAT25_INFO("mr25h10", 128 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO(mr25h256, 32 * 1024, 1, 256, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO(mr25h10, 128 * 1024, 1, 256, 3, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
/* GigaDevice */
- INFO("gd25q32", 0xc84016, 0, 64 * 1024, 64, SECT_4K),
- INFO("gd25q64", 0xc84017, 0, 64 * 1024, 128, SECT_4K),
+ INFO(gd25q32, 0xc84016, 0, 64 * 1024, 64, SECT_4K),
+ INFO(gd25q64, 0xc84017, 0, 64 * 1024, 128, SECT_4K),
/* Intel/Numonyx -- xxxs33b */
- INFO("160s33b", 0x898911, 0, 64 * 1024, 32, 0),
- INFO("320s33b", 0x898912, 0, 64 * 1024, 64, 0),
- INFO("640s33b", 0x898913, 0, 64 * 1024, 128, 0),
+ INFO(160s33b, 0x898911, 0, 64 * 1024, 32, 0),
+ INFO(320s33b, 0x898912, 0, 64 * 1024, 64, 0),
+ INFO(640s33b, 0x898913, 0, 64 * 1024, 128, 0),
/* Macronix */
- INFO("mx25l2005a", 0xc22012, 0, 64 * 1024, 4, SECT_4K),
- INFO("mx25l4005a", 0xc22013, 0, 64 * 1024, 8, SECT_4K),
- INFO("mx25l8005", 0xc22014, 0, 64 * 1024, 16, 0),
- INFO("mx25l1606e", 0xc22015, 0, 64 * 1024, 32, SECT_4K),
- INFO("mx25l3205d", 0xc22016, 0, 64 * 1024, 64, 0),
- INFO("mx25l3255e", 0xc29e16, 0, 64 * 1024, 64, SECT_4K),
- INFO("mx25l6405d", 0xc22017, 0, 64 * 1024, 128, 0),
- INFO("mx25l12805d", 0xc22018, 0, 64 * 1024, 256, 0),
- INFO("mx25l12855e", 0xc22618, 0, 64 * 1024, 256, 0),
- INFO("mx25l25635e", 0xc22019, 0, 64 * 1024, 512, 0),
- INFO("mx25l25655e", 0xc22619, 0, 64 * 1024, 512, 0),
- INFO("mx66l51235l", 0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ),
- INFO("mx66l1g55g", 0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ),
+ INFO(mx25l2005a, 0xc22012, 0, 64 * 1024, 4, SECT_4K),
+ INFO(mx25l4005a, 0xc22013, 0, 64 * 1024, 8, SECT_4K),
+ INFO(mx25l8005, 0xc22014, 0, 64 * 1024, 16, 0),
+ INFO(mx25l1606e, 0xc22015, 0, 64 * 1024, 32, SECT_4K),
+ INFO(mx25l3205d, 0xc22016, 0, 64 * 1024, 64, 0),
+ INFO(mx25l3255e, 0xc29e16, 0, 64 * 1024, 64, SECT_4K),
+ INFO(mx25l6405d, 0xc22017, 0, 64 * 1024, 128, 0),
+ INFO(mx25l12805d, 0xc22018, 0, 64 * 1024, 256, 0),
+ INFO(mx25l12855e, 0xc22618, 0, 64 * 1024, 256, 0),
+ INFO(mx25l25635e, 0xc22019, 0, 64 * 1024, 512, 0),
+ INFO(mx25l25655e, 0xc22619, 0, 64 * 1024, 512, 0),
+ INFO(mx66l51235l, 0xc2201a, 0, 64 * 1024, 1024, SPI_NOR_QUAD_READ),
+ INFO(mx66l1g55g, 0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ),
/* Micron */
- INFO("n25q064", 0x20ba17, 0, 64 * 1024, 128, 0),
- INFO("n25q128a11", 0x20bb18, 0, 64 * 1024, 256, 0),
- INFO("n25q128a13", 0x20ba18, 0, 64 * 1024, 256, 0),
- INFO("n25q256a", 0x20ba19, 0, 64 * 1024, 512, SECT_4K),
- INFO("n25q512a", 0x20bb20, 0, 64 * 1024, 1024, SECT_4K),
- INFO("n25q512ax3", 0x20ba20, 0, 64 * 1024, 1024, USE_FSR),
- INFO("n25q00", 0x20ba21, 0, 64 * 1024, 2048, USE_FSR),
+ INFO(n25q064, 0x20ba17, 0, 64 * 1024, 128, 0),
+ INFO(n25q128a11, 0x20bb18, 0, 64 * 1024, 256, 0),
+ INFO(n25q128a13, 0x20ba18, 0, 64 * 1024, 256, 0),
+ INFO(n25q256a, 0x20ba19, 0, 64 * 1024, 512, SECT_4K),
+ INFO(n25q512a, 0x20bb20, 0, 64 * 1024, 1024, SECT_4K),
+ INFO(n25q512ax3, 0x20ba20, 0, 64 * 1024, 1024, USE_FSR),
+ INFO(n25q00, 0x20ba21, 0, 64 * 1024, 2048, USE_FSR),
/* PMC */
- INFO("pm25lv512", 0, 0, 32 * 1024, 2, SECT_4K_PMC),
- INFO("pm25lv010", 0, 0, 32 * 1024, 4, SECT_4K_PMC),
- INFO("pm25lq032", 0x7f9d46, 0, 64 * 1024, 64, SECT_4K),
+ INFO(pm25lv512, 0, 0, 32 * 1024, 2, SECT_4K_PMC),
+ INFO(pm25lv010, 0, 0, 32 * 1024, 4, SECT_4K_PMC),
+ INFO(pm25lq032, 0x7f9d46, 0, 64 * 1024, 64, SECT_4K),
/* Spansion -- single (large) sector size only, at least
* for the chips listed here (without boot sectors).
*/
- INFO("s25sl032p", 0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
- INFO("s25sl064p", 0x010216, 0x4d00, 64 * 1024, 128, 0),
- INFO("s25fl256s0", 0x010219, 0x4d00, 256 * 1024, 128, 0),
- INFO("s25fl256s1", 0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
- INFO("s25fl512s", 0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
- INFO("s70fl01gs", 0x010221, 0x4d00, 256 * 1024, 256, 0),
- INFO("s25sl12800", 0x012018, 0x0300, 256 * 1024, 64, 0),
- INFO("s25sl12801", 0x012018, 0x0301, 64 * 1024, 256, 0),
- INFO("s25fl129p0", 0x012018, 0x4d00, 256 * 1024, 64, 0),
- INFO("s25fl129p1", 0x012018, 0x4d01, 64 * 1024, 256, 0),
- INFO("s25sl004a", 0x010212, 0, 64 * 1024, 8, 0),
- INFO("s25sl008a", 0x010213, 0, 64 * 1024, 16, 0),
- INFO("s25sl016a", 0x010214, 0, 64 * 1024, 32, 0),
- INFO("s25sl032a", 0x010215, 0, 64 * 1024, 64, 0),
- INFO("s25sl064a", 0x010216, 0, 64 * 1024, 128, 0),
- INFO("s25fl008k", 0xef4014, 0, 64 * 1024, 16, SECT_4K),
- INFO("s25fl016k", 0xef4015, 0, 64 * 1024, 32, SECT_4K),
- INFO("s25fl064k", 0xef4017, 0, 64 * 1024, 128, SECT_4K),
-
- /* SST -- large erase sizes are "overlays", "sectors" are 4K */
- INFO("sst25vf040b", 0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE),
- INFO("sst25vf080b", 0xbf258e, 0, 64 * 1024, 16, SECT_4K | SST_WRITE),
- INFO("sst25vf016b", 0xbf2541, 0, 64 * 1024, 32, SECT_4K | SST_WRITE),
- INFO("sst25vf032b", 0xbf254a, 0, 64 * 1024, 64, SECT_4K | SST_WRITE),
- INFO("sst25vf064c", 0xbf254b, 0, 64 * 1024, 128, SECT_4K),
- INFO("sst25wf512", 0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE),
- INFO("sst25wf010", 0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE),
- INFO("sst25wf020", 0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE),
- INFO("sst25wf040", 0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE),
+ INFO(s25sl032p, 0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
+ INFO(s25sl064p, 0x010216, 0x4d00, 64 * 1024, 128, 0),
+ INFO(s25fl256s0, 0x010219, 0x4d00, 256 * 1024, 128, 0),
+ INFO(s25fl256s1, 0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
+ INFO(s25fl512s, 0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ),
+ INFO(s70fl01gs, 0x010221, 0x4d00, 256 * 1024, 256, 0),
+ INFO(s25sl12800, 0x012018, 0x0300, 256 * 1024, 64, 0),
+ INFO(s25sl12801, 0x012018, 0x0301, 64 * 1024, 256, 0),
+ INFO(s25fl129p0, 0x012018, 0x4d00, 256 * 1024, 64, 0),
+ INFO(s25fl129p1, 0x012018, 0x4d01, 64 * 1024, 256, 0),
+ INFO(s25sl004a, 0x010212, 0, 64 * 1024, 8, 0),
+ INFO(s25sl008a, 0x010213, 0, 64 * 1024, 16, 0),
+ INFO(s25sl016a, 0x010214, 0, 64 * 1024, 32, 0),
+ INFO(s25sl032a, 0x010215, 0, 64 * 1024, 64, 0),
+ INFO(s25sl064a, 0x010216, 0, 64 * 1024, 128, 0),
+ INFO(s25fl008k, 0xef4014, 0, 64 * 1024, 16, SECT_4K),
+ INFO(s25fl016k, 0xef4015, 0, 64 * 1024, 32, SECT_4K),
+ INFO(s25fl064k, 0xef4017, 0, 64 * 1024, 128, SECT_4K),
+
+ /* SST -- large erase sizes are overlays, sectors are 4K */
+ INFO(sst25vf040b, 0xbf258d, 0, 64 * 1024, 8, SECT_4K | SST_WRITE),
+ INFO(sst25vf080b, 0xbf258e, 0, 64 * 1024, 16, SECT_4K | SST_WRITE),
+ INFO(sst25vf016b, 0xbf2541, 0, 64 * 1024, 32, SECT_4K | SST_WRITE),
+ INFO(sst25vf032b, 0xbf254a, 0, 64 * 1024, 64, SECT_4K | SST_WRITE),
+ INFO(sst25vf064c, 0xbf254b, 0, 64 * 1024, 128, SECT_4K),
+ INFO(sst25wf512, 0xbf2501, 0, 64 * 1024, 1, SECT_4K | SST_WRITE),
+ INFO(sst25wf010, 0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE),
+ INFO(sst25wf020, 0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE),
+ INFO(sst25wf040, 0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE),
/* ST Microelectronics -- newer production may have feature updates */
- INFO("m25p05", 0x202010, 0, 32 * 1024, 2, 0),
- INFO("m25p10", 0x202011, 0, 32 * 1024, 4, 0),
- INFO("m25p20", 0x202012, 0, 64 * 1024, 4, 0),
- INFO("m25p40", 0x202013, 0, 64 * 1024, 8, 0),
- INFO("m25p80", 0x202014, 0, 64 * 1024, 16, 0),
- INFO("m25p16", 0x202015, 0, 64 * 1024, 32, 0),
- INFO("m25p32", 0x202016, 0, 64 * 1024, 64, 0),
- INFO("m25p64", 0x202017, 0, 64 * 1024, 128, 0),
- INFO("m25p128", 0x202018, 0, 256 * 1024, 64, 0),
- INFO("n25q032", 0x20ba16, 0, 64 * 1024, 64, 0),
-
- INFO("m25p05-nonjedec", 0, 0, 32 * 1024, 2, 0),
- INFO("m25p10-nonjedec", 0, 0, 32 * 1024, 4, 0),
- INFO("m25p20-nonjedec", 0, 0, 64 * 1024, 4, 0),
- INFO("m25p40-nonjedec", 0, 0, 64 * 1024, 8, 0),
- INFO("m25p80-nonjedec", 0, 0, 64 * 1024, 16, 0),
- INFO("m25p16-nonjedec", 0, 0, 64 * 1024, 32, 0),
- INFO("m25p32-nonjedec", 0, 0, 64 * 1024, 64, 0),
- INFO("m25p64-nonjedec", 0, 0, 64 * 1024, 128, 0),
- INFO("m25p128-nonjedec", 0, 0, 256 * 1024, 64, 0),
-
- INFO("m45pe10", 0x204011, 0, 64 * 1024, 2, 0),
- INFO("m45pe80", 0x204014, 0, 64 * 1024, 16, 0),
- INFO("m45pe16", 0x204015, 0, 64 * 1024, 32, 0),
-
- INFO("m25pe20", 0x208012, 0, 64 * 1024, 4, 0),
- INFO("m25pe80", 0x208014, 0, 64 * 1024, 16, 0),
- INFO("m25pe16", 0x208015, 0, 64 * 1024, 32, SECT_4K),
-
- INFO("m25px16", 0x207115, 0, 64 * 1024, 32, SECT_4K),
- INFO("m25px32", 0x207116, 0, 64 * 1024, 64, SECT_4K),
- INFO("m25px32-s0", 0x207316, 0, 64 * 1024, 64, SECT_4K),
- INFO("m25px32-s1", 0x206316, 0, 64 * 1024, 64, SECT_4K),
- INFO("m25px64", 0x207117, 0, 64 * 1024, 128, 0),
-
- /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
- INFO("w25x10", 0xef3011, 0, 64 * 1024, 2, SECT_4K),
- INFO("w25x20", 0xef3012, 0, 64 * 1024, 4, SECT_4K),
- INFO("w25x40", 0xef3013, 0, 64 * 1024, 8, SECT_4K),
- INFO("w25x80", 0xef3014, 0, 64 * 1024, 16, SECT_4K),
- INFO("w25x16", 0xef3015, 0, 64 * 1024, 32, SECT_4K),
- INFO("w25x32", 0xef3016, 0, 64 * 1024, 64, SECT_4K),
- INFO("w25q32", 0xef4016, 0, 64 * 1024, 64, SECT_4K),
- INFO("w25q32dw", 0xef6016, 0, 64 * 1024, 64, SECT_4K),
- INFO("w25x64", 0xef3017, 0, 64 * 1024, 128, SECT_4K),
- INFO("w25q64", 0xef4017, 0, 64 * 1024, 128, SECT_4K),
- INFO("w25q80", 0xef5014, 0, 64 * 1024, 16, SECT_4K),
- INFO("w25q80bl", 0xef4014, 0, 64 * 1024, 16, SECT_4K),
- INFO("w25q128", 0xef4018, 0, 64 * 1024, 256, SECT_4K),
- INFO("w25q256", 0xef4019, 0, 64 * 1024, 512, SECT_4K),
+ INFO(m25p05, 0x202010, 0, 32 * 1024, 2, 0),
+ INFO(m25p10, 0x202011, 0, 32 * 1024, 4, 0),
+ INFO(m25p20, 0x202012, 0, 64 * 1024, 4, 0),
+ INFO(m25p40, 0x202013, 0, 64 * 1024, 8, 0),
+ INFO(m25p80, 0x202014, 0, 64 * 1024, 16, 0),
+ INFO(m25p16, 0x202015, 0, 64 * 1024, 32, 0),
+ INFO(m25p32, 0x202016, 0, 64 * 1024, 64, 0),
+ INFO(m25p64, 0x202017, 0, 64 * 1024, 128, 0),
+ INFO(m25p128, 0x202018, 0, 256 * 1024, 64, 0),
+ INFO(n25q032, 0x20ba16, 0, 64 * 1024, 64, 0),
+
+ INFO(m25p05_nonjedec, 0, 0, 32 * 1024, 2, 0),
+ INFO(m25p10_nonjedec, 0, 0, 32 * 1024, 4, 0),
+ INFO(m25p20_nonjedec, 0, 0, 64 * 1024, 4, 0),
+ INFO(m25p40_nonjedec, 0, 0, 64 * 1024, 8, 0),
+ INFO(m25p80_nonjedec, 0, 0, 64 * 1024, 16, 0),
+ INFO(m25p16_nonjedec, 0, 0, 64 * 1024, 32, 0),
+ INFO(m25p32_nonjedec, 0, 0, 64 * 1024, 64, 0),
+ INFO(m25p64_nonjedec, 0, 0, 64 * 1024, 128, 0),
+ INFO(m25p128_nonjedec, 0, 0, 256 * 1024, 64, 0),
+
+ INFO(m45pe10, 0x204011, 0, 64 * 1024, 2, 0),
+ INFO(m45pe80, 0x204014, 0, 64 * 1024, 16, 0),
+ INFO(m45pe16, 0x204015, 0, 64 * 1024, 32, 0),
+
+ INFO(m25pe20, 0x208012, 0, 64 * 1024, 4, 0),
+ INFO(m25pe80, 0x208014, 0, 64 * 1024, 16, 0),
+ INFO(m25pe16, 0x208015, 0, 64 * 1024, 32, SECT_4K),
+
+ INFO(m25px16, 0x207115, 0, 64 * 1024, 32, SECT_4K),
+ INFO(m25px32, 0x207116, 0, 64 * 1024, 64, SECT_4K),
+ INFO(m25px32_s0, 0x207316, 0, 64 * 1024, 64, SECT_4K),
+ INFO(m25px32_s1, 0x206316, 0, 64 * 1024, 64, SECT_4K),
+ INFO(m25px64, 0x207117, 0, 64 * 1024, 128, 0),
+
+ /* Winbond -- w25x blocks are 64K, sectors are 4KiB */
+ INFO(w25x10, 0xef3011, 0, 64 * 1024, 2, SECT_4K),
+ INFO(w25x20, 0xef3012, 0, 64 * 1024, 4, SECT_4K),
+ INFO(w25x40, 0xef3013, 0, 64 * 1024, 8, SECT_4K),
+ INFO(w25x80, 0xef3014, 0, 64 * 1024, 16, SECT_4K),
+ INFO(w25x16, 0xef3015, 0, 64 * 1024, 32, SECT_4K),
+ INFO(w25x32, 0xef3016, 0, 64 * 1024, 64, SECT_4K),
+ INFO(w25q32, 0xef4016, 0, 64 * 1024, 64, SECT_4K),
+ INFO(w25q32dw, 0xef6016, 0, 64 * 1024, 64, SECT_4K),
+ INFO(w25x64, 0xef3017, 0, 64 * 1024, 128, SECT_4K),
+ INFO(w25q64, 0xef4017, 0, 64 * 1024, 128, SECT_4K),
+ INFO(w25q80, 0xef5014, 0, 64 * 1024, 16, SECT_4K),
+ INFO(w25q80bl, 0xef4014, 0, 64 * 1024, 16, SECT_4K),
+ INFO(w25q128, 0xef4018, 0, 64 * 1024, 256, SECT_4K),
+ INFO(w25q256, 0xef4019, 0, 64 * 1024, 512, SECT_4K),
/* Catalyst / On Semiconductor -- non-JEDEC */
- CAT25_INFO("cat25c11", 16, 8, 16, 1, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
- CAT25_INFO("cat25c03", 32, 8, 16, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
- CAT25_INFO("cat25c09", 128, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
- CAT25_INFO("cat25c17", 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
- CAT25_INFO("cat25128", 2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
- { },
+ CAT25_INFO(cat25c11, 16, 8, 16, 1, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO(cat25c03, 32, 8, 16, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO(cat25c09, 128, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO(cat25c17, 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+ CAT25_INFO(cat25128, 2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR),
+
+ /* Fill in name fields */
+#define SPI_NOR_ENUM_TYPE(s, c) [CHIP_TYPE_ ## c].name = s,
+ SPI_NOR_ENUM_TYPES()
+#undef SPI_NOR_ENUM_TYPE
+
+ [CHIP_TYPE_COUNT] = { },
};
static const struct flash_info *spi_nor_info_by_name(const char *name)
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 6f92b4b..03b7959 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -198,4 +198,76 @@ struct spi_nor {
*/
int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
+#define __SPI_NOR_ENUM_TYPES(c_id, str_and_c_id) \
+ c_id(at25fs010) c_id(at25fs040) c_id(at25df041a) \
+ c_id(at25df321a) c_id(at25df641) c_id(at26f004) \
+ c_id(at26df081a) c_id(at26df161a) c_id(at26df321) \
+ c_id(at45db081d) \
+ c_id(en25f32) c_id(en25p32) c_id(en25q32b) \
+ c_id(en25p64) c_id(en25q64) c_id(en25qh128) \
+ c_id(en25qh256) \
+ c_id(f25l32pa) \
+ c_id(mr25h256) c_id(mr25h10) \
+ c_id(gd25q32) c_id(gd25q64) \
+ c_id(160s33b) c_id(320s33b) c_id(640s33b) \
+ c_id(mx25l2005a) c_id(mx25l4005a) c_id(mx25l8005) \
+ c_id(mx25l1606e) c_id(mx25l3205d) c_id(mx25l3255e) \
+ c_id(mx25l6405d) c_id(mx25l12805d) c_id(mx25l12855e) \
+ c_id(mx25l25635e) c_id(mx25l25655e) c_id(mx66l51235l) \
+ c_id(mx66l1g55g) \
+ c_id(n25q064) c_id(n25q128a11) c_id(n25q128a13) \
+ c_id(n25q256a) c_id(n25q512a) c_id(n25q512ax3) \
+ c_id(n25q00) \
+ c_id(pm25lv512) c_id(pm25lv010) c_id(pm25lq032) \
+ c_id(s25sl032p) c_id(s25sl064p) c_id(s25fl256s0) \
+ c_id(s25fl256s1) c_id(s25fl512s) c_id(s70fl01gs) \
+ c_id(s25sl12800) c_id(s25sl12801) c_id(s25fl129p0) \
+ c_id(s25fl129p1) c_id(s25sl004a) c_id(s25sl008a) \
+ c_id(s25sl016a) c_id(s25sl032a) c_id(s25sl064a) \
+ c_id(s25fl008k) c_id(s25fl016k) c_id(s25fl064k) \
+ c_id(sst25vf040b) c_id(sst25vf080b) c_id(sst25vf016b) \
+ c_id(sst25vf032b) c_id(sst25vf064c) c_id(sst25wf512) \
+ c_id(sst25wf010) c_id(sst25wf020) c_id(sst25wf040) \
+ c_id(m25p05) c_id(m25p10) c_id(m25p20) \
+ c_id(m25p40) c_id(m25p80) c_id(m25p16) \
+ c_id(m25p32) c_id(m25p64) c_id(m25p128) \
+ c_id(n25q032) \
+ str_and_c_id("m25p05-nonjedec", m25p05_nonjedec) \
+ str_and_c_id("m25p10-nonjedec", m25p10_nonjedec) \
+ str_and_c_id("m25p20-nonjedec", m25p20_nonjedec) \
+ str_and_c_id("m25p40-nonjedec", m25p40_nonjedec) \
+ str_and_c_id("m25p80-nonjedec", m25p80_nonjedec) \
+ str_and_c_id("m25p16-nonjedec", m25p16_nonjedec) \
+ str_and_c_id("m25p32-nonjedec", m25p32_nonjedec) \
+ str_and_c_id("m25p64-nonjedec", m25p64_nonjedec) \
+ str_and_c_id("m25p128-nonjedec", m25p128_nonjedec) \
+ c_id(m45pe10) c_id(m45pe80) c_id(m45pe16) \
+ c_id(m25pe20) c_id(m25pe80) c_id(m25pe16) \
+ c_id(m25px16) c_id(m25px32) \
+ str_and_c_id("m25px32-s0", m25px32_s0) \
+ str_and_c_id("m25px32-s1", m25px32_s1) \
+ c_id(m25px64) \
+ c_id(w25x10) c_id(w25x20) c_id(w25x40) \
+ c_id(w25x80) c_id(w25x16) c_id(w25x32) \
+ c_id(w25q32) c_id(w25q32dw) c_id(w25x64) \
+ c_id(w25q64) c_id(w25q80) c_id(w25q80bl) \
+ c_id(w25q128) c_id(w25q256) \
+ c_id(cat25c11) c_id(cat25c03) c_id(cat25c09) \
+ c_id(cat25c17) c_id(cat25128)
+#define __SPI_NOR_ENUM_TYPE_C_ID(id) SPI_NOR_ENUM_TYPE(#id, id)
+
+/**
+ * SPI_NOR_ENUM_TYPES - invoke SPI_NOR_ENUM_TYPE() for each SPI NOR chip type
+ *
+ * This will expand to SPI_NOR_ENUM_TYPE(string, c_id) for each chip
+ * type recognised by the spi-nor library. The first argument is the
+ * string literal version of the chip type name. The second argument
+ * is a version of the name suitable for including in a C identifier,
+ * though it may begin with a digit.
+ *
+ * The caller must define SPI_NOR_ENUM_TYPE before invoking this macro.
+ */
+#define SPI_NOR_ENUM_TYPES() \
+ __SPI_NOR_ENUM_TYPES(__SPI_NOR_ENUM_TYPE_C_ID, SPI_NOR_ENUM_TYPE)
+
#endif
--
Ben Hutchings
The world is coming to an end. Please log off.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 0/5] m25p80,spi-nor: Fix module aliases for m25p80; clean up chip identification
[not found] ` <1410714624.3040.38.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
` (4 preceding siblings ...)
2014-09-14 17:11 ` [PATCH 5/5] m25p80,spi-nor: Share the list of supported chip type names again Ben Hutchings
@ 2014-09-14 17:13 ` Ben Hutchings
[not found] ` <1410714795.3040.45.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
2014-09-28 11:35 ` Mark Brown
6 siblings, 1 reply; 25+ messages in thread
From: Ben Hutchings @ 2014-09-14 17:13 UTC (permalink / raw)
To: Brian Norris
Cc: Geert Uytterhoeven, Andrew Lunn, Jason Cooper, linux-spi,
Huang Shijie, MTD Maling List, Ian Campbell, debian-kernel,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
On Sun, 2014-09-14 at 18:10 +0100, Ben Hutchings wrote:
> The first patch in the series restores the module aliases to m25p80, but
> it does so by duplicating the list of names. This should be suitable
> for stable, but it isn't viable in the longer term.
>
> The following patches change the spi-nor interface so that this
> duplication is no longer necessary. This includes removing
> spi_nor::read_id, but it could be re-added after this with a different
> interface, e.g. returning a flash_info structure (which would need to be
> defined in spi_nor.h).
Note that these patch are:
- Based on your 'testing' branch
- Untested by me, aside from compiling and checking that m25p80 has the
expected module aliases
Ben.
--
Ben Hutchings
The world is coming to an end. Please log off.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 0/5] m25p80,spi-nor: Fix module aliases for m25p80; clean up chip identification
[not found] ` <1410714624.3040.38.camel-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org>
` (5 preceding siblings ...)
2014-09-14 17:13 ` [PATCH 0/5] m25p80,spi-nor: Fix module aliases for m25p80; clean up chip identification Ben Hutchings
@ 2014-09-28 11:35 ` Mark Brown
6 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2014-09-28 11:35 UTC (permalink / raw)
To: Ben Hutchings
Cc: Brian Norris, Geert Uytterhoeven, Andrew Lunn, Jason Cooper,
linux-spi, Huang Shijie, MTD Maling List, Ian Campbell,
debian-kernel, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
On Sun, Sep 14, 2014 at 06:10:24PM +0100, Ben Hutchings wrote:
> The first patch in the series restores the module aliases to m25p80, but
> it does so by duplicating the list of names. This should be suitable
> for stable, but it isn't viable in the longer term.
Please don't CC patches not for the SPI subsystem to linux-spi, they
just clog up patchwork for no benefit.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread