linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 8/9] ARM: tegra: use DT to find the GIC distributor
Date: Fri, 28 Nov 2014 17:26:52 +0000	[thread overview]
Message-ID: <1417195613-8447-9-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1417195613-8447-1-git-send-email-marc.zyngier@arm.com>

Tegra likes to peek at the distributor to find out if SGIs are
pending. This looks odd, but I'm sure there's a good reason.

But instead of hardcoding everything, let's use the DT instead.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/mach-tegra/iomap.h |  3 ---
 arch/arm/mach-tegra/irq.c   | 20 +++++++++++++++++++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-tegra/iomap.h b/arch/arm/mach-tegra/iomap.h
index 81dc950..52bbb5c 100644
--- a/arch/arm/mach-tegra/iomap.h
+++ b/arch/arm/mach-tegra/iomap.h
@@ -28,9 +28,6 @@
 #define TEGRA_ARM_PERIF_BASE		0x50040000
 #define TEGRA_ARM_PERIF_SIZE		SZ_8K
 
-#define TEGRA_ARM_INT_DIST_BASE		0x50041000
-#define TEGRA_ARM_INT_DIST_SIZE		SZ_4K
-
 #define TEGRA_TMR1_BASE			0x60005000
 #define TEGRA_TMR1_SIZE			SZ_8
 
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index a1befd3..37b17d5 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -36,10 +36,28 @@
 static void __iomem *tegra_gic_cpu_base;
 #endif
 
+static const struct of_device_id dt_gic_match[] __initconst = {
+	{ .compatible = "arm,cortex-a9-gic" },
+	{ .compatible = "arm,cortex-a15-gic" },
+	{ }
+};
+
 bool tegra_pending_sgi(void)
 {
 	u32 pending_set;
-	void __iomem *distbase = IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE);
+	static void __iomem *distbase;
+
+	if (unlikely(!distbase)) {
+		struct device_node *dn;
+
+		dn = of_find_matching_node(NULL, dt_gic_match);
+		if (WARN_ONCE(!dn, "No GIC node????\n"))
+			return false;
+
+		distbase = of_iomap(dn, 0);
+		if (WARN_ONCE(!distbase, "Unable to map distributor????\n"))
+			return false;
+	}
 
 	pending_set = readl_relaxed(distbase + GIC_DIST_PENDING_SET);
 
-- 
2.1.3

  parent reply	other threads:[~2014-11-28 17:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28 17:26 [PATCH 0/9] irqchip: gic: kill gic_arch_extn Marc Zyngier
2014-11-28 17:26 ` [PATCH 1/9] ARM: tegra: irq: fix buggy usage of irq_data irq field Marc Zyngier
2014-11-28 17:26 ` [PATCH 2/9] ARM: tegra: irq: nuke leftovers from non-DT support Marc Zyngier
2014-11-28 17:26 ` [PATCH 3/9] irqchip: tegra: add DT-based support for legacy interrupt controller Marc Zyngier
2014-11-28 17:26 ` [PATCH 4/9] ARM: tegra: skip gic_arch_extn setup if DT has a LIC node Marc Zyngier
2014-11-28 17:26 ` [PATCH 5/9] ARM: tegra: update DTs to expose legacy interrupt controller Marc Zyngier
2014-11-28 17:26 ` [PATCH 6/9] DT: tegra: add binding for the " Marc Zyngier
2014-11-28 17:26 ` [PATCH 7/9] ARM: tegra: remove old LIC support Marc Zyngier
2014-12-01 18:14   ` Stephen Warren
2014-11-28 17:26 ` Marc Zyngier [this message]
2014-11-28 17:26 ` [PATCH 9/9] irqchip: gic: Drop support for gic_arch_extn Marc Zyngier
2014-11-28 17:52 ` [PATCH 0/9] irqchip: gic: kill gic_arch_extn Marc Zyngier

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=1417195613-8447-9-git-send-email-marc.zyngier@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).