Skip to contentSkip to conversation

mtd: nand: fsmc: Small whitespace cleanup

PATCH In review Stefan Roese 3 participants 9 messages Oct 2, 2015 – Oct 27, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 mtd: nand: fsmc: Small whitespace cleanup

Remove tab in empty line.

Cc Linus Walleij <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>
---
 drivers/mtd/nand/fsmc_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/fsmc_nand.c +1 -1
index 793872f..dc94882 100644
@@ -960,7 +960,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 	host->data_va = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(host->data_va))
 		return PTR_ERR(host->data_va);
-	
+
 	host->data_pa = (dma_addr_t)res->start;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_addr");
Signature · 1 line
2.5.3
#1 lore raw

PATCH 2/3 mtd: nand: fsmc: Remove BUG macros

Remove the BUG macros and return with error (if possible) instead.

Cc Linus Walleij <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>
---
 drivers/mtd/nand/fsmc_nand.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mtd/nand/fsmc_nand.c +5 -3
index dc94882..45948e8 100644
@@ -348,7 +348,7 @@ static void fsmc_select_chip(struct mtd_info *mtd, int chipnr)
 		break;
 
 	default:
-		BUG();
+		dev_err(host->dev, "unsupported chip-select %d\n", chipnr);
 	}
 }
 
@@ -1111,7 +1111,8 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 		default:
 			dev_warn(&pdev->dev, "No oob scheme defined for oobsize %d\n",
 				 mtd->oobsize);
-			BUG();
+			ret = -EINVAL;
+			goto err_probe;
 		}
 	} else {
 		switch (host->mtd.oobsize) {
@@ -1127,7 +1128,8 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 		default:
 			dev_warn(&pdev->dev, "No oob scheme defined for oobsize %d\n",
 				 mtd->oobsize);
-			BUG();
+			ret = -EINVAL;
+			goto err_probe;
 		}
 	}
 
Signature · 1 line
2.5.3
#3 lore raw

PATCH v2 3/3 mtd: nand: fsmc: Add BCH4 SW ECC support for SPEAr600

In reply to Stefan Roese

This patch adds support for 4-bit ECC BCH4 for the SPEAr600 SoC. This can be used by boards equipped with a NAND chip that requires 4-bit ECC strength. The SPEAr600 HW ECC only supports 1-bit ECC strength.

To enable SW BCH4, you need to specify this in your nand controller DT node:

	nand-ecc-mode = "soft_bch";
	nand-ecc-strength = <4>;
	nand-ecc-step-size = <512>;

Tested on a custom SPEAr600 board.

Cc Linus Walleij <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>

---
v2:
- Used nand_dt_init() to parse the ECC properties
- Added optional ECC bindings documentation
- Removed whitespace change from this patch, moved to a separate patch
- Removed setting of nand_bch_calculate_ecc / nand_bch_correct_data as its already done in nand_scan_tail()
- Moved ECC checking after nand_scan_ident()
- Removed addition of ecc_mode to platform_data as its not needed anymore

 .../devicetree/bindings/mtd/fsmc-nand.txt          |  3 ++
 drivers/mtd/nand/fsmc_nand.c                       | 57 ++++++++++++++++------
 2 files changed, 44 insertions(+), 16 deletions(-)
Documentation/devicetree/bindings/mtd/fsmc-nand.txt +3 -0
index 5235cbc..f861178 100644
@@ -30,6 +30,9 @@ Optional properties:
                  command is asserted. Zero means one cycle, 255 means 256
                  cycles.
 - bank: default NAND bank to use (0-3 are valid, 0 is the default).
+- nand-ecc-mode      : see nand.txt
+- nand-ecc-strength  : see nand.txt
+- nand-ecc-step-size : see nand.txt
 
 Example:
 
drivers/mtd/nand/fsmc_nand.c +41 -16

86 lines not on this page · raw message

Signature · 1 line
2.5.3
#4 lore raw

Re: [PATCH 3/3 v2] mtd: nand: fsmc: Add BCH4 SW ECC support for SPEAr600

Please base your series on linux-next.git or l2-mtd.git. See:

http://linux-mtd.infradead.org/source.html

or the MAINTAINERS file.

Quoted 7 lines · Stefan Roese
drivers/mtd/nand/fsmc_nand.c +1 -0
@@ -1023,12 +1023,17 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 	nand->cmd_ctrl = fsmc_cmd_ctrl;
 	nand->chip_delay = 30;
 
+	/*

drivers/mtd/nand/fsmc_nand.c static int __init fsmc_nand_probe(struct platform_device *pdev) · line 1036

Quoted 10 lines
drivers/mtd/nand/fsmc_nand.c +4 -0
+	 * Setup default ECC mode. nand_dt_init() called from nand_scan_init()
+	 * can overwrite this value if the DT provides a different value.
+	 */
 	nand->ecc.mode = NAND_ECC_HW;
 	nand->ecc.hwctl = fsmc_enable_hwecc;
 	nand->ecc.size = 512;
 	nand->options = pdata->options;
 	nand->select_chip = fsmc_select_chip;
 	nand->badblockbits = 7;
+	nand->dn = np;

drivers/mtd/nand/fsmc_nand.c: In function ‘fsmc_nand_probe’:
drivers/mtd/nand/fsmc_nand.c:1036:6: error: ‘struct nand_chip’ has no member named ‘dn’

This field was renamed for clarity, to flash_node.

drivers/mtd/nand/fsmc_nand.c static int __init fsmc_nand_probe(struct platform_device *pdev) · line 1039

Quoted 3 lines
drivers/mtd/nand/fsmc_nand.c +0 -0
 	if (pdata->width == FSMC_NAND_BW16)
 		nand->options |= NAND_BUSWIDTH_16;

[...]

Brian

#5 lore raw

PATCH v3 3/3 mtd: nand: fsmc: Add BCH4 SW ECC support for SPEAr600

In reply to Stefan Roese

This patch adds support for 4-bit ECC BCH4 for the SPEAr600 SoC. This can be used by boards equipped with a NAND chip that requires 4-bit ECC strength. The SPEAr600 HW ECC only supports 1-bit ECC strength.

To enable SW BCH4, you need to specify this in your nand controller DT node:

	nand-ecc-mode = "soft_bch";
	nand-ecc-strength = <4>;
	nand-ecc-step-size = <512>;

Tested on a custom SPEAr600 board.

Cc Linus Walleij <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>

---
v3:
- Rebased on top of l2-mtd.git
- Changed "dn" to "flash_node"

v2:
- Used nand_dt_init() to parse the ECC properties
- Added optional ECC bindings documentation
- Removed whitespace change from this patch, moved to a separate patch
- Removed setting of nand_bch_calculate_ecc / nand_bch_correct_data as its already done in nand_scan_tail()
- Moved ECC checking after nand_scan_ident()
- Removed addition of ecc_mode to platform_data as its not needed anymore

 .../devicetree/bindings/mtd/fsmc-nand.txt          |  3 ++
 drivers/mtd/nand/fsmc_nand.c                       | 57 ++++++++++++++++------
 2 files changed, 44 insertions(+), 16 deletions(-)
Documentation/devicetree/bindings/mtd/fsmc-nand.txt +3 -0
index 5235cbc..f861178 100644
@@ -30,6 +30,9 @@ Optional properties:
                  command is asserted. Zero means one cycle, 255 means 256
                  cycles.
 - bank: default NAND bank to use (0-3 are valid, 0 is the default).
+- nand-ecc-mode      : see nand.txt
+- nand-ecc-strength  : see nand.txt
+- nand-ecc-step-size : see nand.txt
 
 Example:
 
drivers/mtd/nand/fsmc_nand.c +41 -16

86 lines not on this page · raw message

Signature · 1 line
2.6.2
#6 lore raw

Re: [PATCH 3/3 v3] mtd: nand: fsmc: Add BCH4 SW ECC support for SPEAr600

Hi Stefan,

Quoted 11 lines · Stefan Roese

This patch adds support for 4-bit ECC BCH4 for the SPEAr600 SoC. This can be used by boards equipped with a NAND chip that requires 4-bit ECC strength. The SPEAr600 HW ECC only supports 1-bit ECC strength.

To enable SW BCH4, you need to specify this in your nand controller DT node:

	nand-ecc-mode = "soft_bch";
	nand-ecc-strength = <4>;
	nand-ecc-step-size = <512>;
Quoted 7 lines

Tested on a custom SPEAr600 board.

Cc Linus Walleij <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>

---

Looks good. Applied to l2-mtd.git with a small addition.

Quoted 22 lines

v3:
- Rebased on top of l2-mtd.git
- Changed "dn" to "flash_node"

v2:
- Used nand_dt_init() to parse the ECC properties
- Added optional ECC bindings documentation
- Removed whitespace change from this patch, moved to a separate patch
- Removed setting of nand_bch_calculate_ecc / nand_bch_correct_data as its already done in nand_scan_tail()
- Moved ECC checking after nand_scan_ident()
- Removed addition of ecc_mode to platform_data as its not needed anymore

 .../devicetree/bindings/mtd/fsmc-nand.txt          |  3 ++
 drivers/mtd/nand/fsmc_nand.c                       | 57 ++++++++++++++++------
 2 files changed, 44 insertions(+), 16 deletions(-)
Documentation/devicetree/bindings/mtd/fsmc-nand.txt +0 -0
index 5235cbc..f861178 100644

Documentation/devicetree/bindings/mtd/fsmc-nand.txt Optional properties: · line 35

Quoted 6 lines
Documentation/devicetree/bindings/mtd/fsmc-nand.txt +3 -0
@@ -30,6 +30,9 @@ Optional properties:
                  command is asserted. Zero means one cycle, 255 means 256
                  cycles.
 - bank: default NAND bank to use (0-3 are valid, 0 is the default).
+- nand-ecc-mode      : see nand.txt
+- nand-ecc-strength  : see nand.txt
+- nand-ecc-step-size : see nand.txt

nand.txt provides more latitude than some controllers/drivers do. It's nice to specify which sort of modes are supported. I added a note aboute HW and soft BCH support here.

drivers/mtd/nand/fsmc_nand.c static int __init fsmc_nand_probe(struct platform_device *pdev) · line 1027

Quoted 13 lines
Documentation/devicetree/bindings/mtd/fsmc-nand.txt +0 -0
 Example:
 
drivers/mtd/nand/fsmc_nand.c +2 -0
index 9e4fd0f..b50be0d 100644
@@ -1023,12 +1023,17 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 	nand->cmd_ctrl = fsmc_cmd_ctrl;
 	nand->chip_delay = 30;
 
+	/*
+	 * Setup default ECC mode. nand_dt_init() called from nand_scan_init()

s/nand_scan_init/nand_scan_ident/

drivers/mtd/nand/fsmc_nand.c static int __init fsmc_nand_probe(struct platform_device *pdev) · line 1039

Quoted 12 lines
drivers/mtd/nand/fsmc_nand.c +3 -0
+	 * can overwrite this value if the DT provides a different value.
+	 */
 	nand->ecc.mode = NAND_ECC_HW;
 	nand->ecc.hwctl = fsmc_enable_hwecc;
 	nand->ecc.size = 512;
 	nand->options = pdata->options;
 	nand->select_chip = fsmc_select_chip;
 	nand->badblockbits = 7;
+	nand->flash_node = np;
 
 	if (pdata->width == FSMC_NAND_BW16)
 		nand->options |= NAND_BUSWIDTH_16;

[snip]

I squashed in the following change.

Documentation/devicetree/bindings/mtd/fsmc-nand.txt +3 -0
index f861178fe69f..32636eb77304 100644
@@ -34,6 +34,9 @@ Optional properties:
 - nand-ecc-strength  : see nand.txt
 - nand-ecc-step-size : see nand.txt
 
+Can support 1-bit HW ECC (default) or if stronger correction is required,
+software-based BCH.
+
 Example:
 
 	fsmc: flash@d1800000 {
drivers/mtd/nand/fsmc_nand.c +1 -1
index b50be0ddeadc..07af3dc7a4d2 100644
@@ -1024,7 +1024,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 	nand->chip_delay = 30;
 
 	/*
-	 * Setup default ECC mode. nand_dt_init() called from nand_scan_init()
+	 * Setup default ECC mode. nand_dt_init() called from nand_scan_ident()
 	 * can overwrite this value if the DT provides a different value.
 	 */
 	nand->ecc.mode = NAND_ECC_HW;
#7 lore raw

Re: [PATCH 3/3 v3] mtd: nand: fsmc: Add BCH4 SW ECC support for SPEAr600

Hi Brian,

Quoted 16 lines · Brian Norris

Hi Stefan,

Quoted 13 lines · Stefan Roese

This patch adds support for 4-bit ECC BCH4 for the SPEAr600 SoC. This can be used by boards equipped with a NAND chip that requires 4-bit ECC strength. The SPEAr600 HW ECC only supports 1-bit ECC strength.

To enable SW BCH4, you need to specify this in your nand controller DT node:

	nand-ecc-mode = "soft_bch";
	nand-ecc-strength = <4>;
	nand-ecc-step-size = <512>;

Tested on a custom SPEAr600 board.

Quoted 7 lines
Quoted 5 lines
Cc Linus Walleij <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Brian Norris <[email protected]>

---

Looks good. Applied to l2-mtd.git with a small addition.

Thanks Brian. Really appreciated.

Thanks,
Stefan