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 <torb...@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: torb...@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: signature.asc
Description: Digital signature

Reply via email to