linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@hisilicon.com>
To: Pratyush Yadav <p.yadav@ti.com>
Cc: vigneshr@ti.com, sergei.shtylyov@cogentembedded.com,
	tudor.ambarus@microchip.com, richard@nod.at,
	me@yadavpratyush.com, john.garry@huawei.com, linuxarm@huawei.com,
	linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com,
	alexander.sverdlin@nokia.com
Subject: Re: [RFC PATCH v2 1/2] mtd: spi-nor: Add capability to disable flash quad mode
Date: Tue, 16 Jun 2020 15:10:54 +0800	[thread overview]
Message-ID: <01838d06-29ec-5931-988a-51ebc12f25b0@hisilicon.com> (raw)
In-Reply-To: <20200615105321.d2pjwjmm3wch4qtx@ti.com>

Hi Pratyush,

Thanks for your review. I'll modify Patch 1 and 2 and
send a formal serie.

Regards,
Yicong


On 2020/6/15 18:53, Pratyush Yadav wrote:
> Hi Yicong,
>
> You generally shouldn't mark a series as "RFC" if you intend it to get 
> merged in.
>
> On 12/05/20 07:26PM, Yicong Yang wrote:
>> Previous we didn't provide a way to disable the flash's quad mode.
>> Which means we cannot do some cleanup works when to remove or
>> poweroff the flash, like what set 4-byte address mode does in
>> spi_nor_restore().
>>
>> Add the capability to disable the flash quad mode, by introducing
>> an enable flag in the flash parameters quad_enable() hooks and
>> related functions.
>>
>> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
>> ---
>>  drivers/mtd/spi-nor/core.c | 53 ++++++++++++++++++++++++++++++++--------------
>>  drivers/mtd/spi-nor/core.h |  8 +++----
>>  2 files changed, 41 insertions(+), 20 deletions(-)
> Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
>
> Nits below.
>
>> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
>> index cc68ea8..72e8d8b 100644
>> --- a/drivers/mtd/spi-nor/core.c
>> +++ b/drivers/mtd/spi-nor/core.c
>> @@ -1907,15 +1907,17 @@ static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
>>  }
>>  
>>  /**
>> - * spi_nor_sr1_bit6_quad_enable() - Set the Quad Enable BIT(6) in the Status
>> + * spi_nor_sr1_bit6_quad_enable() - Set/Unset the Quad Enable BIT(6) in the
>> + *                                  Status
>>   * Register 1.
> The "Register 1" should be on the same line as the "Status above".
>
>>   * @nor:	pointer to a 'struct spi_nor'
>> + * @enable:	true to enter quad mode. false to leave quad mode.
>>   *
>>   * Bit 6 of the Status Register 1 is the QE bit for Macronix like QSPI memories.
>>   *
>>   * Return: 0 on success, -errno otherwise.
>>   */
>> -int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor)
>> +int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor, bool enable)
>>  {
>>  	int ret;
>>  
>> @@ -1923,45 +1925,59 @@ int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor)
>>  	if (ret)
>>  		return ret;
>>  
>> -	if (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)
>> +	if ((enable && (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)) ||
>> +	    !(enable || (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)))
> I still think writing it as:
>
>     (!enable && !(nor->bouncebuf[0] & SR1_QUAD_EN_BIT6))
>
> is slightly more readable. But maybe it's just me so this is OK I guess.
>
>>  		return 0;
>>  
>> -	nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6;
>> +	if (enable)
>> +		nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6;
>> +	else
>> +		nor->bouncebuf[0] &= ~SR1_QUAD_EN_BIT6;
>>  
>>  	return spi_nor_write_sr1_and_check(nor, nor->bouncebuf[0]);
>>  }
>>  
>>  /**
>> - * spi_nor_sr2_bit1_quad_enable() - set the Quad Enable BIT(1) in the Status
>> + * spi_nor_sr2_bit1_quad_enable() - set/unset the Quad Enable BIT(1) in the
>> + *                                  Status
>>   * Register 2.
> The "Register 2" should be on the same line as the "Status above".
>
>>   * @nor:       pointer to a 'struct spi_nor'.
>> + * @enable:	true to enter quad mode. false to leave quad mode.
>>   *
>>   * Bit 1 of the Status Register 2 is the QE bit for Spansion like QSPI memories.
>>   *
>>   * Return: 0 on success, -errno otherwise.
>>   */
>> -int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor)
>> +int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor, bool enable)
>>  {
>>  	int ret;
> [...]
>> diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
>> index 6f2f6b2..719a31d 100644
>> --- a/drivers/mtd/spi-nor/core.h
>> +++ b/drivers/mtd/spi-nor/core.h
>> @@ -219,7 +219,7 @@ struct spi_nor_flash_parameter {
>>  
>>  	struct spi_nor_erase_map        erase_map;
>>  
>> -	int (*quad_enable)(struct spi_nor *nor);
>> +	int (*quad_enable)(struct spi_nor *nor, bool enable);
> Update the comment above reflecting that @quad_enable "enables/disables 
> SPI NOR quad mode".
>
>>  	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);


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2020-06-16  7:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 11:26 [RFC PATCH v2 0/2] Add support to Disable the flash quad mode Yicong Yang
2020-05-12 11:26 ` [RFC PATCH v2 1/2] mtd: spi-nor: Add capability to disable " Yicong Yang
2020-06-15 10:53   ` Pratyush Yadav
2020-06-16  7:10     ` Yicong Yang [this message]
2020-05-12 11:26 ` [RFC PATCH v2 2/2] mtd: spi-nor: Disable the flash quad mode in spi_nor_restore() Yicong Yang
2020-06-15 10:56   ` Pratyush Yadav
2020-06-15  9:19 ` [RFC PATCH v2 0/2] Add support to Disable the flash quad mode Yicong Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01838d06-29ec-5931-988a-51ebc12f25b0@hisilicon.com \
    --to=yangyicong@hisilicon.com \
    --cc=alexander.sverdlin@nokia.com \
    --cc=john.garry@huawei.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=me@yadavpratyush.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=p.yadav@ti.com \
    --cc=richard@nod.at \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).