[PATCH] of_mmc_spi: add card detect irq support

Grant Likely grant.likely at secretlab.ca
Tue Aug 31 03:46:17 EST 2010


On Mon, Aug 30, 2010 at 10:04 AM, Esben Haabendal
<esbenhaabendal at gmail.com> wrote:
> On Mon, Aug 30, 2010 at 3:29 PM, Anton Vorontsov <cbouatmailru at gmail.com> wrote:
>>> @@ -121,8 +136,14 @@ struct mmc_spi_platform_data
>>> *mmc_spi_get_pdata(struct spi_device *spi)
>>>         if (gpio_is_valid(oms->gpios[WP_GPIO]))
>>>                 oms->pdata.get_ro = of_mmc_spi_get_ro;
>>>
>>> -       /* We don't support interrupts yet, let's poll. */
>>> -       oms->pdata.caps |= MMC_CAP_NEEDS_POLL;
>>> +       oms->detect_irq = irq_of_parse_and_map(np, 0);
>>> +       if (oms->detect_irq != NO_IRQ) {
>>
>> I'd write "if (oms->detect_irq)", which is a bit more natural
>> (and still correct, 0 is the only invalid VIRQ number).
>
> Most other architectures has NO_IRQ defined to -1, so I will stick
> with the NO_IRQ comparsion.

Not true.  NO_IRQ is only defined as -1 on ARM, microblaze, mn10300
and parisc, and I've got a patch pending to remove microblaze from
that list.  ARM just happens to be a really big user.

$ git grep NO_IRQ arch/*/include  (I've trimmed the irrelevant matches)
arch/arm/include/asm/irq.h:#ifndef NO_IRQ
arch/arm/include/asm/irq.h:#define NO_IRQ       ((unsigned int)(-1))
arch/microblaze/include/asm/irq.h:#define NO_IRQ (-1)
arch/mn10300/include/asm/irq.h:#define NO_IRQ           INT_MAX
arch/parisc/include/asm/irq.h:#define NO_IRQ            (-1)
arch/powerpc/include/asm/irq.h:#define NO_IRQ                   (0)

> Hopefully, arm users will soon enjoy this driver/wrapper soon also.

My hope is that even on ARM when the device tree is used I'll be able
eliminate IRQs mapped to 0 (but I need to do a lot more research on
how best to do that though).  Are you actually using this on ARM?

I'm okay with you keeping the NO_IRQ test for the short term though.

g.


More information about the Linuxppc-dev mailing list