Re: [PATCH] mtd: nand: Rename nand.h into rawnand.h

2017-08-07 Thread Harvey Hunt

Hi Boris,

On 08/04/2017 04:29 PM, Boris Brezillon wrote:
[...]

  drivers/mtd/nand/jz4780_nand.c  | 2 +-

[...]

For JZ4780,

Acked-By: Harvey Hunt <harveyhuntne...@gmail.com>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 39/52] mtd: nand: jz4780: switch to mtd_ooblayout_ops

2016-02-29 Thread Harvey Hunt

Hi Boris,

On 26/02/16 00:57, Boris Brezillon wrote:

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezil...@free-electrons.com>
---
  drivers/mtd/nand/jz4780_nand.c | 19 +--
  1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/nand/jz4780_nand.c b/drivers/mtd/nand/jz4780_nand.c
index e1c016c..b86a579 100644
--- a/drivers/mtd/nand/jz4780_nand.c
+++ b/drivers/mtd/nand/jz4780_nand.c
@@ -56,8 +56,6 @@ struct jz4780_nand_chip {
struct nand_chip chip;
struct list_head chip_list;

-   struct nand_ecclayout ecclayout;
-
struct gpio_desc *busy_gpio;
struct gpio_desc *wp_gpio;
unsigned int reading: 1;
@@ -165,8 +163,7 @@ static int jz4780_nand_init_ecc(struct jz4780_nand_chip 
*nand, struct device *de
struct nand_chip *chip = >chip;
struct mtd_info *mtd = nand_to_mtd(chip);
struct jz4780_nand_controller *nfc = 
to_jz4780_nand_controller(chip->controller);
-   struct nand_ecclayout *layout = >ecclayout;
-   u32 start, i;
+   int eccbytes;

chip->ecc.bytes = fls((1 + 8) * chip->ecc.size)   *
(chip->ecc.strength / 8);
@@ -201,23 +198,17 @@ static int jz4780_nand_init_ecc(struct jz4780_nand_chip 
*nand, struct device *de
return 0;

/* Generate ECC layout. ECC codes are right aligned in the OOB area. */
-   layout->eccbytes = mtd->writesize / chip->ecc.size * chip->ecc.bytes;
+   eccbytes = mtd->writesize / chip->ecc.size * chip->ecc.bytes;

-   if (layout->eccbytes > mtd->oobsize - 2) {
+   if (eccbytes > mtd->oobsize - 2) {
dev_err(dev,
"invalid ECC config: required %d ECC bytes, but only %d are 
available",
-   layout->eccbytes, mtd->oobsize - 2);
+   eccbytes, mtd->oobsize - 2);
return -EINVAL;
}

-   start = mtd->oobsize - layout->eccbytes;
-   for (i = 0; i < layout->eccbytes; i++)
-   layout->eccpos[i] = start + i;
-
-   layout->oobfree[0].offset = 2;
-   layout->oobfree[0].length = mtd->oobsize - layout->eccbytes - 2;
+   mtd->ooblayout = _ooblayout_lp_ops;

-   chip->ecc.layout = layout;
return 0;
  }




With your patch applied [0] that you gave me earlier in the patchset, I 
am able to boot to userland on my Ci20 (jz4780_{nand,bch}) with a NAND 
rootfs. So, dependant upon that patch (or equivalent) being added to 
this patchset:


Tested-by: Harvey Hunt <harvey.h...@imgtec.com>

Thanks,

Harvey

[0] http://code.bulix.org/36oytz-91960
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 07/52] mtd: nand: core: use mtd_ooblayout_xxx() helpers where appropriate

2016-02-29 Thread Harvey Hunt

Hi Boris,

On 26/02/16 18:33, Boris Brezillon wrote:

Hi Harvey,

On Fri, 26 Feb 2016 15:17:28 +
Harvey Hunt <harvey.h...@imgtec.com> wrote:


Hi Boris,

On 26/02/16 15:10, Boris Brezillon wrote:

Hi Harvey,

On Fri, 26 Feb 2016 14:35:08 +
Harvey Hunt <harvey.h...@imgtec.com> wrote:


[...]
I'll look into this more later today, but wanted to run it by you in
case you have any thoughts.


Can you apply this patch [1], and let me know if you see the additional
trace?


I applied the patch, the following is the (unchanged) output:

[0.256375] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x88
[0.262887] nand: Micron MT29F64G08CBAAAWP
[0.266995] nand: 8192 MiB, MLC, erase size: 2048 KiB, page size:
8192, OOB size: 448
[0.274881] jz4780-nand 1b00.nand-controller: using hardware BCH
(strength 24, size 1024, bytes 42)
[0.289046] Bad block table not found for chip 0
[0.297769] Bad block table not found for chip 0
[0.302425] Scanning device for bad blocks
[0.320239] Bad eraseblock 90 at 0x0b40
[0.324934] Bad eraseblock 91 at 0x0b60
[0.931054] Bad eraseblock 4092 at 0x0001ff80
[0.935917] Bad eraseblock 4093 at 0x0001ffa0
[0.944660] nand_bbt: error while writing bad block table -34
[0.950448] jz4780-nand: probe of 1b00.nand-controller failed
with error -34
[0.958079] UBI error: cannot open mtd 3, error -19
[0.962788] UBI error: cannot open mtd 4, error -19[0.970229]
clk: Not disabling unused clocks



Can you test with this one [1]?

[1]http://code.bulix.org/36oytz-91960


With that patch applied, my Ci20 successfully boots again.

Thanks for looking into it :-)

Harvey
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 07/52] mtd: nand: core: use mtd_ooblayout_xxx() helpers where appropriate

2016-02-26 Thread Harvey Hunt

Hi Boris,

On 26/02/16 15:10, Boris Brezillon wrote:

Hi Harvey,

On Fri, 26 Feb 2016 14:35:08 +
Harvey Hunt <harvey.h...@imgtec.com> wrote:


[...]
I'll look into this more later today, but wanted to run it by you in
case you have any thoughts.


Can you apply this patch [1], and let me know if you see the additional
trace?


I applied the patch, the following is the (unchanged) output:

[0.256375] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x88
[0.262887] nand: Micron MT29F64G08CBAAAWP
[0.266995] nand: 8192 MiB, MLC, erase size: 2048 KiB, page size: 
8192, OOB size: 448
[0.274881] jz4780-nand 1b00.nand-controller: using hardware BCH 
(strength 24, size 1024, bytes 42)

[0.289046] Bad block table not found for chip 0
[0.297769] Bad block table not found for chip 0
[0.302425] Scanning device for bad blocks
[0.320239] Bad eraseblock 90 at 0x0b40
[0.324934] Bad eraseblock 91 at 0x0b60
[0.931054] Bad eraseblock 4092 at 0x0001ff80
[0.935917] Bad eraseblock 4093 at 0x0001ffa0
[0.944660] nand_bbt: error while writing bad block table -34
[0.950448] jz4780-nand: probe of 1b00.nand-controller failed 
with error -34

[0.958079] UBI error: cannot open mtd 3, error -19
[0.962788] UBI error: cannot open mtd 4, error -19[0.970229] 
clk: Not disabling unused clocks




Thanks,

Boris

[1]http://code.bulix.org/l2hkl1-91947



Thanks,

Harvey
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 07/52] mtd: nand: core: use mtd_ooblayout_xxx() helpers where appropriate

2016-02-26 Thread Harvey Hunt

Hi Boris,

On 26/02/16 00:57, Boris Brezillon wrote:

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon 
---
  drivers/mtd/nand/nand_base.c | 183 +++
  drivers/mtd/nand/nand_bch.c  |   3 +-
  2 files changed, 82 insertions(+), 104 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 91672bf..17504f2 100644

[...]

I just pulled your nand/ecclayout branch from github and tested out your 
latest patchset "mtd: rework ECC layout definition" on a Ci20 
(jz4780_{nand,bch}) and noticed that my board was failing to boot.


I bisected to this patch, here is the kernel's output during boot:

479556d ("mtd: nand: core: use mtd_ooblayout_xxx() helpers where 
appropriate"):


[ 0.256349] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x88
[ 0.262860] nand: Micron MT29F64G08CBAAAWP
[ 0.266970] nand: 8192 MiB, MLC, erase size: 2048 KiB, page size: 8192, 
OOB size: 448
[ 0.274856] jz4780-nand 1b00.nand-controller: using hardware BCH 
(strength 24, size 1024, bytes 42)

[ 0.288982] Bad block table not found for chip 0
[ 0.297673] Bad block table not found for chip 0
[ 0.302328] Scanning device for bad blocks
[ 0.320135] Bad eraseblock 90 at 0x0b40
[ 0.324829] Bad eraseblock 91 at 0x0b60
[ 0.931085] Bad eraseblock 4092 at 0x0001ff80
[ 0.935947] Bad eraseblock 4093 at 0x0001ffa0
[ 0.944878] nand_bbt: error while writing bad block table -34
[ 0.950666] jz4780-nand: probe of 1b00.nand-controller failed with 
error -34

[ 0.958302] UBI error: cannot open mtd 3, error -19
[ 0.963002] UBI error: cannot open mtd 4, error -19[ 0.970419] clk: Not 
disabling unused clocks
[ 0.975011] UBIFS error (pid: 1): cannot open "ubi1:root", error -19VFS: 
Cannot open root device "ubi1:root" or unknown-block(0,0): error -19
[ 0.987810] Please append a correct "root=" boot option; here are the 
available partitions:
[ 0.996210] Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(0,0)

[ 1.004498] Rebooting in 10 seconds..

6625d32 ("mtd: use mtd_ooblayout_xxx() helpers where appropriate"):

[ 0.256232] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x88
[ 0.262745] nand: Micron MT29F64G08CBAAAWP
[ 0.266854] nand: 8192 MiB, MLC, erase size: 2048 KiB, page size: 8192, 
OOB size: 448
[ 0.274739] jz4780-nand 1b00.nand-controller: using hardware BCH 
(strength 24, size 1024, bytes 42)

[ 0.285993] Bad block table found at page 1048320, version 0x01
[ 0.294353] Bad block table found at page 1048064, version 0x01
[ 0.301523] nand_read_bbt: bad block at 0x0b40
[ 0.306677] nand_read_bbt: bad block at 0x0b60
[ 0.312289] 5 ofpart partitions found on MTD device 
1b00.nand-controller.1

[ 0.319553] Creating 5 MTD partitions on "1b00.nand-controller.1":
[ 0.326098] 0x-0x0080 : "u-boot-spl"
[ 0.331757] 0x0080-0x00a0 : "u-boot"
[ 0.337185] 0x00a0-0x00c0 : "u-boot-env"
[ 0.342903] 0x00c0-0x04c0 : "boot"
[ 0.348109] 0x04c0-0x0002 : "system"
[ 0.354284] ubi0 error: ubi_attach_mtd_dev: More than 64 PEBs are needed 
for fastmap, sorry.

[...]

I'll look into this more later today, but wanted to run it by you in 
case you have any thoughts.


Thanks,

Harvey
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 05/23] mtd: nand: jz4770: kill the ->ecc_layout field

2015-12-08 Thread Harvey Hunt

Hi Boris,

On 07/12/15 22:26, Boris Brezillon wrote:

->ecc_layout is not used by any board file. Kill this field to avoid any
confusion. New boards are encouraged to use the default ECC layout defined
in NAND core.

Signed-off-by: Boris Brezillon 
---
  arch/mips/include/asm/mach-jz4740/jz4740_nand.h | 2 --
  drivers/mtd/nand/jz4740_nand.c  | 3 ---
  2 files changed, 5 deletions(-)

diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h 
b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h
index 79cff26..398733e 100644
--- a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h
+++ b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h
@@ -25,8 +25,6 @@ struct jz_nand_platform_data {
int num_partitions;
struct mtd_partition*partitions;

-   struct nand_ecclayout   *ecc_layout;
-
unsigned char banks[JZ_NAND_NUM_BANKS];

void (*ident_callback)(struct platform_device *, struct nand_chip *,
diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c
index 5a99a93..c4fe446 100644
--- a/drivers/mtd/nand/jz4740_nand.c
+++ b/drivers/mtd/nand/jz4740_nand.c
@@ -446,9 +446,6 @@ static int jz_nand_probe(struct platform_device *pdev)
chip->ecc.bytes  = 9;
chip->ecc.strength   = 4;

-   if (pdata)
-   chip->ecc.layout = pdata->ecc_layout;
-
chip->chip_delay = 50;
chip->cmd_ctrl = jz_nand_cmd_ctrl;
chip->select_chip = jz_nand_select_chip;



Is there a typo in this commit title? The JZ4740 and JZ4770 have quite 
different NAND controller interfaces, so I don't think that the JZ4740 
driver will support the JZ4770.


Thanks,

Harvey
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel