[PATCH] PINCTRL: SiRF: add CSR SiRFprimaII GPIO driver depending on pinmux APIs

Barry Song 21cnbao at gmail.com
Tue Jun 12 08:03:44 EDT 2012


2012/6/12 Linus Walleij <linus.walleij at linaro.org>
>
> On Tue, May 22, 2012 at 9:14 AM, Barry Song <Barry.Song at csr.com> wrote:
>
> > +static inline struct sirfsoc_gpio_bank *sirfsoc_irq_to_bank(unsigned
> > int irq)
> > +{
> > +       return &sgpio_bank[(irq - SIRFSOC_GPIO_IRQ_START) /
> > SIRFSOC_GPIO_BANK_SIZE];
> > +}
> > +
> > +static inline int sirfsoc_gpio_to_irq(struct gpio_chip *chip, unsigned
> > offset)
> > +{
> > +       return SIRFSOC_GPIO_IRQ_START + (chip->base + offset);
> > +}
> > +
> > +static inline int sirfsoc_irq_to_offset(unsigned int irq)
> > +{
> > +       return (irq - SIRFSOC_GPIO_IRQ_START) % SIRFSOC_GPIO_BANK_SIZE;
> > +}
> > +
> > +static inline int sirfsoc_gpio_to_offset(unsigned int gpio)
> > +{
> > +       return gpio % SIRFSOC_GPIO_BANK_SIZE;
> > +}
>
> Some of this is doing the work of irqdomain, which is supposed to map a
> certain
> local IRQ number to the global space (I guess that is what is denoted by
> SIRFSOC_GPIO_IRQ_START.)
>
> Can you please look into using irqdomain for this?

yes. sure. Thanks!

>
> There are several examples in drivers/gpio/* and drivers/pinctrl/*
> for example:
>
> drivers/gpio/gpio-pxa.c
> drivers/pinctrl/pinctrl-nomadik.c
>
>
> Yours,
> Linus Walleij

-barry



More information about the linux-arm-kernel mailing list