From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: David Brownell <dbrownell@users.sourceforge.net>,
linux-omap@vger.kernel.org
Subject: [PATCH 03/11] ARM: OMAP: gpios implement new to_irq()
Date: Fri, 28 Nov 2008 17:10:04 -0800 [thread overview]
Message-ID: <20081129011004.12337.33627.stgit@localhost> (raw)
In-Reply-To: <20081129010728.12337.8217.stgit@localhost>
From: David Brownell <dbrownell@users.sourceforge.net>
Make OMAP use the new __gpio_to_irq() hook, to make it easier to
support IRQs coming in from off-chip gpio controllers like the
TWL4030/TPS65930 chip used on OMAP3 boads like Beagleboard.org and
the Gumstix Overo.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/plat-omap/gpio.c | 9 +++++++++
arch/arm/plat-omap/include/mach/gpio.h | 16 ++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 8ff225b..e07ab23 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1285,6 +1285,14 @@ static void gpio_set(struct gpio_chip *chip, unsigned offset, int value)
spin_unlock_irqrestore(&bank->lock, flags);
}
+static int gpio_2irq(struct gpio_chip *chip, unsigned offset)
+{
+ struct gpio_bank *bank;
+
+ bank = container_of(chip, struct gpio_bank, chip);
+ return bank->virtual_irq_start + offset;
+}
+
/*---------------------------------------------------------------------*/
static int initialized;
@@ -1480,6 +1488,7 @@ static int __init _omap_gpio_init(void)
bank->chip.get = gpio_get;
bank->chip.direction_output = gpio_output;
bank->chip.set = gpio_set;
+ bank->chip.to_irq = gpio_2irq;
if (bank_is_mpuio(bank)) {
bank->chip.label = "mpuio";
#ifdef CONFIG_ARCH_OMAP16XX
diff --git a/arch/arm/plat-omap/include/mach/gpio.h b/arch/arm/plat-omap/include/mach/gpio.h
index 98e9008..5f996f3 100644
--- a/arch/arm/plat-omap/include/mach/gpio.h
+++ b/arch/arm/plat-omap/include/mach/gpio.h
@@ -109,16 +109,24 @@ static inline int gpio_cansleep(unsigned gpio)
static inline int gpio_to_irq(unsigned gpio)
{
- if (gpio < (OMAP_MAX_GPIO_LINES + 16))
- return OMAP_GPIO_IRQ(gpio);
- return -EINVAL;
+ return __gpio_to_irq(gpio);
}
static inline int irq_to_gpio(unsigned irq)
{
+ int tmp;
+
+ /* omap1 SOC mpuio */
if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16)))
return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES;
- return irq - IH_GPIO_BASE;
+
+ /* SOC gpio */
+ tmp = irq - IH_GPIO_BASE;
+ if (tmp < OMAP_MAX_GPIO_LINES)
+ return tmp;
+
+ /* we don't supply reverse mappings for non-SOC gpios */
+ return -EIO;
}
#endif
next prev parent reply other threads:[~2008-11-29 1:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-29 1:09 [PATCH 00/11] Omap gpio updates for review for 2.6.29 merge window Tony Lindgren
2008-11-29 1:09 ` [PATCH 01/11] ARM: OMAP: Enable GPIO debounce clock only when debounce is enabled v3 Tony Lindgren
2008-11-29 1:09 ` [PATCH 02/11] ARM: OMAP: Extend gpio label column width in omap_gpio debugfs file Tony Lindgren
2008-11-29 1:10 ` Tony Lindgren [this message]
2008-11-29 1:10 ` [PATCH 04/11] ARM: OMAP: switch to standard gpio get/set calls Tony Lindgren
2008-11-29 1:10 ` [PATCH 05/11] ARM: OMAP: switch to gpio_direction_input Tony Lindgren
2008-11-29 1:10 ` [PATCH 06/11] ARM: OMAP: switch to gpio_direction_output Tony Lindgren
2008-11-29 1:10 ` [PATCH 07/11] ARM: OMAP: use gpio_to_irq Tony Lindgren
2008-11-29 1:10 ` [PATCH 08/11] ARM: OMAP: make legacy gpio request/free calls superfluous Tony Lindgren
2008-11-29 1:10 ` [PATCH 09/11] ARM: OMAP: minor gpio bugfixes Tony Lindgren
2008-11-29 1:10 ` [PATCH 10/11] ARM: OMAP: Switch to gpio_request/free calls Tony Lindgren
2008-12-09 1:29 ` [PATCH 10/11] ARM: OMAP: Switch to gpio_request/free calls, v2 Tony Lindgren
2008-11-29 1:11 ` [PATCH 11/11] ARM: OMAP: Switch ohci-omap to gpio_request/free calls Tony Lindgren
2008-11-29 1:35 ` David Brownell
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=20081129011004.12337.33627.stgit@localhost \
--to=tony@atomide.com \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-omap@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.