public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrille Pitchen <cyrille.pitchen@atmel.com>
To: Matthias Schiffer <mschiffer@universe-factory.net>,
	<linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>
Cc: Felix Fietkau <nbd@nbd.name>
Subject: Re: [PATCH 1/2] mtd: spi-nor: disable software protection for Macronix flash at startup
Date: Mon, 23 May 2016 16:01:48 +0200	[thread overview]
Message-ID: <57430D4C.3010000@atmel.com> (raw)
In-Reply-To: <e4b01b739197bd4556617b70553093c58d3b1497.1463578353.git.mschiffer@universe-factory.net>

Hi Matthias,

Le 18/05/2016 15:32, Matthias Schiffer a écrit :
> This patch has been tested in OpenWrt for a few months and seems to work
> correctly.
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
> ---
>  drivers/mtd/spi-nor/spi-nor.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index 157841d..d681003 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -1304,6 +1304,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
>  
>  	if (JEDEC_MFR(info) == SNOR_MFR_ATMEL ||
>  	    JEDEC_MFR(info) == SNOR_MFR_INTEL ||
> +	    JEDEC_MFR(info) == SNOR_MFR_MACRONIX ||
>  	    JEDEC_MFR(info) == SNOR_MFR_SST ||
>  	    info->flags & SPI_NOR_HAS_LOCK) {
>  		write_enable(nor);
> 
The line following this patch chunk is "write_sr(nor, 0);" however, if I refer
to the Macronix mx25l25673g datasheet about the Status Register, bits[5:2]
(BP0, BP1, BP2 and BP3) are non-volatile and define the protected area.
Also bit6 (Quad Enable) is also non-volatile and is used to reassign #WP and
#Hold pins to IO2 and IO3 functions needed by Quad SPI protocols on many other
Macronix memories (indeed on the 73g part, the Quad Enable bit is always 1).

So you should not write 0 directly into the Status Register if you only want to
clear bit7 (Status Register Write Disable): use a read, modify, write sequence
instead.


Best regards,

Cyrille

  parent reply	other threads:[~2016-05-23 14:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 13:32 [PATCH 1/2] mtd: spi-nor: disable software protection for Macronix flash at startup Matthias Schiffer
2016-05-18 13:32 ` [PATCH 2/2] mtd: spi-nor: disable software protection for Winbond flash at startup (again) Matthias Schiffer
2016-05-23 14:01 ` Cyrille Pitchen [this message]
2016-05-23 16:32   ` [PATCH 1/2] mtd: spi-nor: disable software protection for Macronix flash at startup Matthias Schiffer
2016-05-23 17:56     ` 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=57430D4C.3010000@atmel.com \
    --to=cyrille.pitchen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mschiffer@universe-factory.net \
    --cc=nbd@nbd.name \
    /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