aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-06-06 06:33:14 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-07-06 13:17:06 -0400
commit71885b650ab0fd9d2d35cd922bf949c07c171b04 (patch)
tree5b42c827d2e8c1583777e15e02183d6ba541bcf9
parente4a09cbf2dc7ba6c7fd7e07a3ab3d3f499a575e2 (diff)
mtd: mxc_nand: swap iomem resource order
The i.MX v3 nand controller (i.MX5) needs two memory resources. Traditionally we have the AXI resource first. For sorting in this driver into the devicetree it feels much more natural to have the IP resource first. This patch swaps the ordering of these two resources. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc_nand.c11
-rw-r--r--drivers/mtd/nand/mxc_nand.c35
2 files changed, 24 insertions, 22 deletions
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_nand.c b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
index 1568f39fba8b..95b75cc70515 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_nand.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
@@ -63,10 +63,6 @@ struct platform_device *__init imx_add_mxc_nand(
63 /* AXI has to come first, that's how the mxc_nand driver expect it */ 63 /* AXI has to come first, that's how the mxc_nand driver expect it */
64 struct resource res[] = { 64 struct resource res[] = {
65 { 65 {
66 .start = data->axibase,
67 .end = data->axibase + SZ_16K - 1,
68 .flags = IORESOURCE_MEM,
69 }, {
70 .start = data->iobase, 66 .start = data->iobase,
71 .end = data->iobase + data->iosize - 1, 67 .end = data->iobase + data->iosize - 1,
72 .flags = IORESOURCE_MEM, 68 .flags = IORESOURCE_MEM,
@@ -74,10 +70,13 @@ struct platform_device *__init imx_add_mxc_nand(
74 .start = data->irq, 70 .start = data->irq,
75 .end = data->irq, 71 .end = data->irq,
76 .flags = IORESOURCE_IRQ, 72 .flags = IORESOURCE_IRQ,
73 }, {
74 .start = data->axibase,
75 .end = data->axibase + SZ_16K - 1,
76 .flags = IORESOURCE_MEM,
77 }, 77 },
78 }; 78 };
79 return imx_add_platform_device("mxc_nand", data->id, 79 return imx_add_platform_device("mxc_nand", data->id,
80 res + !data->axibase, 80 res, ARRAY_SIZE(res) - !data->axibase,
81 ARRAY_SIZE(res) - !data->axibase,
82 pdata, sizeof(*pdata)); 81 pdata, sizeof(*pdata));
83} 82}
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index db428c24e2c8..48c57275001f 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1376,7 +1376,25 @@ static int __init mxcnd_probe(struct platform_device *pdev)
1376 if (IS_ERR(host->clk)) 1376 if (IS_ERR(host->clk))
1377 return PTR_ERR(host->clk); 1377 return PTR_ERR(host->clk);
1378 1378
1379 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1379 err = mxcnd_probe_dt(host);
1380 if (err > 0)
1381 err = mxcnd_probe_pdata(host);
1382 if (err < 0)
1383 return err;
1384
1385 if (host->devtype_data->needs_ip) {
1386 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1387 if (!res)
1388 return -ENODEV;
1389 host->regs_ip = devm_request_and_ioremap(&pdev->dev, res);
1390 if (!host->regs_ip)
1391 return -ENOMEM;
1392
1393 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1394 } else {
1395 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1396 }
1397
1380 if (!res) 1398 if (!res)
1381 return -ENODEV; 1399 return -ENODEV;
1382 1400
@@ -1386,12 +1404,6 @@ static int __init mxcnd_probe(struct platform_device *pdev)
1386 1404
1387 host->main_area0 = host->base; 1405 host->main_area0 = host->base;
1388 1406
1389 err = mxcnd_probe_dt(host);
1390 if (err > 0)
1391 err = mxcnd_probe_pdata(host);
1392 if (err < 0)
1393 return err;
1394
1395 if (host->devtype_data->regs_offset) 1407 if (host->devtype_data->regs_offset)
1396 host->regs = host->base + host->devtype_data->regs_offset; 1408 host->regs = host->base + host->devtype_data->regs_offset;
1397 host->spare0 = host->base + host->devtype_data->spare0_offset; 1409 host->spare0 = host->base + host->devtype_data->spare0_offset;
@@ -1405,15 +1417,6 @@ static int __init mxcnd_probe(struct platform_device *pdev)
1405 this->ecc.size = 512; 1417 this->ecc.size = 512;
1406 this->ecc.layout = host->devtype_data->ecclayout_512; 1418 this->ecc.layout = host->devtype_data->ecclayout_512;
1407 1419
1408 if (host->devtype_data->needs_ip) {
1409 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1410 if (!res)
1411 return -ENODEV;
1412 host->regs_ip = devm_request_and_ioremap(&pdev->dev, res);
1413 if (!host->regs_ip)
1414 return -ENOMEM;
1415 }
1416
1417 if (host->pdata.hw_ecc) { 1420 if (host->pdata.hw_ecc) {
1418 this->ecc.calculate = mxc_nand_calculate_ecc; 1421 this->ecc.calculate = mxc_nand_calculate_ecc;
1419 this->ecc.hwctl = mxc_nand_enable_hwecc; 1422 this->ecc.hwctl = mxc_nand_enable_hwecc;