[PATCH v3 1/6] mtd: spi-nor: core: Add the ->ready() hook

Pratyush Yadav p.yadav at ti.com
Mon Mar 15 10:47:59 GMT 2021


Hi,

On 12/03/21 06:41PM, tkuw584924 at gmail.com wrote:
> 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.

Nitpick: I wouldn't call it "legacy". There is no newer standard status 
read method. Something like "default" or "standard" would be better.

> 
> 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;

Nitpick: Rename it to spi_nor_default_ready or something similar.

>  	/* 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;
>  };

Other than the above comments,

Reviewed-by: Pratyush Yadav <p.yadav at ti.com>

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.



More information about the linux-mtd mailing list