public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: sfking@fdwdc.com
To: greg@uclinux.org
Cc: geert@linux-m68k.org, linux-m68k@vger.kernel.org,
	Steven King <sfking@fdwdc.com>
Subject: [PATCH 1/4] add to_irq function so we can map gpios to external interrupts.
Date: Wed, 21 May 2014 16:00:30 -0700	[thread overview]
Message-ID: <1400713233-9155-2-git-send-email-sfking@fdwdc.com> (raw)
In-Reply-To: <1400713233-9155-1-git-send-email-sfking@fdwdc.com>

From: Steven King <sfking@fdwdc.com>

---
 arch/m68k/platform/coldfire/gpio.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/m68k/platform/coldfire/gpio.c b/arch/m68k/platform/coldfire/gpio.c
index 9cd2b5c..ab9ac41 100644
--- a/arch/m68k/platform/coldfire/gpio.c
+++ b/arch/m68k/platform/coldfire/gpio.c
@@ -147,6 +147,18 @@ void mcfgpio_free(struct gpio_chip *chip, unsigned offset)
 	__mcfgpio_free(offset);
 }
 
+int mcfgpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+#if defined(MCFGPIO_IRQ_MIN)
+	if ((offset >= MCFGPIO_IRQ_MIN) && (offset < MCFGPIO_IRQ_MAX))
+#else
+	if (offset < MCFGPIO_IRQ_MAX)
+#endif
+		return MCFGPIO_IRQ_VECBASE + offset;
+	else
+		return -EINVAL;
+}
+
 struct bus_type mcfgpio_subsys = {
 	.name		= "gpio",
 	.dev_name	= "gpio",
@@ -160,6 +172,7 @@ static struct gpio_chip mcfgpio_chip = {
 	.direction_output	= mcfgpio_direction_output,
 	.get			= mcfgpio_get_value,
 	.set			= mcfgpio_set_value,
+	.to_irq			= mcfgpio_to_irq,
 	.base			= 0,
 	.ngpio			= MCFGPIO_PIN_MAX,
 };
-- 
1.7.10.4

  reply	other threads:[~2014-05-21 23:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 23:00 [PATCH 0/4] m68knommu: Coldfire gpio fixes and updates sfking
2014-05-21 23:00 ` sfking [this message]
2014-05-21 23:00 ` [PATCH 2/4] setting the gpio data direction register to output doesn't dependent upon the value to output! sfking
2014-05-21 23:00 ` [PATCH 3/4] Make everything thats not exported, static sfking
2014-05-21 23:00 ` [PATCH 4/4] Implement gpio support for m54xx sfking
2014-05-22  1:24   ` Greg Ungerer
2014-05-22  2:51     ` Steven King
2014-05-22  6:39   ` Geert Uytterhoeven
2014-05-22 13:46     ` Steven King
2014-05-22  1:15 ` [PATCH 0/4] m68knommu: Coldfire gpio fixes and updates Greg Ungerer
2014-05-22  2:00   ` Steven King

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=1400713233-9155-2-git-send-email-sfking@fdwdc.com \
    --to=sfking@fdwdc.com \
    --cc=geert@linux-m68k.org \
    --cc=greg@uclinux.org \
    --cc=linux-m68k@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox