public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Torben Hohn <torbenh@linutronix.de>
To: tglx@linutronix.de
Cc: bigeasy@linutronix.de, linux-omap@vger.kernel.org,
	linux-gpio@vger.kernel.org
Subject: RT and omap-gpio irqchip with DeviceTree
Date: Tue, 2 Jul 2013 13:44:53 +0200	[thread overview]
Message-ID: <20130702114452.GA13763@localhost.localdomain> (raw)

[-- 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 --]

             reply	other threads:[~2013-07-02 11:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 11:44 Torben Hohn [this message]
2013-07-02 12:15 ` RT and omap-gpio irqchip with DeviceTree Javier Martinez Canillas
2013-07-02 14:31   ` Torben Hohn
2013-07-02 15:51     ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130702114452.GA13763@localhost.localdomain \
    --to=torbenh@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox