Message ID | 1460750052-16285-13-git-send-email-zajec5@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, 15 Apr 2016 21:54:12 +0200 Rafa? Mi?ecki <zajec5@gmail.com> wrote: > This value should not be part of nand_ecc_modes_t as it specifies > algorithm not a mode. We successfully managed to introduce new "algo" > field which is respected now. > > Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> > --- > drivers/mtd/nand/fsmc_nand.c | 3 +-- > drivers/mtd/nand/jz4780_nand.c | 1 - > drivers/mtd/nand/nand_base.c | 2 -- > drivers/mtd/nand/nandsim.c | 2 +- > drivers/mtd/nand/sunxi_nand.c | 2 -- > include/linux/mtd/nand.h | 1 - > 6 files changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c > index 0f8c63f..d4f454a 100644 > --- a/drivers/mtd/nand/fsmc_nand.c > +++ b/drivers/mtd/nand/fsmc_nand.c > @@ -959,7 +959,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) > break; > > case NAND_ECC_SOFT: > - case NAND_ECC_SOFT_BCH: > if (nand->ecc.algo == NAND_ECC_BCH) { > dev_info(&pdev->dev, "Using 4-bit SW BCH ECC scheme\n"); > break; > @@ -974,7 +973,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) > * Don't set layout for BCH4 SW ECC. This will be > * generated later in nand_bch_init() later. > */ > - if (nand->ecc.mode != NAND_ECC_SOFT_BCH) { > + if (nand->ecc.mode == NAND_ECC_HW) { This test is wrong, it should be if (nand->ecc.mode != NAND_ECC_SOFT || nand->ecc.algo != NAND_ECC_BCH) or if (!(nand->ecc.mode == NAND_ECC_SOFT && nand->ecc.algo == NAND_ECC_BCH) > switch (mtd->oobsize) { > case 16: > case 64: > diff --git a/drivers/mtd/nand/jz4780_nand.c b/drivers/mtd/nand/jz4780_nand.c > index 10f249a..daf3c42 100644 > --- a/drivers/mtd/nand/jz4780_nand.c > +++ b/drivers/mtd/nand/jz4780_nand.c > @@ -179,7 +179,6 @@ static int jz4780_nand_init_ecc(struct jz4780_nand_chip *nand, struct device *de > chip->ecc.correct = jz4780_nand_ecc_correct; > /* fall through */ > case NAND_ECC_SOFT: > - case NAND_ECC_SOFT_BCH: > dev_info(dev, "using %s (strength %d, size %d, bytes %d)\n", > (nfc->bch) ? "hardware BCH" : "software ECC", > chip->ecc.strength, chip->ecc.size, chip->ecc.bytes); > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c > index ffd1b32..186d5b5 100644 > --- a/drivers/mtd/nand/nand_base.c > +++ b/drivers/mtd/nand/nand_base.c > @@ -4248,7 +4248,6 @@ int nand_scan_tail(struct mtd_info *mtd) > ecc->algo = NAND_ECC_HAMMING; > > case NAND_ECC_SOFT: > - case NAND_ECC_SOFT_BCH: > switch (ecc->algo) { > case NAND_ECC_HAMMING: > ecc->calculate = nand_calculate_ecc; > @@ -4386,7 +4385,6 @@ int nand_scan_tail(struct mtd_info *mtd) > /* Large page NAND with SOFT_ECC should support subpage reads */ > switch (ecc->mode) { > case NAND_ECC_SOFT: > - case NAND_ECC_SOFT_BCH: > if (chip->page_shift > 9) > chip->options |= NAND_SUBPAGE_READ; > break; > diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c > index 6ff1d8d..b0074c2 100644 > --- a/drivers/mtd/nand/nandsim.c > +++ b/drivers/mtd/nand/nandsim.c > @@ -2339,7 +2339,7 @@ static int __init ns_init_module(void) > retval = -EINVAL; > goto error; > } > - chip->ecc.mode = NAND_ECC_SOFT_BCH; > + chip->ecc.mode = NAND_ECC_SOFT; > chip->ecc.algo = NAND_ECC_BCH; > chip->ecc.size = 512; > chip->ecc.strength = bch; > diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c > index 1baf8983..a83a690 100644 > --- a/drivers/mtd/nand/sunxi_nand.c > +++ b/drivers/mtd/nand/sunxi_nand.c > @@ -1612,8 +1612,6 @@ static int sunxi_nand_ecc_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc, > return -EINVAL; > > switch (ecc->mode) { > - case NAND_ECC_SOFT_BCH: > - break; > case NAND_ECC_HW: > ret = sunxi_nand_hw_ecc_ctrl_init(mtd, ecc, np); > if (ret) > diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h > index e851839..fbe8e16 100644 > --- a/include/linux/mtd/nand.h > +++ b/include/linux/mtd/nand.h > @@ -116,7 +116,6 @@ typedef enum { > NAND_ECC_HW, > NAND_ECC_HW_SYNDROME, > NAND_ECC_HW_OOB_FIRST, > - NAND_ECC_SOFT_BCH, > } nand_ecc_modes_t; > > enum nand_ecc_algo {
On 17 April 2016 at 19:05, Boris Brezillon <boris.brezillon@free-electrons.com> wrote: > On Fri, 15 Apr 2016 21:54:12 +0200 > Rafa? Mi?ecki <zajec5@gmail.com> wrote: > >> This value should not be part of nand_ecc_modes_t as it specifies >> algorithm not a mode. We successfully managed to introduce new "algo" >> field which is respected now. >> >> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> >> --- >> drivers/mtd/nand/fsmc_nand.c | 3 +-- >> drivers/mtd/nand/jz4780_nand.c | 1 - >> drivers/mtd/nand/nand_base.c | 2 -- >> drivers/mtd/nand/nandsim.c | 2 +- >> drivers/mtd/nand/sunxi_nand.c | 2 -- >> include/linux/mtd/nand.h | 1 - >> 6 files changed, 2 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c >> index 0f8c63f..d4f454a 100644 >> --- a/drivers/mtd/nand/fsmc_nand.c >> +++ b/drivers/mtd/nand/fsmc_nand.c >> @@ -959,7 +959,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) >> break; >> >> case NAND_ECC_SOFT: >> - case NAND_ECC_SOFT_BCH: >> if (nand->ecc.algo == NAND_ECC_BCH) { >> dev_info(&pdev->dev, "Using 4-bit SW BCH ECC scheme\n"); >> break; >> @@ -974,7 +973,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) >> * Don't set layout for BCH4 SW ECC. This will be >> * generated later in nand_bch_init() later. >> */ >> - if (nand->ecc.mode != NAND_ECC_SOFT_BCH) { >> + if (nand->ecc.mode == NAND_ECC_HW) { > > This test is wrong, it should be > > if (nand->ecc.mode != NAND_ECC_SOFT || > nand->ecc.algo != NAND_ECC_BCH) > > or > if (!(nand->ecc.mode == NAND_ECC_SOFT && > nand->ecc.algo == NAND_ECC_BCH) This driver supports only 2 modes (see switch above).
On Sun, 17 Apr 2016 19:10:11 +0200 Rafa? Mi?ecki <zajec5@gmail.com> wrote: > On 17 April 2016 at 19:05, Boris Brezillon > <boris.brezillon@free-electrons.com> wrote: > > On Fri, 15 Apr 2016 21:54:12 +0200 > > Rafa? Mi?ecki <zajec5@gmail.com> wrote: > > > >> This value should not be part of nand_ecc_modes_t as it specifies > >> algorithm not a mode. We successfully managed to introduce new "algo" > >> field which is respected now. > >> > >> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> > >> --- > >> drivers/mtd/nand/fsmc_nand.c | 3 +-- > >> drivers/mtd/nand/jz4780_nand.c | 1 - > >> drivers/mtd/nand/nand_base.c | 2 -- > >> drivers/mtd/nand/nandsim.c | 2 +- > >> drivers/mtd/nand/sunxi_nand.c | 2 -- > >> include/linux/mtd/nand.h | 1 - > >> 6 files changed, 2 insertions(+), 9 deletions(-) > >> > >> diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c > >> index 0f8c63f..d4f454a 100644 > >> --- a/drivers/mtd/nand/fsmc_nand.c > >> +++ b/drivers/mtd/nand/fsmc_nand.c > >> @@ -959,7 +959,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) > >> break; > >> > >> case NAND_ECC_SOFT: > >> - case NAND_ECC_SOFT_BCH: > >> if (nand->ecc.algo == NAND_ECC_BCH) { > >> dev_info(&pdev->dev, "Using 4-bit SW BCH ECC scheme\n"); > >> break; > >> @@ -974,7 +973,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) > >> * Don't set layout for BCH4 SW ECC. This will be > >> * generated later in nand_bch_init() later. > >> */ > >> - if (nand->ecc.mode != NAND_ECC_SOFT_BCH) { > >> + if (nand->ecc.mode == NAND_ECC_HW) { > > > > This test is wrong, it should be > > > > if (nand->ecc.mode != NAND_ECC_SOFT || > > nand->ecc.algo != NAND_ECC_BCH) > > > > or > > if (!(nand->ecc.mode == NAND_ECC_SOFT && > > nand->ecc.algo == NAND_ECC_BCH) > > This driver supports only 2 modes (see switch above). Indeed. Sorry, I didn't read the full context. Thanks for the clarification. Boris
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c index 0f8c63f..d4f454a 100644 --- a/drivers/mtd/nand/fsmc_nand.c +++ b/drivers/mtd/nand/fsmc_nand.c @@ -959,7 +959,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) break; case NAND_ECC_SOFT: - case NAND_ECC_SOFT_BCH: if (nand->ecc.algo == NAND_ECC_BCH) { dev_info(&pdev->dev, "Using 4-bit SW BCH ECC scheme\n"); break; @@ -974,7 +973,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) * Don't set layout for BCH4 SW ECC. This will be * generated later in nand_bch_init() later. */ - if (nand->ecc.mode != NAND_ECC_SOFT_BCH) { + if (nand->ecc.mode == NAND_ECC_HW) { switch (mtd->oobsize) { case 16: case 64: diff --git a/drivers/mtd/nand/jz4780_nand.c b/drivers/mtd/nand/jz4780_nand.c index 10f249a..daf3c42 100644 --- a/drivers/mtd/nand/jz4780_nand.c +++ b/drivers/mtd/nand/jz4780_nand.c @@ -179,7 +179,6 @@ static int jz4780_nand_init_ecc(struct jz4780_nand_chip *nand, struct device *de chip->ecc.correct = jz4780_nand_ecc_correct; /* fall through */ case NAND_ECC_SOFT: - case NAND_ECC_SOFT_BCH: dev_info(dev, "using %s (strength %d, size %d, bytes %d)\n", (nfc->bch) ? "hardware BCH" : "software ECC", chip->ecc.strength, chip->ecc.size, chip->ecc.bytes); diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index ffd1b32..186d5b5 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4248,7 +4248,6 @@ int nand_scan_tail(struct mtd_info *mtd) ecc->algo = NAND_ECC_HAMMING; case NAND_ECC_SOFT: - case NAND_ECC_SOFT_BCH: switch (ecc->algo) { case NAND_ECC_HAMMING: ecc->calculate = nand_calculate_ecc; @@ -4386,7 +4385,6 @@ int nand_scan_tail(struct mtd_info *mtd) /* Large page NAND with SOFT_ECC should support subpage reads */ switch (ecc->mode) { case NAND_ECC_SOFT: - case NAND_ECC_SOFT_BCH: if (chip->page_shift > 9) chip->options |= NAND_SUBPAGE_READ; break; diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 6ff1d8d..b0074c2 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c @@ -2339,7 +2339,7 @@ static int __init ns_init_module(void) retval = -EINVAL; goto error; } - chip->ecc.mode = NAND_ECC_SOFT_BCH; + chip->ecc.mode = NAND_ECC_SOFT; chip->ecc.algo = NAND_ECC_BCH; chip->ecc.size = 512; chip->ecc.strength = bch; diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c index 1baf8983..a83a690 100644 --- a/drivers/mtd/nand/sunxi_nand.c +++ b/drivers/mtd/nand/sunxi_nand.c @@ -1612,8 +1612,6 @@ static int sunxi_nand_ecc_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc, return -EINVAL; switch (ecc->mode) { - case NAND_ECC_SOFT_BCH: - break; case NAND_ECC_HW: ret = sunxi_nand_hw_ecc_ctrl_init(mtd, ecc, np); if (ret) diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index e851839..fbe8e16 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -116,7 +116,6 @@ typedef enum { NAND_ECC_HW, NAND_ECC_HW_SYNDROME, NAND_ECC_HW_OOB_FIRST, - NAND_ECC_SOFT_BCH, } nand_ecc_modes_t; enum nand_ecc_algo {
This value should not be part of nand_ecc_modes_t as it specifies algorithm not a mode. We successfully managed to introduce new "algo" field which is respected now. Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> --- drivers/mtd/nand/fsmc_nand.c | 3 +-- drivers/mtd/nand/jz4780_nand.c | 1 - drivers/mtd/nand/nand_base.c | 2 -- drivers/mtd/nand/nandsim.c | 2 +- drivers/mtd/nand/sunxi_nand.c | 2 -- include/linux/mtd/nand.h | 1 - 6 files changed, 2 insertions(+), 9 deletions(-)