diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2011-02-23 12:37:41 -0500 |
---|---|---|
committer | David Brown <davidb@codeaurora.org> | 2011-02-28 15:40:05 -0500 |
commit | 2a52220c89e02423aa23e6b9fb6dc0c706465a82 (patch) | |
tree | 39a6e46c02ff983e1228c691cf06e3a7405db90e /arch/arm/mach-msm | |
parent | 0693a317b609a5d31d29e26c4f28ea079d5477f4 (diff) |
msm: clock: Remove references to clk_ops_pcom
Not all devices use proc_comm and determining if a clock is local
vs. remote is fragile when done by comparing clk_ops pointers.
Instead, implement an is_local() function for all clk_ops to
determine if the clock is local. Doing this allows us to remove
the last references to clk_ops_pcom from clock.c and compile it
for targets with CONFIG_MSM_PROC_COMM=n.
We don't need to set the clk_ops at runtime until 7x30 local
clock detection comes in. Right now it's just complicating things
so just set the ops pointer statically.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm')
-rw-r--r-- | arch/arm/mach-msm/Makefile | 6 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock-7x30.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock-debug.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock-dummy.c | 54 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock-pcom.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-msm/clock.h | 1 |
7 files changed, 11 insertions, 77 deletions
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile index 2099c979fe2c..9519fd28a025 100644 --- a/arch/arm/mach-msm/Makefile +++ b/arch/arm/mach-msm/Makefile | |||
@@ -1,7 +1,6 @@ | |||
1 | obj-y += io.o idle.o timer.o | 1 | obj-y += io.o idle.o timer.o |
2 | ifdef CONFIG_MSM_PROC_COMM | 2 | obj-y += clock.o |
3 | obj-$(CONFIG_DEBUG_FS) += clock-debug.o | 3 | obj-$(CONFIG_DEBUG_FS) += clock-debug.o |
4 | endif | ||
5 | 4 | ||
6 | obj-$(CONFIG_MSM_VIC) += irq-vic.o | 5 | obj-$(CONFIG_MSM_VIC) += irq-vic.o |
7 | obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o | 6 | obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o |
@@ -9,11 +8,8 @@ obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o | |||
9 | obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o acpuclock-arm11.o | 8 | obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o acpuclock-arm11.o |
10 | obj-$(CONFIG_ARCH_MSM7X30) += dma.o | 9 | obj-$(CONFIG_ARCH_MSM7X30) += dma.o |
11 | obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o | 10 | obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o |
12 | obj-$(CONFIG_ARCH_MSM8X60) += clock-dummy.o | ||
13 | obj-$(CONFIG_ARCH_MSM8960) += clock-dummy.o | ||
14 | 11 | ||
15 | obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o | 12 | obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o |
16 | obj-$(CONFIG_MSM_PROC_COMM) += clock.o | ||
17 | 13 | ||
18 | obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o | 14 | obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o |
19 | obj-$(CONFIG_MSM_SMD) += last_radio_log.o | 15 | obj-$(CONFIG_MSM_SMD) += last_radio_log.o |
diff --git a/arch/arm/mach-msm/clock-7x30.h b/arch/arm/mach-msm/clock-7x30.h index da8e1c6f774e..53622b3992b7 100644 --- a/arch/arm/mach-msm/clock-7x30.h +++ b/arch/arm/mach-msm/clock-7x30.h | |||
@@ -145,6 +145,7 @@ extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable); | |||
145 | .flags = clk_flags, \ | 145 | .flags = clk_flags, \ |
146 | .dev = clk_dev, \ | 146 | .dev = clk_dev, \ |
147 | .dbg_name = #l_id, \ | 147 | .dbg_name = #l_id, \ |
148 | .ops = &clk_ops_pcom, \ | ||
148 | } | 149 | } |
149 | 150 | ||
150 | #endif | 151 | #endif |
diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c index b67b9e82ece6..4886404d42f5 100644 --- a/arch/arm/mach-msm/clock-debug.c +++ b/arch/arm/mach-msm/clock-debug.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/debugfs.h> | 19 | #include <linux/debugfs.h> |
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include "clock.h" | 21 | #include "clock.h" |
22 | #include "clock-pcom.h" | ||
23 | 22 | ||
24 | static int clock_debug_rate_set(void *data, u64 val) | 23 | static int clock_debug_rate_set(void *data, u64 val) |
25 | { | 24 | { |
@@ -79,7 +78,7 @@ static int clock_debug_local_get(void *data, u64 *val) | |||
79 | { | 78 | { |
80 | struct clk *clock = data; | 79 | struct clk *clock = data; |
81 | 80 | ||
82 | *val = clock->ops != &clk_ops_pcom; | 81 | *val = clock->ops->is_local(clock->id); |
83 | 82 | ||
84 | return 0; | 83 | return 0; |
85 | } | 84 | } |
diff --git a/arch/arm/mach-msm/clock-dummy.c b/arch/arm/mach-msm/clock-dummy.c deleted file mode 100644 index 1250d22082ee..000000000000 --- a/arch/arm/mach-msm/clock-dummy.c +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License version 2 and | ||
5 | * only version 2 as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program; if not, write to the Free Software | ||
14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
15 | * 02110-1301, USA. | ||
16 | * | ||
17 | */ | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/module.h> | ||
21 | |||
22 | struct clk *clk_get(struct device *dev, const char *id) | ||
23 | { | ||
24 | return ERR_PTR(-ENOENT); | ||
25 | } | ||
26 | EXPORT_SYMBOL(clk_get); | ||
27 | |||
28 | int clk_enable(struct clk *clk) | ||
29 | { | ||
30 | return -ENOENT; | ||
31 | } | ||
32 | EXPORT_SYMBOL(clk_enable); | ||
33 | |||
34 | void clk_disable(struct clk *clk) | ||
35 | { | ||
36 | } | ||
37 | EXPORT_SYMBOL(clk_disable); | ||
38 | |||
39 | unsigned long clk_get_rate(struct clk *clk) | ||
40 | { | ||
41 | return 0; | ||
42 | } | ||
43 | EXPORT_SYMBOL(clk_get_rate); | ||
44 | |||
45 | int clk_set_rate(struct clk *clk, unsigned long rate) | ||
46 | { | ||
47 | return -ENOENT; | ||
48 | } | ||
49 | EXPORT_SYMBOL(clk_set_rate); | ||
50 | |||
51 | void clk_put(struct clk *clk) | ||
52 | { | ||
53 | } | ||
54 | EXPORT_SYMBOL(clk_put); | ||
diff --git a/arch/arm/mach-msm/clock-pcom.c b/arch/arm/mach-msm/clock-pcom.c index 8c4e86725013..63b711311086 100644 --- a/arch/arm/mach-msm/clock-pcom.c +++ b/arch/arm/mach-msm/clock-pcom.c | |||
@@ -117,6 +117,11 @@ long pc_clk_round_rate(unsigned id, unsigned rate) | |||
117 | return rate; | 117 | return rate; |
118 | } | 118 | } |
119 | 119 | ||
120 | static bool pc_clk_is_local(unsigned id) | ||
121 | { | ||
122 | return false; | ||
123 | } | ||
124 | |||
120 | struct clk_ops clk_ops_pcom = { | 125 | struct clk_ops clk_ops_pcom = { |
121 | .enable = pc_clk_enable, | 126 | .enable = pc_clk_enable, |
122 | .disable = pc_clk_disable, | 127 | .disable = pc_clk_disable, |
@@ -129,4 +134,5 @@ struct clk_ops clk_ops_pcom = { | |||
129 | .get_rate = pc_clk_get_rate, | 134 | .get_rate = pc_clk_get_rate, |
130 | .is_enabled = pc_clk_is_enabled, | 135 | .is_enabled = pc_clk_is_enabled, |
131 | .round_rate = pc_clk_round_rate, | 136 | .round_rate = pc_clk_round_rate, |
137 | .is_local = pc_clk_is_local, | ||
132 | }; | 138 | }; |
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c index 8c2b4dd4a877..e00f6a040ad5 100644 --- a/arch/arm/mach-msm/clock.c +++ b/arch/arm/mach-msm/clock.c | |||
@@ -21,9 +21,6 @@ | |||
21 | #include <linux/pm_qos_params.h> | 21 | #include <linux/pm_qos_params.h> |
22 | 22 | ||
23 | #include "clock.h" | 23 | #include "clock.h" |
24 | #include "proc_comm.h" | ||
25 | #include "clock-7x30.h" | ||
26 | #include "clock-pcom.h" | ||
27 | 24 | ||
28 | static DEFINE_MUTEX(clocks_mutex); | 25 | static DEFINE_MUTEX(clocks_mutex); |
29 | static DEFINE_SPINLOCK(clocks_lock); | 26 | static DEFINE_SPINLOCK(clocks_lock); |
@@ -84,8 +81,6 @@ EXPORT_SYMBOL(clk_disable); | |||
84 | 81 | ||
85 | int clk_reset(struct clk *clk, enum clk_reset_action action) | 82 | int clk_reset(struct clk *clk, enum clk_reset_action action) |
86 | { | 83 | { |
87 | if (!clk->ops->reset) | ||
88 | clk->ops->reset = &pc_clk_reset; | ||
89 | return clk->ops->reset(clk->remote_id, action); | 84 | return clk->ops->reset(clk->remote_id, action); |
90 | } | 85 | } |
91 | EXPORT_SYMBOL(clk_reset); | 86 | EXPORT_SYMBOL(clk_reset); |
@@ -162,23 +157,13 @@ EXPORT_SYMBOL(clk_set_flags); | |||
162 | */ | 157 | */ |
163 | static struct clk *ebi1_clk; | 158 | static struct clk *ebi1_clk; |
164 | 159 | ||
165 | static void __init set_clock_ops(struct clk *clk) | ||
166 | { | ||
167 | if (!clk->ops) { | ||
168 | clk->ops = &clk_ops_pcom; | ||
169 | clk->id = clk->remote_id; | ||
170 | } | ||
171 | } | ||
172 | |||
173 | void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks) | 160 | void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks) |
174 | { | 161 | { |
175 | unsigned n; | 162 | unsigned n; |
176 | 163 | ||
177 | mutex_lock(&clocks_mutex); | 164 | mutex_lock(&clocks_mutex); |
178 | for (n = 0; n < num_clocks; n++) { | 165 | for (n = 0; n < num_clocks; n++) |
179 | set_clock_ops(&clock_tbl[n]); | ||
180 | list_add_tail(&clock_tbl[n].list, &clocks); | 166 | list_add_tail(&clock_tbl[n].list, &clocks); |
181 | } | ||
182 | mutex_unlock(&clocks_mutex); | 167 | mutex_unlock(&clocks_mutex); |
183 | 168 | ||
184 | ebi1_clk = clk_get(NULL, "ebi1_clk"); | 169 | ebi1_clk = clk_get(NULL, "ebi1_clk"); |
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h index 70216b0e9681..8d302c7403a8 100644 --- a/arch/arm/mach-msm/clock.h +++ b/arch/arm/mach-msm/clock.h | |||
@@ -43,6 +43,7 @@ struct clk_ops { | |||
43 | unsigned (*get_rate)(unsigned id); | 43 | unsigned (*get_rate)(unsigned id); |
44 | unsigned (*is_enabled)(unsigned id); | 44 | unsigned (*is_enabled)(unsigned id); |
45 | long (*round_rate)(unsigned id, unsigned rate); | 45 | long (*round_rate)(unsigned id, unsigned rate); |
46 | bool (*is_local)(unsigned id); | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | struct clk { | 49 | struct clk { |