aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-msm/clock.h
diff options
context:
space:
mode:
authorDaniel Walker <dwalker@codeaurora.org>2010-05-12 16:43:28 -0400
committerDaniel Walker <dwalker@codeaurora.org>2010-05-13 19:08:20 -0400
commit5e96da5d5074eae3b94d4abadfc114febb6e2a51 (patch)
tree4278052c5aaa63ae7af02fac8635c257139f3d6b /arch/arm/mach-msm/clock.h
parentec4d79255c684a74ade2f2394b9f9a669cee0036 (diff)
msm: generalize clock support.
The 'PCOM' method of clock control (commands issued to the radio CPU) is shared across several (but not all) Qualcomm SOCs. Generalize this clock mechanism so these other SOCs can be added. Signed-off-by: Gregory Bean <gbean@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org> Signed-off-by: Daniel Walker <dwalker@codeaurora.org> Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org> Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm/clock.h')
-rw-r--r--arch/arm/mach-msm/clock.h70
1 files changed, 65 insertions, 5 deletions
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h
index f875e1544e5f..598db9290422 100644
--- a/arch/arm/mach-msm/clock.h
+++ b/arch/arm/mach-msm/clock.h
@@ -1,7 +1,7 @@
1/* arch/arm/mach-msm/clock.h 1/* arch/arm/mach-msm/clock.h
2 * 2 *
3 * Copyright (C) 2007 Google, Inc. 3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2007 QUALCOMM Incorporated 4 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -18,6 +18,9 @@
18#define __ARCH_ARM_MACH_MSM_CLOCK_H 18#define __ARCH_ARM_MACH_MSM_CLOCK_H
19 19
20#include <linux/list.h> 20#include <linux/list.h>
21#include <mach/clk.h>
22
23#include "clock-pcom.h"
21 24
22#define CLKFLAG_INVERT 0x00000001 25#define CLKFLAG_INVERT 0x00000001
23#define CLKFLAG_NOINVERT 0x00000002 26#define CLKFLAG_NOINVERT 0x00000002
@@ -25,14 +28,32 @@
25#define CLKFLAG_NORESET 0x00000008 28#define CLKFLAG_NORESET 0x00000008
26 29
27#define CLK_FIRST_AVAILABLE_FLAG 0x00000100 30#define CLK_FIRST_AVAILABLE_FLAG 0x00000100
28#define CLKFLAG_USE_MIN_MAX_TO_SET 0x00000200 31#define CLKFLAG_AUTO_OFF 0x00000200
29#define CLKFLAG_AUTO_OFF 0x00000400 32#define CLKFLAG_MIN 0x00000400
33#define CLKFLAG_MAX 0x00000800
34
35struct clk_ops {
36 int (*enable)(unsigned id);
37 void (*disable)(unsigned id);
38 void (*auto_off)(unsigned id);
39 int (*reset)(unsigned id, enum clk_reset_action action);
40 int (*set_rate)(unsigned id, unsigned rate);
41 int (*set_min_rate)(unsigned id, unsigned rate);
42 int (*set_max_rate)(unsigned id, unsigned rate);
43 int (*set_flags)(unsigned id, unsigned flags);
44 unsigned (*get_rate)(unsigned id);
45 unsigned (*is_enabled)(unsigned id);
46 long (*round_rate)(unsigned id, unsigned rate);
47};
30 48
31struct clk { 49struct clk {
32 uint32_t id; 50 uint32_t id;
51 uint32_t remote_id;
33 uint32_t count; 52 uint32_t count;
34 uint32_t flags; 53 uint32_t flags;
35 const char *name; 54 const char *name;
55 struct clk_ops *ops;
56 const char *dbg_name;
36 struct list_head list; 57 struct list_head list;
37 struct device *dev; 58 struct device *dev;
38}; 59};
@@ -41,8 +62,47 @@ struct clk {
41#define A11S_CLK_SEL_ADDR (MSM_CSR_BASE + 0x104) 62#define A11S_CLK_SEL_ADDR (MSM_CSR_BASE + 0x104)
42#define A11S_VDD_SVS_PLEVEL_ADDR (MSM_CSR_BASE + 0x124) 63#define A11S_VDD_SVS_PLEVEL_ADDR (MSM_CSR_BASE + 0x124)
43 64
44extern struct clk msm_clocks[]; 65#ifdef CONFIG_DEBUG_FS
45extern unsigned msm_num_clocks; 66#define CLOCK_DBG_NAME(x) .dbg_name = x,
67#else
68#define CLOCK_DBG_NAME(x)
69#endif
70
71#define CLOCK(clk_name, clk_id, clk_dev, clk_flags) { \
72 .name = clk_name, \
73 .id = clk_id, \
74 .flags = clk_flags, \
75 .dev = clk_dev, \
76 CLOCK_DBG_NAME(#clk_id) \
77 }
78
79#define OFF CLKFLAG_AUTO_OFF
80#define CLK_MIN CLKFLAG_MIN
81#define CLK_MAX CLKFLAG_MAX
82#define CLK_MINMAX (CLK_MIN | CLK_MAX)
83#define NR_CLKS P_NR_CLKS
84
85enum {
86 PLL_0 = 0,
87 PLL_1,
88 PLL_2,
89 PLL_3,
90 PLL_4,
91 PLL_5,
92 PLL_6,
93 NUM_PLL
94};
95
96enum clkvote_client {
97 CLKVOTE_ACPUCLK = 0,
98 CLKVOTE_PMQOS,
99 CLKVOTE_MAX,
100};
101
102int msm_clock_require_tcxo(unsigned long *reason, int nbits);
103int msm_clock_get_name(uint32_t id, char *name, uint32_t size);
104int ebi1_clk_set_min_rate(enum clkvote_client client, unsigned long rate);
105unsigned long clk_get_max_axi_khz(void);
46 106
47#endif 107#endif
48 108