mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of: add ranges address translation for default bus
@ 2013-05-12 23:09 Sebastian Hesselbarth
  2013-05-19  7:34 ` Sascha Hauer
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Hesselbarth @ 2013-05-12 23:09 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox

This patch adds address translation for default bus types. It has been
shamelessly ported from Linux device tree address translation with the
following exceptions:
- only default bus map and translate are supported
- of_bus has not been ported
- check for #size-cells > 0 has been removed

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: barebox@lists.infradead.org
---
 drivers/of/base.c |  131 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 114 insertions(+), 17 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 8383549..cad7baa 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -28,6 +28,12 @@
 #include <linux/amba/bus.h>
 #include <linux/err.h>
 
+/* Max address size we deal with */
+#define OF_MAX_ADDR_CELLS	4
+#define OF_CHECK_ADDR_COUNT(na)	((na) > 0 && (na) <= OF_MAX_ADDR_CELLS)
+/* do not check for #size-cells > 0 as no size cells is perfectly valid */
+#define OF_CHECK_COUNTS(na, ns)	(OF_CHECK_ADDR_COUNT(na))
+
 /**
  * struct alias_prop - Alias property in 'aliases' node
  * @link:	List node to link the structure in aliases_lookup list
@@ -212,28 +218,119 @@ int of_alias_get_id(struct device_node *np, const char *stem)
 }
 EXPORT_SYMBOL_GPL(of_alias_get_id);
 
-u64 of_translate_address(struct device_node *node, const __be32 *in_addr)
+static u64 of_bus_default_map(__be32 *addr, const __be32 *range,
+			      int na, int ns, int pna)
 {
-	struct property *p;
-	u64 addr = be32_to_cpu(*in_addr);
+	u64 cp, s, da;
+
+	cp = of_read_number(range, na);
+	s = of_read_number(range + na + pna, ns);
+	da = of_read_number(addr, na);
+
+	/*
+	 * If #address-cells > 2 we assume the mapping does not specify a
+	 * physical address. Rather, the address specifies an identifier
+	 * that must match exactly.
+	 */
+	if (na > 2 && memcmp(range, addr, 4 * na) != 0)
+		return OF_BAD_ADDR;
+
+	/* check if address is outside mapping range */
+	if (da < cp || da >= (cp + s))
+		return OF_BAD_ADDR;
+	return da - cp;
+}
+
+static int of_bus_default_translate(__be32 *addr, u64 offset, int na)
+{
+	u64 a = of_read_number(addr, na);
+	memset(addr, 0, 4 * na);
+	a += offset;
+	if (na > 1)
+		addr[na - 2] = cpu_to_be32(a >> 32);
+	addr[na - 1] = cpu_to_be32(a & 0xffffffffu);
+	return 0;
+}
+
+static int of_translate_one(struct device_node *parent,
+			    __be32 *addr, int na, int ns, int pna,
+			    const char *rprop)
+{
+	const __be32 *ranges;
+	unsigned int rlen;
+	int rone;
+	u64 offset = OF_BAD_ADDR;
+
+	ranges = of_get_property(parent, rprop, &rlen);
+	if (!ranges)
+		return 1;
+
+	/* walk through ranges */
+	rlen /= 4;
+	rone = na + pna + ns;
+	for (; rlen >= rone; rlen -= rone, ranges += rone) {
+		offset = of_bus_default_map(addr, ranges, na, ns, pna);
+		if (offset != OF_BAD_ADDR)
+			break;
+	}
+	if (offset == OF_BAD_ADDR)
+		return 1;
+
+	memcpy(addr, ranges + na, 4 * pna);
+	/* translate into parent address space */
+	return of_bus_default_translate(addr, offset, pna);
+}
+
+u64 __of_translate_address(struct device_node *node,
+			   const __be32 *in_addr, const char *rprop)
+{
+	struct device_node *parent = node->parent;
+	__be32 addr[OF_MAX_ADDR_CELLS];
+	int na, ns, pna, pns;
+	u64 result = OF_BAD_ADDR;
+
+	/* count address cells & copy address locally */
+	of_bus_count_cells(node, &na, &ns);
+	if (!OF_CHECK_COUNTS(na, ns)) {
+		printk(KERN_ERR "of: bad cell count (%d, %d) for %s\n",
+		       na, ns, node->full_name);
+		return OF_BAD_ADDR;
+	}
+	memcpy(addr, in_addr, na * 4);
 
 	while (1) {
-		int na, nc;
-
-		if (!node->parent)
-			return addr;
-
-		node = node->parent;
-		p = of_find_property(node, "ranges");
-		if (!p && node->parent)
-			return OF_BAD_ADDR;
-		of_bus_count_cells(node, &na, &nc);
-		if (na != 1 || nc != 1) {
-			printk("%s: #size-cells != 1 or #address-cells != 1 "
-					"currently not supported\n", node->name);
-			return OF_BAD_ADDR;
+		node = parent;
+		parent = node->parent;
+
+		/* exit at root node */
+		if (!parent) {
+			result = of_read_number(addr, na);
+			break;
 		}
+
+		/* get new parent bus and counts */
+		of_bus_count_cells(node, &pna, &pns);
+		if (!OF_CHECK_COUNTS(pna, pns)) {
+			printk(KERN_ERR "of: bad cell count (%d, %d) for %s\n",
+			       pna, pns, node->full_name);
+			break;
+		}
+
+		/* apply bus translation */
+		if (of_translate_one(node, addr, na, ns, pna, rprop))
+			break;
+
+		/* ascend device tree */
+		na = pna;
+		ns = pns;
 	}
+
+	return result;
+}
+
+u64 of_translate_address(struct device_node *node, const __be32 *in_addr)
+{
+	return __of_translate_address(node, in_addr, "ranges");
 }
 EXPORT_SYMBOL(of_translate_address);
 
-- 
1.7.10.4


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

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-05-12 23:09 [PATCH] of: add ranges address translation for default bus Sebastian Hesselbarth
@ 2013-05-19  7:34 ` Sascha Hauer
  2013-05-19  8:07   ` Sebastian Hesselbarth
  2013-06-11  9:33   ` Sebastian Hesselbarth
  0 siblings, 2 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-05-19  7:34 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox

Hi Sebastian,

On Mon, May 13, 2013 at 01:09:06AM +0200, Sebastian Hesselbarth wrote:
> This patch adds address translation for default bus types. It has been
> shamelessly ported from Linux device tree address translation with the
> following exceptions:
> - only default bus map and translate are supported
> - of_bus has not been ported
> - check for #size-cells > 0 has been removed
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

I just gave this one a test.

First of all you dropped 1:1 translation, see the attached fixup.

Then, since this code duplicates the majority of drivers/of/address.c,
would it make sense to move it to the same file in barebox aswell?

Sascha

8<---------------------------------------------------------
From bb502b1154a135f7aead65858ffa420f3d3e2df3 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Sun, 19 May 2013 09:28:56 +0200
Subject: [PATCH] fixup! of: add ranges address translation for default bus

Fix 1:1 translation using empty ranges property

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/base.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5d449d1..7f3b76d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -260,11 +260,21 @@ static int of_translate_one(struct device_node *parent,
 	unsigned int rlen;
 	int rone;
 	u64 offset = OF_BAD_ADDR;
+	struct property *prop = of_find_property(parent, rprop);
 
-	ranges = of_get_property(parent, rprop, &rlen);
-	if (!ranges)
+	if (!prop)
 		return 1;
 
+	rlen = prop->length;
+	ranges = prop->value;
+
+	if (rlen == 0) {
+		/* empty ranges; 1:1 translation */
+		offset = of_read_number(addr, na);
+		memset(addr, 0, pna * 4);
+		goto finish;
+	}
+
 	/* walk through ranges */
 	rlen /= 4;
 	rone = na + pna + ns;
@@ -277,6 +287,7 @@ static int of_translate_one(struct device_node *parent,
 		return 1;
 
 	memcpy(addr, ranges + na, 4 * pna);
+finish:
 	/* translate into parent address space */
 	return of_bus_default_translate(addr, offset, pna);
 }
-- 
1.8.2.rc2


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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-05-19  7:34 ` Sascha Hauer
@ 2013-05-19  8:07   ` Sebastian Hesselbarth
  2013-05-19 10:39     ` Sascha Hauer
  2013-06-11  9:33   ` Sebastian Hesselbarth
  1 sibling, 1 reply; 14+ messages in thread
From: Sebastian Hesselbarth @ 2013-05-19  8:07 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Thomas Petazzoni, barebox

On 05/19/2013 09:34 AM, Sascha Hauer wrote:
> Hi Sebastian,
>
> On Mon, May 13, 2013 at 01:09:06AM +0200, Sebastian Hesselbarth wrote:
>> This patch adds address translation for default bus types. It has been
>> shamelessly ported from Linux device tree address translation with the
>> following exceptions:
>> - only default bus map and translate are supported
>> - of_bus has not been ported
>> - check for #size-cells>  0 has been removed
>>
>> Signed-off-by: Sebastian Hesselbarth<sebastian.hesselbarth@gmail.com>
>
> I just gave this one a test.
>
> First of all you dropped 1:1 translation, see the attached fixup.

Sascha,

I know I dropped it, but have you tried empty/bool properties?
I had no luck with an empty/bool ranges, so I removed the 1:1
translation by empty property and wanted to take a look at bool
props first.

Could be that, I was just tired and made a mistake. Will investigate
as soon as Thomas aggrees to my next consolidation patch set.

> Then, since this code duplicates the majority of drivers/of/address.c,
> would it make sense to move it to the same file in barebox aswell?

In general, yes. If you copy the behavior of linux, we should not
try to merge individual base.c, address.c, whatever.c out of drivers/of
into differently named files.

Sebastian


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

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-05-19  8:07   ` Sebastian Hesselbarth
@ 2013-05-19 10:39     ` Sascha Hauer
  2013-05-19 10:49       ` Sebastian Hesselbarth
  0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2013-05-19 10:39 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox

On Sun, May 19, 2013 at 10:07:26AM +0200, Sebastian Hesselbarth wrote:
> On 05/19/2013 09:34 AM, Sascha Hauer wrote:
> >Hi Sebastian,
> >
> >On Mon, May 13, 2013 at 01:09:06AM +0200, Sebastian Hesselbarth wrote:
> >>This patch adds address translation for default bus types. It has been
> >>shamelessly ported from Linux device tree address translation with the
> >>following exceptions:
> >>- only default bus map and translate are supported
> >>- of_bus has not been ported
> >>- check for #size-cells>  0 has been removed
> >>
> >>Signed-off-by: Sebastian Hesselbarth<sebastian.hesselbarth@gmail.com>
> >
> >I just gave this one a test.
> >
> >First of all you dropped 1:1 translation, see the attached fixup.
> 
> Sascha,
> 
> I know I dropped it, but have you tried empty/bool properties?
> I had no luck with an empty/bool ranges, so I removed the 1:1
> translation by empty property and wanted to take a look at bool
> props first.

Probably because of_get_property doesn't seem to be 100% Linux
compatible. Our version returns NULL for empty properties whereas
the Linux version seems to return some valid pointer for zero length
properties.

I used of_find_property instead in my fixup, but maybe it's better
to change the behaviour of of_get_property instead.

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-05-19 10:39     ` Sascha Hauer
@ 2013-05-19 10:49       ` Sebastian Hesselbarth
  2013-05-19 15:20         ` Thomas Petazzoni
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Hesselbarth @ 2013-05-19 10:49 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Thomas Petazzoni, barebox

On 05/19/2013 12:39 PM, Sascha Hauer wrote:
> On Sun, May 19, 2013 at 10:07:26AM +0200, Sebastian Hesselbarth wrote:
>> On 05/19/2013 09:34 AM, Sascha Hauer wrote:
>>> First of all you dropped 1:1 translation, see the attached fixup.
>>
>> I know I dropped it, but have you tried empty/bool properties?
>> I had no luck with an empty/bool ranges, so I removed the 1:1
>> translation by empty property and wanted to take a look at bool
>> props first.
>
> Probably because of_get_property doesn't seem to be 100% Linux
> compatible. Our version returns NULL for empty properties whereas
> the Linux version seems to return some valid pointer for zero length
> properties.

I knew there was something ;)

> I used of_find_property instead in my fixup, but maybe it's better
> to change the behaviour of of_get_property instead.

Yes. With the next mvebu consolidation patches, we get rid of any
board specific code for Armada 370/XP, Dove, and Kirkwood. On top
of that, I then start with replacing static timer and uart
registration with DT probed devices. That is when I need ranges
translation.

I can rework DT ranges and bool properties, send a patch set before
mvebu DT, and you drop this one.

But I will not start working on it before Thomas finds some time to
test/comment on the (not yet) published consolidation patches.

Sebastian

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

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-05-19 10:49       ` Sebastian Hesselbarth
@ 2013-05-19 15:20         ` Thomas Petazzoni
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2013-05-19 15:20 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: barebox

Dear Sebastian Hesselbarth,

On Sun, 19 May 2013 12:49:31 +0200, Sebastian Hesselbarth wrote:

> But I will not start working on it before Thomas finds some time to
> test/comment on the (not yet) published consolidation patches.

I had a look at them, and it looks great to me. The only problem that I
could see from a quick review is that your patch "arm: mvebu: introduce
common console UART config" breaks functional bisectability because it
moves the UART used for earlyprintk from 0xd0 to 0xf1, even though the
SoC and board code is not yet migrated to use the common lowlevel code
that does the remapping at 0xf1. I'm personally not overly choked if
the functional bisectability is broken at this point, but maybe Sascha
will.

I believe you should simply post your patches on the list, there's no
need to get a prior ack from me. Maybe we can simply ask Sascha to wait
for your opinion on my patches, and my opinion on your patches before
applying them? I very much prefer to see patches being posted publicly
rather than having those 'private' reviews. Sascha, are you ok?

Thanks for your work Sebastian!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-05-19  7:34 ` Sascha Hauer
  2013-05-19  8:07   ` Sebastian Hesselbarth
@ 2013-06-11  9:33   ` Sebastian Hesselbarth
  2013-06-13  9:25     ` Sascha Hauer
  1 sibling, 1 reply; 14+ messages in thread
From: Sebastian Hesselbarth @ 2013-06-11  9:33 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Thomas Petazzoni, barebox

On 05/19/13 09:34, Sascha Hauer wrote:
> Hi Sebastian,
>
> On Mon, May 13, 2013 at 01:09:06AM +0200, Sebastian Hesselbarth wrote:
>> This patch adds address translation for default bus types. It has been
>> shamelessly ported from Linux device tree address translation with the
>> following exceptions:
>> - only default bus map and translate are supported
>> - of_bus has not been ported
>> - check for #size-cells > 0 has been removed
>>
>> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>
> I just gave this one a test.
>
> First of all you dropped 1:1 translation, see the attached fixup.
>
> Then, since this code duplicates the majority of drivers/of/address.c,
> would it make sense to move it to the same file in barebox aswell?

Sascha,

coming back to this I am wondering if a full sync of linux' drivers/of
with barebox' drivers/of should be done. IMHO at least for the core
stuff (base/address/fdt) it makes sense, of_* can come later if
required.

I started merging already, and from what I can see we should just remove
the spinlocks and OF_DYNAMIC stuff (but leave of_node_get/_put as stubs)

Sebastian

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

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-06-11  9:33   ` Sebastian Hesselbarth
@ 2013-06-13  9:25     ` Sascha Hauer
  2013-06-13  9:38       ` Sebastian Hesselbarth
  0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2013-06-13  9:25 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox

On Tue, Jun 11, 2013 at 11:33:06AM +0200, Sebastian Hesselbarth wrote:
> On 05/19/13 09:34, Sascha Hauer wrote:
> >Hi Sebastian,
> >
> >On Mon, May 13, 2013 at 01:09:06AM +0200, Sebastian Hesselbarth wrote:
> >>This patch adds address translation for default bus types. It has been
> >>shamelessly ported from Linux device tree address translation with the
> >>following exceptions:
> >>- only default bus map and translate are supported
> >>- of_bus has not been ported
> >>- check for #size-cells > 0 has been removed
> >>
> >>Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> >
> >I just gave this one a test.
> >
> >First of all you dropped 1:1 translation, see the attached fixup.
> >
> >Then, since this code duplicates the majority of drivers/of/address.c,
> >would it make sense to move it to the same file in barebox aswell?
> 
> Sascha,
> 
> coming back to this I am wondering if a full sync of linux' drivers/of
> with barebox' drivers/of should be done. IMHO at least for the core
> stuff (base/address/fdt) it makes sense, of_* can come later if
> required.
> 
> I started merging already, and from what I can see we should just remove
> the spinlocks and OF_DYNAMIC stuff (but leave of_node_get/_put as stubs)

Sounds like a plan. Functions existing both in barebox and Linux should
behave the same way. However, if Linux turns out to do something silly
or (for our usecase) too bloated, we shouldn't do the same just because
Linux does it.

I want to keep the Linux list usage in the devicetree, so they won't be
really in sync.

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-06-13  9:25     ` Sascha Hauer
@ 2013-06-13  9:38       ` Sebastian Hesselbarth
  2013-06-13 12:48         ` Sascha Hauer
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Hesselbarth @ 2013-06-13  9:38 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Thomas Petazzoni, barebox

On 06/13/13 11:25, Sascha Hauer wrote:
> On Tue, Jun 11, 2013 at 11:33:06AM +0200, Sebastian Hesselbarth wrote:
>> I started merging already, and from what I can see we should just remove
>> the spinlocks and OF_DYNAMIC stuff (but leave of_node_get/_put as stubs)
>
> Sounds like a plan. Functions existing both in barebox and Linux should
> behave the same way. However, if Linux turns out to do something silly
> or (for our usecase) too bloated, we shouldn't do the same just because
> Linux does it.
>
> I want to keep the Linux list usage in the devicetree, so they won't be
> really in sync.

Ok, I started converting and doing it in a clean way is kind of tricky.

First of all, allyesconfig doesn't build - so it is hard to find and
re-build all users of current of_* functions.

If you want to stick with list usage, it will end up with converting
instead of just move current functions out of the way, import Linux
OF, and switch users to that functions.

I will have a look at it, find users/abusers of current API and see
how much we can merge.

You also want to stick with of_set_* and friends within base.c or
move them out to some other source file where all set/modify functions
will sit in?

Sebastian


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

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-06-13  9:38       ` Sebastian Hesselbarth
@ 2013-06-13 12:48         ` Sascha Hauer
  2013-06-13 18:50           ` Sebastian Hesselbarth
  0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2013-06-13 12:48 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox

On Thu, Jun 13, 2013 at 11:38:19AM +0200, Sebastian Hesselbarth wrote:
> On 06/13/13 11:25, Sascha Hauer wrote:
> >On Tue, Jun 11, 2013 at 11:33:06AM +0200, Sebastian Hesselbarth wrote:
> >>I started merging already, and from what I can see we should just remove
> >>the spinlocks and OF_DYNAMIC stuff (but leave of_node_get/_put as stubs)
> >
> >Sounds like a plan. Functions existing both in barebox and Linux should
> >behave the same way. However, if Linux turns out to do something silly
> >or (for our usecase) too bloated, we shouldn't do the same just because
> >Linux does it.
> >
> >I want to keep the Linux list usage in the devicetree, so they won't be
> >really in sync.
> 
> Ok, I started converting and doing it in a clean way is kind of tricky.
> 
> First of all, allyesconfig doesn't build - so it is hard to find and
> re-build all users of current of_* functions.
> 
> If you want to stick with list usage, it will end up with converting
> instead of just move current functions out of the way, import Linux
> OF, and switch users to that functions.
> 
> I will have a look at it, find users/abusers of current API and see
> how much we can merge.
> 
> You also want to stick with of_set_* and friends within base.c or
> move them out to some other source file where all set/modify functions
> will sit in?

I'm fine with moving the set/modify kernel to another file, no problem.

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-06-13 12:48         ` Sascha Hauer
@ 2013-06-13 18:50           ` Sebastian Hesselbarth
  2013-06-17  7:47             ` Sascha Hauer
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Hesselbarth @ 2013-06-13 18:50 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Thomas Petazzoni, barebox

On 06/13/13 14:48, Sascha Hauer wrote:
> On Thu, Jun 13, 2013 at 11:38:19AM +0200, Sebastian Hesselbarth wrote:
>> On 06/13/13 11:25, Sascha Hauer wrote:
>>> Sounds like a plan. Functions existing both in barebox and Linux should
>>> behave the same way. However, if Linux turns out to do something silly
>>> or (for our usecase) too bloated, we shouldn't do the same just because
>>> Linux does it.

Sascha,

pushed a branch you can have a first look at to

git://github.com/shesselba/barebox-dove.git of-sync-v1

Started fixing some functions and merged of_find_node_by_something()
functions and corresponding helpers. Also converted some users to
the new helpers. I think it is a good point to send a first patch set.

Sebastian

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

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-06-13 18:50           ` Sebastian Hesselbarth
@ 2013-06-17  7:47             ` Sascha Hauer
  2013-06-17 10:23               ` Sebastian Hesselbarth
  0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2013-06-17  7:47 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox

On Thu, Jun 13, 2013 at 08:50:30PM +0200, Sebastian Hesselbarth wrote:
> On 06/13/13 14:48, Sascha Hauer wrote:
> >On Thu, Jun 13, 2013 at 11:38:19AM +0200, Sebastian Hesselbarth wrote:
> >>On 06/13/13 11:25, Sascha Hauer wrote:
> >>>Sounds like a plan. Functions existing both in barebox and Linux should
> >>>behave the same way. However, if Linux turns out to do something silly
> >>>or (for our usecase) too bloated, we shouldn't do the same just because
> >>>Linux does it.
> 
> Sascha,
> 
> pushed a branch you can have a first look at to
> 
> git://github.com/shesselba/barebox-dove.git of-sync-v1

I had a quick look at this branch. It has some really good stuff in it.
You should post it for a closer review if you consider it ready.

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-06-17  7:47             ` Sascha Hauer
@ 2013-06-17 10:23               ` Sebastian Hesselbarth
  2013-06-17 10:40                 ` Sascha Hauer
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Hesselbarth @ 2013-06-17 10:23 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Thomas Petazzoni, barebox

On 06/17/2013 09:47 AM, Sascha Hauer wrote:
> On Thu, Jun 13, 2013 at 08:50:30PM +0200, Sebastian Hesselbarth wrote:
>> On 06/13/13 14:48, Sascha Hauer wrote:
>>> On Thu, Jun 13, 2013 at 11:38:19AM +0200, Sebastian Hesselbarth wrote:
>>>> On 06/13/13 11:25, Sascha Hauer wrote:
>>>>> Sounds like a plan. Functions existing both in barebox and Linux should
>>>>> behave the same way. However, if Linux turns out to do something silly
>>>>> or (for our usecase) too bloated, we shouldn't do the same just because
>>>>> Linux does it.
>> pushed a branch you can have a first look at to
>>
>> git://github.com/shesselba/barebox-dove.git of-sync-v1
>
> I had a quick look at this branch. It has some really good stuff in it.
> You should post it for a closer review if you consider it ready.

Ok, I've had another round of patches in branch of-sync-part2-v1. I will
merge both and either send an RFC or merge in some clean-ups. I didn't
provide stubs for !CONFIG_OF at some places.

It is already kind of huge patch, so I prefer sending it before more
stuff gets in. Currently, it is more or less fully merged with Linux OF
API wrt base.c.

Next would be to move code that should have been in common/oftree.c in
the first place (of_add_initrd, of_print_nodes, ...), move out stuff to
of/device.c and of/address.c.

I haven't looked into barebox' driver/device backend but realized that
struct resource is attached to the device_node. Maybe it should also
move to some other struct (device_d) ?

Sebastian

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

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

* Re: [PATCH] of: add ranges address translation for default bus
  2013-06-17 10:23               ` Sebastian Hesselbarth
@ 2013-06-17 10:40                 ` Sascha Hauer
  0 siblings, 0 replies; 14+ messages in thread
From: Sascha Hauer @ 2013-06-17 10:40 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox

On Mon, Jun 17, 2013 at 12:23:41PM +0200, Sebastian Hesselbarth wrote:
> On 06/17/2013 09:47 AM, Sascha Hauer wrote:
> >On Thu, Jun 13, 2013 at 08:50:30PM +0200, Sebastian Hesselbarth wrote:
> >>On 06/13/13 14:48, Sascha Hauer wrote:
> >>>On Thu, Jun 13, 2013 at 11:38:19AM +0200, Sebastian Hesselbarth wrote:
> >>>>On 06/13/13 11:25, Sascha Hauer wrote:
> >>>>>Sounds like a plan. Functions existing both in barebox and Linux should
> >>>>>behave the same way. However, if Linux turns out to do something silly
> >>>>>or (for our usecase) too bloated, we shouldn't do the same just because
> >>>>>Linux does it.
> >>pushed a branch you can have a first look at to
> >>
> >>git://github.com/shesselba/barebox-dove.git of-sync-v1
> >
> >I had a quick look at this branch. It has some really good stuff in it.
> >You should post it for a closer review if you consider it ready.
> 
> Ok, I've had another round of patches in branch of-sync-part2-v1. I will
> merge both and either send an RFC or merge in some clean-ups. I didn't
> provide stubs for !CONFIG_OF at some places.
> 
> It is already kind of huge patch, so I prefer sending it before more
> stuff gets in. Currently, it is more or less fully merged with Linux OF
> API wrt base.c.
> 
> Next would be to move code that should have been in common/oftree.c in
> the first place (of_add_initrd, of_print_nodes, ...), move out stuff to
> of/device.c and of/address.c.
> 
> I haven't looked into barebox' driver/device backend but realized that
> struct resource is attached to the device_node. Maybe it should also
> move to some other struct (device_d) ?

It already is attached to struct device_d. It should be easy to drop the
reference in struct device_node. I don't know why struct device_node has
the resources in it anyway, probably this happened during development
and I never thought about it again.

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

end of thread, other threads:[~2013-06-17 10:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-12 23:09 [PATCH] of: add ranges address translation for default bus Sebastian Hesselbarth
2013-05-19  7:34 ` Sascha Hauer
2013-05-19  8:07   ` Sebastian Hesselbarth
2013-05-19 10:39     ` Sascha Hauer
2013-05-19 10:49       ` Sebastian Hesselbarth
2013-05-19 15:20         ` Thomas Petazzoni
2013-06-11  9:33   ` Sebastian Hesselbarth
2013-06-13  9:25     ` Sascha Hauer
2013-06-13  9:38       ` Sebastian Hesselbarth
2013-06-13 12:48         ` Sascha Hauer
2013-06-13 18:50           ` Sebastian Hesselbarth
2013-06-17  7:47             ` Sascha Hauer
2013-06-17 10:23               ` Sebastian Hesselbarth
2013-06-17 10:40                 ` Sascha Hauer

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