* [U-Boot] [PATCH] ppc4xx/fdt/flash: Fix bug in fdt_fixup_nor_flash_node()
@ 2010-09-29 15:22 Stefan Roese
2010-10-04 9:22 ` Stefan Roese
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Roese @ 2010-09-29 15:22 UTC (permalink / raw)
To: u-boot
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>
---
common/fdt_support.c | 17 ++++++++++-------
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 */
--
1.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] ppc4xx/fdt/flash: Fix bug in fdt_fixup_nor_flash_node()
2010-09-29 15:22 [U-Boot] [PATCH] ppc4xx/fdt/flash: Fix bug in fdt_fixup_nor_flash_node() Stefan Roese
@ 2010-10-04 9:22 ` Stefan Roese
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Roese @ 2010-10-04 9:22 UTC (permalink / raw)
To: u-boot
On Wednesday 29 September 2010 17:22:32 Stefan Roese wrote:
> 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.
Applied to u-boot-ppc4xx/master. Thanks.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-04 9:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-29 15:22 [U-Boot] [PATCH] ppc4xx/fdt/flash: Fix bug in fdt_fixup_nor_flash_node() Stefan Roese
2010-10-04 9:22 ` Stefan Roese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox