aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-msm/clock.h
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2013-06-17 13:43:19 -0400
committerDavid Brown <davidb@codeaurora.org>2013-06-24 16:08:05 -0400
commit8cc7f5338e729b79194e6c22e3c794faaef974b8 (patch)
treed9fad83dcb3e260ad862907a80431ad70d51883e /arch/arm/mach-msm/clock.h
parent421faca0b538d1ed5f2065cbbc6bbec38f49a54f (diff)
ARM: msm: Migrate to common clock framework
Move the existing clock code in mach-msm to the common clock framework. We lose our capability to set the rate of and enable a clock through debugfs. This is ok though because the debugfs features are mainly used for testing and development of new clock code. To maintain compatibility with the original MSM clock code we make a wrapper for clk_reset() that calls the struct msm_clk specific reset function. This is necessary for the usb and sdcc devices on MSM until a better suited API is made available. Cc: Saravana Kannan <skannan@codeaurora.org> Acked-by: Mike Turquette <mturquette@linaro.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm/clock.h')
-rw-r--r--arch/arm/mach-msm/clock.h46
1 files changed, 10 insertions, 36 deletions
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h
index cc76bfe9ba46..42d29dd7aafc 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-2010, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2007-2012, The Linux Foundation. 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
@@ -17,8 +17,7 @@
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/clk-provider.h>
21#include <linux/list.h>
22#include <mach/clk.h> 21#include <mach/clk.h>
23 22
24#define CLK_FIRST_AVAILABLE_FLAG 0x00000100 23#define CLK_FIRST_AVAILABLE_FLAG 0x00000100
@@ -26,44 +25,19 @@
26#define CLKFLAG_MIN 0x00000400 25#define CLKFLAG_MIN 0x00000400
27#define CLKFLAG_MAX 0x00000800 26#define CLKFLAG_MAX 0x00000800
28 27
29struct clk_ops {
30 int (*enable)(unsigned id);
31 void (*disable)(unsigned id);
32 void (*auto_off)(unsigned id);
33 int (*reset)(unsigned id, enum clk_reset_action action);
34 int (*set_rate)(unsigned id, unsigned rate);
35 int (*set_min_rate)(unsigned id, unsigned rate);
36 int (*set_max_rate)(unsigned id, unsigned rate);
37 unsigned (*get_rate)(unsigned id);
38 unsigned (*is_enabled)(unsigned id);
39 long (*round_rate)(unsigned id, unsigned rate);
40 bool (*is_local)(unsigned id);
41};
42
43struct clk {
44 uint32_t id;
45 uint32_t remote_id;
46 uint32_t count;
47 uint32_t flags;
48 struct clk_ops *ops;
49 const char *dbg_name;
50 struct list_head list;
51};
52
53#define OFF CLKFLAG_AUTO_OFF 28#define OFF CLKFLAG_AUTO_OFF
54#define CLK_MIN CLKFLAG_MIN 29#define CLK_MIN CLKFLAG_MIN
55#define CLK_MAX CLKFLAG_MAX 30#define CLK_MAX CLKFLAG_MAX
56#define CLK_MINMAX (CLK_MIN | CLK_MAX) 31#define CLK_MINMAX (CLK_MIN | CLK_MAX)
57 32
58#ifdef CONFIG_DEBUG_FS 33struct msm_clk {
59int __init clock_debug_init(void); 34 int (*reset)(struct clk_hw *hw, enum clk_reset_action action);
60int __init clock_debug_add(struct clk *clock); 35 struct clk_hw hw;
61#else 36};
62static inline int __init clock_debug_init(void) { return 0; }
63static inline int __init clock_debug_add(struct clk *clock) { return 0; }
64#endif
65 37
66struct clk_lookup; 38static inline struct msm_clk *to_msm_clk(struct clk_hw *hw)
67void msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks); 39{
40 return container_of(hw, struct msm_clk, hw);
41}
68 42
69#endif 43#endif