Saravana Kannan | 1901078 | 2012-09-21 18:34:50 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | extern struct clk_mux_ops clk_mux_ops_kpss; |
| 21 | extern struct clk_div_ops clk_div_ops_kpss_div2; |
| 22 | |
Saravana Kannan | 1747596 | 2013-09-06 19:22:21 -0700 | [diff] [blame] | 23 | #define DEFINE_KPSS_DIV2_CLK(clk_name, _parent, _offset, _lf_tree) \ |
Saravana Kannan | 1901078 | 2012-09-21 18:34:50 -0700 | [diff] [blame] | 24 | static struct div_clk clk_name = { \ |
Patrick Daly | 86abe9b | 2013-09-03 18:55:37 -0700 | [diff] [blame] | 25 | .data = { \ |
| 26 | .div = 2, \ |
| 27 | .min_div = 2, \ |
| 28 | .max_div = 2, \ |
| 29 | }, \ |
Saravana Kannan | 1901078 | 2012-09-21 18:34:50 -0700 | [diff] [blame] | 30 | .ops = &clk_div_ops_kpss_div2, \ |
| 31 | .offset = _offset, \ |
| 32 | .mask = 0x3, \ |
| 33 | .shift = 6, \ |
Saravana Kannan | 1747596 | 2013-09-06 19:22:21 -0700 | [diff] [blame] | 34 | .priv = (void *) _lf_tree, \ |
Saravana Kannan | 1901078 | 2012-09-21 18:34:50 -0700 | [diff] [blame] | 35 | .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 | |
| 44 | struct 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 Mulukutla | 8e2750d | 2013-09-10 15:12:44 -0700 | [diff] [blame] | 55 | u32 config_val; |
Saravana Kannan | 1901078 | 2012-09-21 18:34:50 -0700 | [diff] [blame] | 56 | const u32 user_val; |
Vikram Mulukutla | 8e2750d | 2013-09-10 15:12:44 -0700 | [diff] [blame] | 57 | u32 user_vco_mask; |
Saravana Kannan | 1901078 | 2012-09-21 18:34:50 -0700 | [diff] [blame] | 58 | unsigned long low_vco_max_rate; |
| 59 | |
| 60 | unsigned long min_rate; |
| 61 | unsigned long max_rate; |
| 62 | }; |
| 63 | |
| 64 | struct 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 | |
| 73 | static inline struct hfpll_clk *to_hfpll_clk(struct clk *c) |
| 74 | { |
| 75 | return container_of(c, struct hfpll_clk, c); |
| 76 | } |
| 77 | |
| 78 | extern struct clk_ops clk_ops_hfpll; |
| 79 | |
| 80 | struct avs_data { |
| 81 | unsigned long *rate; |
| 82 | u32 *dscr; |
| 83 | int num; |
| 84 | }; |
| 85 | |
| 86 | struct 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 | |
| 94 | static 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 | |
| 99 | extern struct clk_ops clk_ops_kpss_cpu; |
| 100 | extern struct clk_ops clk_ops_kpss_l2; |
| 101 | |
| 102 | #endif |