blob: 07b72d57ad46062caa74d3155a0ae608ea193e59 [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
Saravana Kannan17475962013-09-06 19:22:21 -070023#define DEFINE_KPSS_DIV2_CLK(clk_name, _parent, _offset, _lf_tree) \
Saravana Kannan19010782012-09-21 18:34:50 -070024static struct div_clk clk_name = { \
Patrick Daly86abe9b2013-09-03 18:55:37 -070025 .data = { \
26 .div = 2, \
27 .min_div = 2, \
28 .max_div = 2, \
29 }, \
Saravana Kannan19010782012-09-21 18:34:50 -070030 .ops = &clk_div_ops_kpss_div2, \
31 .offset = _offset, \
32 .mask = 0x3, \
33 .shift = 6, \
Saravana Kannan17475962013-09-06 19:22:21 -070034 .priv = (void *) _lf_tree, \
Saravana Kannan19010782012-09-21 18:34:50 -070035 .c = { \
36 .parent = _parent, \
37 .dbg_name = #clk_name, \
38 .ops = &clk_ops_div, \
39 .flags = CLKFLAG_NO_RATE_CACHE, \
40 CLK_INIT(clk_name.c), \
41 } \
42}
43
44struct hfpll_data {
45 const u32 mode_offset;
46 const u32 l_offset;
47 const u32 m_offset;
48 const u32 n_offset;
49 const u32 user_offset;
50 const u32 droop_offset;
51 const u32 config_offset;
52 const u32 status_offset;
53
54 const u32 droop_val;
Vikram Mulukutla8e2750d2013-09-10 15:12:44 -070055 u32 config_val;
Saravana Kannan19010782012-09-21 18:34:50 -070056 const u32 user_val;
Vikram Mulukutla8e2750d2013-09-10 15:12:44 -070057 u32 user_vco_mask;
Saravana Kannan19010782012-09-21 18:34:50 -070058 unsigned long low_vco_max_rate;
59
60 unsigned long min_rate;
61 unsigned long max_rate;
62};
63
64struct hfpll_clk {
65 void * __iomem base;
66 struct hfpll_data const *d;
67 unsigned long src_rate;
68 int init_done;
69
70 struct clk c;
71};
72
73static inline struct hfpll_clk *to_hfpll_clk(struct clk *c)
74{
75 return container_of(c, struct hfpll_clk, c);
76}
77
78extern struct clk_ops clk_ops_hfpll;
79
80struct avs_data {
81 unsigned long *rate;
82 u32 *dscr;
83 int num;
84};
85
86struct kpss_core_clk {
87 int id;
88 u32 cp15_iaddr;
89 u32 l2_slp_delay;
90 struct avs_data *avs_tbl;
91 struct clk c;
92};
93
94static inline struct kpss_core_clk *to_kpss_core_clk(struct clk *c)
95{
96 return container_of(c, struct kpss_core_clk, c);
97}
98
99extern struct clk_ops clk_ops_kpss_cpu;
100extern struct clk_ops clk_ops_kpss_l2;
101
102#endif