mtd: nand: davinci: don't request AEMIF address range

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jan 28 00:59:04 EST 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=0966a416d22bb5d4a5444e5a8eb0e0ae671826e6
Commit:     0966a416d22bb5d4a5444e5a8eb0e0ae671826e6
Parent:     458f3933bb8a72c2c4a2751009152d83ac71c23b
Author:     Ivan Khoronzhuk <ivan.khoronzhuk at ti.com>
AuthorDate: Tue Dec 17 15:38:31 2013 +0200
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Jan 3 11:22:26 2014 -0800

    mtd: nand: davinci: don't request AEMIF address range
    
    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 at ti.com>
    Reviewed-by: Grygorii Strashko <grygorii.strashko at ti.com>
    Reviewed-by: Taras Kondratiuk <taras at ti.com>
    Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk at ti.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/davinci_nand.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index 8a61a40..0104d26 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -637,9 +637,17 @@ static int 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);
+	/*
+	 * This registers range is used to setup NAND settings. In case with
+	 * TI AEMIF driver, the same memory address range is requested already
+	 * by AEMIF, so we cannot request it twice, just ioremap.
+	 * The AEMIF and NAND drivers not use the same registers in this range.
+	 */
+	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;



More information about the linux-mtd-cvs mailing list