mtd: rawnand: Add a NAND_NO_BBM_QUIRK flag
Subsystems (2)
PATCH v2 1/3 mtd: rawnand: Add a NAND_NO_BBM_QUIRK flag
Some controllers with embedded ECC engines override the BBM marker with data or ECC bytes, thus making bad block detection through bad block marker impossible. Let's flag those chips so the core knows it shouldn't check the BBM and consider all blocks good.
This should allow us to get rid of two implementers of the legacy.block_bad() hook.
---
Changes in v2:
* Use the BIT() macro
* Rebase on top of nand/next
--- drivers/mtd/nand/raw/nand_base.c | 3 +++ include/linux/mtd/rawnand.h | 8 ++++++++ 2 files changed, 11 insertions(+)
drivers/mtd/nand/raw/nand_base.c +3 -0
@@ -395,6 +395,9 @@ static int nand_block_bad(struct nand_chip *chip, loff_t ofs)static int nand_isbad_bbm (struct nand_chip *chip,loff_t ofs) { +if (chip->options &NAND_NO_BBM_QUIRK ) +return 0 ; +if (chip->legacy.block_bad)return chip->legacy.block_bad (chip, ofs);
include/linux/mtd/rawnand.h +8 -0
@@ -221,6 +221,14 @@ enum nand_ecc_algo {#define NAND_BBM_SECONDPAGE BIT(25)#define NAND_BBM_LASTPAGE BIT(26) +/* +* Some controllers with pipelined ECC engines override the BBM marker with +* data or ECC bytes, thus making bad block detection through bad block marker +* impossible. Let's flag those chips so the core knows it shouldn't check the +* BBM and consider all blocks good. +*/ +#define NAND_NO_BBM_QUIRK BIT(27) +/* Cell info constants */ #define NAND_CI_CHIPNR_MSK 0x03#define NAND_CI_CELLTYPE_MSK 0x0C
Signature · 6 lines
2.25.3 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH v2 2/3 mtd: rawnand: cafe: Set the NAND_NO_BBM_QUIRK flag
We have a dummy block_bad() implementation returning 0. Let's set the NAND_NO_BBM_QUIRK flag and let the core take care of that.
---
Changes in v2:
* Add R-b
--- drivers/mtd/nand/raw/cafe_nand.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/mtd/nand/raw/cafe_nand.c +2 -9
@@ -546,11 +546,6 @@ static int cafe_nand_write_page_lowlevel(struct nand_chip *chip,return nand_prog_page_end_op (chip); } -static int cafe_nand_block_bad (struct nand_chip *chip,loff_t ofs) -{ -return 0 ; -} -/* F_2[X]/(X**6+X+1) */ static unsigned short gf64_mul (u8 a,u8 b) {
@@ -718,10 +713,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,/* Enable the following for a flash based bad block table */ cafe->nand.bbt_options =NAND_BBT_USE_FLASH ; -if (skipbbt) { - cafe->nand.options |=NAND_SKIP_BBTSCAN ; - cafe->nand.legacy.block_bad = cafe_nand_block_bad; - } +if (skipbbt) + cafe->nand.options |=NAND_SKIP_BBTSCAN |NAND_NO_BBM_QUIRK ;if (numtimings && numtimings !=3 ) {dev_warn (&cafe->pdev->dev,"%d timing register values ignored; precisely three are required\n" , numtimings);
Signature · 6 lines
2.25.3 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH v2 2/3] mtd: rawnand: cafe: Set the NAND_NO_BBM_QUIRK flag
Quoted 5 lines · Boris Brezillon
We have a dummy
block_bad()implementation returning 0. Let's set theNAND_NO_BBM_QUIRKflag and let the core take care of that.Signed-off-by Boris Brezillon <[email protected]>Reviewed-by Miquel Raynal <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH v2 3/3 mtd: rawnand: diskonchip: Set the NAND_NO_BBM_QUIRK flag
In reply to Boris BrezillonWe have a dummy block_bad() implementation returning 0. Let's set the NAND_NO_BBM_QUIRK flag and let the core take care of that.
---
Changes in v2:
* Add R-b
--- drivers/mtd/nand/raw/diskonchip.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/mtd/nand/raw/diskonchip.c +1 -9
@@ -776,13 +776,6 @@ static int doc200x_dev_ready(struct nand_chip *this) } } -static int doc200x_block_bad (struct nand_chip *this,loff_t ofs) -{ -/* This is our last resort if we couldn't find or create a BBT. Just -pretend all blocks are good. */ -return 0 ; -} -static void doc200x_enable_hwecc (struct nand_chip *this,int mode) {struct doc_priv *doc =nand_get_controller_data (this);
@@ -1578,7 +1571,6 @@ static int __init doc_probe(unsigned long physadr) nand->legacy.cmd_ctrl = doc200x_hwcontrol; nand->legacy.dev_ready = doc200x_dev_ready; nand->legacy.waitfunc = doc200x_wait; - nand->legacy.block_bad = doc200x_block_bad; nand->ecc.hwctl = doc200x_enable_hwecc; nand->ecc.calculate = doc200x_calculate_ecc; nand->ecc.correct = doc200x_correct_data;
@@ -1590,7 +1582,7 @@ static int __init doc_probe(unsigned long physadr) nand->ecc.options =NAND_ECC_GENERIC_ERASED_CHECK ; nand->bbt_options =NAND_BBT_USE_FLASH ;/* Skip the automatic BBT scan so we can run it manually */ - nand->options |=NAND_SKIP_BBTSCAN ; + nand->options |=NAND_SKIP_BBTSCAN |NAND_NO_BBM_QUIRK ; doc->physadr = physadr; doc->virtadr = virtadr;
Signature · 6 lines
2.25.3 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH v2 3/3] mtd: rawnand: diskonchip: Set the NAND_NO_BBM_QUIRK flag
Quoted 5 lines · Boris Brezillon
We have a dummy
block_bad()implementation returning 0. Let's set theNAND_NO_BBM_QUIRKflag and let the core take care of that.Signed-off-by Boris Brezillon <[email protected]>Reviewed-by Miquel Raynal <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 9 lines · Boris Brezillon
Some controllers with embedded ECC engines override the BBM marker with data or ECC bytes, thus making bad block detection through bad block marker impossible. Let's flag those chips so the core knows it shouldn't check the BBM and consider all blocks good.
This should allow us to get rid of two implementers of the
legacy.block_bad()hook.Signed-off-by Boris Brezillon <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/