[PATCH 2/2] Documentation: gpio: Update description for X-Gene standby GPIO controller DTS binding

Arnd Bergmann arnd at arndb.de
Fri Sep 11 07:47:28 PDT 2015


On Friday 11 September 2015 21:23:31 Y Vo wrote:
> >> /* Board-specific: exclude GPIO_DS8 to leave it as GPIO */
> >> &sbgpio {
> >>        interrupts =    <0x0 0x29 0x1>,         /* GPIO_DS9 */
> >>                        <0x0 0x2a 0x1>,         /* GPIO_DS10 */
> >>                        <0x0 0x2b 0x1>,         /* GPIO_DS11 */
> >>                        <0x0 0x2c 0x1>,         /* GPIO_DS12 */
> >>                        <0x0 0x2d 0x1>;         /* GPIO_DS13 */
> >> }
> >
> > This would be a very unusual binding, because that requires the driver
> > to know the contents of the properties in advance and the driver
> > cannot derive the function of an irq from the position in the array.
> >
> > Please come up with another approach that is more like other drivers
> > do this and that makes it possible to reuse the driver if the
> > interrupt numbers change.
> The GPIO standby doesn't support interrupt controller itself, it only
> wires the GPIO line to the external IRQ of GIC. So it is not similar
> to other driver. Each GPIO is fixed to GIC IRQ index, and never
> change.

That is not relevant here, what matters is just that each IRQ still
has a very specific function, which is basically what every driver
does.

> Is that possible if we change to this approach:
> - Keep all GPIO as GPIO mode by default.
> - If anyone want to use them as interrupt, they must add the interrupt
> node to DT specific-board below:
> 
> Example to configure GPIO_DS11, 12, 13 as external irq:
> 
> &sbgpio {
>         interrupts = <0x0 0x2b 0x1>,         /* GPIO_DS11 */
>                         <0x0 0x2c 0x1>,         /* GPIO_DS12 */
>                         <0x0 0x2d 0x1>;         /* GPIO_DS13 */

That is exactly the same as you have in your patch. You should
always list all interrupts that the gpio controller is wired
to, whether they are used or not.

Ideally, the driver just decides at runtime how to wire that
mux, based on how the gpio is configured by the client driver.
If the client asks for an interrupt (with gpio_to_irq) and is
it is configured as an input, then you connect it to the GIC,
otherwise you leave it to be handled by the gpio chip itself.
Any reason you can't do that?

	Arnd



More information about the linux-arm-kernel mailing list