linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Davinci nand driver fixes and updates
@ 2013-11-20 15:22 Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 1/7] mtd: nand: davinci: fix driver registration Ivan Khoronzhuk
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Ivan Khoronzhuk @ 2013-11-20 15:22 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, grygorii.strashko, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Ivan Khoronzhuk, linux-arm-kernel

This series contains fixes and updates of Davinci nand driver, in
order to prepare it to be reused for Keystone platform.

V1:
https://lkml.org/lkml/2013/11/11/352

Ivan Khoronzhuk (7):
  mtd: nand: davinci: fix driver registration
  mtd: nand: davinci: return ENOMEM if memory allocation is failed
  mtd: nand: davinci: check required ti,davinci-chipselect property
  mtd: nand: davinci: simplify error handling
  mtd: nand: davinci: move bindings under mtd
  mtd: nand: davinci: extend description of bindings
  mtd: nand: davinci: adjust DT properties to MTD generic

 .../devicetree/bindings/arm/davinci/nand.txt       |   46 ----------
 .../devicetree/bindings/mtd/davinci-nand.txt       |   92 ++++++++++++++++++++
 drivers/mtd/nand/davinci_nand.c                    |   68 +++++++--------
 3 files changed, 126 insertions(+), 80 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/arm/davinci/nand.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/davinci-nand.txt

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/7] mtd: nand: davinci: fix driver registration
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
@ 2013-11-20 15:22 ` Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 2/7] mtd: nand: davinci: return ENOMEM if memory allocation is failed Ivan Khoronzhuk
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ivan Khoronzhuk @ 2013-11-20 15:22 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, grygorii.strashko, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Ivan Khoronzhuk, linux-arm-kernel

When kernel is booted using DT, there is no guarantee that Davinci
NAND device has been created already at the time when driver init
function is executed. Therefore, platform_driver_probe() can't be used
because this may result the Davinci NAND driver will never be probed.
The driver probing has to be made with core mechanism.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 drivers/mtd/nand/davinci_nand.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index b77a01e..d87213f 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -877,6 +877,7 @@ static int __exit nand_davinci_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver nand_davinci_driver = {
+	.probe		= nand_davinci_probe,
 	.remove		= __exit_p(nand_davinci_remove),
 	.driver		= {
 		.name	= "davinci_nand",
@@ -886,7 +887,7 @@ static struct platform_driver nand_davinci_driver = {
 };
 MODULE_ALIAS("platform:davinci_nand");
 
-module_platform_driver_probe(nand_davinci_driver, nand_davinci_probe);
+module_platform_driver(nand_davinci_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Texas Instruments");
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/7] mtd: nand: davinci: return ENOMEM if memory allocation is failed
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 1/7] mtd: nand: davinci: fix driver registration Ivan Khoronzhuk
@ 2013-11-20 15:22 ` Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 3/7] mtd: nand: davinci: check required ti, davinci-chipselect property Ivan Khoronzhuk
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ivan Khoronzhuk @ 2013-11-20 15:22 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, grygorii.strashko, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Ivan Khoronzhuk, linux-arm-kernel

In case when memory allocation is failed the driver should return
ENOMEM instead of ENODEV.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 drivers/mtd/nand/davinci_nand.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index d87213f..ddcd7c8 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -541,7 +541,7 @@ static struct davinci_nand_pdata
 				GFP_KERNEL);
 		pdev->dev.platform_data = pdata;
 		if (!pdata)
-			return NULL;
+			return ERR_PTR(-ENOMEM);
 		if (!of_property_read_u32(pdev->dev.of_node,
 			"ti,davinci-chipselect", &prop))
 			pdev->id = prop;
@@ -598,6 +598,9 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 	nand_ecc_modes_t		ecc_mode;
 
 	pdata = nand_davinci_get_pdata(pdev);
+	if (IS_ERR(pdata))
+		return PTR_ERR(pdata);
+
 	/* insist on board-specific configuration */
 	if (!pdata)
 		return -ENODEV;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/7] mtd: nand: davinci: check required ti, davinci-chipselect property
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 1/7] mtd: nand: davinci: fix driver registration Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 2/7] mtd: nand: davinci: return ENOMEM if memory allocation is failed Ivan Khoronzhuk
@ 2013-11-20 15:22 ` Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 4/7] mtd: nand: davinci: simplify error handling Ivan Khoronzhuk
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ivan Khoronzhuk @ 2013-11-20 15:22 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, grygorii.strashko, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Ivan Khoronzhuk, linux-arm-kernel

The property "ti,davinci-chipselect" is required. So we have to check
if it is set.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 drivers/mtd/nand/davinci_nand.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index ddcd7c8..9a96ac7 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -545,6 +545,9 @@ static struct davinci_nand_pdata
 		if (!of_property_read_u32(pdev->dev.of_node,
 			"ti,davinci-chipselect", &prop))
 			pdev->id = prop;
+		else
+			return ERR_PTR(-EINVAL);
+
 		if (!of_property_read_u32(pdev->dev.of_node,
 			"ti,davinci-mask-ale", &prop))
 			pdata->mask_ale = prop;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/7] mtd: nand: davinci: simplify error handling
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
                   ` (2 preceding siblings ...)
  2013-11-20 15:22 ` [PATCH 3/7] mtd: nand: davinci: check required ti, davinci-chipselect property Ivan Khoronzhuk
@ 2013-11-20 15:22 ` Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 5/7] mtd: nand: davinci: move bindings under mtd Ivan Khoronzhuk
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ivan Khoronzhuk @ 2013-11-20 15:22 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, grygorii.strashko, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Ivan Khoronzhuk, linux-arm-kernel

There is not needed to use a lot of names for err handling.
It complicates code support and reading.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 drivers/mtd/nand/davinci_nand.c |   46 +++++++++++++++------------------------
 1 file changed, 17 insertions(+), 29 deletions(-)

diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index 9a96ac7..c0be223 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -615,8 +615,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
 	if (!info) {
 		dev_err(&pdev->dev, "unable to allocate memory\n");
-		ret = -ENOMEM;
-		goto err_nomem;
+		return -ENOMEM;
 	}
 
 	platform_set_drvdata(pdev, info);
@@ -625,20 +624,16 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 	res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	if (!res1 || !res2) {
 		dev_err(&pdev->dev, "resource missing\n");
-		ret = -EINVAL;
-		goto err_nomem;
+		return -EINVAL;
 	}
 
 	vaddr = devm_ioremap_resource(&pdev->dev, res1);
-	if (IS_ERR(vaddr)) {
-		ret = PTR_ERR(vaddr);
-		goto err_ioremap;
-	}
+	if (IS_ERR(vaddr))
+		return PTR_ERR(vaddr);
+
 	base = devm_ioremap_resource(&pdev->dev, res2);
-	if (IS_ERR(base)) {
-		ret = PTR_ERR(base);
-		goto err_ioremap;
-	}
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	info->dev		= &pdev->dev;
 	info->base		= base;
@@ -705,7 +700,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 			spin_unlock_irq(&davinci_nand_lock);
 
 			if (ret == -EBUSY)
-				goto err_ecc;
+				return ret;
 
 			info->chip.ecc.calculate = nand_davinci_calculate_4bit;
 			info->chip.ecc.correct = nand_davinci_correct_4bit;
@@ -721,8 +716,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 		info->chip.ecc.strength = pdata->ecc_bits;
 		break;
 	default:
-		ret = -EINVAL;
-		goto err_ecc;
+		return -EINVAL;
 	}
 	info->chip.ecc.mode = ecc_mode;
 
@@ -730,7 +724,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 	if (IS_ERR(info->clk)) {
 		ret = PTR_ERR(info->clk);
 		dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);
-		goto err_clk;
+		return ret;
 	}
 
 	ret = clk_prepare_enable(info->clk);
@@ -759,7 +753,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 							info->core_chipsel);
 	if (ret < 0) {
 		dev_dbg(&pdev->dev, "NAND timing values setup fail\n");
-		goto err_timing;
+		goto err;
 	}
 
 	spin_lock_irq(&davinci_nand_lock);
@@ -775,7 +769,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 	ret = nand_scan_ident(&info->mtd, pdata->mask_chipsel ? 2 : 1, NULL);
 	if (ret < 0) {
 		dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
-		goto err_scan;
+		goto err;
 	}
 
 	/* Update ECC layout if needed ... for 1-bit HW ECC, the default
@@ -789,7 +783,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 		if (!chunks || info->mtd.oobsize < 16) {
 			dev_dbg(&pdev->dev, "too small\n");
 			ret = -EINVAL;
-			goto err_scan;
+			goto err;
 		}
 
 		/* For small page chips, preserve the manufacturer's
@@ -820,7 +814,7 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "no 4-bit ECC support yet "
 				"for 4KiB-page NAND\n");
 		ret = -EIO;
-		goto err_scan;
+		goto err;
 
 syndrome_done:
 		info->chip.ecc.layout = &info->ecclayout;
@@ -828,7 +822,7 @@ syndrome_done:
 
 	ret = nand_scan_tail(&info->mtd);
 	if (ret < 0)
-		goto err_scan;
+		goto err;
 
 	if (pdata->parts)
 		ret = mtd_device_parse_register(&info->mtd, NULL, NULL,
@@ -841,7 +835,7 @@ syndrome_done:
 						NULL, 0);
 	}
 	if (ret < 0)
-		goto err_scan;
+		goto err;
 
 	val = davinci_nand_readl(info, NRCSR_OFFSET);
 	dev_info(&pdev->dev, "controller rev. %d.%d\n",
@@ -849,8 +843,7 @@ syndrome_done:
 
 	return 0;
 
-err_scan:
-err_timing:
+err:
 	clk_disable_unprepare(info->clk);
 
 err_clk_enable:
@@ -858,11 +851,6 @@ err_clk_enable:
 	if (ecc_mode == NAND_ECC_HW_SYNDROME)
 		ecc4_busy = false;
 	spin_unlock_irq(&davinci_nand_lock);
-
-err_ecc:
-err_clk:
-err_ioremap:
-err_nomem:
 	return ret;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/7] mtd: nand: davinci: move bindings under mtd
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
                   ` (3 preceding siblings ...)
  2013-11-20 15:22 ` [PATCH 4/7] mtd: nand: davinci: simplify error handling Ivan Khoronzhuk
@ 2013-11-20 15:22 ` Ivan Khoronzhuk
  2013-11-20 15:22 ` [PATCH 6/7] mtd: nand: davinci: extend description of bindings Ivan Khoronzhuk
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ivan Khoronzhuk @ 2013-11-20 15:22 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, grygorii.strashko, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Ivan Khoronzhuk, linux-arm-kernel

Move bindings under mtd. Do this in order to make davinci-nand
driver usable by keystone architecture.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 .../devicetree/bindings/arm/davinci/nand.txt       |   46 --------------------
 .../devicetree/bindings/mtd/davinci-nand.txt       |   46 ++++++++++++++++++++
 2 files changed, 46 insertions(+), 46 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/arm/davinci/nand.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/davinci-nand.txt

diff --git a/Documentation/devicetree/bindings/arm/davinci/nand.txt b/Documentation/devicetree/bindings/arm/davinci/nand.txt
deleted file mode 100644
index 3545ea7..0000000
--- a/Documentation/devicetree/bindings/arm/davinci/nand.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-* Texas Instruments Davinci NAND
-
-This file provides information, what the device node for the
-davinci nand interface contain.
-
-Required properties:
-- compatible: "ti,davinci-nand";
-- reg : contain 2 offset/length values:
-        - offset and length for the access window
-        - offset and length for accessing the aemif control registers
-- ti,davinci-chipselect: Indicates on the davinci_nand driver which
-                         chipselect is used for accessing the nand.
-
-Recommended properties :
-- ti,davinci-mask-ale: mask for ale
-- ti,davinci-mask-cle: mask for cle
-- ti,davinci-mask-chipsel: mask for chipselect
-- ti,davinci-ecc-mode: ECC mode valid values for davinci driver:
-		- "none"
-		- "soft"
-		- "hw"
-- ti,davinci-ecc-bits: used ECC bits, currently supported 1 or 4.
-- ti,davinci-nand-buswidth: buswidth 8 or 16
-- ti,davinci-nand-use-bbt: use flash based bad block table support.
-
-nand device bindings may contain additional sub-nodes describing
-partitions of the address space. See partition.txt for more detail.
-
-Example(da850 EVM ):
-nand_cs3@62000000 {
-	compatible = "ti,davinci-nand";
-	reg = <0x62000000 0x807ff
-		0x68000000 0x8000>;
-	ti,davinci-chipselect = <1>;
-	ti,davinci-mask-ale = <0>;
-	ti,davinci-mask-cle = <0>;
-	ti,davinci-mask-chipsel = <0>;
-	ti,davinci-ecc-mode = "hw";
-	ti,davinci-ecc-bits = <4>;
-	ti,davinci-nand-use-bbt;
-
-	partition@180000 {
-		label = "ubifs";
-		reg = <0x180000 0x7e80000>;
-	};
-};
diff --git a/Documentation/devicetree/bindings/mtd/davinci-nand.txt b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
new file mode 100644
index 0000000..3545ea7
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
@@ -0,0 +1,46 @@
+* Texas Instruments Davinci NAND
+
+This file provides information, what the device node for the
+davinci nand interface contain.
+
+Required properties:
+- compatible: "ti,davinci-nand";
+- reg : contain 2 offset/length values:
+        - offset and length for the access window
+        - offset and length for accessing the aemif control registers
+- ti,davinci-chipselect: Indicates on the davinci_nand driver which
+                         chipselect is used for accessing the nand.
+
+Recommended properties :
+- ti,davinci-mask-ale: mask for ale
+- ti,davinci-mask-cle: mask for cle
+- ti,davinci-mask-chipsel: mask for chipselect
+- ti,davinci-ecc-mode: ECC mode valid values for davinci driver:
+		- "none"
+		- "soft"
+		- "hw"
+- ti,davinci-ecc-bits: used ECC bits, currently supported 1 or 4.
+- ti,davinci-nand-buswidth: buswidth 8 or 16
+- ti,davinci-nand-use-bbt: use flash based bad block table support.
+
+nand device bindings may contain additional sub-nodes describing
+partitions of the address space. See partition.txt for more detail.
+
+Example(da850 EVM ):
+nand_cs3@62000000 {
+	compatible = "ti,davinci-nand";
+	reg = <0x62000000 0x807ff
+		0x68000000 0x8000>;
+	ti,davinci-chipselect = <1>;
+	ti,davinci-mask-ale = <0>;
+	ti,davinci-mask-cle = <0>;
+	ti,davinci-mask-chipsel = <0>;
+	ti,davinci-ecc-mode = "hw";
+	ti,davinci-ecc-bits = <4>;
+	ti,davinci-nand-use-bbt;
+
+	partition@180000 {
+		label = "ubifs";
+		reg = <0x180000 0x7e80000>;
+	};
+};
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/7] mtd: nand: davinci: extend description of bindings
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
                   ` (4 preceding siblings ...)
  2013-11-20 15:22 ` [PATCH 5/7] mtd: nand: davinci: move bindings under mtd Ivan Khoronzhuk
@ 2013-11-20 15:22 ` Ivan Khoronzhuk
  2013-11-20 15:46   ` Arnd Bergmann
  2013-11-20 15:22 ` [PATCH 7/7] mtd: nand: davinci: adjust DT properties to MTD generic Ivan Khoronzhuk
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Ivan Khoronzhuk @ 2013-11-20 15:22 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, grygorii.strashko, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Ivan Khoronzhuk, linux-arm-kernel

Extend bindings for davinci_nand driver to be more clear.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 .../devicetree/bindings/mtd/davinci-nand.txt       |   77 ++++++++++++++------
 1 file changed, 54 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/davinci-nand.txt b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
index 3545ea7..d2a3fc0 100644
--- a/Documentation/devicetree/bindings/mtd/davinci-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
@@ -1,36 +1,67 @@
-* Texas Instruments Davinci NAND
+Device tree bindings for Texas instruments Davinci NAND controller
 
-This file provides information, what the device node for the
-davinci nand interface contain.
+This file provides information, what the device node for the davinci NAND
+interface contains.
+
+Documentation:
+Davinci DM646x - http://www.ti.com/lit/ug/sprueq7c/sprueq7c.pdf
 
 Required properties:
-- compatible: "ti,davinci-nand";
-- reg : contain 2 offset/length values:
-        - offset and length for the access window
-        - offset and length for accessing the aemif control registers
-- ti,davinci-chipselect: Indicates on the davinci_nand driver which
-                         chipselect is used for accessing the nand.
+
+- compatible:			"ti,davinci-nand"
+
+- reg:				Contains 2 offset/length values:
+				- offset and length for the access window.
+				- offset and length for accessing the AEMIF
+				control registers.
+
+- ti,davinci-chipselect:	number of chipselect. Indicates on the
+				davinci_nand driver which chipselect is used
+				for accessing the nand.
+				Can be in the range [0-3].
 
 Recommended properties :
-- ti,davinci-mask-ale: mask for ale
-- ti,davinci-mask-cle: mask for cle
-- ti,davinci-mask-chipsel: mask for chipselect
-- ti,davinci-ecc-mode: ECC mode valid values for davinci driver:
-		- "none"
-		- "soft"
-		- "hw"
-- ti,davinci-ecc-bits: used ECC bits, currently supported 1 or 4.
-- ti,davinci-nand-buswidth: buswidth 8 or 16
-- ti,davinci-nand-use-bbt: use flash based bad block table support.
-
-nand device bindings may contain additional sub-nodes describing
-partitions of the address space. See partition.txt for more detail.
+
+- ti,davinci-mask-ale:		mask for ALE. Needed for executing address
+				phase. These offset will be added to the base
+				address for the chip select space the NAND Flash
+				device is connected to.
+				If not set equal to 0x08.
+
+- ti,davinci-mask-cle:		mask for CLE. Needed for executing command
+				phase. These offset will be added to the base
+				address for the chip select space the NAND Flash
+				device is connected to.
+				If not set equal to 0x10.
+
+- ti,davinci-mask-chipsel:	mask for chipselect address. Needed to mask
+				addresses for given chipselect.
+
+- ti,davinci-ecc-mode:		operation mode of the NAND ecc mode. ECC mode
+				valid values for davinci driver:
+				- "none"
+				- "soft"
+				- "hw"
+
+- ti,davinci-ecc-bits:		used ECC bits, currently supported 1 or 4.
+
+- ti,davinci-nand-buswidth:	buswidth 8 or 16.
+
+- ti,davinci-nand-use-bbt:	use flash based bad block table support. OOB
+				identifier is saved in OOB area.
+
+Nand device bindings may contain additional sub-nodes describing partitions of
+the address space. See partition.txt for more detail. The NAND Flash timing
+values must be programmed in the chip select’s node of AEMIF
+memory-controller (see Documentation/devicetree/bindings/memory-controllers/
+davinci-aemif.txt).
 
 Example(da850 EVM ):
+
 nand_cs3@62000000 {
 	compatible = "ti,davinci-nand";
 	reg = <0x62000000 0x807ff
-		0x68000000 0x8000>;
+	       0x68000000 0x8000>;
 	ti,davinci-chipselect = <1>;
 	ti,davinci-mask-ale = <0>;
 	ti,davinci-mask-cle = <0>;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/7] mtd: nand: davinci: adjust DT properties to MTD generic
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
                   ` (5 preceding siblings ...)
  2013-11-20 15:22 ` [PATCH 6/7] mtd: nand: davinci: extend description of bindings Ivan Khoronzhuk
@ 2013-11-20 15:22 ` Ivan Khoronzhuk
  2013-11-20 20:13 ` [PATCH 0/7] Davinci nand driver fixes and updates Grygorii Strashko
  2013-11-29 15:37 ` Santosh Shilimkar
  8 siblings, 0 replies; 13+ messages in thread
From: Ivan Khoronzhuk @ 2013-11-20 15:22 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, grygorii.strashko, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Ivan Khoronzhuk, linux-arm-kernel

The properties davinci-ecc-mode, davinci-nand-use-bbt, davinci-nand-buswidth
are MTD generic. Correct names for them are: nand-ecc-mode, nand-on-flash-bbt,
nand-bus-width accordingly. So rename them in dts and documentation.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 .../devicetree/bindings/mtd/davinci-nand.txt       |   25 ++++++++++++++++----
 drivers/mtd/nand/davinci_nand.c                    |   11 ++++++---
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/davinci-nand.txt b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
index d2a3fc0..befaa5b 100644
--- a/Documentation/devicetree/bindings/mtd/davinci-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
@@ -37,7 +37,7 @@ Recommended properties :
 - ti,davinci-mask-chipsel:	mask for chipselect address. Needed to mask
 				addresses for given chipselect.
 
-- ti,davinci-ecc-mode:		operation mode of the NAND ecc mode. ECC mode
+- nand-ecc-mode:		operation mode of the NAND ecc mode. ECC mode
 				valid values for davinci driver:
 				- "none"
 				- "soft"
@@ -45,10 +45,25 @@ Recommended properties :
 
 - ti,davinci-ecc-bits:		used ECC bits, currently supported 1 or 4.
 
-- ti,davinci-nand-buswidth:	buswidth 8 or 16.
+- nand-bus-width:		buswidth 8 or 16. If not present 8.
+
+- nand-on-flash-bbt:		use flash based bad block table support. OOB
+				identifier is saved in OOB area. If not present
+				false.
+
+Deprecated properties:
+
+- ti,davinci-ecc-mode:		operation mode of the NAND ecc mode. ECC mode
+				valid values for davinci driver:
+				- "none"
+				- "soft"
+				- "hw"
+
+- ti,davinci-nand-buswidth:	buswidth 8 or 16. If not present 8.
 
 - ti,davinci-nand-use-bbt:	use flash based bad block table support. OOB
-				identifier is saved in OOB area.
+				identifier is saved in OOB area. If not present
+				false.
 
 Nand device bindings may contain additional sub-nodes describing partitions of
 the address space. See partition.txt for more detail. The NAND Flash timing
@@ -66,9 +81,9 @@ nand_cs3@62000000 {
 	ti,davinci-mask-ale = <0>;
 	ti,davinci-mask-cle = <0>;
 	ti,davinci-mask-chipsel = <0>;
-	ti,davinci-ecc-mode = "hw";
+	nand-ecc-mode = "hw";
 	ti,davinci-ecc-bits = <4>;
-	ti,davinci-nand-use-bbt;
+	nand-on-flash-bbt;
 
 	partition@180000 {
 		label = "ubifs";
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index c0be223..f7b21b8 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -534,7 +534,6 @@ static struct davinci_nand_pdata
 		struct davinci_nand_pdata *pdata;
 		const char *mode;
 		u32 prop;
-		int len;
 
 		pdata =  devm_kzalloc(&pdev->dev,
 				sizeof(struct davinci_nand_pdata),
@@ -558,6 +557,8 @@ static struct davinci_nand_pdata
 			"ti,davinci-mask-chipsel", &prop))
 			pdata->mask_chipsel = prop;
 		if (!of_property_read_string(pdev->dev.of_node,
+			"nand-ecc-mode", &mode) ||
+		    !of_property_read_string(pdev->dev.of_node,
 			"ti,davinci-ecc-mode", &mode)) {
 			if (!strncmp("none", mode, 4))
 				pdata->ecc_mode = NAND_ECC_NONE;
@@ -570,11 +571,15 @@ static struct davinci_nand_pdata
 			"ti,davinci-ecc-bits", &prop))
 			pdata->ecc_bits = prop;
 		if (!of_property_read_u32(pdev->dev.of_node,
+			"nand-bus-width", &prop) ||
+		    !of_property_read_u32(pdev->dev.of_node,
 			"ti,davinci-nand-buswidth", &prop))
 			if (prop == 16)
 				pdata->options |= NAND_BUSWIDTH_16;
-		if (of_find_property(pdev->dev.of_node,
-			"ti,davinci-nand-use-bbt", &len))
+		if (of_property_read_bool(pdev->dev.of_node,
+			"nand-on-flash-bbt") ||
+		    of_property_read_bool(pdev->dev.of_node,
+			"ti,davinci-nand-use-bbt"))
 			pdata->bbt_options = NAND_BBT_USE_FLASH;
 	}
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/7] mtd: nand: davinci: extend description of bindings
  2013-11-20 15:22 ` [PATCH 6/7] mtd: nand: davinci: extend description of bindings Ivan Khoronzhuk
@ 2013-11-20 15:46   ` Arnd Bergmann
  2013-11-20 15:54     ` ivan.khoronzhuk
  0 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2013-11-20 15:46 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Mark Rutland, devicetree, grygorii.strashko, Russell King,
	Pawel Moll, Stephen Warren, Ian Campbell, Kumar Gala,
	Rob Herring, linux-kernel, Santosh Shilimkar, Rob Landley,
	Ivan Khoronzhuk, linux-mtd

On Wednesday 20 November 2013, Ivan Khoronzhuk wrote:
> Extend bindings for davinci_nand driver to be more clear.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> ---
>  .../devicetree/bindings/mtd/davinci-nand.txt       |   77 ++++++++++++++------
>  1 file changed, 54 insertions(+), 23 deletions(-)

Hi Ivan,

The changes look good to me, but please clarify in the changeset description
above whether this is a backwards-compatible change, a clarification without
semantic changes, or an incompatible change (which should be avoided).

	Arnd

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/7] mtd: nand: davinci: extend description of bindings
  2013-11-20 15:46   ` Arnd Bergmann
@ 2013-11-20 15:54     ` ivan.khoronzhuk
  0 siblings, 0 replies; 13+ messages in thread
From: ivan.khoronzhuk @ 2013-11-20 15:54 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: Mark Rutland, devicetree, grygorii.strashko, Russell King,
	Pawel Moll, Stephen Warren, Ian Campbell, Kumar Gala,
	Rob Herring, linux-kernel, Santosh Shilimkar, Rob Landley,
	linux-mtd

On 11/20/2013 05:46 PM, Arnd Bergmann wrote:
> On Wednesday 20 November 2013, Ivan Khoronzhuk wrote:
>> Extend bindings for davinci_nand driver to be more clear.
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>> ---
>>   .../devicetree/bindings/mtd/davinci-nand.txt       |   77 ++++++++++++++------
>>   1 file changed, 54 insertions(+), 23 deletions(-)
>
> Hi Ivan,
>
> The changes look good to me, but please clarify in the changeset description
> above whether this is a backwards-compatible change, a clarification without
> semantic changes, or an incompatible change (which should be avoided).
>
> 	Arnd
>

This is a clarification only, without semantic changes.
Thanks, I'll update.

-- 
Regards,
Ivan Khoronzhuk

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] Davinci nand driver fixes and updates
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
                   ` (6 preceding siblings ...)
  2013-11-20 15:22 ` [PATCH 7/7] mtd: nand: davinci: adjust DT properties to MTD generic Ivan Khoronzhuk
@ 2013-11-20 20:13 ` Grygorii Strashko
  2013-11-29 15:37 ` Santosh Shilimkar
  8 siblings, 0 replies; 13+ messages in thread
From: Grygorii Strashko @ 2013-11-20 20:13 UTC (permalink / raw)
  To: Ivan Khoronzhuk, Santosh Shilimkar, Rob Landley, Russell King
  Cc: Mark Rutland, devicetree, Pawel Moll, Stephen Warren,
	Ian Campbell, Kumar Gala, Rob Herring, linux-kernel, linux-mtd,
	linux-arm-kernel

On 11/20/2013 05:22 PM, Ivan Khoronzhuk wrote:
> This series contains fixes and updates of Davinci nand driver, in
> order to prepare it to be reused for Keystone platform.
>
> V1:
> https://lkml.org/lkml/2013/11/11/352
>
> Ivan Khoronzhuk (7):
>    mtd: nand: davinci: fix driver registration
>    mtd: nand: davinci: return ENOMEM if memory allocation is failed
>    mtd: nand: davinci: check required ti,davinci-chipselect property
>    mtd: nand: davinci: simplify error handling
>    mtd: nand: davinci: move bindings under mtd
>    mtd: nand: davinci: extend description of bindings
>    mtd: nand: davinci: adjust DT properties to MTD generic

For overall series:
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

>
>   .../devicetree/bindings/arm/davinci/nand.txt       |   46 ----------
>   .../devicetree/bindings/mtd/davinci-nand.txt       |   92 ++++++++++++++++++++
>   drivers/mtd/nand/davinci_nand.c                    |   68 +++++++--------
>   3 files changed, 126 insertions(+), 80 deletions(-)
>   delete mode 100644 Documentation/devicetree/bindings/arm/davinci/nand.txt
>   create mode 100644 Documentation/devicetree/bindings/mtd/davinci-nand.txt
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] Davinci nand driver fixes and updates
  2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
                   ` (7 preceding siblings ...)
  2013-11-20 20:13 ` [PATCH 0/7] Davinci nand driver fixes and updates Grygorii Strashko
@ 2013-11-29 15:37 ` Santosh Shilimkar
  2013-11-29 15:44   ` Grygorii Strashko
  8 siblings, 1 reply; 13+ messages in thread
From: Santosh Shilimkar @ 2013-11-29 15:37 UTC (permalink / raw)
  To: Ivan Khoronzhuk
  Cc: Mark Rutland, devicetree, grygorii.strashko, Russell King,
	Pawel Moll, Stephen Warren, Ian Campbell, Kumar Gala,
	Rob Herring, linux-kernel, linux-mtd, Rob Landley,
	linux-arm-kernel

Ivan,

On Wednesday 20 November 2013 10:22 AM, Ivan Khoronzhuk wrote:
> This series contains fixes and updates of Davinci nand driver, in
> order to prepare it to be reused for Keystone platform.
> 
> V1:
> https://lkml.org/lkml/2013/11/11/352
> 
> Ivan Khoronzhuk (7):
>   mtd: nand: davinci: fix driver registration
>   mtd: nand: davinci: return ENOMEM if memory allocation is failed
>   mtd: nand: davinci: check required ti,davinci-chipselect property
>   mtd: nand: davinci: simplify error handling
>   mtd: nand: davinci: move bindings under mtd
>   mtd: nand: davinci: extend description of bindings
>   mtd: nand: davinci: adjust DT properties to MTD generic
> 
>  .../devicetree/bindings/arm/davinci/nand.txt       |   46 ----------
>  .../devicetree/bindings/mtd/davinci-nand.txt       |   92 ++++++++++++++++++++
>  drivers/mtd/nand/davinci_nand.c                    |   68 +++++++--------
>  3 files changed, 126 insertions(+), 80 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/arm/davinci/nand.txt
>  create mode 100644 Documentation/devicetree/bindings/mtd/davinci-nand.txt
> 
Can you please update the series with pending comments and
send a refreshed version. 

Regards,
Santosh

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] Davinci nand driver fixes and updates
  2013-11-29 15:37 ` Santosh Shilimkar
@ 2013-11-29 15:44   ` Grygorii Strashko
  0 siblings, 0 replies; 13+ messages in thread
From: Grygorii Strashko @ 2013-11-29 15:44 UTC (permalink / raw)
  To: Santosh Shilimkar, Ivan Khoronzhuk
  Cc: Mark Rutland, devicetree, Russell King, Pawel Moll,
	Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Rob Landley, linux-arm-kernel

On 11/29/2013 05:37 PM, Santosh Shilimkar wrote:
> Ivan,
> 
> On Wednesday 20 November 2013 10:22 AM, Ivan Khoronzhuk wrote:
>> This series contains fixes and updates of Davinci nand driver, in
>> order to prepare it to be reused for Keystone platform.
>>
>> V1:
>> https://lkml.org/lkml/2013/11/11/352
>>
>> Ivan Khoronzhuk (7):
>>    mtd: nand: davinci: fix driver registration
>>    mtd: nand: davinci: return ENOMEM if memory allocation is failed
>>    mtd: nand: davinci: check required ti,davinci-chipselect property
>>    mtd: nand: davinci: simplify error handling
>>    mtd: nand: davinci: move bindings under mtd
>>    mtd: nand: davinci: extend description of bindings
>>    mtd: nand: davinci: adjust DT properties to MTD generic
>>
>>   .../devicetree/bindings/arm/davinci/nand.txt       |   46 ----------
>>   .../devicetree/bindings/mtd/davinci-nand.txt       |   92 ++++++++++++++++++++
>>   drivers/mtd/nand/davinci_nand.c                    |   68 +++++++--------
>>   3 files changed, 126 insertions(+), 80 deletions(-)
>>   delete mode 100644 Documentation/devicetree/bindings/arm/davinci/nand.txt
>>   create mode 100644 Documentation/devicetree/bindings/mtd/davinci-nand.txt
>>
> Can you please update the series with pending comments and
> send a refreshed version.

New series was posted week ago https://lkml.org/lkml/2013/11/21/182
"[PATCH v2 00/10] Reuse davinci-nand driver for Keystone arch"

Now we will need to remove one patch form it, which will go alone
as discussed - no other comments were provided.

Patch:
 "[PATCH v2 09/10] mtd: nand: davinci: don't set timings if AEMIF is used"

replaced by:
 https://lkml.org/lkml/2013/11/27/256
 "[PATCH v2] ARM: davinci: aemif: get rid of davinci-nand driver dependency on aemif"

Regards,
- grygorii

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-11-29 15:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 15:22 [PATCH 0/7] Davinci nand driver fixes and updates Ivan Khoronzhuk
2013-11-20 15:22 ` [PATCH 1/7] mtd: nand: davinci: fix driver registration Ivan Khoronzhuk
2013-11-20 15:22 ` [PATCH 2/7] mtd: nand: davinci: return ENOMEM if memory allocation is failed Ivan Khoronzhuk
2013-11-20 15:22 ` [PATCH 3/7] mtd: nand: davinci: check required ti, davinci-chipselect property Ivan Khoronzhuk
2013-11-20 15:22 ` [PATCH 4/7] mtd: nand: davinci: simplify error handling Ivan Khoronzhuk
2013-11-20 15:22 ` [PATCH 5/7] mtd: nand: davinci: move bindings under mtd Ivan Khoronzhuk
2013-11-20 15:22 ` [PATCH 6/7] mtd: nand: davinci: extend description of bindings Ivan Khoronzhuk
2013-11-20 15:46   ` Arnd Bergmann
2013-11-20 15:54     ` ivan.khoronzhuk
2013-11-20 15:22 ` [PATCH 7/7] mtd: nand: davinci: adjust DT properties to MTD generic Ivan Khoronzhuk
2013-11-20 20:13 ` [PATCH 0/7] Davinci nand driver fixes and updates Grygorii Strashko
2013-11-29 15:37 ` Santosh Shilimkar
2013-11-29 15:44   ` Grygorii Strashko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).