mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mtd: make sure address-cells/size-cells are set when adding partition nodes
@ 2016-09-15  6:03 Michael Olbrich
  2016-09-16  8:03 ` Sascha Hauer
  2016-09-19 10:55 ` Uwe Kleine-König
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Olbrich @ 2016-09-15  6:03 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich

address-cells/size-cells can either be set to 1 or 2 for 32 or 63 bit
addresses respectively. Barebox currently writes 32 bit addresses.
This makes sure that address-cells/size-cells are both set and have the
correct value.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---

Hi,

this is just a minor fix. What is really needed it support for 64 bit
addressing. Also, the bindings documentation says that all partitions
should be in a 'partitions' sub node. The main question here is probably
which kernel version introduced these features and what should be supported
by barebox.

Michael

 drivers/mtd/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 6d04b8855387..8d0e83415ae7 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -575,6 +575,14 @@ static int of_mtd_fixup(struct device_node *root, void *ctx)
 		of_delete_node(part);
 	}
 
+	ret = of_property_write_u32(np, "#address-cells", 1);
+	if (ret)
+		return ret;
+
+	ret = of_property_write_u32(np, "#size-cells", 1);
+	if (ret)
+		return ret;
+
 	list_for_each_entry(partmtd, &mtd->partitions, partitions_entry) {
 		int na, ns, len = 0;
 		char *name = basprintf("partition@%0llx",
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: make sure address-cells/size-cells are set when adding partition nodes
  2016-09-15  6:03 [PATCH] mtd: make sure address-cells/size-cells are set when adding partition nodes Michael Olbrich
@ 2016-09-16  8:03 ` Sascha Hauer
  2016-09-19 10:55 ` Uwe Kleine-König
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2016-09-16  8:03 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: barebox

On Thu, Sep 15, 2016 at 08:03:26AM +0200, Michael Olbrich wrote:
> address-cells/size-cells can either be set to 1 or 2 for 32 or 63 bit
> addresses respectively. Barebox currently writes 32 bit addresses.
> This makes sure that address-cells/size-cells are both set and have the
> correct value.
> 
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
> 
> Hi,
> 
> this is just a minor fix. What is really needed it support for 64 bit
> addressing.

Looking at the code this is already implemented. It already creates the
reg property using of_write_number() and honouring of_n_addr_cells() /
of_n_size_cells(). This of course only works when the target device tree
already has the #address-cells and #size-cells properties with the
correct values. So instead of just setting them to hardcoded '1' you
should set them to the desired value, the loop below should do the rest
correctly.

> Also, the bindings documentation says that all partitions
> should be in a 'partitions' sub node. The main question here is probably
> which kernel version introduced these features and what should be supported
> by barebox.

The partitions subnode was introduced with 4.4, so we better do not rely
on the kernel being able to handle it.

What we can and probably should do is to look into the target device tree
if it already has a partitions subnode with compatible = "fixed-partitions"
and if does, use it.

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] 3+ messages in thread

* Re: [PATCH] mtd: make sure address-cells/size-cells are set when adding partition nodes
  2016-09-15  6:03 [PATCH] mtd: make sure address-cells/size-cells are set when adding partition nodes Michael Olbrich
  2016-09-16  8:03 ` Sascha Hauer
@ 2016-09-19 10:55 ` Uwe Kleine-König
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2016-09-19 10:55 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: barebox

On Thu, Sep 15, 2016 at 08:03:26AM +0200, Michael Olbrich wrote:
> address-cells/size-cells can either be set to 1 or 2 for 32 or 63 bit
s/63/64/ ?

Uwe
> addresses respectively. Barebox currently writes 32 bit addresses.

-- 
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] 3+ messages in thread

end of thread, other threads:[~2016-09-19 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15  6:03 [PATCH] mtd: make sure address-cells/size-cells are set when adding partition nodes Michael Olbrich
2016-09-16  8:03 ` Sascha Hauer
2016-09-19 10:55 ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox