linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	Cyrille Pitchen <cyrille.pitchen@atmel.com>
Cc: boris.brezillon@free-electrons.com, computersforpeace@gmail.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	richard@nod.at
Subject: Re: [PATCH 1/1] mtd: spi-nor: improve macronix_quad_enable()
Date: Wed, 7 Dec 2016 00:46:59 +0100	[thread overview]
Message-ID: <6fbb8128-3583-ee9b-a623-9d2649db6860@gmail.com> (raw)
In-Reply-To: <c5bf49e1-fd4b-7d33-3d15-3ad4ac1174fa@wedev4u.fr>

On 12/07/2016 12:05 AM, Cyrille Pitchen wrote:
> Le 06/12/2016 à 20:01, Marek Vasut a écrit :
>> On 12/06/2016 05:01 PM, Cyrille Pitchen wrote:
>>> The patch checks whether the Quad Enable bit is already set in the Status
>>> Register. If so, the function exits immediately with a successful return
>>> code.
>>
>> Performance optimization I presume ?
> 
> Performance optimization is one benefit but this real purpose of the
> patch is to avoid writing over and over a non-volatile bit at each boot,
> actually each time spi_nor_scan() is called.
> 
> To be honest, I don't know whether internally the SPI memory is clever
> enough not to perform the actual write when it sees the bit value has
> not changed. I wanted to improve the memory lifetime by avoiding the
> update of the bit from software just to be sure :)

Well the bit is in some sort of internal SRAM or silicon register , no?

> Anyway, thanks for your review!

np

>> Acked-by: Marek Vasut <marek.vasut@gmail.com>
>>
>>> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
>>> Reviewed-by: Jagan Teki <jagan@openedev.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 da7cd69d4857..1fd32b991eb7 100644
>>> --- a/drivers/mtd/spi-nor/spi-nor.c
>>> +++ b/drivers/mtd/spi-nor/spi-nor.c
>>> @@ -1216,6 +1216,9 @@ static int macronix_quad_enable(struct spi_nor *nor)
>>>  	val = read_sr(nor);
>>>  	if (val < 0)
>>>  		return val;
>>> +	if (val & SR_QUAD_EN_MX)
>>> +		return 0;
>>> +
>>>  	write_enable(nor);
>>>  
>>>  	write_sr(nor, val | SR_QUAD_EN_MX);
>>>
>>
>>
> 


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-12-07  0:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06 16:01 [PATCH 1/1] mtd: spi-nor: improve macronix_quad_enable() Cyrille Pitchen
2016-12-06 19:01 ` Marek Vasut
2016-12-06 23:05   ` Cyrille Pitchen
2016-12-06 23:46     ` Marek Vasut [this message]
2016-12-13 16:35   ` Cyrille Pitchen

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=6fbb8128-3583-ee9b-a623-9d2649db6860@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@atmel.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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).