summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2010-09-24 13:51:50 +0200
committerStefan Roese <sr@denx.de>2010-10-04 11:19:49 +0200
commit2778a01431973b8474e48d5da99a76405a3b421e (patch)
treef17441e07111c8a457de6fcb65704b621e1f1bcc /common
parentc96be63aabb49fa2fc95de6b1aae13e91d8e3d10 (diff)
downloadu-boot-imx-2778a01431973b8474e48d5da99a76405a3b421e.zip
u-boot-imx-2778a01431973b8474e48d5da99a76405a3b421e.tar.gz
u-boot-imx-2778a01431973b8474e48d5da99a76405a3b421e.tar.bz2
ppc4xx/fdt/flash: Fix bug in fdt_fixup_nor_flash_node()
This patch fixes a bug in fdt_fixup_nor_flash_node() when the reg property has multiple reg tuples, like: reg = <0 0x00000000 0x04000000 0 0x04000000 0x04000000>; In this case this function did not update the reg property correctly. Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'common')
-rw-r--r--common/fdt_support.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 6f32e3f..0ed6e77 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -620,7 +620,7 @@ int fdt_fixup_nor_flash_size(void *blob)
int off;
int len;
struct fdt_property *prop;
- u32 *reg;
+ u32 *reg, *reg2;
int i;
for (i = 0; i < 2; i++) {
@@ -640,18 +640,21 @@ int fdt_fixup_nor_flash_size(void *blob)
* There might be multiple reg-tuples,
* so loop through them all
*/
- len /= tuple_size;
- reg = (u32 *)&prop->data[0];
- for (idx = 0; idx < len; idx++) {
+ reg = reg2 = (u32 *)&prop->data[0];
+ for (idx = 0; idx < (len / tuple_size); idx++) {
/*
* Update size in reg property
*/
reg[2] = flash_get_bank_size(reg[0],
idx);
- fdt_setprop(blob, off, "reg", reg,
- tuple_size);
- reg += tuple_size;
+
+ /*
+ * Point to next reg tuple
+ */
+ reg += 3;
}
+
+ fdt_setprop(blob, off, "reg", reg2, len);
}
/* Move to next compatible node */