[RFC PATCH] basic-mmio-gpio: add support for device tree
Scott Wood
scottwood at freescale.com
Thu Jul 28 08:09:42 EST 2011
On Wed, 27 Jul 2011 21:16:54 +0100
Jamie Iles <jamie at jamieiles.com> wrote:
> On Wed, Jul 27, 2011 at 03:05:02PM -0500, Scott Wood wrote:
> > On Wed, 27 Jul 2011 15:24:16 +0100
> > Jamie Iles <jamie at jamieiles.com> wrote:
> >
> > > This patch adds support for basic-mmio-gpio controllers to be
> > > instantiated from the device tree. It's RFC at the moment because I'm
> > > really not happy with the way that the registers are described (zero
> > > size meaning the register is not present). In a previous discussion
> > > (https://lkml.org/lkml/2011/5/4/117) Grant suggested using a reg
> > > property to describe the whole controller then arrays of reg-offset
> > > values for multiple banks e.g:
> > >
> > > gpio at fedc0000 {
> > > compatible = "acme,super-soc-gpio", "mmio-gpio";
> > > reg = <0xfedc0000 0x100>;
> > > gpio-controller;
> > > #gpio-cells = <1>;
> > >
> > > mmgpio-regoffset-data = <0x00 0x04 0x08 0x0c>;
> > > mmgpio-regoffset-dir = <0x20 0x24 0x28 0x2c>;
> > > mmgpio-regoffset-set = <0x10 0x14 0x18 0x1c>;
> > > mmgpio-regoffset-clr = <0x30 0x34 0x38 0x3c>;
> > > };
> > >
> > > but this loses the hierarchy as Anton pointed out, so I've tried this
> > > approach instead.
> >
> > How does it lose hierarchy versus an unnamed, ordered list?
>
> This doesn't allow you to represent the banks as child nodes.
Ah, I missed the multiple-bank aspect -- was thinking more of named versus
unnamed.
> > Consider the likelihood of new types of reg being added to try to jam new
> > controllers into this "generic" model.
>
> Yes, that's what I don't like about the way I've done it. We could have
> something like:
>
> gpio at 1000 {
> compatible = "acme,super-soc-gpio", "mmio-gpio";
> reg = <0x1000 0x0100>;
>
> banka: gpio at 1000 {
> compatible = "mmio-gpio-bank";
> regoffset-data = <0x00>;
> regoffset-dir = <0x04>;
> ...
> };
>
> bankb: gpio at 1020 {
> compatible = "mmio-gpio-bank";
> regoffset-data = <0x20>;
> regoffset-dir = <0x24>;
> ...
> };
> };
>
> instead perhaps?
Looks reasonable.
-Scott
More information about the devicetree-discuss
mailing list