aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2010-10-08 08:41:27 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 20:12:46 -0400
commit940fe282aeda984d32ca9e3d2be7df1b4c5161b1 (patch)
tree9d913b4f995410927058b5ce70a5d0e088ff3c16 /drivers
parent41bdc602eca8738d6f3c71235744f72d888fe6b4 (diff)
mtd: physmap_of: Loop through all "reg" tuples for mapping
This patch changes the loop over the "reg" tuples to not exit directly upon of_address_to_resource() failure but to continue with the next "reg" tuple instead. This failure could be due to size = 0, which might be passed via the device-tree. This is needed for boards, where a "reg" tuple might have size 0 (of_address_to_resource() returns with EINVAL when size = 0). Example: Fully equipped board: reg = <0 0x00000000 0x00400000 0 0x00400000 0x00400000>; Partially equipped board: reg = <0 0x00000000 0x00400000 0 0x00400000 0x00000000>; This could be the case on boards with runtime detection of multiple NOR flash configurations where the detected flash size is inserted into the dtb in U-Boot. Signed-off-by: Stefan Roese <sr@denx.de> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/maps/physmap_of.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index ec4011c3d5f2..9861814aa027 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -267,9 +267,11 @@ static int __devinit of_flash_probe(struct platform_device *dev,
267 for (i = 0; i < count; i++) { 267 for (i = 0; i < count; i++) {
268 err = -ENXIO; 268 err = -ENXIO;
269 if (of_address_to_resource(dp, i, &res)) { 269 if (of_address_to_resource(dp, i, &res)) {
270 dev_err(&dev->dev, "Can't get IO address from device" 270 /*
271 " tree\n"); 271 * Continue with next register tuple if this
272 goto err_out; 272 * one is not mappable
273 */
274 continue;
273 } 275 }
274 276
275 dev_dbg(&dev->dev, "of_flash device: %.8llx-%.8llx\n", 277 dev_dbg(&dev->dev, "of_flash device: %.8llx-%.8llx\n",