blob: 7de81c99121b84b43872df48943f0d52e812ed11 [file] [log] [blame]
Pankaj Kumar3912c982011-12-07 16:59:03 +05301/*
2 * Copyright (c) 2012, Code Aurora Forum. 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
Vikram Mulukutla681d8682012-03-09 23:56:20 -080015#ifndef __ARCH_ARM_MACH_MSM_CLOCK_PLL_H
16#define __ARCH_ARM_MACH_MSM_CLOCK_PLL_H
17
Pankaj Kumar3912c982011-12-07 16:59:03 +053018/**
19 * enum - For PLL IDs
20 */
21enum {
22 PLL_TCXO = -1,
23 PLL_0 = 0,
24 PLL_1,
25 PLL_2,
26 PLL_3,
27 PLL_4,
28 PLL_END,
29};
30
31/**
32 * struct pll_shared_clk - PLL shared with other processors without
33 * any HW voting
34 * @id: PLL ID
35 * @mode_reg: enable register
36 * @parent: clock source
37 * @c: clk
38 */
39struct pll_shared_clk {
40 unsigned int id;
41 void __iomem *const mode_reg;
42 struct clk c;
43};
44
45extern struct clk_ops clk_pll_ops;
46
47static inline struct pll_shared_clk *to_pll_shared_clk(struct clk *clk)
48{
49 return container_of(clk, struct pll_shared_clk, c);
50}
51
52/**
53 * msm_shared_pll_control_init() - Initialize shared pll control structure
54 */
55void msm_shared_pll_control_init(void);
Vikram Mulukutla681d8682012-03-09 23:56:20 -080056
57/**
58 * struct pll_vote_clk - phase locked loop (HW voteable)
59 * @soft_vote: soft voting variable for multiple PLL software instances
60 * @soft_vote_mask: soft voting mask for multiple PLL software instances
61 * @en_reg: enable register
62 * @en_mask: ORed with @en_reg to enable the clock
63 * @status_mask: ANDed with @status_reg to determine if PLL is active.
64 * @status_reg: status register
65 * @parent: clock source
66 * @c: clk
67 */
68struct pll_vote_clk {
69 u32 *soft_vote;
70 const u32 soft_vote_mask;
71 void __iomem *const en_reg;
72 const u32 en_mask;
73 void __iomem *const status_reg;
74 const u32 status_mask;
75
76 struct clk *parent;
77 struct clk c;
78};
79
80extern struct clk_ops clk_ops_pll_vote;
81
82static inline struct pll_vote_clk *to_pll_vote_clk(struct clk *clk)
83{
84 return container_of(clk, struct pll_vote_clk, c);
85}
86
87/**
88 * struct pll_clk - phase locked loop
89 * @mode_reg: enable register
90 * @parent: clock source
91 * @c: clk
92 */
93struct pll_clk {
94 void __iomem *const mode_reg;
95
96 struct clk *parent;
97 struct clk c;
98};
99
100extern struct clk_ops clk_ops_local_pll;
101
102static inline struct pll_clk *to_pll_clk(struct clk *clk)
103{
104 return container_of(clk, struct pll_clk, c);
105}
106
107int sr_pll_clk_enable(struct clk *clk);
108
109/*
110 * PLL vote clock APIs
111 */
112int pll_vote_clk_enable(struct clk *clk);
113void pll_vote_clk_disable(struct clk *clk);
114struct clk *pll_vote_clk_get_parent(struct clk *clk);
115int pll_vote_clk_is_enabled(struct clk *clk);
116
117#endif