aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2010-10-01 03:06:08 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 19:55:56 -0400
commit766f271a63d1ee7caed8030736e6aed253d02073 (patch)
tree198b4cf3efd5de59121bdca483a095b8234b588a /drivers/mtd/nand
parentd86fbdb8ed0ac957693ff475cca076021677166a (diff)
mtd: Fix endianness issues from device tree
This patch adds the appropriate conversions to correct the endianness issues in the MTD driver whenever it accesses the device tree (which is always big endian). Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/fsl_upm.c8
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c4
-rw-r--r--drivers/mtd/nand/ndfc.c8
3 files changed, 10 insertions, 10 deletions
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index c8ab15653e7c..efdcca94ce55 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -222,7 +222,7 @@ static int __devinit fun_probe(struct platform_device *ofdev,
222{ 222{
223 struct fsl_upm_nand *fun; 223 struct fsl_upm_nand *fun;
224 struct resource io_res; 224 struct resource io_res;
225 const uint32_t *prop; 225 const __be32 *prop;
226 int rnb_gpio; 226 int rnb_gpio;
227 int ret; 227 int ret;
228 int size; 228 int size;
@@ -270,7 +270,7 @@ static int __devinit fun_probe(struct platform_device *ofdev,
270 goto err1; 270 goto err1;
271 } 271 }
272 for (i = 0; i < fun->mchip_count; i++) 272 for (i = 0; i < fun->mchip_count; i++)
273 fun->mchip_offsets[i] = prop[i]; 273 fun->mchip_offsets[i] = be32_to_cpu(prop[i]);
274 } else { 274 } else {
275 fun->mchip_count = 1; 275 fun->mchip_count = 1;
276 } 276 }
@@ -295,13 +295,13 @@ static int __devinit fun_probe(struct platform_device *ofdev,
295 295
296 prop = of_get_property(ofdev->dev.of_node, "chip-delay", NULL); 296 prop = of_get_property(ofdev->dev.of_node, "chip-delay", NULL);
297 if (prop) 297 if (prop)
298 fun->chip_delay = *prop; 298 fun->chip_delay = be32_to_cpup(prop);
299 else 299 else
300 fun->chip_delay = 50; 300 fun->chip_delay = 50;
301 301
302 prop = of_get_property(ofdev->dev.of_node, "fsl,upm-wait-flags", &size); 302 prop = of_get_property(ofdev->dev.of_node, "fsl,upm-wait-flags", &size);
303 if (prop && size == sizeof(uint32_t)) 303 if (prop && size == sizeof(uint32_t))
304 fun->wait_flags = *prop; 304 fun->wait_flags = be32_to_cpup(prop);
305 else 305 else
306 fun->wait_flags = FSL_UPM_WAIT_RUN_PATTERN | 306 fun->wait_flags = FSL_UPM_WAIT_RUN_PATTERN |
307 FSL_UPM_WAIT_WRITE_BYTE; 307 FSL_UPM_WAIT_WRITE_BYTE;
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index f4610bc7ccd0..469e649c911c 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -663,7 +663,7 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op,
663#endif 663#endif
664 struct nand_chip *chip; 664 struct nand_chip *chip;
665 unsigned long regs_paddr, regs_size; 665 unsigned long regs_paddr, regs_size;
666 const uint *chips_no; 666 const __be32 *chips_no;
667 int resettime = 0; 667 int resettime = 0;
668 int retval = 0; 668 int retval = 0;
669 int rev, len; 669 int rev, len;
@@ -806,7 +806,7 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op,
806 } 806 }
807 807
808 /* Detect NAND chips */ 808 /* Detect NAND chips */
809 if (nand_scan(mtd, *chips_no)) { 809 if (nand_scan(mtd, be32_to_cpup(chips_no))) {
810 dev_err(dev, "NAND Flash not found !\n"); 810 dev_err(dev, "NAND Flash not found !\n");
811 devm_free_irq(dev, prv->irq, mtd); 811 devm_free_irq(dev, prv->irq, mtd);
812 retval = -ENXIO; 812 retval = -ENXIO;
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 510554e6c115..c9ae0a5023b6 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -229,7 +229,7 @@ static int __devinit ndfc_probe(struct platform_device *ofdev,
229 const struct of_device_id *match) 229 const struct of_device_id *match)
230{ 230{
231 struct ndfc_controller *ndfc = &ndfc_ctrl; 231 struct ndfc_controller *ndfc = &ndfc_ctrl;
232 const u32 *reg; 232 const __be32 *reg;
233 u32 ccr; 233 u32 ccr;
234 int err, len; 234 int err, len;
235 235
@@ -244,7 +244,7 @@ static int __devinit ndfc_probe(struct platform_device *ofdev,
244 dev_err(&ofdev->dev, "unable read reg property (%d)\n", len); 244 dev_err(&ofdev->dev, "unable read reg property (%d)\n", len);
245 return -ENOENT; 245 return -ENOENT;
246 } 246 }
247 ndfc->chip_select = reg[0]; 247 ndfc->chip_select = be32_to_cpu(reg[0]);
248 248
249 ndfc->ndfcbase = of_iomap(ofdev->dev.of_node, 0); 249 ndfc->ndfcbase = of_iomap(ofdev->dev.of_node, 0);
250 if (!ndfc->ndfcbase) { 250 if (!ndfc->ndfcbase) {
@@ -257,7 +257,7 @@ static int __devinit ndfc_probe(struct platform_device *ofdev,
257 /* It is ok if ccr does not exist - just default to 0 */ 257 /* It is ok if ccr does not exist - just default to 0 */
258 reg = of_get_property(ofdev->dev.of_node, "ccr", NULL); 258 reg = of_get_property(ofdev->dev.of_node, "ccr", NULL);
259 if (reg) 259 if (reg)
260 ccr |= *reg; 260 ccr |= be32_to_cpup(reg);
261 261
262 out_be32(ndfc->ndfcbase + NDFC_CCR, ccr); 262 out_be32(ndfc->ndfcbase + NDFC_CCR, ccr);
263 263
@@ -265,7 +265,7 @@ static int __devinit ndfc_probe(struct platform_device *ofdev,
265 reg = of_get_property(ofdev->dev.of_node, "bank-settings", NULL); 265 reg = of_get_property(ofdev->dev.of_node, "bank-settings", NULL);
266 if (reg) { 266 if (reg) {
267 int offset = NDFC_BCFG0 + (ndfc->chip_select << 2); 267 int offset = NDFC_BCFG0 + (ndfc->chip_select << 2);
268 out_be32(ndfc->ndfcbase + offset, *reg); 268 out_be32(ndfc->ndfcbase + offset, be32_to_cpup(reg));
269 } 269 }
270 270
271 err = ndfc_chip_init(ndfc, ofdev->dev.of_node); 271 err = ndfc_chip_init(ndfc, ofdev->dev.of_node);