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>
This commit is contained in:
parent
c96be63aab
commit
2778a01431
|
@ -620,7 +620,7 @@ int fdt_fixup_nor_flash_size(void *blob)
|
||||||
int off;
|
int off;
|
||||||
int len;
|
int len;
|
||||||
struct fdt_property *prop;
|
struct fdt_property *prop;
|
||||||
u32 *reg;
|
u32 *reg, *reg2;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 2; 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,
|
* There might be multiple reg-tuples,
|
||||||
* so loop through them all
|
* so loop through them all
|
||||||
*/
|
*/
|
||||||
len /= tuple_size;
|
reg = reg2 = (u32 *)&prop->data[0];
|
||||||
reg = (u32 *)&prop->data[0];
|
for (idx = 0; idx < (len / tuple_size); idx++) {
|
||||||
for (idx = 0; idx < len; idx++) {
|
|
||||||
/*
|
/*
|
||||||
* Update size in reg property
|
* Update size in reg property
|
||||||
*/
|
*/
|
||||||
reg[2] = flash_get_bank_size(reg[0],
|
reg[2] = flash_get_bank_size(reg[0],
|
||||||
idx);
|
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 */
|
/* Move to next compatible node */
|
||||||
|
|
Loading…
Reference in New Issue