diff mbox series

[v3,1/2] mtd: spi-nor: Set the erase flag for multi-die

Message ID 20231026112312.3217502-1-festevam@gmail.com
State Superseded
Delegated to: Ambarus Tudor
Headers show
Series [v3,1/2] mtd: spi-nor: Set the erase flag for multi-die | expand

Commit Message

Fabio Estevam Oct. 26, 2023, 11:23 a.m. UTC
From: Fabio Estevam <festevam@denx.de>

Instead of manually passing the .flags = NO_CHIP_ERASE in the case
of multi-die SPI NOR flash, retrieve the information about the number of
dies directly from SFDP and set the SNOR_F_NO_OP_CHIP_ERASE flag in the
multi-die case.

Suggested-by: Michael Walle  <michael@walle.cc>
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v2:
- Newly introduced.

 drivers/mtd/spi-nor/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tudor Ambarus Oct. 27, 2023, 6:15 a.m. UTC | #1
On 26.10.2023 14:23, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> Instead of manually passing the .flags = NO_CHIP_ERASE in the case
> of multi-die SPI NOR flash, retrieve the information about the number of
> dies directly from SFDP and set the SNOR_F_NO_OP_CHIP_ERASE flag in the
> multi-die case.

We don't have enough data from manufacturers to make such an assumption.
And since this is not backed up by a standard, I'd like to stick to the
.flags = NO_CHIP_ERASE for now.

> 
> Suggested-by: Michael Walle  <michael@walle.cc>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
> Changes since v2:
> - Newly introduced.
> 
>  drivers/mtd/spi-nor/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 1c443fe568cf..f85ea57534ba 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -2850,7 +2850,7 @@ static void spi_nor_init_flags(struct spi_nor *nor)
>  			nor->flags |= SNOR_F_HAS_SR_BP3_BIT6;
>  	}
>  
> -	if (flags & NO_CHIP_ERASE)
> +	if (flags & NO_CHIP_ERASE || nor->params->n_dice > 1)
>  		nor->flags |= SNOR_F_NO_OP_CHIP_ERASE;
>  
>  	if (flags & SPI_NOR_RWW && nor->params->n_banks > 1 &&
Michael Walle Oct. 27, 2023, 8:03 p.m. UTC | #2
>> Instead of manually passing the .flags = NO_CHIP_ERASE in the case
>> of multi-die SPI NOR flash, retrieve the information about the number of
>> dies directly from SFDP and set the SNOR_F_NO_OP_CHIP_ERASE flag in the
>> multi-die case.
>
>We don't have enough data from manufacturers to make such an assumption.
>And since this is not backed up by a standard, I'd like to stick to the
>.flags = NO_CHIP_ERASE for now

mh. we have two flashes which are multi die ones. as far as I remember. i checked the semper flash and it didn't support chip erase. also.. chip erase isn't a standard either and not backed by SFDP, correct? We shouldn't use it in the first place. So we might have a chance to fix that for multi die chips now. 

So as long as there isn't a multi die flash which supports 
chip erase, I'd like to keep the additional flags as minimal as possible. for the best case scenario it would just work out of the box with just SFDP, which is impossible if we need that no_chip_erase flag.

-michael
diff mbox series

Patch

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 1c443fe568cf..f85ea57534ba 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2850,7 +2850,7 @@  static void spi_nor_init_flags(struct spi_nor *nor)
 			nor->flags |= SNOR_F_HAS_SR_BP3_BIT6;
 	}
 
-	if (flags & NO_CHIP_ERASE)
+	if (flags & NO_CHIP_ERASE || nor->params->n_dice > 1)
 		nor->flags |= SNOR_F_NO_OP_CHIP_ERASE;
 
 	if (flags & SPI_NOR_RWW && nor->params->n_banks > 1 &&