All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>,
	Rob Herring <robherring2@gmail.com>,
	Deepak Saxena <dsaxena@linaro.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Scott Wood <scottwood@freescale.com>,
	Tony Lindgren <tony@atomide.com>, Kevin Hilman <khilman@ti.com>,
	Matt Porter <mporter@ti.com>,
	Koen Kooi <koen@dominion.thruhere.net>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Felipe Balbi <balbi@ti.com>, Russ Dill <Russ.Dill@ti.com>,
	linux-omap@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Subject: Re: [RFC] Device Tree Overlays Proposal (Was Re: capebus moving omap_devices to mach-omap2)
Date: Tue, 13 Nov 2012 12:05:05 +1100	[thread overview]
Message-ID: <20121113010505.GR4696@truffula.fritz.box> (raw)
In-Reply-To: <CACxGe6vQ50aS0Fe7QvTHKfV=EDpsZoLC7SOxXLGc0pkMvyk5DQ@mail.gmail.com>

On Fri, Nov 09, 2012 at 09:42:37PM +0000, Grant Likely wrote:
> On Fri, Nov 9, 2012 at 2:26 AM, David Gibson
> <david@gibson.dropbear.id.au> wrote:
> > (3) Resolving phandle references from the subtree to the main tree.
> >
> > So, I think this can actually be avoided, at least in cases where what
> > physical connections are available to the expansion module is well
> > defined.  The main causes to have external references are interrupts
> > and gpios.  Interrupts we handle by defining an interrupt specifier
> > space for the interrupts available on the expansion
> > socket/connector/bus/whatever.  In the master tree we then have
> > something like:
> >
> > ...
> >         expansion-socket@XXXX {
> >                 expansion-id = "SlotA";
> >                 interrupt-map = < /* map expansion irq specs to
> >                                      board interrupt controllers */ >;
> >                 interrupt-map-mask = < ... >;
> >                 ranges = < /* map expansion local addresses to global
> >                               mmio */ >;
> >         };
> >
> > The subtree for the expansion module gets attached as a subnode of
> > this one.  It doesn't use explicit interrupt-parents but instead just
> > uses the expansion local irq specifiers, letting the parent be the
> > default which will bubble up to this socket node where the
> > interrupt-map will send them to the right places.
> >
> > I don't recall the gpio bindings off hand, but as I recall we based
> > them off the irq tree bindings so we ought to be able to do the same
> > thing for them.
> >
> > Likewise, if there are several interchangeable expansion sockets that
> > have some address bits hard wired to distinguish them, we can just use
> > socket local mmio addresses within the subtree and the ranges property
> > here will sort that out.
> 
> If I'm reading correctly, the suggestion is that everything be grafted
> below a single node and all connections route through that node using
> mapping. Correct?
> 
> For interrupts that works today
> For gpios, it isn't currently supported, but we could do it.
> For SPI it would mean that the new spi devices would not appear below
> the actual spi bus they are attached to
> For I2C, MDIO, and one wire, same problem.
> For memory mapped devices, the expansion node would need to a ranges
> for all the windows that map through it, and it assumes only one
> memory mapped bus (or at least it prefers only one memory mapped bus.
> If there were more than one then the expansion node placement wouldn't
> have a natural place to sit)
> 
> The problem is that this is not like a PCI bus where there is only one
> kind of interface. It is a whole bunch of interfaces that happen to be
> grouped together loosely (as an expansion connector in the beaglebone
> case, but expansion isn't the only problem that I'm hearing about).
> 
> So, with a group of i2c, spi, memory mapped and other devices than are
> all plugged in together, how does that look? They really should not
> sit on the same level. An spi device cannot be a peer of an i2c device
> for instance, the address mapping is entirely different. The kernel
> really wants i2c devices to be a child of the actual i2c bus which may
> already have an i2c device or too on the main board. Does the
> expansion node need to have some kind of redirect node for each of the
> busses where the children of it need to create devices as children of
> the master bus?
> 
> To me that seems to get really complex in a hurry. More complex than
> the overlay approach.

Ah, yes, I see.  Yeah, that's a genuine showstopper for my original
proposal.  Ok, let me offer a couple of counter-proposals:

1) bus-ranges

The notion of bus-reg and bus-ranges properties is something I've
toyed with before for other reasons, as a way of augmenting the
"normal" DT tree structure with interrupt-tree like DAG sections.
bus-reg and bus-ranges would act like the normal reg and ranges
properties except that each entry includes a phandle explicitly giving
the parent bus.  In that case a suitable 'bus-ranges' in the socket
node would resurrect my graft proposal.

I'm not particularly sold on this idea, but I mention it because it
has applications other than this one.  In particular it would mean we
could avoid having two different nodes for a device which is mostly
accessed via MMIO but also has a few sideband registers controlled by
i2c (or whatever).

2) graft bundle

The base tree has something like this:

	...
	i2c@XXX {
		...
		cape-socket {
			compatible = "vendor,cape-socket";
			id = "Socket-A";
			piece-id = "i2c";
			ranges = < ... >;
		};
	};
	...
	spi@YYY {
		...
		cape-socket {
			compatible = "vendor,cape-socket";
			id = "Socket-A";
			piece-id = "spi";
			ranges = < ... >;
		};
	};
	...
	cape-socket {
		compatible = "vendor,cape-socket";
		id = "Socket-A";
		piece-id = "misc";
		interrupt-map = < ... >;
		interrupt-map-mask = < ... >;
		gpio-map = < ... >;
		gpio-map-mask = < ... >;
	};

Then instead of grafting a single subtree for the socket, we install a
"bundle" of subtrees, one each for each of the pieces within the
socket.  That bundle could either be an actual set of multiple fdts,
or they could be placed into one fdt with a dummy root node, something like:
	/ {
		plugin-bundle;
		compatible = "vendor,cape-plugin";
		version = ...;
		i2c-piece = {
			piece-id = "i2c";
			...
		};
		misc-piece = {
			piece-id = "misc";
			...
		};
	};
That does have the additional advantage of letting us easily expand
the metadata in the future by adding more properties to the dummy root
node.

It's a bit more complex than the overlay proposal, but I think it's
safer - because the base tree clearly defines where it can be
extended.  Plus it has the big advantage that it's no longer dependent
on the exact node paths in the base tree, the matching for each
component is done by the piece-id or other metadata.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org>,
	Matt Porter <mporter-l0cyMroinI0@public.gmane.org>,
	Koen Kooi
	<koen-QLwJDigV5abLmq1fohREcCpxlwaOVQ5f@public.gmane.org>,
	Pantelis Antoniou
	<panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>,
	linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
	Deepak Saxena <dsaxena-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Scott Wood <scottwood-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	Russ Dill <Russ.Dill-l0cyMroinI0@public.gmane.org>,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [RFC] Device Tree Overlays Proposal (Was Re: capebus moving omap_devices to mach-omap2)
Date: Tue, 13 Nov 2012 12:05:05 +1100	[thread overview]
Message-ID: <20121113010505.GR4696@truffula.fritz.box> (raw)
In-Reply-To: <CACxGe6vQ50aS0Fe7QvTHKfV=EDpsZoLC7SOxXLGc0pkMvyk5DQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, Nov 09, 2012 at 09:42:37PM +0000, Grant Likely wrote:
> On Fri, Nov 9, 2012 at 2:26 AM, David Gibson
> <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote:
> > (3) Resolving phandle references from the subtree to the main tree.
> >
> > So, I think this can actually be avoided, at least in cases where what
> > physical connections are available to the expansion module is well
> > defined.  The main causes to have external references are interrupts
> > and gpios.  Interrupts we handle by defining an interrupt specifier
> > space for the interrupts available on the expansion
> > socket/connector/bus/whatever.  In the master tree we then have
> > something like:
> >
> > ...
> >         expansion-socket@XXXX {
> >                 expansion-id = "SlotA";
> >                 interrupt-map = < /* map expansion irq specs to
> >                                      board interrupt controllers */ >;
> >                 interrupt-map-mask = < ... >;
> >                 ranges = < /* map expansion local addresses to global
> >                               mmio */ >;
> >         };
> >
> > The subtree for the expansion module gets attached as a subnode of
> > this one.  It doesn't use explicit interrupt-parents but instead just
> > uses the expansion local irq specifiers, letting the parent be the
> > default which will bubble up to this socket node where the
> > interrupt-map will send them to the right places.
> >
> > I don't recall the gpio bindings off hand, but as I recall we based
> > them off the irq tree bindings so we ought to be able to do the same
> > thing for them.
> >
> > Likewise, if there are several interchangeable expansion sockets that
> > have some address bits hard wired to distinguish them, we can just use
> > socket local mmio addresses within the subtree and the ranges property
> > here will sort that out.
> 
> If I'm reading correctly, the suggestion is that everything be grafted
> below a single node and all connections route through that node using
> mapping. Correct?
> 
> For interrupts that works today
> For gpios, it isn't currently supported, but we could do it.
> For SPI it would mean that the new spi devices would not appear below
> the actual spi bus they are attached to
> For I2C, MDIO, and one wire, same problem.
> For memory mapped devices, the expansion node would need to a ranges
> for all the windows that map through it, and it assumes only one
> memory mapped bus (or at least it prefers only one memory mapped bus.
> If there were more than one then the expansion node placement wouldn't
> have a natural place to sit)
> 
> The problem is that this is not like a PCI bus where there is only one
> kind of interface. It is a whole bunch of interfaces that happen to be
> grouped together loosely (as an expansion connector in the beaglebone
> case, but expansion isn't the only problem that I'm hearing about).
> 
> So, with a group of i2c, spi, memory mapped and other devices than are
> all plugged in together, how does that look? They really should not
> sit on the same level. An spi device cannot be a peer of an i2c device
> for instance, the address mapping is entirely different. The kernel
> really wants i2c devices to be a child of the actual i2c bus which may
> already have an i2c device or too on the main board. Does the
> expansion node need to have some kind of redirect node for each of the
> busses where the children of it need to create devices as children of
> the master bus?
> 
> To me that seems to get really complex in a hurry. More complex than
> the overlay approach.

Ah, yes, I see.  Yeah, that's a genuine showstopper for my original
proposal.  Ok, let me offer a couple of counter-proposals:

1) bus-ranges

The notion of bus-reg and bus-ranges properties is something I've
toyed with before for other reasons, as a way of augmenting the
"normal" DT tree structure with interrupt-tree like DAG sections.
bus-reg and bus-ranges would act like the normal reg and ranges
properties except that each entry includes a phandle explicitly giving
the parent bus.  In that case a suitable 'bus-ranges' in the socket
node would resurrect my graft proposal.

I'm not particularly sold on this idea, but I mention it because it
has applications other than this one.  In particular it would mean we
could avoid having two different nodes for a device which is mostly
accessed via MMIO but also has a few sideband registers controlled by
i2c (or whatever).

2) graft bundle

The base tree has something like this:

	...
	i2c@XXX {
		...
		cape-socket {
			compatible = "vendor,cape-socket";
			id = "Socket-A";
			piece-id = "i2c";
			ranges = < ... >;
		};
	};
	...
	spi@YYY {
		...
		cape-socket {
			compatible = "vendor,cape-socket";
			id = "Socket-A";
			piece-id = "spi";
			ranges = < ... >;
		};
	};
	...
	cape-socket {
		compatible = "vendor,cape-socket";
		id = "Socket-A";
		piece-id = "misc";
		interrupt-map = < ... >;
		interrupt-map-mask = < ... >;
		gpio-map = < ... >;
		gpio-map-mask = < ... >;
	};

Then instead of grafting a single subtree for the socket, we install a
"bundle" of subtrees, one each for each of the pieces within the
socket.  That bundle could either be an actual set of multiple fdts,
or they could be placed into one fdt with a dummy root node, something like:
	/ {
		plugin-bundle;
		compatible = "vendor,cape-plugin";
		version = ...;
		i2c-piece = {
			piece-id = "i2c";
			...
		};
		misc-piece = {
			piece-id = "misc";
			...
		};
	};
That does have the additional advantage of letting us easily expand
the metadata in the future by adding more properties to the dummy root
node.

It's a bit more complex than the overlay proposal, but I think it's
safer - because the base tree clearly defines where it can be
extended.  Plus it has the big advantage that it's no longer dependent
on the exact node paths in the base tree, the matching for each
component is done by the piece-id or other metadata.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2012-11-13  1:06 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05 20:40 [RFC] Device Tree Overlays Proposal (Was Re: capebus moving omap_devices to mach-omap2) Grant Likely
2012-11-05 21:40 ` Tabi Timur-B04825
2012-11-05 21:40   ` Tabi Timur-B04825
2012-11-05 23:22   ` Tony Lindgren
2012-11-05 23:22     ` Tony Lindgren
2012-11-09 12:06     ` Grant Likely
2012-11-09 12:06       ` Grant Likely
2012-11-06  0:07   ` Grant Likely
2012-11-06  0:07     ` Grant Likely
2012-11-06 10:31   ` Pantelis Antoniou
2012-11-06 10:31     ` Pantelis Antoniou
2012-11-07 22:35   ` Ryan Mallon
2012-11-07 22:35     ` Ryan Mallon
2012-11-08 13:28     ` Koen Kooi
2012-11-08 13:28       ` Koen Kooi
2012-11-08 14:09       ` Timur Tabi
2012-11-08 14:09         ` Timur Tabi
2012-11-08 17:00       ` Mitch Bradley
2012-11-08 17:00         ` Mitch Bradley
2012-11-06 10:30 ` Pantelis Antoniou
2012-11-06 11:14   ` Grant Likely
2012-11-06 18:35     ` Tony Lindgren
2012-11-06 19:29       ` Russ Dill
2012-11-06 19:41         ` Pantelis Antoniou
2012-11-06 19:41           ` Pantelis Antoniou
2012-11-06 22:17           ` Stephen Warren
2012-11-06 22:17             ` Stephen Warren
2012-11-06 19:34     ` Pantelis Antoniou
2012-11-06 20:45       ` Grant Likely
2012-11-06 20:50         ` Grant Likely
2012-11-07  8:06         ` Pantelis Antoniou
2012-11-07 15:33           ` Alan Tull
2012-11-07 15:33             ` Alan Tull
2012-11-09 17:03           ` Grant Likely
2012-11-07  8:13         ` Pantelis Antoniou
2012-11-07 10:19           ` Benoit Cousson
2012-11-07 10:19             ` Benoit Cousson
2012-11-07 11:02             ` Pantelis Antoniou
2012-11-07 11:02               ` Pantelis Antoniou
2012-11-07 11:12               ` Benoit Cousson
2012-11-07 11:12                 ` Benoit Cousson
2012-11-07 11:23                 ` Pantelis Antoniou
2012-11-07 11:23                   ` Pantelis Antoniou
2012-11-09 20:33               ` Grant Likely
2012-11-12 11:34                 ` Pantelis Antoniou
2012-11-12 13:01                   ` Grant Likely
2012-11-07 17:25             ` Stephen Warren
2012-11-07 22:10               ` Pantelis Antoniou
2012-11-07 22:10                 ` Pantelis Antoniou
2012-11-08 10:36               ` Cousson, Benoit
2012-11-08 10:36                 ` Cousson, Benoit
2012-11-09  5:32   ` Joel A Fernandes
2012-11-09 14:29     ` David Gibson
2012-11-10  3:15       ` Joel A Fernandes
2012-11-09 21:22     ` Grant Likely
2012-11-12 11:47       ` Pantelis Antoniou
2012-11-12 11:47         ` Pantelis Antoniou
2012-11-13  3:59       ` Joel A Fernandes
2012-11-09 22:59     ` Stephen Warren
     [not found]   ` <-4237940489086529028@unknownmsgid>
     [not found]     ` <559B8433-67C3-4A1A-A5D6-859907655176@antoniou-consulting.com>
2012-11-10  3:36       ` Joel A Fernandes
2012-11-10  3:36         ` Joel A Fernandes
2012-11-12 12:48         ` Pantelis Antoniou
2012-11-13  2:28         ` David Gibson
2012-11-06 22:37 ` Stephen Warren
2012-11-06 22:37   ` Stephen Warren
2012-11-07  0:54   ` Mitch Bradley
2012-11-07  0:54     ` Mitch Bradley
2012-11-09 17:02     ` Grant Likely
2012-11-12 11:29       ` Pantelis Antoniou
2012-11-07  8:47   ` Pantelis Antoniou
2012-11-07 17:18     ` Stephen Warren
2012-11-07 22:08       ` Pantelis Antoniou
2012-11-07 22:08         ` Pantelis Antoniou
2012-11-09 16:28   ` Grant Likely
2012-11-09 23:23     ` Stephen Warren
2012-11-09 23:40       ` Grant Likely
2012-11-12 10:53         ` Koen Kooi
2012-11-12 12:10       ` Pantelis Antoniou
2012-11-12 12:10         ` Pantelis Antoniou
2012-11-12 16:52         ` Stephen Warren
2012-11-13  7:25           ` David Gibson
2012-11-13  8:09             ` Pantelis Antoniou
2012-11-13  8:09               ` Pantelis Antoniou
2012-11-13 12:24               ` Grant Likely
2012-11-13 13:38                 ` Pantelis Antoniou
2012-11-13 13:38                   ` Pantelis Antoniou
2012-11-15  4:57                   ` David Gibson
2012-11-13 17:10               ` Stephen Warren
2012-11-13 23:30               ` David Gibson
2012-11-13 23:30                 ` David Gibson
2012-11-14  0:00                 ` Pantelis Antoniou
2012-11-13 16:57             ` Stephen Warren
2012-11-13 18:10               ` Mitch Bradley
2012-11-13 18:10                 ` Mitch Bradley
2012-11-13 18:29                 ` Stephen Warren
2012-11-13 18:29                   ` Stephen Warren
2012-11-13 19:09                   ` Mitch Bradley
2012-11-13 19:11                     ` Pantelis Antoniou
2012-11-17 22:27       ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-20 17:09         ` Grant Likely
2012-11-11 20:47     ` Rob Landley
2012-11-12 12:50       ` Pantelis Antoniou
2012-11-12 16:54         ` Stephen Warren
2012-11-12 16:54           ` Stephen Warren
2012-11-12 11:23     ` Pantelis Antoniou
2012-11-12 16:49       ` Stephen Warren
2012-11-12 17:00         ` Pantelis Antoniou
2012-11-12 17:10           ` Stephen Warren
2012-11-12 17:19             ` Pantelis Antoniou
2012-11-12 17:29               ` Stephen Warren
2012-11-12 17:38                 ` Pantelis Antoniou
2012-11-12 20:16       ` Russ Dill
2012-11-12 16:45     ` Stephen Warren
2012-11-09  2:26 ` David Gibson
2012-11-09 15:40   ` Pantelis Antoniou
2012-11-13  0:03     ` David Gibson
2012-11-13  0:03       ` David Gibson
2012-11-09 21:08   ` Grant Likely
2012-11-13  0:05     ` David Gibson
2012-11-13  0:05       ` David Gibson
2012-11-09 21:42   ` Grant Likely
2012-11-13  1:05     ` David Gibson [this message]
2012-11-13  1:05       ` David Gibson
2012-11-13  5:22       ` Stephen Warren
2012-11-13  6:54         ` David Gibson
2012-11-13  6:54           ` David Gibson
2012-11-09 22:57   ` Stephen Warren
2012-11-09 23:27     ` Grant Likely
2012-11-12 12:05     ` Pantelis Antoniou
2012-11-09 23:14   ` Stephen Warren
2012-11-09 23:14     ` Stephen Warren
2012-11-09 23:06 ` Stephen Warren
2012-11-09 23:32   ` Grant Likely
2012-11-12 11:03 ` Koen Kooi
2012-11-12 11:03   ` Koen Kooi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121113010505.GR4696@truffula.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=Russ.Dill@ti.com \
    --cc=balbi@ti.com \
    --cc=benh@kernel.crashing.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=dsaxena@linaro.org \
    --cc=grant.likely@secretlab.ca \
    --cc=khilman@ti.com \
    --cc=koen@dominion.thruhere.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mporter@ti.com \
    --cc=panto@antoniou-consulting.com \
    --cc=robherring2@gmail.com \
    --cc=scottwood@freescale.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.