Pankaj Kumar | 3912c98 | 2011-12-07 16:59:03 +0530 | [diff] [blame] | 1 | /* |
| 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 Mulukutla | 681d868 | 2012-03-09 23:56:20 -0800 | [diff] [blame] | 15 | #ifndef __ARCH_ARM_MACH_MSM_CLOCK_PLL_H |
| 16 | #define __ARCH_ARM_MACH_MSM_CLOCK_PLL_H |
| 17 | |
Pankaj Kumar | 3912c98 | 2011-12-07 16:59:03 +0530 | [diff] [blame] | 18 | /** |
| 19 | * enum - For PLL IDs |
| 20 | */ |
| 21 | enum { |
| 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 | */ |
| 39 | struct pll_shared_clk { |
| 40 | unsigned int id; |
| 41 | void __iomem *const mode_reg; |
| 42 | struct clk c; |
Vikram Mulukutla | 4d6caa8 | 2012-04-10 18:04:55 -0700 | [diff] [blame^] | 43 | void *const __iomem *base; |
Pankaj Kumar | 3912c98 | 2011-12-07 16:59:03 +0530 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | extern struct clk_ops clk_pll_ops; |
| 47 | |
| 48 | static inline struct pll_shared_clk *to_pll_shared_clk(struct clk *clk) |
| 49 | { |
| 50 | return container_of(clk, struct pll_shared_clk, c); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * msm_shared_pll_control_init() - Initialize shared pll control structure |
| 55 | */ |
| 56 | void msm_shared_pll_control_init(void); |
Vikram Mulukutla | 681d868 | 2012-03-09 23:56:20 -0800 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * struct pll_vote_clk - phase locked loop (HW voteable) |
| 60 | * @soft_vote: soft voting variable for multiple PLL software instances |
| 61 | * @soft_vote_mask: soft voting mask for multiple PLL software instances |
| 62 | * @en_reg: enable register |
| 63 | * @en_mask: ORed with @en_reg to enable the clock |
| 64 | * @status_mask: ANDed with @status_reg to determine if PLL is active. |
| 65 | * @status_reg: status register |
| 66 | * @parent: clock source |
| 67 | * @c: clk |
| 68 | */ |
| 69 | struct pll_vote_clk { |
| 70 | u32 *soft_vote; |
| 71 | const u32 soft_vote_mask; |
| 72 | void __iomem *const en_reg; |
| 73 | const u32 en_mask; |
| 74 | void __iomem *const status_reg; |
| 75 | const u32 status_mask; |
| 76 | |
| 77 | struct clk *parent; |
| 78 | struct clk c; |
Vikram Mulukutla | 4d6caa8 | 2012-04-10 18:04:55 -0700 | [diff] [blame^] | 79 | void *const __iomem *base; |
Vikram Mulukutla | 681d868 | 2012-03-09 23:56:20 -0800 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | extern struct clk_ops clk_ops_pll_vote; |
| 83 | |
| 84 | static inline struct pll_vote_clk *to_pll_vote_clk(struct clk *clk) |
| 85 | { |
| 86 | return container_of(clk, struct pll_vote_clk, c); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * struct pll_clk - phase locked loop |
| 91 | * @mode_reg: enable register |
| 92 | * @parent: clock source |
| 93 | * @c: clk |
| 94 | */ |
| 95 | struct pll_clk { |
| 96 | void __iomem *const mode_reg; |
| 97 | |
| 98 | struct clk *parent; |
| 99 | struct clk c; |
Vikram Mulukutla | 4d6caa8 | 2012-04-10 18:04:55 -0700 | [diff] [blame^] | 100 | void *const __iomem *base; |
Vikram Mulukutla | 681d868 | 2012-03-09 23:56:20 -0800 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | extern struct clk_ops clk_ops_local_pll; |
| 104 | |
| 105 | static inline struct pll_clk *to_pll_clk(struct clk *clk) |
| 106 | { |
| 107 | return container_of(clk, struct pll_clk, c); |
| 108 | } |
| 109 | |
| 110 | int sr_pll_clk_enable(struct clk *clk); |
| 111 | |
| 112 | /* |
| 113 | * PLL vote clock APIs |
| 114 | */ |
| 115 | int pll_vote_clk_enable(struct clk *clk); |
| 116 | void pll_vote_clk_disable(struct clk *clk); |
| 117 | struct clk *pll_vote_clk_get_parent(struct clk *clk); |
| 118 | int pll_vote_clk_is_enabled(struct clk *clk); |
| 119 | |
| 120 | #endif |