diff mbox

[v2,1/2] Add flag to disable chip erase

Message ID 20161230132325.14337-2-mar.krzeminski@gmail.com
State Superseded
Delegated to: Cyrille Pitchen
Headers show

Commit Message

mar.krzeminski Dec. 30, 2016, 1:23 p.m. UTC
Extend spi-nor framework to allow disable chip erase
command also for selected flash chips.

Signed-off-by: Marcin Krzeminski <mar.krzeminski@gmail.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Cyrille Pitchen Jan. 4, 2017, 12:56 p.m. UTC | #1
Hi Marcin,

Globally this patch looks good but for next patches it would be better to
add the "mtd: spi-nor: " prefix in the subject line. Hence when reading the
git log output we can immediately identify which sub system is modified by
some commit.

For this series, if Marek has no other comment, I can take it and fix the
subject line. Otherwise, if another version is needed then please fix the
subject lines :)

Le 30/12/2016 à 14:23, Marcin Krzeminski a écrit :
> Extend spi-nor framework to allow disable chip erase
> command also for selected flash chips.
> 

This describes what the patch does, so that's good. However you could also
explain why we want/need to disable the chip erase and enforce this is a
bug fix for some SPI NOR memories. You could also reword the subject line
with something like "mtd: spi-nor: fix erase ...."

Best regards,

Cyrille

> Signed-off-by: Marcin Krzeminski <mar.krzeminski@gmail.com>
> ---
>  drivers/mtd/spi-nor/spi-nor.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index 15fb8af..b6656b2 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -81,6 +81,7 @@ struct flash_info {
>  					 * because it has the same value as
>  					 * ATMEL flashes)
>  					*/
> +#define NO_CHIP_ERASE	BIT(10) /* Chip does not support chip erase */
>  };
>  
>  #define JEDEC_MFR(info)	((info)->id[0])
> @@ -1545,6 +1546,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
>  		nor->flags |= SNOR_F_USE_FSR;
>  	if (info->flags & SPI_NOR_HAS_TB)
>  		nor->flags |= SNOR_F_HAS_SR_TB;
> +	if (info->flags & NO_CHIP_ERASE)
> +		nor->flags |= SNOR_F_NO_OP_CHIP_ERASE;
>  
>  #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
>  	/* prefer "small sector" erase if possible */
>
mar.krzeminski Jan. 4, 2017, 4:05 p.m. UTC | #2
W dniu 04.01.2017 o 13:56, Cyrille Pitchen pisze:
> Hi Marcin,
>
> Globally this patch looks good but for next patches it would be better to
> add the "mtd: spi-nor: " prefix in the subject line. Hence when reading the
> git log output we can immediately identify which sub system is modified by
> some commit.
Sorry, I forgot about this.
>
> For this series, if Marek has no other comment, I can take it and fix the
> subject line. Otherwise, if another version is needed then please fix the
> subject lines :)

I'll wait for Marek comments if any, and send fixed subject line.
>
> Le 30/12/2016 à 14:23, Marcin Krzeminski a écrit :
>> Extend spi-nor framework to allow disable chip erase
>> command also for selected flash chips.
>>
> This describes what the patch does, so that's good. However you could also
> explain why we want/need to disable the chip erase and enforce this is a
> bug fix for some SPI NOR memories. You could also reword the subject line
> with something like "mtd: spi-nor: fix erase ...."
Sure.
>
> Best regards,
>
> Cyrille
>
>> Signed-off-by: Marcin Krzeminski <mar.krzeminski@gmail.com>
>> ---
>>   drivers/mtd/spi-nor/spi-nor.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
>> index 15fb8af..b6656b2 100644
>> --- a/drivers/mtd/spi-nor/spi-nor.c
>> +++ b/drivers/mtd/spi-nor/spi-nor.c
>> @@ -81,6 +81,7 @@ struct flash_info {
>>   					 * because it has the same value as
>>   					 * ATMEL flashes)
>>   					*/
>> +#define NO_CHIP_ERASE	BIT(10) /* Chip does not support chip erase */
>>   };
>>   
>>   #define JEDEC_MFR(info)	((info)->id[0])
>> @@ -1545,6 +1546,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
>>   		nor->flags |= SNOR_F_USE_FSR;
>>   	if (info->flags & SPI_NOR_HAS_TB)
>>   		nor->flags |= SNOR_F_HAS_SR_TB;
>> +	if (info->flags & NO_CHIP_ERASE)
>> +		nor->flags |= SNOR_F_NO_OP_CHIP_ERASE;
>>   
>>   #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
>>   	/* prefer "small sector" erase if possible */
>>
>
diff mbox

Patch

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 15fb8af..b6656b2 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -81,6 +81,7 @@  struct flash_info {
 					 * because it has the same value as
 					 * ATMEL flashes)
 					*/
+#define NO_CHIP_ERASE	BIT(10) /* Chip does not support chip erase */
 };
 
 #define JEDEC_MFR(info)	((info)->id[0])
@@ -1545,6 +1546,8 @@  int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
 		nor->flags |= SNOR_F_USE_FSR;
 	if (info->flags & SPI_NOR_HAS_TB)
 		nor->flags |= SNOR_F_HAS_SR_TB;
+	if (info->flags & NO_CHIP_ERASE)
+		nor->flags |= SNOR_F_NO_OP_CHIP_ERASE;
 
 #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
 	/* prefer "small sector" erase if possible */