lkml.org 
[lkml]   [2018]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] mtd: rawnand: Support bad block markers in first, second or last page
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.

\
 
 \ /
  Last update: 2018-12-20 15:08    [W:0.057 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site