aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-msm
diff options
context:
space:
mode:
authorDavid Brown <davidb@codeaurora.org>2011-01-28 14:31:53 -0500
committerDavid Brown <davidb@codeaurora.org>2011-01-28 14:31:53 -0500
commitecca8194c16bdf6cde99a2b29c23a77901cd61a6 (patch)
tree80b533b480b94b1bdc4dad3b0d300868f44cde04 /arch/arm/mach-msm
parentd1f4cec78ee3141a78b2b35969f5bebf7ea9b208 (diff)
parent07a3cc4814f790354d4c7be2c9dc6143a714a07a (diff)
Merge branch 'msm-core' into for-next
* msm-core: msm: Clean up useless ifdefs msm: clock: Add support for more proc_comm clocks msm: clock: Invert debugfs directory layout msm: clock: Move debugfs code from clock.c to clock-debug.c msm: clock: Remove 7x30 and pcom includes from clock.h msm: clock: Remove unused code and definitions msm: Warning fix in trout gpio board file msm: Remove broken register definition from trout
Diffstat (limited to 'arch/arm/mach-msm')
-rw-r--r--arch/arm/mach-msm/Makefile3
-rw-r--r--arch/arm/mach-msm/board-halibut.c2
-rw-r--r--arch/arm/mach-msm/board-mahimahi.c2
-rw-r--r--arch/arm/mach-msm/board-msm7x27.c8
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c6
-rw-r--r--arch/arm/mach-msm/board-msm8x60.c4
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c4
-rw-r--r--arch/arm/mach-msm/board-sapphire.c2
-rw-r--r--arch/arm/mach-msm/board-trout-gpio.c2
-rw-r--r--arch/arm/mach-msm/board-trout.c2
-rw-r--r--arch/arm/mach-msm/clock-debug.c131
-rw-r--r--arch/arm/mach-msm/clock-pcom.c1
-rw-r--r--arch/arm/mach-msm/clock-pcom.h4
-rw-r--r--arch/arm/mach-msm/clock.c148
-rw-r--r--arch/arm/mach-msm/clock.h52
-rw-r--r--arch/arm/mach-msm/devices-msm7x00.c1
-rw-r--r--arch/arm/mach-msm/devices-msm7x30.c3
-rw-r--r--arch/arm/mach-msm/devices-qsd8x50.c7
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-7x00.h6
-rw-r--r--arch/arm/mach-msm/io.c1
20 files changed, 165 insertions, 224 deletions
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 0e5c9dc2383..c7964417dae 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -1,4 +1,7 @@
1obj-y += io.o idle.o timer.o 1obj-y += io.o idle.o timer.o
2ifdef CONFIG_MSM_PROC_COMM
3obj-$(CONFIG_DEBUG_FS) += clock-debug.o
4endif
2 5
3obj-$(CONFIG_MSM_VIC) += irq-vic.o 6obj-$(CONFIG_MSM_VIC) += irq-vic.o
4 7
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 75dabb16c80..18a3c97bc86 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -93,8 +93,6 @@ static void __init halibut_map_io(void)
93} 93}
94 94
95MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)") 95MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
96#ifdef CONFIG_MSM_DEBUG_UART
97#endif
98 .boot_params = 0x10000100, 96 .boot_params = 0x10000100,
99 .fixup = halibut_fixup, 97 .fixup = halibut_fixup,
100 .map_io = halibut_map_io, 98 .map_io = halibut_map_io,
diff --git a/arch/arm/mach-msm/board-mahimahi.c b/arch/arm/mach-msm/board-mahimahi.c
index ef3ebf2f763..7a9a03eb189 100644
--- a/arch/arm/mach-msm/board-mahimahi.c
+++ b/arch/arm/mach-msm/board-mahimahi.c
@@ -74,8 +74,6 @@ static void __init mahimahi_map_io(void)
74extern struct sys_timer msm_timer; 74extern struct sys_timer msm_timer;
75 75
76MACHINE_START(MAHIMAHI, "mahimahi") 76MACHINE_START(MAHIMAHI, "mahimahi")
77#ifdef CONFIG_MSM_DEBUG_UART
78#endif
79 .boot_params = 0x20000100, 77 .boot_params = 0x20000100,
80 .fixup = mahimahi_fixup, 78 .fixup = mahimahi_fixup,
81 .map_io = mahimahi_map_io, 79 .map_io = mahimahi_map_io,
diff --git a/arch/arm/mach-msm/board-msm7x27.c b/arch/arm/mach-msm/board-msm7x27.c
index e7a76eff57d..16d75807e3a 100644
--- a/arch/arm/mach-msm/board-msm7x27.c
+++ b/arch/arm/mach-msm/board-msm7x27.c
@@ -130,8 +130,6 @@ static void __init msm7x2x_map_io(void)
130} 130}
131 131
132MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF") 132MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF")
133#ifdef CONFIG_MSM_DEBUG_UART
134#endif
135 .boot_params = PHYS_OFFSET + 0x100, 133 .boot_params = PHYS_OFFSET + 0x100,
136 .map_io = msm7x2x_map_io, 134 .map_io = msm7x2x_map_io,
137 .init_irq = msm7x2x_init_irq, 135 .init_irq = msm7x2x_init_irq,
@@ -140,8 +138,6 @@ MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF")
140MACHINE_END 138MACHINE_END
141 139
142MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA") 140MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA")
143#ifdef CONFIG_MSM_DEBUG_UART
144#endif
145 .boot_params = PHYS_OFFSET + 0x100, 141 .boot_params = PHYS_OFFSET + 0x100,
146 .map_io = msm7x2x_map_io, 142 .map_io = msm7x2x_map_io,
147 .init_irq = msm7x2x_init_irq, 143 .init_irq = msm7x2x_init_irq,
@@ -150,8 +146,6 @@ MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA")
150MACHINE_END 146MACHINE_END
151 147
152MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF") 148MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF")
153#ifdef CONFIG_MSM_DEBUG_UART
154#endif
155 .boot_params = PHYS_OFFSET + 0x100, 149 .boot_params = PHYS_OFFSET + 0x100,
156 .map_io = msm7x2x_map_io, 150 .map_io = msm7x2x_map_io,
157 .init_irq = msm7x2x_init_irq, 151 .init_irq = msm7x2x_init_irq,
@@ -160,8 +154,6 @@ MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF")
160MACHINE_END 154MACHINE_END
161 155
162MACHINE_START(MSM7X25_FFA, "QCT MSM7x25 FFA") 156MACHINE_START(MSM7X25_FFA, "QCT MSM7x25 FFA")
163#ifdef CONFIG_MSM_DEBUG_UART
164#endif
165 .boot_params = PHYS_OFFSET + 0x100, 157 .boot_params = PHYS_OFFSET + 0x100,
166 .map_io = msm7x2x_map_io, 158 .map_io = msm7x2x_map_io,
167 .init_irq = msm7x2x_init_irq, 159 .init_irq = msm7x2x_init_irq,
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 0707cc041f2..dc9fac107c6 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -105,8 +105,6 @@ static void __init msm7x30_map_io(void)
105} 105}
106 106
107MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF") 107MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
108#ifdef CONFIG_MSM_DEBUG_UART
109#endif
110 .boot_params = PHYS_OFFSET + 0x100, 108 .boot_params = PHYS_OFFSET + 0x100,
111 .map_io = msm7x30_map_io, 109 .map_io = msm7x30_map_io,
112 .init_irq = msm7x30_init_irq, 110 .init_irq = msm7x30_init_irq,
@@ -115,8 +113,6 @@ MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
115MACHINE_END 113MACHINE_END
116 114
117MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA") 115MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
118#ifdef CONFIG_MSM_DEBUG_UART
119#endif
120 .boot_params = PHYS_OFFSET + 0x100, 116 .boot_params = PHYS_OFFSET + 0x100,
121 .map_io = msm7x30_map_io, 117 .map_io = msm7x30_map_io,
122 .init_irq = msm7x30_init_irq, 118 .init_irq = msm7x30_init_irq,
@@ -125,8 +121,6 @@ MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
125MACHINE_END 121MACHINE_END
126 122
127MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID") 123MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
128#ifdef CONFIG_MSM_DEBUG_UART
129#endif
130 .boot_params = PHYS_OFFSET + 0x100, 124 .boot_params = PHYS_OFFSET + 0x100,
131 .map_io = msm7x30_map_io, 125 .map_io = msm7x30_map_io,
132 .init_irq = msm7x30_init_irq, 126 .init_irq = msm7x30_init_irq,
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
index 9b5eb2b4ae1..b3c55f138fc 100644
--- a/arch/arm/mach-msm/board-msm8x60.c
+++ b/arch/arm/mach-msm/board-msm8x60.c
@@ -28,10 +28,6 @@
28#include <mach/board.h> 28#include <mach/board.h>
29#include <mach/msm_iomap.h> 29#include <mach/msm_iomap.h>
30 30
31unsigned long clk_get_max_axi_khz(void)
32{
33 return 0;
34}
35 31
36static void __init msm8x60_map_io(void) 32static void __init msm8x60_map_io(void)
37{ 33{
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 29ef683c804..b464d48da7c 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -195,8 +195,6 @@ static void __init qsd8x50_init(void)
195} 195}
196 196
197MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF") 197MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
198#ifdef CONFIG_MSM_DEBUG_UART
199#endif
200 .boot_params = PHYS_OFFSET + 0x100, 198 .boot_params = PHYS_OFFSET + 0x100,
201 .map_io = qsd8x50_map_io, 199 .map_io = qsd8x50_map_io,
202 .init_irq = qsd8x50_init_irq, 200 .init_irq = qsd8x50_init_irq,
@@ -205,8 +203,6 @@ MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
205MACHINE_END 203MACHINE_END
206 204
207MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5") 205MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
208#ifdef CONFIG_MSM_DEBUG_UART
209#endif
210 .boot_params = PHYS_OFFSET + 0x100, 206 .boot_params = PHYS_OFFSET + 0x100,
211 .map_io = qsd8x50_map_io, 207 .map_io = qsd8x50_map_io,
212 .init_irq = qsd8x50_init_irq, 208 .init_irq = qsd8x50_init_irq,
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c
index 8919ffb1719..6781ca844f2 100644
--- a/arch/arm/mach-msm/board-sapphire.c
+++ b/arch/arm/mach-msm/board-sapphire.c
@@ -105,8 +105,6 @@ static void __init sapphire_map_io(void)
105 105
106MACHINE_START(SAPPHIRE, "sapphire") 106MACHINE_START(SAPPHIRE, "sapphire")
107/* Maintainer: Brian Swetland <swetland@google.com> */ 107/* Maintainer: Brian Swetland <swetland@google.com> */
108#ifdef CONFIG_MSM_DEBUG_UART
109#endif
110 .boot_params = PHYS_OFFSET + 0x100, 108 .boot_params = PHYS_OFFSET + 0x100,
111 .fixup = sapphire_fixup, 109 .fixup = sapphire_fixup,
112 .map_io = sapphire_map_io, 110 .map_io = sapphire_map_io,
diff --git a/arch/arm/mach-msm/board-trout-gpio.c b/arch/arm/mach-msm/board-trout-gpio.c
index a604ec1e44b..31117a4499c 100644
--- a/arch/arm/mach-msm/board-trout-gpio.c
+++ b/arch/arm/mach-msm/board-trout-gpio.c
@@ -74,8 +74,6 @@ static int msm_gpiolib_direction_output(struct gpio_chip *chip,
74 74
75static int trout_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 75static int trout_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
76{ 76{
77 struct msm_gpio_chip *msm_gpio = to_msm_gpio_chip(chip);
78
79 return TROUT_GPIO_TO_INT(offset + chip->base); 77 return TROUT_GPIO_TO_INT(offset + chip->base);
80} 78}
81 79
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 73f14606654..8448687f5a4 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -92,8 +92,6 @@ static void __init trout_map_io(void)
92} 92}
93 93
94MACHINE_START(TROUT, "HTC Dream") 94MACHINE_START(TROUT, "HTC Dream")
95#ifdef CONFIG_MSM_DEBUG_UART
96#endif
97 .boot_params = 0x10000100, 95 .boot_params = 0x10000100,
98 .fixup = trout_fixup, 96 .fixup = trout_fixup,
99 .map_io = trout_map_io, 97 .map_io = trout_map_io,
diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
new file mode 100644
index 00000000000..b67b9e82ece
--- /dev/null
+++ b/arch/arm/mach-msm/clock-debug.c
@@ -0,0 +1,131 @@
1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/ctype.h>
19#include <linux/debugfs.h>
20#include <linux/clk.h>
21#include "clock.h"
22#include "clock-pcom.h"
23
24static int clock_debug_rate_set(void *data, u64 val)
25{
26 struct clk *clock = data;
27 int ret;
28
29 /* Only increases to max rate will succeed, but that's actually good
30 * for debugging purposes so we don't check for error. */
31 if (clock->flags & CLK_MAX)
32 clk_set_max_rate(clock, val);
33 if (clock->flags & CLK_MIN)
34 ret = clk_set_min_rate(clock, val);
35 else
36 ret = clk_set_rate(clock, val);
37 if (ret != 0)
38 printk(KERN_ERR "clk_set%s_rate failed (%d)\n",
39 (clock->flags & CLK_MIN) ? "_min" : "", ret);
40 return ret;
41}
42
43static int clock_debug_rate_get(void *data, u64 *val)
44{
45 struct clk *clock = data;
46 *val = clk_get_rate(clock);
47 return 0;
48}
49
50DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_debug_rate_get,
51 clock_debug_rate_set, "%llu\n");
52
53static int clock_debug_enable_set(void *data, u64 val)
54{
55 struct clk *clock = data;
56 int rc = 0;
57
58 if (val)
59 rc = clock->ops->enable(clock->id);
60 else
61 clock->ops->disable(clock->id);
62
63 return rc;
64}
65
66static int clock_debug_enable_get(void *data, u64 *val)
67{
68 struct clk *clock = data;
69
70 *val = clock->ops->is_enabled(clock->id);
71
72 return 0;
73}
74
75DEFINE_SIMPLE_ATTRIBUTE(clock_enable_fops, clock_debug_enable_get,
76 clock_debug_enable_set, "%llu\n");
77
78static int clock_debug_local_get(void *data, u64 *val)
79{
80 struct clk *clock = data;
81
82 *val = clock->ops != &clk_ops_pcom;
83
84 return 0;
85}
86
87DEFINE_SIMPLE_ATTRIBUTE(clock_local_fops, clock_debug_local_get,
88 NULL, "%llu\n");
89
90static struct dentry *debugfs_base;
91
92int __init clock_debug_init(void)
93{
94 debugfs_base = debugfs_create_dir("clk", NULL);
95 if (!debugfs_base)
96 return -ENOMEM;
97 return 0;
98}
99
100int __init clock_debug_add(struct clk *clock)
101{
102 char temp[50], *ptr;
103 struct dentry *clk_dir;
104
105 if (!debugfs_base)
106 return -ENOMEM;
107
108 strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
109 for (ptr = temp; *ptr; ptr++)
110 *ptr = tolower(*ptr);
111
112 clk_dir = debugfs_create_dir(temp, debugfs_base);
113 if (!clk_dir)
114 return -ENOMEM;
115
116 if (!debugfs_create_file("rate", S_IRUGO | S_IWUSR, clk_dir,
117 clock, &clock_rate_fops))
118 goto error;
119
120 if (!debugfs_create_file("enable", S_IRUGO | S_IWUSR, clk_dir,
121 clock, &clock_enable_fops))
122 goto error;
123
124 if (!debugfs_create_file("is_local", S_IRUGO, clk_dir, clock,
125 &clock_local_fops))
126 goto error;
127 return 0;
128error:
129 debugfs_remove_recursive(clk_dir);
130 return -ENOMEM;
131}
diff --git a/arch/arm/mach-msm/clock-pcom.c b/arch/arm/mach-msm/clock-pcom.c
index a3b45627eb4..8c4e8672501 100644
--- a/arch/arm/mach-msm/clock-pcom.c
+++ b/arch/arm/mach-msm/clock-pcom.c
@@ -20,6 +20,7 @@
20 20
21#include "proc_comm.h" 21#include "proc_comm.h"
22#include "clock.h" 22#include "clock.h"
23#include "clock-pcom.h"
23 24
24/* 25/*
25 * glue for the proc_comm interface 26 * glue for the proc_comm interface
diff --git a/arch/arm/mach-msm/clock-pcom.h b/arch/arm/mach-msm/clock-pcom.h
index 17d027b2350..2c813f1dba2 100644
--- a/arch/arm/mach-msm/clock-pcom.h
+++ b/arch/arm/mach-msm/clock-pcom.h
@@ -132,8 +132,10 @@
132#define P_CSI1_P_CLK 97 132#define P_CSI1_P_CLK 97
133#define P_GSBI_CLK 98 133#define P_GSBI_CLK 98
134#define P_GSBI_P_CLK 99 134#define P_GSBI_P_CLK 99
135#define P_CE_CLK 100 /* Crypto engine */
136#define P_CODEC_SSBI_CLK 101
135 137
136#define P_NR_CLKS 100 138#define P_NR_CLKS 102
137 139
138struct clk_ops; 140struct clk_ops;
139extern struct clk_ops clk_ops_pcom; 141extern struct clk_ops clk_ops_pcom;
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index 2069bfaa3a2..8c2b4dd4a87 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -15,33 +15,19 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/module.h>
20#include <linux/list.h> 18#include <linux/list.h>
21#include <linux/err.h> 19#include <linux/err.h>
22#include <linux/clk.h>
23#include <linux/spinlock.h> 20#include <linux/spinlock.h>
24#include <linux/debugfs.h>
25#include <linux/ctype.h>
26#include <linux/pm_qos_params.h> 21#include <linux/pm_qos_params.h>
27#include <mach/clk.h>
28 22
29#include "clock.h" 23#include "clock.h"
30#include "proc_comm.h" 24#include "proc_comm.h"
31#include "clock-7x30.h" 25#include "clock-7x30.h"
26#include "clock-pcom.h"
32 27
33static DEFINE_MUTEX(clocks_mutex); 28static DEFINE_MUTEX(clocks_mutex);
34static DEFINE_SPINLOCK(clocks_lock); 29static DEFINE_SPINLOCK(clocks_lock);
35static LIST_HEAD(clocks); 30static LIST_HEAD(clocks);
36struct clk *msm_clocks;
37unsigned msm_num_clocks;
38
39/*
40 * Bitmap of enabled clocks, excluding ACPU which is always
41 * enabled
42 */
43static DECLARE_BITMAP(clock_map_enabled, NR_CLKS);
44static DEFINE_SPINLOCK(clock_map_lock);
45 31
46/* 32/*
47 * Standard clock functions defined in include/linux/clk.h 33 * Standard clock functions defined in include/linux/clk.h
@@ -77,12 +63,8 @@ int clk_enable(struct clk *clk)
77 unsigned long flags; 63 unsigned long flags;
78 spin_lock_irqsave(&clocks_lock, flags); 64 spin_lock_irqsave(&clocks_lock, flags);
79 clk->count++; 65 clk->count++;
80 if (clk->count == 1) { 66 if (clk->count == 1)
81 clk->ops->enable(clk->id); 67 clk->ops->enable(clk->id);
82 spin_lock(&clock_map_lock);
83 clock_map_enabled[BIT_WORD(clk->id)] |= BIT_MASK(clk->id);
84 spin_unlock(&clock_map_lock);
85 }
86 spin_unlock_irqrestore(&clocks_lock, flags); 68 spin_unlock_irqrestore(&clocks_lock, flags);
87 return 0; 69 return 0;
88} 70}
@@ -94,12 +76,8 @@ void clk_disable(struct clk *clk)
94 spin_lock_irqsave(&clocks_lock, flags); 76 spin_lock_irqsave(&clocks_lock, flags);
95 BUG_ON(clk->count == 0); 77 BUG_ON(clk->count == 0);
96 clk->count--; 78 clk->count--;
97 if (clk->count == 0) { 79 if (clk->count == 0)
98 clk->ops->disable(clk->id); 80 clk->ops->disable(clk->id);
99 spin_lock(&clock_map_lock);
100 clock_map_enabled[BIT_WORD(clk->id)] &= ~BIT_MASK(clk->id);
101 spin_unlock(&clock_map_lock);
102 }
103 spin_unlock_irqrestore(&clocks_lock, flags); 81 spin_unlock_irqrestore(&clocks_lock, flags);
104} 82}
105EXPORT_SYMBOL(clk_disable); 83EXPORT_SYMBOL(clk_disable);
@@ -196,13 +174,10 @@ void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks)
196{ 174{
197 unsigned n; 175 unsigned n;
198 176
199 spin_lock_init(&clocks_lock);
200 mutex_lock(&clocks_mutex); 177 mutex_lock(&clocks_mutex);
201 msm_clocks = clock_tbl; 178 for (n = 0; n < num_clocks; n++) {
202 msm_num_clocks = num_clocks; 179 set_clock_ops(&clock_tbl[n]);
203 for (n = 0; n < msm_num_clocks; n++) { 180 list_add_tail(&clock_tbl[n].list, &clocks);
204 set_clock_ops(&msm_clocks[n]);
205 list_add_tail(&msm_clocks[n].list, &clocks);
206 } 181 }
207 mutex_unlock(&clocks_mutex); 182 mutex_unlock(&clocks_mutex);
208 183
@@ -211,115 +186,6 @@ void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks)
211 186
212} 187}
213 188
214#if defined(CONFIG_DEBUG_FS)
215static struct clk *msm_clock_get_nth(unsigned index)
216{
217 if (index < msm_num_clocks)
218 return msm_clocks + index;
219 else
220 return 0;
221}
222
223static int clock_debug_rate_set(void *data, u64 val)
224{
225 struct clk *clock = data;
226 int ret;
227
228 /* Only increases to max rate will succeed, but that's actually good
229 * for debugging purposes. So we don't check for error. */
230 if (clock->flags & CLK_MAX)
231 clk_set_max_rate(clock, val);
232 if (clock->flags & CLK_MIN)
233 ret = clk_set_min_rate(clock, val);
234 else
235 ret = clk_set_rate(clock, val);
236 if (ret != 0)
237 printk(KERN_ERR "clk_set%s_rate failed (%d)\n",
238 (clock->flags & CLK_MIN) ? "_min" : "", ret);
239 return ret;
240}
241
242static int clock_debug_rate_get(void *data, u64 *val)
243{
244 struct clk *clock = data;
245 *val = clk_get_rate(clock);
246 return 0;
247}
248
249static int clock_debug_enable_set(void *data, u64 val)
250{
251 struct clk *clock = data;
252 int rc = 0;
253
254 if (val)
255 rc = clock->ops->enable(clock->id);
256 else
257 clock->ops->disable(clock->id);
258
259 return rc;
260}
261
262static int clock_debug_enable_get(void *data, u64 *val)
263{
264 struct clk *clock = data;
265
266 *val = clock->ops->is_enabled(clock->id);
267
268 return 0;
269}
270
271static int clock_debug_local_get(void *data, u64 *val)
272{
273 struct clk *clock = data;
274
275 *val = clock->ops != &clk_ops_pcom;
276
277 return 0;
278}
279
280DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_debug_rate_get,
281 clock_debug_rate_set, "%llu\n");
282DEFINE_SIMPLE_ATTRIBUTE(clock_enable_fops, clock_debug_enable_get,
283 clock_debug_enable_set, "%llu\n");
284DEFINE_SIMPLE_ATTRIBUTE(clock_local_fops, clock_debug_local_get,
285 NULL, "%llu\n");
286
287static int __init clock_debug_init(void)
288{
289 struct dentry *dent_rate, *dent_enable, *dent_local;
290 struct clk *clock;
291 unsigned n = 0;
292 char temp[50], *ptr;
293
294 dent_rate = debugfs_create_dir("clk_rate", 0);
295 if (IS_ERR(dent_rate))
296 return PTR_ERR(dent_rate);
297
298 dent_enable = debugfs_create_dir("clk_enable", 0);
299 if (IS_ERR(dent_enable))
300 return PTR_ERR(dent_enable);
301
302 dent_local = debugfs_create_dir("clk_local", NULL);
303 if (IS_ERR(dent_local))
304 return PTR_ERR(dent_local);
305
306 while ((clock = msm_clock_get_nth(n++)) != 0) {
307 strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
308 for (ptr = temp; *ptr; ptr++)
309 *ptr = tolower(*ptr);
310 debugfs_create_file(temp, 0644, dent_rate,
311 clock, &clock_rate_fops);
312 debugfs_create_file(temp, 0644, dent_enable,
313 clock, &clock_enable_fops);
314 debugfs_create_file(temp, S_IRUGO, dent_local,
315 clock, &clock_local_fops);
316 }
317 return 0;
318}
319
320device_initcall(clock_debug_init);
321#endif
322
323/* The bootloader and/or AMSS may have left various clocks enabled. 189/* The bootloader and/or AMSS may have left various clocks enabled.
324 * Disable any clocks that belong to us (CLKFLAG_AUTO_OFF) but have 190 * Disable any clocks that belong to us (CLKFLAG_AUTO_OFF) but have
325 * not been explicitly enabled by a clk_enable() call. 191 * not been explicitly enabled by a clk_enable() call.
@@ -330,8 +196,10 @@ static int __init clock_late_init(void)
330 struct clk *clk; 196 struct clk *clk;
331 unsigned count = 0; 197 unsigned count = 0;
332 198
199 clock_debug_init();
333 mutex_lock(&clocks_mutex); 200 mutex_lock(&clocks_mutex);
334 list_for_each_entry(clk, &clocks, list) { 201 list_for_each_entry(clk, &clocks, list) {
202 clock_debug_add(clk);
335 if (clk->flags & CLKFLAG_AUTO_OFF) { 203 if (clk->flags & CLKFLAG_AUTO_OFF) {
336 spin_lock_irqsave(&clocks_lock, flags); 204 spin_lock_irqsave(&clocks_lock, flags);
337 if (!clk->count) { 205 if (!clk->count) {
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h
index c270b552ed1..70216b0e968 100644
--- a/arch/arm/mach-msm/clock.h
+++ b/arch/arm/mach-msm/clock.h
@@ -17,12 +17,10 @@
17#ifndef __ARCH_ARM_MACH_MSM_CLOCK_H 17#ifndef __ARCH_ARM_MACH_MSM_CLOCK_H
18#define __ARCH_ARM_MACH_MSM_CLOCK_H 18#define __ARCH_ARM_MACH_MSM_CLOCK_H
19 19
20#include <linux/init.h>
20#include <linux/list.h> 21#include <linux/list.h>
21#include <mach/clk.h> 22#include <mach/clk.h>
22 23
23#include "clock-pcom.h"
24#include "clock-7x30.h"
25
26#define CLKFLAG_INVERT 0x00000001 24#define CLKFLAG_INVERT 0x00000001
27#define CLKFLAG_NOINVERT 0x00000002 25#define CLKFLAG_NOINVERT 0x00000002
28#define CLKFLAG_NONEST 0x00000004 26#define CLKFLAG_NONEST 0x00000004
@@ -59,51 +57,17 @@ struct clk {
59 struct device *dev; 57 struct device *dev;
60}; 58};
61 59
62#define A11S_CLK_CNTL_ADDR (MSM_CSR_BASE + 0x100)
63#define A11S_CLK_SEL_ADDR (MSM_CSR_BASE + 0x104)
64#define A11S_VDD_SVS_PLEVEL_ADDR (MSM_CSR_BASE + 0x124)
65
66#ifdef CONFIG_DEBUG_FS
67#define CLOCK_DBG_NAME(x) .dbg_name = x,
68#else
69#define CLOCK_DBG_NAME(x)
70#endif
71
72#define CLOCK(clk_name, clk_id, clk_dev, clk_flags) { \
73 .name = clk_name, \
74 .id = clk_id, \
75 .flags = clk_flags, \
76 .dev = clk_dev, \
77 CLOCK_DBG_NAME(#clk_id) \
78 }
79
80#define OFF CLKFLAG_AUTO_OFF 60#define OFF CLKFLAG_AUTO_OFF
81#define CLK_MIN CLKFLAG_MIN 61#define CLK_MIN CLKFLAG_MIN
82#define CLK_MAX CLKFLAG_MAX 62#define CLK_MAX CLKFLAG_MAX
83#define CLK_MINMAX (CLK_MIN | CLK_MAX) 63#define CLK_MINMAX (CLK_MIN | CLK_MAX)
84#define NR_CLKS P_NR_CLKS
85
86enum {
87 PLL_0 = 0,
88 PLL_1,
89 PLL_2,
90 PLL_3,
91 PLL_4,
92 PLL_5,
93 PLL_6,
94 NUM_PLL
95};
96
97enum clkvote_client {
98 CLKVOTE_ACPUCLK = 0,
99 CLKVOTE_PMQOS,
100 CLKVOTE_MAX,
101};
102
103int msm_clock_require_tcxo(unsigned long *reason, int nbits);
104int msm_clock_get_name(uint32_t id, char *name, uint32_t size);
105int ebi1_clk_set_min_rate(enum clkvote_client client, unsigned long rate);
106unsigned long clk_get_max_axi_khz(void);
107 64
65#ifdef CONFIG_DEBUG_FS
66int __init clock_debug_init(void);
67int __init clock_debug_add(struct clk *clock);
68#else
69static inline int __init clock_debug_init(void) { return 0; }
70static inline int __init clock_debug_add(struct clk *clock) { return 0; }
108#endif 71#endif
109 72
73#endif
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index 2549fb23ee9..ed62806559e 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -26,6 +26,7 @@
26 26
27 27
28#include "clock.h" 28#include "clock.h"
29#include "clock-pcom.h"
29#include <mach/mmc.h> 30#include <mach/mmc.h>
30 31
31static struct resource resources_uart1[] = { 32static struct resource resources_uart1[] = {
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index d4c7afccbdb..cd4343bcf73 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -28,6 +28,7 @@
28#include <asm/mach/flash.h> 28#include <asm/mach/flash.h>
29 29
30#include "clock-pcom.h" 30#include "clock-pcom.h"
31#include "clock-7x30.h"
31 32
32#include <mach/mmc.h> 33#include <mach/mmc.h>
33 34
@@ -133,6 +134,8 @@ struct clk msm_clocks_7x30[] = {
133 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), 134 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
134 CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0), 135 CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0),
135 CLK_PCOM("camif_pad_pclk", CAMIF_PAD_P_CLK, NULL, OFF), 136 CLK_PCOM("camif_pad_pclk", CAMIF_PAD_P_CLK, NULL, OFF),
137 CLK_PCOM("ce_clk", CE_CLK, NULL, 0),
138 CLK_PCOM("codec_ssbi_clk", CODEC_SSBI_CLK, NULL, 0),
136 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), 139 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN),
137 CLK_PCOM("ecodec_clk", ECODEC_CLK, NULL, 0), 140 CLK_PCOM("ecodec_clk", ECODEC_CLK, NULL, 0),
138 CLK_PCOM("emdh_clk", EMDH_CLK, NULL, OFF | CLK_MINMAX), 141 CLK_PCOM("emdh_clk", EMDH_CLK, NULL, OFF | CLK_MINMAX),
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index c9fa6552ff7..bd545f9e8c2 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -27,6 +27,7 @@
27#include <asm/mach/flash.h> 27#include <asm/mach/flash.h>
28 28
29#include <mach/mmc.h> 29#include <mach/mmc.h>
30#include "clock-pcom.h"
30 31
31static struct resource resources_uart3[] = { 32static struct resource resources_uart3[] = {
32 { 33 {
@@ -315,12 +316,14 @@ int __init msm_add_sdcc(unsigned int controller,
315 316
316struct clk msm_clocks_8x50[] = { 317struct clk msm_clocks_8x50[] = {
317 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 318 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
319 CLK_PCOM("ce_clk", CE_CLK, NULL, 0),
318 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), 320 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN),
319 CLK_PCOM("ebi2_clk", EBI2_CLK, NULL, 0), 321 CLK_PCOM("ebi2_clk", EBI2_CLK, NULL, 0),
320 CLK_PCOM("ecodec_clk", ECODEC_CLK, NULL, 0), 322 CLK_PCOM("ecodec_clk", ECODEC_CLK, NULL, 0),
321 CLK_PCOM("emdh_clk", EMDH_CLK, NULL, OFF | CLK_MINMAX), 323 CLK_PCOM("emdh_clk", EMDH_CLK, NULL, OFF | CLK_MINMAX),
322 CLK_PCOM("gp_clk", GP_CLK, NULL, 0), 324 CLK_PCOM("gp_clk", GP_CLK, NULL, 0),
323 CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, 0), 325 CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, 0),
326 CLK_PCOM("i2c_clk", I2C_CLK, NULL, 0),
324 CLK_PCOM("icodec_rx_clk", ICODEC_RX_CLK, NULL, 0), 327 CLK_PCOM("icodec_rx_clk", ICODEC_RX_CLK, NULL, 0),
325 CLK_PCOM("icodec_tx_clk", ICODEC_TX_CLK, NULL, 0), 328 CLK_PCOM("icodec_tx_clk", ICODEC_TX_CLK, NULL, 0),
326 CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF), 329 CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF),
@@ -346,7 +349,11 @@ struct clk msm_clocks_8x50[] = {
346 CLK_PCOM("tsif_ref_clk", TSIF_REF_CLK, NULL, 0), 349 CLK_PCOM("tsif_ref_clk", TSIF_REF_CLK, NULL, 0),
347 CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0), 350 CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0),
348 CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0), 351 CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0),
352 CLK_PCOM("uart_clk", UART1_CLK, NULL, OFF),
353 CLK_PCOM("uart_clk", UART2_CLK, NULL, 0),
349 CLK_PCOM("uart_clk", UART3_CLK, &msm_device_uart3.dev, OFF), 354 CLK_PCOM("uart_clk", UART3_CLK, &msm_device_uart3.dev, OFF),
355 CLK_PCOM("uartdm_clk", UART1DM_CLK, NULL, OFF),
356 CLK_PCOM("uartdm_clk", UART2DM_CLK, NULL, 0),
350 CLK_PCOM("usb_hs_clk", USB_HS_CLK, NULL, OFF), 357 CLK_PCOM("usb_hs_clk", USB_HS_CLK, NULL, OFF),
351 CLK_PCOM("usb_hs_pclk", USB_HS_P_CLK, NULL, OFF), 358 CLK_PCOM("usb_hs_pclk", USB_HS_P_CLK, NULL, OFF),
352 CLK_PCOM("usb_otg_clk", USB_OTG_CLK, NULL, 0), 359 CLK_PCOM("usb_otg_clk", USB_OTG_CLK, NULL, 0),
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
index 1e75ed74f16..8f99d97615a 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
@@ -126,10 +126,4 @@
126#define MSM_AD5_SIZE (SZ_1M*13) 126#define MSM_AD5_SIZE (SZ_1M*13)
127 127
128 128
129#if defined(CONFIG_ARCH_MSM7X30)
130#define MSM_GCC_BASE IOMEM(0xF8009000)
131#define MSM_GCC_PHYS 0xC0182000
132#define MSM_GCC_SIZE SZ_4K
133#endif
134
135#endif 129#endif
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index d8d9be5d821..cec6ed1c91d 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -42,7 +42,6 @@
42static struct map_desc msm_io_desc[] __initdata = { 42static struct map_desc msm_io_desc[] __initdata = {
43 MSM_DEVICE(VIC), 43 MSM_DEVICE(VIC),
44 MSM_CHIP_DEVICE(CSR, MSM7X00), 44 MSM_CHIP_DEVICE(CSR, MSM7X00),
45 MSM_DEVICE(GPT),
46 MSM_DEVICE(DMOV), 45 MSM_DEVICE(DMOV),
47 MSM_DEVICE(GPIO1), 46 MSM_DEVICE(GPIO1),
48 MSM_DEVICE(GPIO2), 47 MSM_DEVICE(GPIO2),