[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6bc1b181-a439-77c3-5162-a032a5f21b08@ti.com>
Date: Mon, 5 Aug 2019 12:10:32 +0530
From: Vignesh Raghavendra <vigneshr@...com>
To: <Tudor.Ambarus@...rochip.com>, <marek.vasut@...il.com>
CC: <dwmw2@...radead.org>, <computersforpeace@...il.com>,
<miquel.raynal@...tlin.com>, <richard@....at>,
<linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mtd: spi-nor: Fix the disabling of write protection at
init
On 31/07/19 2:16 PM, Tudor.Ambarus@...rochip.com wrote:
> From: Tudor Ambarus <tudor.ambarus@...rochip.com>
>
> spi_nor_spansion_clear_sr_bp() depends on spansion_quad_enable().
> While spansion_quad_enable() is selected as default when
> initializing the flash parameters, the nor->quad_enable() method
> can be overwritten later on when parsing BFPT.
>
> Select the write protection disable mechanism at spi_nor_init() time,
> when the nor->quad_enable() method is already known.
>
> Fixes: 191f5c2ed4b6faba ("mtd: spi-nor: use 16-bit WRR command when QE is set on spansion flashes")
> Signed-off-by: Tudor Ambarus <tudor.ambarus@...rochip.com>
Reviewed-by: Vignesh Raghavendra <vigneshr@...com>
> ---
> drivers/mtd/spi-nor/spi-nor.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index 924dbaf3fa49..28a64dbdaea9 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -4357,8 +4357,6 @@ static int spi_nor_init_params(struct spi_nor *nor,
> default:
> /* Kept only for backward compatibility purpose. */
> params->quad_enable = spansion_quad_enable;
> - if (nor->clear_sr_bp)
> - nor->clear_sr_bp = spi_nor_spansion_clear_sr_bp;
> break;
> }
>
> @@ -4621,6 +4619,9 @@ static int spi_nor_init(struct spi_nor *nor)
> int err;
>
> if (nor->clear_sr_bp) {
> + if (nor->quad_enable == spansion_quad_enable)
> + nor->clear_sr_bp = spi_nor_spansion_clear_sr_bp;
> +
> err = nor->clear_sr_bp(nor);
> if (err) {
> dev_err(nor->dev,
>
--
Regards
Vignesh
Powered by blists - more mailing lists