summaryrefslogtreecommitdiff
path: root/drivers/irqchip
diff options
context:
space:
mode:
authorPeng Du <pdu@nvidia.com>2013-12-16 14:58:35 -0800
committerTom Cherry <tcherry@nvidia.com>2014-01-21 20:27:36 -0800
commit57605e7b82f97c7278e3cb599d25ab611c5bff7f (patch)
treeff582ae3c6f52dbf7c2979d5b4d66de0da9dcaf2 /drivers/irqchip
parent35e11e854cf904e2a5aa592f6fed429f688ee612 (diff)
irqchip: tegra: read num of ictrls from DT first
Add a mechanism for defining the number of platform interrupt controllers in the device tree. If no such property exists, we fall back to reading the GIC distributor reg (DIST_CTR). Change-Id: I7a846e2fb060750e8e3dab4f61c2b0ff3917c565 Signed-off-by: Peng Du <pdu@nvidia.com> Reviewed-on: http://git-master/r/346050 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bo Yan <byan@nvidia.com> Reviewed-by: Alexander Van Brunt <avanbrunt@nvidia.com>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r--drivers/irqchip/irq-tegra.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/irqchip/irq-tegra.c b/drivers/irqchip/irq-tegra.c
index e99dfe212009..ad640c9c4f9a 100644
--- a/drivers/irqchip/irq-tegra.c
+++ b/drivers/irqchip/irq-tegra.c
@@ -33,6 +33,7 @@
#include <linux/irqchip/tegra.h>
#include <linux/cpumask.h> /* Required by asm/hardware/gic.h */
#include <linux/cpu_pm.h>
+#include <linux/tegra-soc.h>
/* HACK: will be removed once cpuidle is moved to drivers */
#include "../../arch/arm/mach-tegra/pm.h"
@@ -459,11 +460,16 @@ static int __init tegra_gic_of_init(struct device_node *node,
int i;
struct device_node *arm_gic_np =
of_find_compatible_node(NULL, NULL, "arm,cortex-a15-gic");
+ struct device_node *tegra_gic_np =
+ of_find_compatible_node(NULL, NULL, "nvidia,tegra-gic");
gic_dist_base = of_iomap(arm_gic_np, 0);
gic_cpu_base = of_iomap(arm_gic_np, 1);
- num_ictlrs = readl_relaxed(gic_dist_base + GIC_DIST_CTR) & 0x1f;
gic_version = (readl(gic_dist_base + 0xFE8) & 0xF0) >> 4;
+ /* Retrieve # of ictrls from DT and fallback to gic dist */
+ if (of_property_read_u32(tegra_gic_np, "num-ictrls", &num_ictlrs))
+ num_ictlrs = readl_relaxed(gic_dist_base + GIC_DIST_CTR) & 0x1f;
+
pr_info("the number of interrupt controllers found is %d", num_ictlrs);
ictlr_reg_base = kzalloc(sizeof(void *) * num_ictlrs, GFP_KERNEL);