diff options
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/common.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/pmc.c | 76 | ||||
-rw-r--r-- | arch/arm/mach-tegra/pmc.h | 23 |
4 files changed, 103 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 23d15fba3843..e0b7a4d32599 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -7,6 +7,7 @@ obj-y += clock.o | |||
7 | obj-y += timer.o | 7 | obj-y += timer.o |
8 | obj-y += pinmux.o | 8 | obj-y += pinmux.o |
9 | obj-y += fuse.o | 9 | obj-y += fuse.o |
10 | obj-y += pmc.o | ||
10 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o | 11 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o |
11 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o | 12 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o |
12 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o | 13 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o |
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 76210e5df561..43da4284d862 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "board.h" | 32 | #include "board.h" |
33 | #include "clock.h" | 33 | #include "clock.h" |
34 | #include "fuse.h" | 34 | #include "fuse.h" |
35 | #include "pmc.h" | ||
35 | 36 | ||
36 | /* | 37 | /* |
37 | * Storage for debug-macro.S's state. | 38 | * Storage for debug-macro.S's state. |
@@ -117,11 +118,13 @@ void __init tegra20_init_early(void) | |||
117 | tegra2_init_clocks(); | 118 | tegra2_init_clocks(); |
118 | tegra_clk_init_from_table(tegra20_clk_init_table); | 119 | tegra_clk_init_from_table(tegra20_clk_init_table); |
119 | tegra_init_cache(0x331, 0x441); | 120 | tegra_init_cache(0x331, 0x441); |
121 | tegra_pmc_init(); | ||
120 | } | 122 | } |
121 | #endif | 123 | #endif |
122 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | 124 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC |
123 | void __init tegra30_init_early(void) | 125 | void __init tegra30_init_early(void) |
124 | { | 126 | { |
125 | tegra_init_cache(0x441, 0x551); | 127 | tegra_init_cache(0x441, 0x551); |
128 | tegra_pmc_init(); | ||
126 | } | 129 | } |
127 | #endif | 130 | #endif |
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c new file mode 100644 index 000000000000..7af6a54404be --- /dev/null +++ b/arch/arm/mach-tegra/pmc.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/of.h> | ||
21 | |||
22 | #include <mach/iomap.h> | ||
23 | |||
24 | #define PMC_CTRL 0x0 | ||
25 | #define PMC_CTRL_INTR_LOW (1 << 17) | ||
26 | |||
27 | static inline u32 tegra_pmc_readl(u32 reg) | ||
28 | { | ||
29 | return readl(IO_ADDRESS(TEGRA_PMC_BASE + reg)); | ||
30 | } | ||
31 | |||
32 | static inline void tegra_pmc_writel(u32 val, u32 reg) | ||
33 | { | ||
34 | writel(val, IO_ADDRESS(TEGRA_PMC_BASE + reg)); | ||
35 | } | ||
36 | |||
37 | #ifdef CONFIG_OF | ||
38 | static const struct of_device_id matches[] __initconst = { | ||
39 | { .compatible = "nvidia,tegra20-pmc" }, | ||
40 | { } | ||
41 | }; | ||
42 | #endif | ||
43 | |||
44 | void __init tegra_pmc_init(void) | ||
45 | { | ||
46 | /* | ||
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. | ||
51 | */ | ||
52 | bool invert_interrupt = true; | ||
53 | u32 val; | ||
54 | |||
55 | #ifdef CONFIG_OF | ||
56 | if (of_have_populated_dt()) { | ||
57 | struct device_node *np; | ||
58 | |||
59 | invert_interrupt = false; | ||
60 | |||
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; | ||
66 | } | ||
67 | } | ||
68 | #endif | ||
69 | |||
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); | ||
76 | } | ||
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h new file mode 100644 index 000000000000..8995ee4a8768 --- /dev/null +++ b/arch/arm/mach-tegra/pmc.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
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. | ||
7 | * | ||
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. | ||
12 | * | ||
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/>. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __MACH_TEGRA_PMC_H | ||
19 | #define __MACH_TEGRA_PMC_H | ||
20 | |||
21 | void tegra_pmc_init(void); | ||
22 | |||
23 | #endif | ||