blob: 2691a8ca0644f304feac000941a020a79de8a5a5 [file] [log] [blame]
Saravana Kannan19010782012-09-21 18:34:50 -07001/*
2 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef __ARCH_ARM_MACH_MSM_CLOCK_KRAIT_H
15#define __ARCH_ARM_MACH_MSM_CLOCK_KRAIT_H
16
17#include <mach/clk-provider.h>
18#include <mach/clock-generic.h>
19
20extern struct clk_mux_ops clk_mux_ops_kpss;
21extern struct clk_div_ops clk_div_ops_kpss_div2;
22
23#define DEFINE_KPSS_DIV2_CLK(clk_name, _parent, _offset) \
24static struct div_clk clk_name = { \
25 .div = 2, \
26 .min_div = 2, \
27 .max_div = 2, \
28 .ops = &clk_div_ops_kpss_div2, \
29 .offset = _offset, \
30 .mask = 0x3, \
31 .shift = 6, \
32 .c = { \
33 .parent = _parent, \
34 .dbg_name = #clk_name, \
35 .ops = &clk_ops_div, \
36 .flags = CLKFLAG_NO_RATE_CACHE, \
37 CLK_INIT(clk_name.c), \
38 } \
39}
40
41struct hfpll_data {
42 const u32 mode_offset;
43 const u32 l_offset;
44 const u32 m_offset;
45 const u32 n_offset;
46 const u32 user_offset;
47 const u32 droop_offset;
48 const u32 config_offset;
49 const u32 status_offset;
50
51 const u32 droop_val;
52 const u32 config_val;
53 const u32 user_val;
54 const u32 user_vco_mask;
55 unsigned long low_vco_max_rate;
56
57 unsigned long min_rate;
58 unsigned long max_rate;
59};
60
61struct hfpll_clk {
62 void * __iomem base;
63 struct hfpll_data const *d;
64 unsigned long src_rate;
65 int init_done;
66
67 struct clk c;
68};
69
70static inline struct hfpll_clk *to_hfpll_clk(struct clk *c)
71{
72 return container_of(c, struct hfpll_clk, c);
73}
74
75extern struct clk_ops clk_ops_hfpll;
76
77struct avs_data {
78 unsigned long *rate;
79 u32 *dscr;
80 int num;
81};
82
83struct kpss_core_clk {
84 int id;
85 u32 cp15_iaddr;
86 u32 l2_slp_delay;
87 struct avs_data *avs_tbl;
88 struct clk c;
89};
90
91static inline struct kpss_core_clk *to_kpss_core_clk(struct clk *c)
92{
93 return container_of(c, struct kpss_core_clk, c);
94}
95
96extern struct clk_ops clk_ops_kpss_cpu;
97extern struct clk_ops clk_ops_kpss_l2;
98
99#endif