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
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>
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
));
38 static const struct of_device_id matches
[] __initconst
= {
39 { .compatible
= "nvidia,tegra20-pmc" },
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;
56 if (of_have_populated_dt()) {
57 struct device_node
*np
;
59 invert_interrupt
= false;
61 np
= of_find_matching_node(NULL
, matches
);
63 if (of_find_property(np
, "nvidia,invert-interrupt",
65 invert_interrupt
= true;
70 val
= tegra_pmc_readl(PMC_CTRL
);
72 val
|= PMC_CTRL_INTR_LOW
;
74 val
&= ~PMC_CTRL_INTR_LOW
;
75 tegra_pmc_writel(val
, PMC_CTRL
);