x86, efi: Set runtime_version to the EFI spec revision
[linux/fpc-iii.git] / arch / arm / mach-tegra / pmc.c
blobd4fdb5fcec20955c95a4f0199efb1ae180f72409
1 /*
2 * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <linux/kernel.h>
19 #include <linux/io.h>
20 #include <linux/of.h>
22 #include "iomap.h"
24 #define PMC_CTRL 0x0
25 #define PMC_CTRL_INTR_LOW (1 << 17)
27 static inline u32 tegra_pmc_readl(u32 reg)
29 return readl(IO_ADDRESS(TEGRA_PMC_BASE + reg));
32 static inline void tegra_pmc_writel(u32 val, u32 reg)
34 writel(val, IO_ADDRESS(TEGRA_PMC_BASE + reg));
37 #ifdef CONFIG_OF
38 static const struct of_device_id matches[] __initconst = {
39 { .compatible = "nvidia,tegra20-pmc" },
40 { }
42 #endif
44 void __init tegra_pmc_init(void)
47 * For now, Harmony is the only board that uses the PMC, and it wants
48 * the signal inverted. Seaboard would too if it used the PMC.
49 * Hopefully by the time other boards want to use the PMC, everything
50 * will be device-tree, or they also want it inverted.
52 bool invert_interrupt = true;
53 u32 val;
55 #ifdef CONFIG_OF
56 if (of_have_populated_dt()) {
57 struct device_node *np;
59 invert_interrupt = false;
61 np = of_find_matching_node(NULL, matches);
62 if (np) {
63 if (of_find_property(np, "nvidia,invert-interrupt",
64 NULL))
65 invert_interrupt = true;
68 #endif
70 val = tegra_pmc_readl(PMC_CTRL);
71 if (invert_interrupt)
72 val |= PMC_CTRL_INTR_LOW;
73 else
74 val &= ~PMC_CTRL_INTR_LOW;
75 tegra_pmc_writel(val, PMC_CTRL);