diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/dpll44xx.c | 78 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/clock.h | 14 |
4 files changed, 95 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 10c3c8f16eaa..89274a9f0357 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -123,7 +123,7 @@ obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o \ | |||
123 | clock3517.o clock36xx.o \ | 123 | clock3517.o clock36xx.o \ |
124 | dpll3xxx.o clock3xxx_data.o | 124 | dpll3xxx.o clock3xxx_data.o |
125 | obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o \ | 125 | obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o \ |
126 | dpll3xxx.o | 126 | dpll3xxx.o dpll44xx.o |
127 | 127 | ||
128 | # OMAP2 clock rate set data (old "OPP" data) | 128 | # OMAP2 clock rate set data (old "OPP" data) |
129 | obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o | 129 | obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o |
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 2a939e5ec6a2..c450d69a0dce 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -65,6 +65,9 @@ u32 omap3_dpll_autoidle_read(struct clk *clk); | |||
65 | int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate); | 65 | int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate); |
66 | int omap3_noncore_dpll_enable(struct clk *clk); | 66 | int omap3_noncore_dpll_enable(struct clk *clk); |
67 | void omap3_noncore_dpll_disable(struct clk *clk); | 67 | void omap3_noncore_dpll_disable(struct clk *clk); |
68 | int omap4_dpllmx_gatectrl_read(struct clk *clk); | ||
69 | void omap4_dpllmx_allow_gatectrl(struct clk *clk); | ||
70 | void omap4_dpllmx_deny_gatectrl(struct clk *clk); | ||
68 | 71 | ||
69 | #ifdef CONFIG_OMAP_RESET_CLOCKS | 72 | #ifdef CONFIG_OMAP_RESET_CLOCKS |
70 | void omap2_clk_disable_unused(struct clk *clk); | 73 | void omap2_clk_disable_unused(struct clk *clk); |
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c new file mode 100644 index 000000000000..94a3592cd54c --- /dev/null +++ b/arch/arm/mach-omap2/dpll44xx.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * OMAP4-specific DPLL control functions | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/clk.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/bitops.h> | ||
17 | |||
18 | #include <plat/cpu.h> | ||
19 | #include <plat/clock.h> | ||
20 | |||
21 | #include "clock.h" | ||
22 | #include "cm-regbits-44xx.h" | ||
23 | |||
24 | /* Supported only on OMAP4 */ | ||
25 | int omap4_dpllmx_gatectrl_read(struct clk *clk) | ||
26 | { | ||
27 | u32 v; | ||
28 | u32 mask; | ||
29 | |||
30 | if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) | ||
31 | return -EINVAL; | ||
32 | |||
33 | mask = clk->flags & CLOCK_CLKOUTX2 ? | ||
34 | OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : | ||
35 | OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; | ||
36 | |||
37 | v = __raw_readl(clk->clksel_reg); | ||
38 | v &= mask; | ||
39 | v >>= __ffs(mask); | ||
40 | |||
41 | return v; | ||
42 | } | ||
43 | |||
44 | void omap4_dpllmx_allow_gatectrl(struct clk *clk) | ||
45 | { | ||
46 | u32 v; | ||
47 | u32 mask; | ||
48 | |||
49 | if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) | ||
50 | return; | ||
51 | |||
52 | mask = clk->flags & CLOCK_CLKOUTX2 ? | ||
53 | OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : | ||
54 | OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; | ||
55 | |||
56 | v = __raw_readl(clk->clksel_reg); | ||
57 | /* Clear the bit to allow gatectrl */ | ||
58 | v &= ~mask; | ||
59 | __raw_writel(v, clk->clksel_reg); | ||
60 | } | ||
61 | |||
62 | void omap4_dpllmx_deny_gatectrl(struct clk *clk) | ||
63 | { | ||
64 | u32 v; | ||
65 | u32 mask; | ||
66 | |||
67 | if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) | ||
68 | return; | ||
69 | |||
70 | mask = clk->flags & CLOCK_CLKOUTX2 ? | ||
71 | OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : | ||
72 | OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; | ||
73 | |||
74 | v = __raw_readl(clk->clksel_reg); | ||
75 | /* Set the bit to deny gatectrl */ | ||
76 | v |= mask; | ||
77 | __raw_writel(v, clk->clksel_reg); | ||
78 | } | ||
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h index be69f5cac32d..dcd7bb81420d 100644 --- a/arch/arm/plat-omap/include/plat/clock.h +++ b/arch/arm/plat-omap/include/plat/clock.h | |||
@@ -176,12 +176,24 @@ struct dpll_data { | |||
176 | 176 | ||
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | /* struct clk.flags possibilities */ | 179 | /* |
180 | * struct clk.flags possibilities | ||
181 | * | ||
182 | * XXX document the rest of the clock flags here | ||
183 | * | ||
184 | * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL | ||
185 | * bits share the same register. This flag allows the | ||
186 | * omap4_dpllmx*() code to determine which GATE_CTRL bit field | ||
187 | * should be used. This is a temporary solution - a better approach | ||
188 | * would be to associate clock type-specific data with the clock, | ||
189 | * similar to the struct dpll_data approach. | ||
190 | */ | ||
180 | #define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */ | 191 | #define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */ |
181 | #define CLOCK_IDLE_CONTROL (1 << 1) | 192 | #define CLOCK_IDLE_CONTROL (1 << 1) |
182 | #define CLOCK_NO_IDLE_PARENT (1 << 2) | 193 | #define CLOCK_NO_IDLE_PARENT (1 << 2) |
183 | #define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */ | 194 | #define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */ |
184 | #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ | 195 | #define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */ |
196 | #define CLOCK_CLKOUTX2 (1 << 5) | ||
185 | 197 | ||
186 | /** | 198 | /** |
187 | * struct clk - OMAP struct clk | 199 | * struct clk - OMAP struct clk |