All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Frank.Li@freescale.com
Cc: linux-mtd@lists.infradead.org, b45815@freescale.com, lznuaa@gmail.com
Subject: Re: [PATCH v3 8/8] mtd: spi-nor: fsl-quadspi: fix unsupported cmd when run flash_erase
Date: Fri, 31 Jul 2015 14:20:53 -0700	[thread overview]
Message-ID: <20150731212053.GG10676@google.com> (raw)
In-Reply-To: <1437761188-8179-9-git-send-email-Frank.Li@freescale.com>

On Sat, Jul 25, 2015 at 02:06:28AM +0800, Frank.Li@freescale.com wrote:
> From: Frank Li <Frank.Li@freescale.com>
> 
> fsl-quadspi 21e0000.qspi: Unsupported cmd 0x20
> 
> when config CONFIG_MTD_SPI_NOR_USE_4K_SECTORS enable,
> erase will use SPINOR_OP_BE_4K, which was not supported by fsl-quadspi
> driver

Slightly off topic: things looks pretty fragile here. /me thinks most of
this can be written more cleanly...

> Signed-off-by: Frank Li <Frank.Li@freescale.com>
> Acked-by: Allen Xu <b45815@freescale.com>
> ---
>  drivers/mtd/spi-nor/fsl-quadspi.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
> index 0f3f22d..e50da5c 100644
> --- a/drivers/mtd/spi-nor/fsl-quadspi.c
> +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
> @@ -396,11 +396,11 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q)
>  	lut_base = SEQID_SE * 4;
>  
>  	if (q->nor_size <= SZ_16M) {
> -		cmd = SPINOR_OP_SE;
> +		cmd = q->nor[0].erase_opcode;
>  		addrlen = ADDR24BIT;
>  	} else {
>  		/* use the 4-byte address */
> -		cmd = SPINOR_OP_SE;
> +		cmd = q->nor[0].erase_opcode;
>  		addrlen = ADDR32BIT;
>  	}

This whole block can be refactored to:

	cmd = q->nor[0].erase_opcode;
	addrlen = q->nor_size <= SZ_16M ? ADDR24BIT : ADDR32BIT;

But really, this should be based on nor->addr_width...

>  
> @@ -471,6 +471,8 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd)
>  	case SPINOR_OP_BRWR:
>  		return SEQID_BRWR;
>  	default:
> +		if (cmd == q->nor[0].erase_opcode)

Related question: what happens if you have multiple flash chips
connected, and they don't need the same opcodes? It looks like you
program the LUT only for the opcodes of the first flash, so the second
wouldn't work right.

> +			return SEQID_SE;
>  		dev_err(q->dev, "Unsupported cmd 0x%.2x\n", cmd);
>  		break;
>  	}

Brian

  reply	other threads:[~2015-07-31 21:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 18:06 [PATCH v3 0/8] mtd: spi-nor: fsl-quadspi fix and added i.mx7d and i.mxul support Frank.Li
2015-07-24 18:06 ` [PATCH v3 1/8] mtd: spi-nor: fsl-qspi: dynamically map memory space for AHB read Frank.Li
2015-07-31 20:28   ` Brian Norris
2015-07-24 18:06 ` [PATCH v3 2/8] mtd: spi-nor: fsl-quadspi: use quirk to distinguish different qspi version Frank.Li
2015-07-31 20:35   ` Brian Norris
2015-07-24 18:06 ` [PATCH v3 3/8] mtd: spi-nor: fsl-quadspi: add imx7d support Frank.Li
2015-07-31 20:41   ` Brian Norris
2015-07-31 20:45   ` Brian Norris
2015-07-24 18:06 ` [PATCH v3 4/8] mtd: spi-nor: fsl-quadspi: add i.mx6ul support Frank.Li
2015-07-31 20:46   ` Brian Norris
2015-07-24 18:06 ` [PATCH v3 5/8] mtd: spi-nor: fsl-quadspi: i.MX6SX: fixed the random QSPI access failed issue Frank.Li
2015-07-31 21:00   ` Brian Norris
2015-07-24 18:06 ` [PATCH v3 6/8] mtd: spi-nor: fsl-quadspi: workaround qspi can't wakeup from wait mode Frank.Li
2015-07-24 18:06 ` [PATCH v3 7/8] mtd: spi-nor: fsl-quadspi: reset the module in the probe Frank.Li
2015-07-24 18:06 ` [PATCH v3 8/8] mtd: spi-nor: fsl-quadspi: fix unsupported cmd when run flash_erase Frank.Li
2015-07-31 21:20   ` Brian Norris [this message]
2015-07-31 21:58     ` Zhi Li
2015-07-24 19:42 ` [PATCH v3 0/8] mtd: spi-nor: fsl-quadspi fix and added i.mx7d and i.mxul support Brian Norris
2015-07-24 19:46   ` Zhi Li
2015-07-24 19:51     ` Zhi Li
2015-07-24 19:54       ` Brian Norris
2015-07-24 19:57         ` Zhi Li

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=20150731212053.GG10676@google.com \
    --to=computersforpeace@gmail.com \
    --cc=Frank.Li@freescale.com \
    --cc=b45815@freescale.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=lznuaa@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.