Devicetree
 help / color / mirror / Atom feed
From: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
To: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
	ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
Subject: [RFC PATCH 04/10] MIPS: Octeon: Add a irq_create_of_mapping() implementation.
Date: Tue, 22 Feb 2011 12:57:48 -0800	[thread overview]
Message-ID: <1298408274-20856-5-git-send-email-ddaney@caviumnetworks.com> (raw)
In-Reply-To: <1298408274-20856-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>

This is needed for Octeon to use the Device Tree.

Signed-off-by: David Daney <ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
---
 arch/mips/cavium-octeon/octeon-irq.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index b365710..b0a9261 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -8,7 +8,9 @@
 
 #include <linux/interrupt.h>
 #include <linux/bitops.h>
+#include <linux/module.h>
 #include <linux/percpu.h>
+#include <linux/of_irq.h>
 #include <linux/irq.h>
 #include <linux/smp.h>
 
@@ -64,6 +66,29 @@ static void __init octeon_irq_set_ciu_mapping(int irq, int line, int bit,
 	octeon_irq_ciu_to_irq[line][bit] = irq;
 }
 
+/*
+ * irq_create_of_mapping - Hook to resolve OF irq specifier into a Linux irq#
+ *
+ * Octeon irq maps are a pair of indexes.  The first selects either
+ * ciu0 or ciu1, the second is the bit within the ciu register.
+ */
+unsigned int irq_create_of_mapping(struct device_node *controller,
+				   const u32 *intspec, unsigned int intsize)
+{
+	int ciu, bit;
+	unsigned int irq = 0;
+
+	ciu = be32_to_cpup(intspec);
+	bit = be32_to_cpup(intspec + 1);
+
+	if (ciu < 8 && bit < 64)
+		irq = octeon_irq_ciu_to_irq[ciu][bit];
+
+	return irq;
+}
+EXPORT_SYMBOL_GPL(irq_create_of_mapping);
+
+
 static int octeon_coreid_for_cpu(int cpu)
 {
 #ifdef CONFIG_SMP
-- 
1.7.2.3

  parent reply	other threads:[~2011-02-22 20:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 20:57 [RFC PATCH 00/10] MIPS: Octeon: Use Device Tree David Daney
2011-02-22 20:57 ` [RFC PATCH 01/10] MIPS: Octeon: Move some Ethernet support files out of staging David Daney
2011-02-23 14:48   ` Grant Likely
2011-02-23 17:36     ` David Daney
     [not found] ` <1298408274-20856-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-22 20:57   ` [RFC PATCH 02/10] MIPS: Octeon: Add device tree source files David Daney
2011-02-23  0:07     ` David Gibson
2011-02-23 14:30       ` Ralf Baechle
2011-02-23 16:59       ` David Daney
     [not found]         ` <4D653CF1.30009-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-24 23:19           ` David Gibson
2011-02-25 15:22             ` Grant Likely
2011-02-25 21:46               ` Benjamin Herrenschmidt
2011-02-23 19:06       ` David Daney
     [not found]         ` <4D655AB6.80400-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-23 23:49           ` David Gibson
2011-02-24  1:57             ` David Daney
     [not found]               ` <4D65BB17.4060703-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-24  2:14                 ` David Gibson
2011-02-24  2:22                   ` David Daney
2011-02-22 20:57   ` [RFC PATCH 03/10] MIPS: Prune some target specific code out of prom.c David Daney
2011-02-22 20:57   ` David Daney [this message]
2011-02-22 20:57   ` [RFC PATCH 05/10] MIPS: Octeon: Rearrance CVMX files in preperation for device tree David Daney
2011-02-22 20:57   ` [RFC PATCH 08/10] netdev: mdio-octeon.c: Convert to use " David Daney
2011-02-22 20:57   ` [RFC PATCH 10/10] staging: octeon_ethernet: " David Daney
2011-02-22 20:57 ` [RFC PATCH 06/10] MIPS: Octeon: Initialize and fixup " David Daney
2011-02-23  0:16   ` David Gibson
2011-02-23 17:41   ` Grant Likely
     [not found]     ` <20110223174120.GG14597-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-02-23 18:40       ` David Daney
2011-02-23 18:51         ` Grant Likely
2011-02-23 19:20           ` David Daney
2011-02-22 20:57 ` [RFC PATCH 07/10] i2c: Convert i2c-octeon.c to use " David Daney
2011-02-23 16:25   ` Grant Likely
2011-02-22 20:57 ` [RFC PATCH 09/10] netdev: octeon_mgmt: Convert " David Daney
     [not found]   ` <1298408274-20856-10-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-23 16:32     ` Grant Likely
2011-02-23 20:33       ` David Miller

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=1298408274-20856-5-git-send-email-ddaney@caviumnetworks.com \
    --to=ddaney-m3mlkvoiwjvv6pq1l3v1odbpr1lh4cv8@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.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