devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch
@ 2013-12-05 17:25 Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 2/9] mtd: nand: davinci: return ENOMEM if memory allocation is failed Ivan Khoronzhuk
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 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, dwmw2, linux-arm-kernel

This series contains fixes and updates of Davinci nand driver in
order to reuse it for Keystone platform.

v2..v3:
- mtd: nand: davinci: don't set timings if AEMIF is used
	dropped, it would be replaced by alone patch
	ARM: davinci: aemif: get rid of davinci-nand driver dependency on aemif

v1..v2
The series is combination of two following series:
- Davinci nand driver fixes and updates:
https://lkml.org/lkml/2013/11/20/271
- Reuse davinci-nand driver for Keystone arch
https://lkml.org/lkml/2013/11/20/315

- mtd: nand: davinci: extend description of bindings
	clarified changeset description

- mtd: nand: davinci: reuse driver for Keystone arch
	removed "ti,keystone-nand" compatible from driver

Ivan Khoronzhuk (9):
  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
  mtd: nand: davinci: reuse driver for Keystone arch
  mtd: nand: davinci: don't request AEMIF address range

 .../devicetree/bindings/arm/davinci/nand.txt       |   46 ----------
 .../devicetree/bindings/mtd/davinci-nand.txt       |   94 ++++++++++++++++++++
 drivers/mtd/nand/Kconfig                           |    6 +-
 drivers/mtd/nand/davinci_nand.c                    |   70 ++++++++-------
 4 files changed, 133 insertions(+), 83 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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v3 1/9] mtd: nand: davinci: fix driver registration
       [not found] ` <1386264358-9738-1-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
@ 2013-12-05 17:25   ` Ivan Khoronzhuk
  2013-12-17  9:24     ` Brian Norris
  2013-12-05 17:25   ` [PATCH v3 8/9] mtd: nand: davinci: reuse driver for Keystone arch Ivan Khoronzhuk
  2013-12-09 16:44   ` [PATCH v3 0/9] Reuse davinci-nand " Santosh Shilimkar
  2 siblings, 1 reply; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Mark Rutland,
	Rob Herring, Stephen Warren, Kumar Gala, Ian Campbell,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	grygorii.strashko-l0cyMroinI0, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
	Ivan Khoronzhuk

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.

Acked-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org>
Reviewed-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
Reviewed-by: Taras Kondratiuk <taras-l0cyMroinI0@public.gmane.org>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v3 2/9] mtd: nand: davinci: return ENOMEM if memory allocation is failed
  2013-12-05 17:25 [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch Ivan Khoronzhuk
@ 2013-12-05 17:25 ` Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 3/9] mtd: nand: davinci: check required ti, davinci-chipselect property Ivan Khoronzhuk
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 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, dwmw2, linux-arm-kernel

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

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Taras Kondratiuk <taras@ti.com>
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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v3 3/9] mtd: nand: davinci: check required ti, davinci-chipselect property
  2013-12-05 17:25 [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 2/9] mtd: nand: davinci: return ENOMEM if memory allocation is failed Ivan Khoronzhuk
@ 2013-12-05 17:25 ` Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 4/9] mtd: nand: davinci: simplify error handling Ivan Khoronzhuk
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 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, dwmw2, linux-arm-kernel

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

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Taras Kondratiuk <taras@ti.com>
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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v3 4/9] mtd: nand: davinci: simplify error handling
  2013-12-05 17:25 [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 2/9] mtd: nand: davinci: return ENOMEM if memory allocation is failed Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 3/9] mtd: nand: davinci: check required ti, davinci-chipselect property Ivan Khoronzhuk
@ 2013-12-05 17:25 ` Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 5/9] mtd: nand: davinci: move bindings under mtd Ivan Khoronzhuk
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: devicetree, Pawel Moll, Mark Rutland, Rob Herring, Stephen Warren,
	Kumar Gala, Ian Campbell, linux-kernel, linux-arm-kernel,
	linux-mtd, grygorii.strashko, dwmw2, Ivan Khoronzhuk

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

Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Taras Kondratiuk <taras@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@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] 19+ messages in thread

* [PATCH v3 5/9] mtd: nand: davinci: move bindings under mtd
  2013-12-05 17:25 [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch Ivan Khoronzhuk
                   ` (2 preceding siblings ...)
  2013-12-05 17:25 ` [PATCH v3 4/9] mtd: nand: davinci: simplify error handling Ivan Khoronzhuk
@ 2013-12-05 17:25 ` Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 6/9] mtd: nand: davinci: extend description of bindings Ivan Khoronzhuk
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: devicetree, Pawel Moll, Mark Rutland, Rob Herring, Stephen Warren,
	Kumar Gala, Ian Campbell, linux-kernel, linux-arm-kernel,
	linux-mtd, grygorii.strashko, dwmw2, Ivan Khoronzhuk

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

Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Taras Kondratiuk <taras@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 .../{arm/davinci/nand.txt => mtd/davinci-nand.txt} |    0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/{arm/davinci/nand.txt => mtd/davinci-nand.txt} (100%)

diff --git a/Documentation/devicetree/bindings/arm/davinci/nand.txt b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
similarity index 100%
rename from Documentation/devicetree/bindings/arm/davinci/nand.txt
rename to Documentation/devicetree/bindings/mtd/davinci-nand.txt
-- 
1.7.9.5

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

* [PATCH v3 6/9] mtd: nand: davinci: extend description of bindings
  2013-12-05 17:25 [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch Ivan Khoronzhuk
                   ` (3 preceding siblings ...)
  2013-12-05 17:25 ` [PATCH v3 5/9] mtd: nand: davinci: move bindings under mtd Ivan Khoronzhuk
@ 2013-12-05 17:25 ` Ivan Khoronzhuk
  2013-12-05 17:25 ` [PATCH v3 7/9] mtd: nand: davinci: adjust DT properties to MTD generic Ivan Khoronzhuk
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: devicetree, Pawel Moll, Mark Rutland, Rob Herring, Stephen Warren,
	Kumar Gala, Ian Campbell, linux-kernel, linux-arm-kernel,
	linux-mtd, grygorii.strashko, dwmw2, Ivan Khoronzhuk

Extend bindings for davinci_nand driver to be more clear.
This is clarification only, without semantic changes.

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Taras Kondratiuk <taras@ti.com>
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] 19+ messages in thread

* [PATCH v3 7/9] mtd: nand: davinci: adjust DT properties to MTD generic
  2013-12-05 17:25 [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch Ivan Khoronzhuk
                   ` (4 preceding siblings ...)
  2013-12-05 17:25 ` [PATCH v3 6/9] mtd: nand: davinci: extend description of bindings Ivan Khoronzhuk
@ 2013-12-05 17:25 ` Ivan Khoronzhuk
       [not found]   ` <1386264358-9738-8-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
  2013-12-05 17:25 ` [PATCH v3 9/9] mtd: nand: davinci: don't request AEMIF address range Ivan Khoronzhuk
       [not found] ` <1386264358-9738-1-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
  7 siblings, 1 reply; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: devicetree, Pawel Moll, Mark Rutland, Rob Herring, Stephen Warren,
	Kumar Gala, Ian Campbell, linux-kernel, linux-arm-kernel,
	linux-mtd, grygorii.strashko, dwmw2, Ivan Khoronzhuk

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.

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Taras Kondratiuk <taras@ti.com>
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] 19+ messages in thread

* [PATCH v3 8/9] mtd: nand: davinci: reuse driver for Keystone arch
       [not found] ` <1386264358-9738-1-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
  2013-12-05 17:25   ` [PATCH v3 1/9] mtd: nand: davinci: fix driver registration Ivan Khoronzhuk
@ 2013-12-05 17:25   ` Ivan Khoronzhuk
  2013-12-09 16:44   ` [PATCH v3 0/9] Reuse davinci-nand " Santosh Shilimkar
  2 siblings, 0 replies; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Mark Rutland,
	Rob Herring, Stephen Warren, Kumar Gala, Ian Campbell,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	grygorii.strashko-l0cyMroinI0, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
	Ivan Khoronzhuk

The Keystone arch has compatible nand device, so reuse it.
In case with Keystone it depends on TI_AEMIF because AEMIF
driver is responsible to set timings.

See http://www.ti.com/lit/ug/sprugz3a/sprugz3a.pdf

Reviewed-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
Reviewed-by: Taras Kondratiuk <taras-l0cyMroinI0@public.gmane.org>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
---
 .../devicetree/bindings/mtd/davinci-nand.txt       |    8 +++++---
 drivers/mtd/nand/Kconfig                           |    6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/davinci-nand.txt b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
index befaa5b..cfb18ab 100644
--- a/Documentation/devicetree/bindings/mtd/davinci-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/davinci-nand.txt
@@ -1,14 +1,16 @@
-Device tree bindings for Texas instruments Davinci NAND controller
+Device tree bindings for Texas instruments Davinci/Keystone NAND controller
 
-This file provides information, what the device node for the davinci NAND
-interface contains.
+This file provides information, what the device node for the davinci/keystone
+NAND interface contains.
 
 Documentation:
 Davinci DM646x - http://www.ti.com/lit/ug/sprueq7c/sprueq7c.pdf
+Kestone - http://www.ti.com/lit/ug/sprugz3a/sprugz3a.pdf
 
 Required properties:
 
 - compatible:			"ti,davinci-nand"
+				"ti,keystone-nand"
 
 - reg:				Contains 2 offset/length values:
 				- offset and length for the access window.
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 93ae6a6..35f3ea3 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -464,11 +464,11 @@ config MTD_NAND_SH_FLCTL
 	  for NAND Flash using FLCTL.
 
 config MTD_NAND_DAVINCI
-        tristate "Support NAND on DaVinci SoC"
-        depends on ARCH_DAVINCI
+        tristate "Support NAND on DaVinci/Keystone SoC"
+        depends on ARCH_DAVINCI || (ARCH_KEYSTONE && TI_AEMIF)
         help
 	  Enable the driver for NAND flash chips on Texas Instruments
-	  DaVinci processors.
+	  DaVinci/Keystone processors.
 
 config MTD_NAND_TXX9NDFMC
 	tristate "NAND Flash support for TXx9 SoC"
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v3 9/9] mtd: nand: davinci: don't request AEMIF address range
  2013-12-05 17:25 [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch Ivan Khoronzhuk
                   ` (5 preceding siblings ...)
  2013-12-05 17:25 ` [PATCH v3 7/9] mtd: nand: davinci: adjust DT properties to MTD generic Ivan Khoronzhuk
@ 2013-12-05 17:25 ` Ivan Khoronzhuk
       [not found]   ` <1386264358-9738-10-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
       [not found] ` <1386264358-9738-1-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
  7 siblings, 1 reply; 19+ messages in thread
From: Ivan Khoronzhuk @ 2013-12-05 17:25 UTC (permalink / raw)
  To: Santosh Shilimkar, Rob Landley, Russell King
  Cc: devicetree, Pawel Moll, Mark Rutland, Rob Herring, Stephen Warren,
	Kumar Gala, Ian Campbell, linux-kernel, linux-arm-kernel,
	linux-mtd, grygorii.strashko, dwmw2, Ivan Khoronzhuk

The TI AEMIF driver registers are used to setup timings for each chip
select. The same registers range is used to setup NAND settings.
The AEMIF and NAND drivers not use the same registers in this range.

In case with TI AEMIF driver, the memory address range is requested
already by AEMIF, so we cannot request it twice, just ioremap.

Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Taras Kondratiuk <taras@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 drivers/mtd/nand/davinci_nand.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index f7b21b8..0cd4dbc 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -636,9 +636,11 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 	if (IS_ERR(vaddr))
 		return PTR_ERR(vaddr);
 
-	base = devm_ioremap_resource(&pdev->dev, res2);
-	if (IS_ERR(base))
-		return PTR_ERR(base);
+	base = devm_ioremap(&pdev->dev, res2->start, resource_size(res2));
+	if (!base) {
+		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res2);
+		return -EADDRNOTAVAIL;
+	}
 
 	info->dev		= &pdev->dev;
 	info->base		= base;
-- 
1.7.9.5

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

* Re: [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch
       [not found] ` <1386264358-9738-1-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
  2013-12-05 17:25   ` [PATCH v3 1/9] mtd: nand: davinci: fix driver registration Ivan Khoronzhuk
  2013-12-05 17:25   ` [PATCH v3 8/9] mtd: nand: davinci: reuse driver for Keystone arch Ivan Khoronzhuk
@ 2013-12-09 16:44   ` Santosh Shilimkar
  2013-12-14 19:18     ` Santosh Shilimkar
  2 siblings, 1 reply; 19+ messages in thread
From: Santosh Shilimkar @ 2013-12-09 16:44 UTC (permalink / raw)
  To: Ivan Khoronzhuk, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ
  Cc: Rob Landley, Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Pawel Moll, Mark Rutland, Rob Herring, Stephen Warren, Kumar Gala,
	Ian Campbell, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	grygorii.strashko-l0cyMroinI0

David,

On Thursday 05 December 2013 12:25 PM, Ivan Khoronzhuk wrote:
> This series contains fixes and updates of Davinci nand driver in
> order to reuse it for Keystone platform.
> 
> v2..v3:
> - mtd: nand: davinci: don't set timings if AEMIF is used
> 	dropped, it would be replaced by alone patch
> 	ARM: davinci: aemif: get rid of davinci-nand driver dependency on aemif
> 
> v1..v2
> The series is combination of two following series:
> - Davinci nand driver fixes and updates:
> https://lkml.org/lkml/2013/11/20/271
> - Reuse davinci-nand driver for Keystone arch
> https://lkml.org/lkml/2013/11/20/315
> 
> - mtd: nand: davinci: extend description of bindings
> 	clarified changeset description
> 
> - mtd: nand: davinci: reuse driver for Keystone arch
> 	removed "ti,keystone-nand" compatible from driver
> 
> Ivan Khoronzhuk (9):
>   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
>   mtd: nand: davinci: reuse driver for Keystone arch
>   mtd: nand: davinci: don't request AEMIF address range
> 
Can you please pick up the $subject series if you are happy
with it ?
It lets us re-use Davinci nand driver on Keystone SOCs.

Regards,
Santosh

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch
  2013-12-09 16:44   ` [PATCH v3 0/9] Reuse davinci-nand " Santosh Shilimkar
@ 2013-12-14 19:18     ` Santosh Shilimkar
  0 siblings, 0 replies; 19+ messages in thread
From: Santosh Shilimkar @ 2013-12-14 19:18 UTC (permalink / raw)
  To: dwmw2
  Cc: Mark Rutland, devicetree, grygorii.strashko, Russell King,
	Pawel Moll, Stephen Warren, Ian Campbell, Kumar Gala, Rob Herring,
	linux-kernel, linux-mtd, Rob Landley, Ivan Khoronzhuk,
	linux-arm-kernel

On Monday 09 December 2013 11:44 AM, Santosh Shilimkar wrote:
> David,
> 
> On Thursday 05 December 2013 12:25 PM, Ivan Khoronzhuk wrote:
>> This series contains fixes and updates of Davinci nand driver in
>> order to reuse it for Keystone platform.
>>
>> v2..v3:
>> - mtd: nand: davinci: don't set timings if AEMIF is used
>> 	dropped, it would be replaced by alone patch
>> 	ARM: davinci: aemif: get rid of davinci-nand driver dependency on aemif
>>
>> v1..v2
>> The series is combination of two following series:
>> - Davinci nand driver fixes and updates:
>> https://lkml.org/lkml/2013/11/20/271
>> - Reuse davinci-nand driver for Keystone arch
>> https://lkml.org/lkml/2013/11/20/315
>>
>> - mtd: nand: davinci: extend description of bindings
>> 	clarified changeset description
>>
>> - mtd: nand: davinci: reuse driver for Keystone arch
>> 	removed "ti,keystone-nand" compatible from driver
>>
>> Ivan Khoronzhuk (9):
>>   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
>>   mtd: nand: davinci: reuse driver for Keystone arch
>>   mtd: nand: davinci: don't request AEMIF address range
>>
> Can you please pick up the $subject series if you are happy
> with it ?
> It lets us re-use Davinci nand driver on Keystone SOCs.
> 
Ping..

regards,
Santosh

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

* Re: [PATCH v3 9/9] mtd: nand: davinci: don't request AEMIF address range
       [not found]   ` <1386264358-9738-10-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
@ 2013-12-17  8:42     ` Brian Norris
  2013-12-17 10:33       ` ivan.khoronzhuk
  0 siblings, 1 reply; 19+ messages in thread
From: Brian Norris @ 2013-12-17  8:42 UTC (permalink / raw)
  To: Ivan Khoronzhuk
  Cc: Santosh Shilimkar, Rob Landley, Russell King,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Mark Rutland,
	Rob Herring, Stephen Warren, Kumar Gala, Ian Campbell,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	grygorii.strashko-l0cyMroinI0, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ

On Thu, Dec 05, 2013 at 07:25:57PM +0200, Ivan Khoronzhuk wrote:
> The TI AEMIF driver registers are used to setup timings for each chip
> select. The same registers range is used to setup NAND settings.
> The AEMIF and NAND drivers not use the same registers in this range.
> 
> In case with TI AEMIF driver, the memory address range is requested
> already by AEMIF, so we cannot request it twice, just ioremap.
> 
> Acked-by: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org>
> Reviewed-by: Grygorii Strashko <grygorii.strashko-l0cyMroinI0@public.gmane.org>
> Reviewed-by: Taras Kondratiuk <taras-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/mtd/nand/davinci_nand.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
> index f7b21b8..0cd4dbc 100644
> --- a/drivers/mtd/nand/davinci_nand.c
> +++ b/drivers/mtd/nand/davinci_nand.c
> @@ -636,9 +636,11 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
>  	if (IS_ERR(vaddr))
>  		return PTR_ERR(vaddr);
>  
> -	base = devm_ioremap_resource(&pdev->dev, res2);
> -	if (IS_ERR(base))
> -		return PTR_ERR(base);
> +	base = devm_ioremap(&pdev->dev, res2->start, resource_size(res2));

Since it's important that we don't re-introduce the "request resource"
boilerplate later, can you add a comment describing the situation?

> +	if (!base) {
> +		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res2);
> +		return -EADDRNOTAVAIL;
> +	}
>  
>  	info->dev		= &pdev->dev;
>  	info->base		= base;

Thanks,
Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 7/9] mtd: nand: davinci: adjust DT properties to MTD generic
       [not found]   ` <1386264358-9738-8-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
@ 2013-12-17  8:50     ` Brian Norris
  2013-12-17 12:19       ` ivan.khoronzhuk
  0 siblings, 1 reply; 19+ messages in thread
From: Brian Norris @ 2013-12-17  8:50 UTC (permalink / raw)
  To: Ivan Khoronzhuk
  Cc: Santosh Shilimkar, Rob Landley, Russell King,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Mark Rutland,
	Rob Herring, Stephen Warren, Kumar Gala, Ian Campbell,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	grygorii.strashko-l0cyMroinI0, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ

On Thu, Dec 05, 2013 at 07:25:55PM +0200, Ivan Khoronzhuk wrote:
> --- a/drivers/mtd/nand/davinci_nand.c
> +++ b/drivers/mtd/nand/davinci_nand.c
> @@ -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) ||

Is it possible to use the of_get_nand_ecc_mode() helper? It's
unfortunate that davinci_nand had to use custom bindings in the first
place, making this more difficult... So I can take this patch as-is.

> +		    !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) ||

Similar story here, with of_get_nand_bus_width().

> +		    !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;
>  	}
>  

Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 1/9] mtd: nand: davinci: fix driver registration
  2013-12-05 17:25   ` [PATCH v3 1/9] mtd: nand: davinci: fix driver registration Ivan Khoronzhuk
@ 2013-12-17  9:24     ` Brian Norris
  2013-12-17 10:21       ` ivan.khoronzhuk
  0 siblings, 1 reply; 19+ messages in thread
From: Brian Norris @ 2013-12-17  9:24 UTC (permalink / raw)
  To: Ivan Khoronzhuk
  Cc: Santosh Shilimkar, Rob Landley, Russell King, devicetree,
	Pawel Moll, Mark Rutland, Rob Herring, Stephen Warren, Kumar Gala,
	Ian Campbell, linux-kernel, linux-arm-kernel, linux-mtd,
	grygorii.strashko, dwmw2

On Thu, Dec 05, 2013 at 07:25:49PM +0200, Ivan Khoronzhuk wrote:
> --- 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),

I believe you need to drop the __exit_p() here. And now that you're
using module_platform_driver(), you need to drop the __init and __exit
from the probe() and remove() routines, to avoid section mismatch
warnings.

>  	.driver		= {
>  		.name	= "davinci_nand",

So on second thought, please resubmit the series with the requested
changes.

Thanks,
Brian

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

* Re: [PATCH v3 1/9] mtd: nand: davinci: fix driver registration
  2013-12-17  9:24     ` Brian Norris
@ 2013-12-17 10:21       ` ivan.khoronzhuk
       [not found]         ` <52B02598.5060004-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: ivan.khoronzhuk @ 2013-12-17 10:21 UTC (permalink / raw)
  To: Brian Norris
  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, dwmw2,
	linux-arm-kernel

On 12/17/2013 11:24 AM, Brian Norris wrote:
> On Thu, Dec 05, 2013 at 07:25:49PM +0200, Ivan Khoronzhuk wrote:
>> --- 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),
> 
> I believe you need to drop the __exit_p() here. And now that you're
> using module_platform_driver(), you need to drop the __init and __exit
> from the probe() and remove() routines, to avoid section mismatch
> warnings.
> 
>>   	.driver		= {
>>   		.name	= "davinci_nand",
> 
> So on second thought, please resubmit the series with the requested
> changes.
> 
> Thanks,
> Brian
> 

Thanks, Brian.
Do you want me to drop it in stand alone patch or in this one?

-- 
Regards,
Ivan Khoronzhuk

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 9/9] mtd: nand: davinci: don't request AEMIF address range
  2013-12-17  8:42     ` Brian Norris
@ 2013-12-17 10:33       ` ivan.khoronzhuk
  0 siblings, 0 replies; 19+ messages in thread
From: ivan.khoronzhuk @ 2013-12-17 10:33 UTC (permalink / raw)
  To: Brian Norris
  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, dwmw2,
	linux-arm-kernel

On 12/17/2013 10:42 AM, Brian Norris wrote:
> On Thu, Dec 05, 2013 at 07:25:57PM +0200, Ivan Khoronzhuk wrote:
>> The TI AEMIF driver registers are used to setup timings for each chip
>> select. The same registers range is used to setup NAND settings.
>> The AEMIF and NAND drivers not use the same registers in this range.
>>
>> In case with TI AEMIF driver, the memory address range is requested
>> already by AEMIF, so we cannot request it twice, just ioremap.
>>
>> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
>> Reviewed-by: Taras Kondratiuk <taras@ti.com>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
>> ---
>>   drivers/mtd/nand/davinci_nand.c |    8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
>> index f7b21b8..0cd4dbc 100644
>> --- a/drivers/mtd/nand/davinci_nand.c
>> +++ b/drivers/mtd/nand/davinci_nand.c
>> @@ -636,9 +636,11 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
>>   	if (IS_ERR(vaddr))
>>   		return PTR_ERR(vaddr);
>>
>> -	base = devm_ioremap_resource(&pdev->dev, res2);
>> -	if (IS_ERR(base))
>> -		return PTR_ERR(base);
>> +	base = devm_ioremap(&pdev->dev, res2->start, resource_size(res2));
>
> Since it's important that we don't re-introduce the "request resource"
> boilerplate later, can you add a comment describing the situation?
>
>> +	if (!base) {
>> +		dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res2);
>> +		return -EADDRNOTAVAIL;
>> +	}
>>
>>   	info->dev		= &pdev->dev;
>>   	info->base		= base;
>
> Thanks,
> Brian
>

Yes, I'll add the comment.

-- 
Regards,
Ivan Khoronzhuk

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH v3 1/9] mtd: nand: davinci: fix driver registration
       [not found]         ` <52B02598.5060004-l0cyMroinI0@public.gmane.org>
@ 2013-12-17 10:43           ` Brian Norris
  0 siblings, 0 replies; 19+ messages in thread
From: Brian Norris @ 2013-12-17 10:43 UTC (permalink / raw)
  To: ivan.khoronzhuk
  Cc: Santosh Shilimkar, Rob Landley, Russell King,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pawel Moll,
	Mark Rutland, Rob Herring, Stephen Warren, Kumar Gala,
	Ian Campbell, Linux Kernel,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Strashko, Grygorii, David Woodhouse

On Tue, Dec 17, 2013 at 2:21 AM, ivan.khoronzhuk <ivan.khoronzhuk-l0cyMroinI0@public.gmane.org> wrote:
> On 12/17/2013 11:24 AM, Brian Norris wrote:
>> On Thu, Dec 05, 2013 at 07:25:49PM +0200, Ivan Khoronzhuk wrote:
>>> --- 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),
>>
>> I believe you need to drop the __exit_p() here. And now that you're
>> using module_platform_driver(), you need to drop the __init and __exit
>> from the probe() and remove() routines, to avoid section mismatch
>> warnings.
>
> Do you want me to drop it in stand alone patch or in this one?

I think you can just do the __exit_p()/__init/__exit removal all in
this same patch. The changes are all inter-related.

Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 7/9] mtd: nand: davinci: adjust DT properties to MTD generic
  2013-12-17  8:50     ` Brian Norris
@ 2013-12-17 12:19       ` ivan.khoronzhuk
  0 siblings, 0 replies; 19+ messages in thread
From: ivan.khoronzhuk @ 2013-12-17 12:19 UTC (permalink / raw)
  To: Brian Norris
  Cc: Santosh Shilimkar, Rob Landley, Russell King,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Mark Rutland,
	Rob Herring, Stephen Warren, Kumar Gala, Ian Campbell,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	grygorii.strashko-l0cyMroinI0, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ

On 12/17/2013 10:50 AM, Brian Norris wrote:
> On Thu, Dec 05, 2013 at 07:25:55PM +0200, Ivan Khoronzhuk wrote:
>> --- a/drivers/mtd/nand/davinci_nand.c
>> +++ b/drivers/mtd/nand/davinci_nand.c
>> @@ -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) ||
> 
> Is it possible to use the of_get_nand_ecc_mode() helper? It's
> unfortunate that davinci_nand had to use custom bindings in the first
> place, making this more difficult... So I can take this patch as-is.
> 

Yes, I will do nothing for that

>> +		    !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) ||
> 
> Similar story here, with of_get_nand_bus_width().
> 

It seems for bus width I can replace it on:

prop = of_get_nand_bus_width(pdev->dev.of_node);
if ( 0 < prop || !of_property_read_u32(pdev->dev.of_node,
	     "ti,davinci-nand-buswidth", &prop))
     if (prop == 16)
	     pdata->options |= NAND_BUSWIDTH_16;


>> +		    !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;
>>   	}
>>   
> 
> Brian
> 


-- 
Regards,
Ivan Khoronzhuk
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2013-12-17 12:19 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-05 17:25 [PATCH v3 0/9] Reuse davinci-nand driver for Keystone arch Ivan Khoronzhuk
2013-12-05 17:25 ` [PATCH v3 2/9] mtd: nand: davinci: return ENOMEM if memory allocation is failed Ivan Khoronzhuk
2013-12-05 17:25 ` [PATCH v3 3/9] mtd: nand: davinci: check required ti, davinci-chipselect property Ivan Khoronzhuk
2013-12-05 17:25 ` [PATCH v3 4/9] mtd: nand: davinci: simplify error handling Ivan Khoronzhuk
2013-12-05 17:25 ` [PATCH v3 5/9] mtd: nand: davinci: move bindings under mtd Ivan Khoronzhuk
2013-12-05 17:25 ` [PATCH v3 6/9] mtd: nand: davinci: extend description of bindings Ivan Khoronzhuk
2013-12-05 17:25 ` [PATCH v3 7/9] mtd: nand: davinci: adjust DT properties to MTD generic Ivan Khoronzhuk
     [not found]   ` <1386264358-9738-8-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-12-17  8:50     ` Brian Norris
2013-12-17 12:19       ` ivan.khoronzhuk
2013-12-05 17:25 ` [PATCH v3 9/9] mtd: nand: davinci: don't request AEMIF address range Ivan Khoronzhuk
     [not found]   ` <1386264358-9738-10-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-12-17  8:42     ` Brian Norris
2013-12-17 10:33       ` ivan.khoronzhuk
     [not found] ` <1386264358-9738-1-git-send-email-ivan.khoronzhuk-l0cyMroinI0@public.gmane.org>
2013-12-05 17:25   ` [PATCH v3 1/9] mtd: nand: davinci: fix driver registration Ivan Khoronzhuk
2013-12-17  9:24     ` Brian Norris
2013-12-17 10:21       ` ivan.khoronzhuk
     [not found]         ` <52B02598.5060004-l0cyMroinI0@public.gmane.org>
2013-12-17 10:43           ` Brian Norris
2013-12-05 17:25   ` [PATCH v3 8/9] mtd: nand: davinci: reuse driver for Keystone arch Ivan Khoronzhuk
2013-12-09 16:44   ` [PATCH v3 0/9] Reuse davinci-nand " Santosh Shilimkar
2013-12-14 19:18     ` Santosh Shilimkar

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).