All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Shijie <shijie.huang@intel.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: Marek Vasut <marex@denx.de>, Huang Shijie <b32955@freescale.com>,
	zajec5@gmail.com, Huang Shijie <shijie8@gmail.com>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH 7/8] mtd: spi-nor: factor out write_enable() for erase commands
Date: Wed, 10 Sep 2014 23:20:21 +0800	[thread overview]
Message-ID: <20140910152021.GB13016@shldeISGChi005.sh.intel.com> (raw)
In-Reply-To: <20140910070537.GC5732@norris-Latitude-E6410>

On Wed, Sep 10, 2014 at 12:05:37AM -0700, Brian Norris wrote:
> Hi Huang,
> 
> On Tue, Aug 12, 2014 at 08:59:12AM +0800, Huang Shijie wrote:
> > On Mon, Aug 11, 2014 at 11:48:18AM -0700, Brian Norris wrote:
> > > On Sat, Aug 09, 2014 at 06:52:34PM +0800, Huang Shijie wrote:
> > > > On Wed, Aug 06, 2014 at 06:17:01PM -0700, Brian Norris wrote:
> > > > > diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
> > > > > index 9c13622a0c7a..07fbfb0a7738 100644
> > > > > --- a/drivers/mtd/spi-nor/fsl-quadspi.c
> > > > > +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
> > > > > @@ -738,11 +738,6 @@ static int fsl_qspi_erase(struct spi_nor *nor, loff_t offs)
> > > > >  	dev_dbg(nor->dev, "%dKiB at 0x%08x:0x%08x\n",
> > > > >  		nor->mtd->erasesize / 1024, q->chip_base_addr, (u32)offs);
> > > > >  
> > > > > -	/* Send write enable, then erase commands. */
> > > > > -	ret = nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0);
> > > > > -	if (ret)
> > > > > -		return ret;
> > > > > -
> > > > This write-enable is used for per-sector-erase, not for the whole chip
> > > > erase.
> > > > 
> > > > So if you really want to remove this code, you should add an extra write-enable
> > > > in the spi_nor_erase.
> > > 
> > > I don't understand your comment.
> > > 
> > > Before this patch, there is a write-enable command in:
> > >  * m25p80.c, per-sector erase
> > >  * fsl-quadspi, per-sector erase
> > >  * spi-nor.c, whole-chip erase
> > > 
> > > With this patch, I am factoring all of these out into spi_nor_erase().
> > > 
> > > What is the problem?
> > Hi Brian:
> >    For the spi_nor_erase(), the patch should like this:
> > 
> > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> > index c130bf7..26c48bc 100644
> > --- a/drivers/mtd/spi-nor/spi-nor.c
> > +++ b/drivers/mtd/spi-nor/spi-nor.c
> > @@ -324,6 +324,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
> >  
> >  	/* whole-chip erase? */
> >  	if (len == mtd->size) {
> > +		write_enable(nor);
> >  		if (erase_chip(nor)) {
> >  			ret = -EIO;
> >  			goto erase_err;
> > @@ -337,6 +338,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
> >  	/* "sector"-at-a-time erase */
> >  	} else {
> >  		while (len) {
> > +			write_enable(nor);
The difference is here.

you miss a write_enable for each sector's erase. 

thanks
Huang Shijie
> >  			if (nor->erase(nor, addr)) {
> >  				ret = -EIO;
> >  				goto erase_err;
> > 
> 
> How is your patch any different than mine? Mine has the exact same code,
> except it covers both paths by putting the write_enable() outside the
> conditional entirely.

  reply	other threads:[~2014-09-10  7:23 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07  1:16 [PATCH 0/8] mtd: spi-nor: refactor wait-till-ready Brian Norris
2014-08-07  1:16 ` [PATCH 1/8] mtd: spi-nor: eliminate duplicate spi_nor_wait_till_{, fsr}_ready() code Brian Norris
2014-08-07 14:23   ` Marek Vasut
2014-08-09  6:25   ` Huang Shijie
2014-08-11 17:59     ` Brian Norris
2014-09-10  7:26   ` [PATCH v2 1/10] " Brian Norris
2014-08-07  1:16 ` [PATCH 2/8] mtd: spi-nor: handle timeout errors in spi_nor_write() Brian Norris
2014-08-07 14:23   ` Marek Vasut
2014-08-09  7:37   ` Huang Shijie
2014-08-07  1:16 ` [PATCH 3/8] mtd: spi-nor: move "wait-till-ready" checks into erase/write functions Brian Norris
2014-08-07 14:24   ` Marek Vasut
2014-08-09  8:42   ` Huang Shijie
2014-08-11 18:23     ` Brian Norris
2014-08-12  1:37       ` Huang Shijie
2014-08-07  1:16 ` [PATCH 4/8] mtd: m25p80: drop wait-till-ready checks Brian Norris
2014-08-07 14:24   ` Marek Vasut
2014-08-07  1:16 ` [PATCH 5/8] mtd: fsl-quadspi: " Brian Norris
2014-08-07 14:24   ` Marek Vasut
2014-08-07  1:17 ` [PATCH 6/8] mtd: spi-nor: drop replaceable wait-till-ready function pointer Brian Norris
2014-08-07 14:25   ` Marek Vasut
2014-08-09  9:53   ` Huang Shijie
2014-08-11 18:43     ` Brian Norris
2014-08-12  1:16       ` Huang Shijie
2014-09-10  7:02         ` Brian Norris
2014-08-12  5:13   ` Rafał Miłecki
2014-08-12  5:14     ` Rafał Miłecki
2014-08-07  1:17 ` [PATCH 7/8] mtd: spi-nor: factor out write_enable() for erase commands Brian Norris
2014-08-07 14:25   ` Marek Vasut
2014-08-09 10:52   ` Huang Shijie
2014-08-11 18:48     ` Brian Norris
2014-08-12  0:59       ` Huang Shijie
2014-09-10  7:05         ` Brian Norris
2014-09-10 15:20           ` Huang Shijie [this message]
2014-09-10  7:47             ` Brian Norris
2014-09-10 16:12               ` Huang Shijie
2014-09-10 23:25                 ` Brian Norris
2014-11-05 10:29   ` [PATCH v2] " Brian Norris
2014-11-06  3:39     ` Huang Shijie
2014-12-01  8:19     ` Brian Norris
2014-08-07  1:17 ` [RFC 8/8] debug: mtd: spi-nor: add BUG_ON() prints to check for !ready Brian Norris
2014-08-07 14:26   ` Marek Vasut
2014-11-05 10:10 ` [PATCH 0/8] mtd: spi-nor: refactor wait-till-ready Brian Norris

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=20140910152021.GB13016@shldeISGChi005.sh.intel.com \
    --to=shijie.huang@intel.com \
    --cc=b32955@freescale.com \
    --cc=computersforpeace@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marex@denx.de \
    --cc=shijie8@gmail.com \
    --cc=zajec5@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.