summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-04-27 11:22:16 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-04-28 09:09:46 +0200
commit10e69303239b91a81149490fd22c848a0813c35e (patch)
tree5fb9fd72aeb324d127d8bfa21f707a6cc1e8c6f2
parentdbe6023074ee5105faf74bee1beef82446239d59 (diff)
downloadbarebox-10e69303239b91a81149490fd22c848a0813c35e.tar.gz
barebox-10e69303239b91a81149490fd22c848a0813c35e.tar.xz
mtd: partition: Fix OF partition fixup
To get the number of address cells and size cells we have to use the newly created partition node, not the parent device node. The parent device node returns the address/size cells of the controller node, not the partition node. On an am335x machine this fixes the device tree passed to Linux. The situation there is: ... gpmc@50000000 { ... #address-cells = <0x2>; #size-cells = <0x1>; ranges = <0x0 0x0 0x8000000 0x10000000>; ... nand@0,0 { reg = <0x0 0x0 0x0>; #address-cells = <0x1>; #size-cells = <0x1>; ... partition@7 { label = "system"; reg = <0x220000 0x7de0000>; }; }; }; and without this patch barebox passes three bytes for partition@7's reg property instead of only two which naturally confuses Linux and yields to the system partition to start at 0 with a size of 0x220000. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--drivers/mtd/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 63b1e4a824..431114bab8 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -520,8 +520,8 @@ static int of_mtd_fixup(struct device_node *root, void *ctx)
if (!p)
return -ENOMEM;
- na = of_n_addr_cells(np);
- ns = of_n_size_cells(np);
+ na = of_n_addr_cells(part);
+ ns = of_n_size_cells(part);
of_write_number(tmp + len, partmtd->master_offset, na);
len += na * 4;