* [PATCH] mtd: partition: Fix OF partition fixup
@ 2015-04-27 9:24 Sascha Hauer
2015-04-27 9:56 ` Uwe Kleine-König
2015-04-30 10:51 ` Marc Kleine-Budde
0 siblings, 2 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-04-27 9:24 UTC (permalink / raw)
To: Barebox List; +Cc: ukl
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.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mtd/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 63b1e4a..431114b 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;
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: partition: Fix OF partition fixup
2015-04-27 9:24 [PATCH] mtd: partition: Fix OF partition fixup Sascha Hauer
@ 2015-04-27 9:56 ` Uwe Kleine-König
2015-04-30 10:51 ` Marc Kleine-Budde
1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2015-04-27 9:56 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
Hello Sascha,
On Mon, Apr 27, 2015 at 11:24:10AM +0200, Sascha Hauer wrote:
> 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.
seems like correctly "schlau gekuckt" and matching the problem report I
sent you (off-list).
Just tested your patch and it really fixes my problem, it works fine now
with and without passing a dtb for booting. As you pointed out this
doesn't explain though why the use case with an explicit dtb worked
already before. I verified that of_mtd_fixup is called there, but didn't
dig any deeper, e.g. by testing if the partitioning is really modified
if I did any changes. Will do so later today.
I'd formulate the commit log a tad more critical, like adding:
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.
Other than than that:
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: partition: Fix OF partition fixup
2015-04-27 9:24 [PATCH] mtd: partition: Fix OF partition fixup Sascha Hauer
2015-04-27 9:56 ` Uwe Kleine-König
@ 2015-04-30 10:51 ` Marc Kleine-Budde
2015-05-04 7:22 ` Sascha Hauer
1 sibling, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2015-04-30 10:51 UTC (permalink / raw)
To: Sascha Hauer, Barebox List; +Cc: ukl
[-- Attachment #1.1: Type: text/plain, Size: 671 bytes --]
On 04/27/2015 11:24 AM, Sascha Hauer wrote:
> 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.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Have you already applied this patch?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: partition: Fix OF partition fixup
2015-04-30 10:51 ` Marc Kleine-Budde
@ 2015-05-04 7:22 ` Sascha Hauer
0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-05-04 7:22 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: Barebox List, ukl
On Thu, Apr 30, 2015 at 12:51:05PM +0200, Marc Kleine-Budde wrote:
> On 04/27/2015 11:24 AM, Sascha Hauer wrote:
> > 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.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>
> Have you already applied this patch?
Yes, it's applied to master.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-04 7:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-27 9:24 [PATCH] mtd: partition: Fix OF partition fixup Sascha Hauer
2015-04-27 9:56 ` Uwe Kleine-König
2015-04-30 10:51 ` Marc Kleine-Budde
2015-05-04 7:22 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox