Re: [PATCHv3 0/7] gpio: extend basic_mmio_gpio for differentcontrollers

From: Anton Vorontsov
Date: Tue May 03 2011 - 17:52:32 EST


On Tue, May 03, 2011 at 03:13:20PM -0600, Grant Likely wrote:
> > struct gpio_mmio_generic {
> >    Âspinlock_t   Âlock;
> >
> > Â Â Â Â/* initialized by user */
> >    Âunsigned long  reg_data;
> >    Âunsigned long  reg_set;
> >    Âunsigned long  reg_clr;
> >    Âunsigned long  reg_dir;
> >
> >    Âvoid __iomem  Â*reg_base;

This assumes that all reg_* will be mapped with a single ioremap().
My solution (see below) doesn't have this issue.

> > void gpio_mmio_generic_setup(struct gpio_mmio_generic *gmg, int register_width);
> > int gpio_mmio_generic_add(struct gpio_mmio_generic *gmg);
> > void gpio_mmio_generic_remove(struct gpio_mmio_generic *gmg);

I'm not sure you need that complex API.

> > gpio_mmio_generic_setup() sets up the common callback ops in the
> > embedded gpio_chip, but the decisions it makes could be overridden by
> > the user before calling gpio_mmio_generic_add().
> >
> > I've not had time to prototype this yet, but I wanted to get it
> > written down and out onto the list for feedback since I probably won't
> > have any chance to get to it until after UDS. ÂBonus points to anyone
> > who wants to take the initiative to hack it together before I get to
> > it. ÂExtra bonus points to anyone who also converts some of the other
> > gpio controllers to use it. Â:-D
>
> And triple bonus points to anyone who thinks this is stupid and comes
> up with a better approach. :-)

This isn't stupid. And I started working on this, so what about
http://lkml.org/lkml/2011/4/19/401 ? This is pretty much the same
that you propose.

Thanks.

--
Anton Vorontsov
Email: cbouatmailru@xxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/