linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <bbrezillon@kernel.org>
To: Schrempf Frieder <frieder.schrempf@kontron.de>
Cc: "richard@nod.at" <richard@nod.at>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Marek Vasut <marek.vasut@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 1/3] mtd: rawnand: Support bad block markers in first, second or last page
Date: Thu, 20 Dec 2018 15:07:26 +0100	[thread overview]
Message-ID: <20181220150715.5b19f480@bbrezillon> (raw)
In-Reply-To: <20181220145954.55ae36e9@bbrezillon>

On Thu, 20 Dec 2018 14:59:54 +0100
Boris Brezillon <boris.brezillon@bootlin.com> wrote:

> >  
> >  /**
> > + * nand_bbm_page_offset - Get the page offsets for bad block markers
> > + * @chip: NAND chip object
> > + * @index: Index for the page offset  
> 
> Hm, the meaning of index is far from obvious. How about passing the
> current page instead (and return 1 if there are more pages to scan 0
> otherwise)?
> 
> Something like:
> 
> static int nand_bbm_get_next_page(struct nand_chip *chip, int page)
> {
> 	struct mtd_info *mtd = nand_to_mtd(chip);
> 	int last_page = ((mtd->erasesize - mtd->writesize) >>
> 			 chip->page_shift) & chip->pagemask;
> 
> 	if (page < 0 && chip->bbt_options & NAND_BBT_SCANFIRSTPAGE)
> 		return 0;
> 	else if (page < 1 && chip->bbt_options & NAND_BBT_SCAN2NDPAGE)
> 		return 1;
> 	else if (page < last_page &&
> 		 chip->bbt_options & NAND_BBT_SCANLASTPAGE)
> 		return last_page;
> 
> 	return -1;
> }
> 
> And yes, that means defining NAND_BBT_SCANFIRSTPAGE and setting it when
> appropriate.
> 

Oh, and you'll have to define NAND_BBT_SCANFIRST2PAGES like this

#define NAND_BBT_SCANFIRST2PAGES NAND_BBT_SCAN1STPAGE |	\
				 NAND_BBT_SCAN2NDPAGE

and then patch all users of NAND_BBT_SCAN2NDPAGE to use
NAND_BBT_SCANFIRST2PAGES instead.

  reply	other threads:[~2018-12-20 14:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17 15:48 [PATCH 0/3] mtd: rawnand: Support bad block markers in first, second or last page Schrempf Frieder
2018-12-17 15:49 ` [PATCH 1/3] " Schrempf Frieder
2018-12-20 13:59   ` Boris Brezillon
2018-12-20 14:07     ` Boris Brezillon [this message]
2018-12-20 14:35     ` Schrempf Frieder
2018-12-20 15:42       ` Boris Brezillon
2018-12-17 15:49 ` [PATCH 2/3] mtd: rawnand: ESMT: Also use the last page for bad block markers Schrempf Frieder
2018-12-17 15:49 ` [PATCH 3/3] mtd: rawnand: AMD: " Schrempf Frieder

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=20181220150715.5b19f480@bbrezillon \
    --to=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    /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).