mbox series

[v2,0/4] mtd: rawnand: Support bad block markers in first, second or last page

Message ID 20190122112258.20042-1-frieder.schrempf@kontron.de
Headers show
Series mtd: rawnand: Support bad block markers in first, second or last page | expand

Message

Frieder Schrempf Jan. 22, 2019, 11:23 a.m. UTC
From: Frieder Schrempf <frieder.schrempf@kontron.de>

Currently supported bad block marker positions within the block are:
* in first page only
* in last page only
* in first or second page

Some ESMT NANDs are known to have been shipped by the manufacturer
with bad block markers in the first or last page, instead of the
first or second page.

Also the datasheets for Cypress/Spansion/AMD NANDs claim that the
first, second *and* last page needs to be checked.

Therefore we make it possible to set NAND_BBT_SCAN2NDPAGE and
NAND_BBT_SCANLASTPAGE at the same time to scan/set all three pages.

This series also contains patches for AMD/Spansion/Cypress and ESMT
chips to enable both flags at the same time.
---
Changes in v2:
==============
* Rebase on 5.0-rc1
* Add patch to move bad block marker position info to a common place and
  rename/prepare existing flags
* improve/rename function nand_bbm_get_next_page() to use new flags
---
Frieder Schrempf (4):
  mtd: nand: Always store info about bad block markers in chip struct
  mtd: rawnand: Support bad block markers in first, second or last page
  mtd: rawnand: ESMT: Also use the last page for bad block markers
  mtd: rawnand: AMD: Also use the last page for bad block markers

 drivers/mtd/nand/onenand/onenand_base.c |  2 +-
 drivers/mtd/nand/onenand/onenand_bbt.c  |  2 +-
 drivers/mtd/nand/raw/internals.h        |  1 +
 drivers/mtd/nand/raw/nand_amd.c         |  8 +++-
 drivers/mtd/nand/raw/nand_base.c        | 64 +++++++++++++++++--------
 drivers/mtd/nand/raw/nand_bbt.c         | 28 +++++------
 drivers/mtd/nand/raw/nand_esmt.c        |  9 +++-
 drivers/mtd/nand/raw/nand_hynix.c       |  4 +-
 drivers/mtd/nand/raw/nand_macronix.c    |  2 +-
 drivers/mtd/nand/raw/nand_micron.c      |  2 +-
 drivers/mtd/nand/raw/nand_samsung.c     |  4 +-
 drivers/mtd/nand/raw/nand_toshiba.c     |  2 +-
 drivers/mtd/nand/raw/sh_flctl.c         |  4 +-
 include/linux/mtd/bbm.h                 | 14 +-----
 include/linux/mtd/rawnand.h             | 16 +++++++
 15 files changed, 100 insertions(+), 62 deletions(-)

Comments

Frieder Schrempf Jan. 22, 2019, 1:09 p.m. UTC | #1
On 22.01.19 12:22, Schrempf Frieder wrote:
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> Currently supported bad block marker positions within the block are:
> * in first page only
> * in last page only
> * in first or second page
> 
> Some ESMT NANDs are known to have been shipped by the manufacturer
> with bad block markers in the first or last page, instead of the
> first or second page.
> 
> Also the datasheets for Cypress/Spansion/AMD NANDs claim that the
> first, second *and* last page needs to be checked.
> 
> Therefore we make it possible to set NAND_BBT_SCAN2NDPAGE and
> NAND_BBT_SCANLASTPAGE at the same time to scan/set all three pages.

In v2 the flags were redefined and are now called NAND_BBM_FIRSTPAGE, 
NAND_BBM_FIRSTPAGE and NAND_BBM_LASTPAGE. I forgot to edit this paragraph.

> 
> This series also contains patches for AMD/Spansion/Cypress and ESMT
> chips to enable both flags at the same time.
> ---
> Changes in v2:
> ==============
> * Rebase on 5.0-rc1
> * Add patch to move bad block marker position info to a common place and
>    rename/prepare existing flags
> * improve/rename function nand_bbm_get_next_page() to use new flags
> ---
> Frieder Schrempf (4):
>    mtd: nand: Always store info about bad block markers in chip struct
>    mtd: rawnand: Support bad block markers in first, second or last page
>    mtd: rawnand: ESMT: Also use the last page for bad block markers
>    mtd: rawnand: AMD: Also use the last page for bad block markers
> 
>   drivers/mtd/nand/onenand/onenand_base.c |  2 +-
>   drivers/mtd/nand/onenand/onenand_bbt.c  |  2 +-
>   drivers/mtd/nand/raw/internals.h        |  1 +
>   drivers/mtd/nand/raw/nand_amd.c         |  8 +++-
>   drivers/mtd/nand/raw/nand_base.c        | 64 +++++++++++++++++--------
>   drivers/mtd/nand/raw/nand_bbt.c         | 28 +++++------
>   drivers/mtd/nand/raw/nand_esmt.c        |  9 +++-
>   drivers/mtd/nand/raw/nand_hynix.c       |  4 +-
>   drivers/mtd/nand/raw/nand_macronix.c    |  2 +-
>   drivers/mtd/nand/raw/nand_micron.c      |  2 +-
>   drivers/mtd/nand/raw/nand_samsung.c     |  4 +-
>   drivers/mtd/nand/raw/nand_toshiba.c     |  2 +-
>   drivers/mtd/nand/raw/sh_flctl.c         |  4 +-
>   include/linux/mtd/bbm.h                 | 14 +-----
>   include/linux/mtd/rawnand.h             | 16 +++++++
>   15 files changed, 100 insertions(+), 62 deletions(-)
>