public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* RT and omap-gpio irqchip with DeviceTree
@ 2013-07-02 11:44 Torben Hohn
  2013-07-02 12:15 ` Javier Martinez Canillas
  0 siblings, 1 reply; 4+ messages in thread
From: Torben Hohn @ 2013-07-02 11:44 UTC (permalink / raw)
  To: tglx; +Cc: bigeasy, linux-omap, linux-gpio

[-- Attachment #1: Type: text/plain, Size: 3246 bytes --]


Hi..

I am running into Problems with a network adapter IRQ connected to an
omap-gpio pin.

omap-gpio expects gpio-request() to be called before i can use the pin.
But this is abstracted via the DeviceTree bindings.

I see 8d4c277e185c31359cf70573d8b0351fb7dd0dfe in mainline.
This one just puts a warning into the exact place, i am dealing with.
But i need to make this work, instead of bailing out.

I have this fix in place, instead:
---------------------------------------------------------------------------------------
commit 4ca17be8e7e24863cb98f440992fd89034aa34f5
Author: Torben Hohn <torbenh@linutronix.de>
Date:   Fri Jun 21 17:34:24 2013 +0200

    gpio omap: Fix for DT calling into gpio_irq_type without request_gpio()
    
    gpio_irq_type() requires that the GPIO is requested, do that.

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index f1fbedb2..57d956c 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -87,6 +87,8 @@ struct gpio_bank {
 #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
 #define GPIO_MOD_CTRL_BIT      BIT(0)
 
+static int omap_gpio_request(struct gpio_chip *chip, unsigned offset);
+
 static int irq_to_gpio(struct gpio_bank *bank, unsigned int gpio_irq)
 {
        return gpio_irq - bank->irq_base + bank->chip.base;
@@ -429,6 +431,9 @@ static int gpio_irq_type(struct irq_data *d, unsigned type)
        if (!gpio)
                gpio = irq_to_gpio(bank, d->irq);
 
+       if (!bank->mod_usage)
+               omap_gpio_request( &bank->chip, gpio );
+
        if (type & ~IRQ_TYPE_SENSE_MASK)
                return -EINVAL;
 

-----------------------------------------------------------------------------------------


But now with RT i am running into a Problem, because gpio_irq_type() is called 
under a raw_spinlock() But its calling pm_runtime_suspend() which carries a normal spinlock.


-----------------------------------------------------------------------------------------
/**
 *      irq_set_type - set the irq trigger type for an irq
 *      @irq:   irq number
 *      @type:  IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
 */     
int irq_set_irq_type(unsigned int irq, unsigned int type)
{
        unsigned long flags;
        struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
        int ret = 0;
        
        if (!desc)
                return -EINVAL;
        
        type &= IRQ_TYPE_SENSE_MASK;
        ret = __irq_set_trigger(desc, irq, type);
        irq_put_desc_busunlock(desc, flags);
        return ret;
}
-----------------------------------------------------------------------------------------

I think, i need a normal hook in the irq_chip, which "prepares" the irq, but i dont see one.


-- 
Mit freundlichen Grüßen
Torben Hohn

Linutronix GmbH

Standort: Bremen

Phone: +49 421 5650 2310 ; Fax.: +49 7556 919 886
mailto: torbenh@linutronix.de
Firmensitz / Registered Office: D-88690 Uhldingen, Auf dem Berg 3
Registergericht / Local District Court: Freiburg i. Br., HRB Nr. / Trade
register no.: 700 806;

Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-02 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-02 11:44 RT and omap-gpio irqchip with DeviceTree Torben Hohn
2013-07-02 12:15 ` Javier Martinez Canillas
2013-07-02 14:31   ` Torben Hohn
2013-07-02 15:51     ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox