[PATCH v3 1/6] mtd: spi-nor: core: Add the ->ready() hook
tkuw584924 at gmail.com
tkuw584924 at gmail.com
Fri Mar 12 09:41:55 GMT 2021
From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
This hook can be used for SPI NOR flashes that do not support legacy
status read method.
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
---
Changes in v3:
- New in v3
The purpose is same as the patch introduced by Yaliang Wang.
https://patchwork.ozlabs.org/project/linux-mtd/patch/20210301142844.1089385-1-yaliang.wang@windriver.com/
drivers/mtd/spi-nor/core.c | 3 ++-
drivers/mtd/spi-nor/core.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 0522304f52fa..c8a7f246ab7d 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -826,7 +826,7 @@ static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor,
if (time_after_eq(jiffies, deadline))
timeout = 1;
- ret = spi_nor_ready(nor);
+ ret = nor->params->ready(nor);
if (ret < 0)
return ret;
if (ret)
@@ -2920,6 +2920,7 @@ static void spi_nor_info_init_params(struct spi_nor *nor)
params->quad_enable = spi_nor_sr2_bit1_quad_enable;
params->set_4byte_addr_mode = spansion_set_4byte_addr_mode;
params->setup = spi_nor_default_setup;
+ params->ready = spi_nor_ready;
/* Default to 16-bit Write Status (01h) Command */
nor->flags |= SNOR_F_HAS_16BIT_SR;
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 4a3f7f150b5d..4d06c27630fe 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -218,6 +218,7 @@ struct spi_nor_locking_ops {
* flashes that have peculiarities to the SPI NOR standard
* e.g. different opcodes, specific address calculation,
* page size, etc.
+ * @ready: checks if the SPI NOR flash is ready.
* @locking_ops: SPI NOR locking methods.
*/
struct spi_nor_flash_parameter {
@@ -238,6 +239,7 @@ struct spi_nor_flash_parameter {
int (*set_4byte_addr_mode)(struct spi_nor *nor, bool enable);
u32 (*convert_addr)(struct spi_nor *nor, u32 addr);
int (*setup)(struct spi_nor *nor, const struct spi_nor_hwcaps *hwcaps);
+ int (*ready)(struct spi_nor *nor);
const struct spi_nor_locking_ops *locking_ops;
};
--
2.25.1
More information about the linux-mtd
mailing list