[PATCH] mtd: partition: Fix OF partition fixup

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Mon Apr 27 02:56:11 PDT 2015

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 at 50000000 {
                #address-cells = <0x2>;
                #size-cells = <0x1>;
                ranges = <0x0 0x0 0x8000000 0x10000000>;
                nand at 0,0 {
                        reg = <0x0 0x0 0x0>;
                        #address-cells = <0x1>;
                        #size-cells = <0x1>;
                        partition at 7 {
                                label = "system";
                                reg = <0x220000 0x7de0000>;

	and without this patch barebox passes three bytes for
	partition at 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 at pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>


Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

More information about the barebox mailing list