linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Schrempf Frieder' <frieder.schrempf@kontron.de>,
	Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Boris Brezillon <bbrezillon@kernel.org>,
	Jeff Kletsky <git-commits@allycomm.com>,
	liaoweixiong <liaoweixiong@allwinnertech.com>,
	Peter Pan <peterpandong@micron.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Richard Weinberger <richard@nod.at>
Subject: RE: [PATCH 3/3] mtd: spinand: Wait for the erase op to finish before writing a bad block marker
Date: Mon, 17 Feb 2020 11:30:18 +0000	[thread overview]
Message-ID: <73f3002b3a5245dbbde064e1c0b1af92@AcuMS.aculab.com> (raw)
In-Reply-To: <cbec4c2f-64f3-3353-b237-83345321d7a7@kontron.de>

From: Schrempf Frieder
> Sent: 17 February 2020 11:19
> > Schrempf Frieder <frieder.schrempf@kontron.de> wrote on Tue, 11 Feb
> > 2020 16:35:53 +0000:
> >
> >> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> >>
> >> Currently when marking a block, we use spinand_erase_op() to erase
> >> the block before writing the marker to the OOB area without waiting
> >> for the operation to succeed. This can lead to the marking failing
> >> silently and no bad block marker being written to the flash.
> >>
> >> To fix this we reuse the spinand_erase() function, that already does
> >> everything we need to do before actually writing the marker.
> >>
> >
> > Thanks a lot for this series!
> >
> > Yet I don't really understand the point of waiting for the erasure if
> > it failed: we don't really care as programming (1 -> 0) cells is always
> > possible. Are you sure this lead to an error?
> 
> We don't care about the result of the erase operation, but I think we
> still need to wait for it to be done and the STATUS_BUSY bit to be
> cleared. Otherwise it seems like the program operation to set the marker
> can get ignored by the chip. At least that's my explanation for the
> behavior I was observing.

Serial flash devices won't allow any accesses while an erase or write
in in progress.
So while you don't need to wait for either to finish, you do need
to remember that one is 'pending' and wait for it to finish
before any further accesses (apart from reads of the status register).

How many writes you can do to an area (that clear 1s) and the size
of the area will be device dependant.
IIRC one device I've used allows 2 writes to each 16bit word.
This allows either two separate byte writes or one write of
a 16bit (or 32bit) value followed by a second write of all 0s
the 'erase' the value without doing a erase-rewrite cycle.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

      reply	other threads:[~2020-02-17 11:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 16:35 [PATCH 0/3] mtd: spinand: Fix reading and writing of bad block markers Schrempf Frieder
2020-02-11 16:35 ` [PATCH 1/3] mtd: spinand: Stop using spinand->oobbuf for buffering " Schrempf Frieder
2020-02-11 18:35   ` Schrempf Frieder
2020-02-17 11:17   ` Boris Brezillon
2020-02-11 16:35 ` [PATCH 2/3] mtd: spinand: Explicitly use MTD_OPS_RAW to write the bad block marker to OOB Schrempf Frieder
2020-02-17 11:18   ` Boris Brezillon
2020-02-11 16:35 ` [PATCH 3/3] mtd: spinand: Wait for the erase op to finish before writing a bad block marker Schrempf Frieder
2020-02-17 10:39   ` Miquel Raynal
2020-02-17 11:14     ` Boris Brezillon
2020-02-17 11:29       ` Schrempf Frieder
2020-02-17 11:19     ` Schrempf Frieder
2020-02-17 11:30       ` David Laight [this message]

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=73f3002b3a5245dbbde064e1c0b1af92@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=bbrezillon@kernel.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=git-commits@allycomm.com \
    --cc=liaoweixiong@allwinnertech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=peterpandong@micron.com \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    /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).