1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2011 Google, Inc.
6 * Colin Cross <ccross@android.com>
8 * Copyright (C) 2010,2013, NVIDIA Corporation
11 #include <linux/cpu_pm.h>
12 #include <linux/interrupt.h>
14 #include <linux/irqchip/arm-gic.h>
15 #include <linux/irq.h>
16 #include <linux/kernel.h>
17 #include <linux/of_address.h>
19 #include <linux/syscore_ops.h>
25 #define SGI_MASK 0xFFFF
27 #ifdef CONFIG_PM_SLEEP
28 static void __iomem *tegra_gic_cpu_base;
31 bool tegra_pending_sgi(void)
34 void __iomem *distbase = IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE);
36 pending_set = readl_relaxed(distbase + GIC_DIST_PENDING_SET);
38 if (pending_set & SGI_MASK)
44 #ifdef CONFIG_PM_SLEEP
45 static int tegra_gic_notifier(struct notifier_block *self,
46 unsigned long cmd, void *v)
50 writel_relaxed(0x1E0, tegra_gic_cpu_base + GIC_CPU_CTRL);
57 static struct notifier_block tegra_gic_notifier_block = {
58 .notifier_call = tegra_gic_notifier,
61 static const struct of_device_id tegra114_dt_gic_match[] __initconst = {
62 { .compatible = "arm,cortex-a15-gic" },
66 static void __init tegra114_gic_cpu_pm_registration(void)
68 struct device_node *dn;
70 dn = of_find_matching_node(NULL, tegra114_dt_gic_match);
74 tegra_gic_cpu_base = of_iomap(dn, 1);
76 cpu_pm_register_notifier(&tegra_gic_notifier_block);
79 static void __init tegra114_gic_cpu_pm_registration(void) { }
82 static const struct of_device_id tegra_ictlr_match[] __initconst = {
83 { .compatible = "nvidia,tegra20-ictlr" },
84 { .compatible = "nvidia,tegra30-ictlr" },
88 void __init tegra_init_irq(void)
90 if (WARN_ON(!of_find_matching_node(NULL, tegra_ictlr_match)))
91 pr_warn("Outdated DT detected, suspend/resume will NOT work\n");
93 tegra114_gic_cpu_pm_registration();