diff options
author | Heiko Stuebner <heiko@sntech.de> | 2014-11-20 14:38:50 -0500 |
---|---|---|
committer | Heiko Stuebner <heiko@sntech.de> | 2014-11-25 03:57:07 -0500 |
commit | 4f8a7c549f373f33c065c9cbb5a5f3f1a9d8f56c (patch) | |
tree | 6c3adc9b74f0663ec871a0cc45309b7044657d68 /drivers | |
parent | 12c0a0e81e2f9c03404a3e095517c022991aad43 (diff) |
clk: rockchip: add ability to specify pll-specific flags
This adds a flag parameter to plls that allows us to create
special flags to tweak the behaviour of the plls if necessary.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/clk/rockchip/clk-pll.c | 4 | ||||
-rw-r--r-- | drivers/clk/rockchip/clk-rk3188.c | 8 | ||||
-rw-r--r-- | drivers/clk/rockchip/clk-rk3288.c | 10 | ||||
-rw-r--r-- | drivers/clk/rockchip/clk.c | 3 | ||||
-rw-r--r-- | drivers/clk/rockchip/clk.h | 7 |
5 files changed, 19 insertions, 13 deletions
diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c index a3e886a38480..feb9cad3e676 100644 --- a/drivers/clk/rockchip/clk-pll.c +++ b/drivers/clk/rockchip/clk-pll.c | |||
@@ -39,6 +39,7 @@ struct rockchip_clk_pll { | |||
39 | int lock_offset; | 39 | int lock_offset; |
40 | unsigned int lock_shift; | 40 | unsigned int lock_shift; |
41 | enum rockchip_pll_type type; | 41 | enum rockchip_pll_type type; |
42 | u8 flags; | ||
42 | const struct rockchip_pll_rate_table *rate_table; | 43 | const struct rockchip_pll_rate_table *rate_table; |
43 | unsigned int rate_count; | 44 | unsigned int rate_count; |
44 | spinlock_t *lock; | 45 | spinlock_t *lock; |
@@ -282,7 +283,7 @@ struct clk *rockchip_clk_register_pll(enum rockchip_pll_type pll_type, | |||
282 | void __iomem *base, int con_offset, int grf_lock_offset, | 283 | void __iomem *base, int con_offset, int grf_lock_offset, |
283 | int lock_shift, int mode_offset, int mode_shift, | 284 | int lock_shift, int mode_offset, int mode_shift, |
284 | struct rockchip_pll_rate_table *rate_table, | 285 | struct rockchip_pll_rate_table *rate_table, |
285 | spinlock_t *lock) | 286 | u8 clk_pll_flags, spinlock_t *lock) |
286 | { | 287 | { |
287 | const char *pll_parents[3]; | 288 | const char *pll_parents[3]; |
288 | struct clk_init_data init; | 289 | struct clk_init_data init; |
@@ -345,6 +346,7 @@ struct clk *rockchip_clk_register_pll(enum rockchip_pll_type pll_type, | |||
345 | pll->reg_base = base + con_offset; | 346 | pll->reg_base = base + con_offset; |
346 | pll->lock_offset = grf_lock_offset; | 347 | pll->lock_offset = grf_lock_offset; |
347 | pll->lock_shift = lock_shift; | 348 | pll->lock_shift = lock_shift; |
349 | pll->flags = clk_pll_flags; | ||
348 | pll->lock = lock; | 350 | pll->lock = lock; |
349 | 351 | ||
350 | pll_clk = clk_register(NULL, &pll->hw); | 352 | pll_clk = clk_register(NULL, &pll->hw); |
diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c index 22dccc6cd664..dc028b754c9e 100644 --- a/drivers/clk/rockchip/clk-rk3188.c +++ b/drivers/clk/rockchip/clk-rk3188.c | |||
@@ -212,13 +212,13 @@ PNAME(mux_sclk_macref_p) = { "mac_src", "ext_rmii" }; | |||
212 | 212 | ||
213 | static struct rockchip_pll_clock rk3188_pll_clks[] __initdata = { | 213 | static struct rockchip_pll_clock rk3188_pll_clks[] __initdata = { |
214 | [apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK2928_PLL_CON(0), | 214 | [apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK2928_PLL_CON(0), |
215 | RK2928_MODE_CON, 0, 6, rk3188_pll_rates), | 215 | RK2928_MODE_CON, 0, 6, 0, rk3188_pll_rates), |
216 | [dpll] = PLL(pll_rk3066, PLL_DPLL, "dpll", mux_pll_p, 0, RK2928_PLL_CON(4), | 216 | [dpll] = PLL(pll_rk3066, PLL_DPLL, "dpll", mux_pll_p, 0, RK2928_PLL_CON(4), |
217 | RK2928_MODE_CON, 4, 5, NULL), | 217 | RK2928_MODE_CON, 4, 5, 0, NULL), |
218 | [cpll] = PLL(pll_rk3066, PLL_CPLL, "cpll", mux_pll_p, 0, RK2928_PLL_CON(8), | 218 | [cpll] = PLL(pll_rk3066, PLL_CPLL, "cpll", mux_pll_p, 0, RK2928_PLL_CON(8), |
219 | RK2928_MODE_CON, 8, 7, rk3188_pll_rates), | 219 | RK2928_MODE_CON, 8, 7, 0, rk3188_pll_rates), |
220 | [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK2928_PLL_CON(12), | 220 | [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK2928_PLL_CON(12), |
221 | RK2928_MODE_CON, 12, 8, rk3188_pll_rates), | 221 | RK2928_MODE_CON, 12, 8, 0, rk3188_pll_rates), |
222 | }; | 222 | }; |
223 | 223 | ||
224 | #define MFLAGS CLK_MUX_HIWORD_MASK | 224 | #define MFLAGS CLK_MUX_HIWORD_MASK |
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index 174589c95e33..2d31a22c0273 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c | |||
@@ -202,15 +202,15 @@ PNAME(mux_hsicphy12m_p) = { "hsicphy12m_xin12m", "hsicphy12m_usbphy" }; | |||
202 | 202 | ||
203 | static struct rockchip_pll_clock rk3288_pll_clks[] __initdata = { | 203 | static struct rockchip_pll_clock rk3288_pll_clks[] __initdata = { |
204 | [apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK3288_PLL_CON(0), | 204 | [apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK3288_PLL_CON(0), |
205 | RK3288_MODE_CON, 0, 6, rk3288_pll_rates), | 205 | RK3288_MODE_CON, 0, 6, 0, rk3288_pll_rates), |
206 | [dpll] = PLL(pll_rk3066, PLL_DPLL, "dpll", mux_pll_p, 0, RK3288_PLL_CON(4), | 206 | [dpll] = PLL(pll_rk3066, PLL_DPLL, "dpll", mux_pll_p, 0, RK3288_PLL_CON(4), |
207 | RK3288_MODE_CON, 4, 5, NULL), | 207 | RK3288_MODE_CON, 4, 5, 0, NULL), |
208 | [cpll] = PLL(pll_rk3066, PLL_CPLL, "cpll", mux_pll_p, 0, RK3288_PLL_CON(8), | 208 | [cpll] = PLL(pll_rk3066, PLL_CPLL, "cpll", mux_pll_p, 0, RK3288_PLL_CON(8), |
209 | RK3288_MODE_CON, 8, 7, rk3288_pll_rates), | 209 | RK3288_MODE_CON, 8, 7, 0, rk3288_pll_rates), |
210 | [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK3288_PLL_CON(12), | 210 | [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK3288_PLL_CON(12), |
211 | RK3288_MODE_CON, 12, 8, rk3288_pll_rates), | 211 | RK3288_MODE_CON, 12, 8, 0, rk3288_pll_rates), |
212 | [npll] = PLL(pll_rk3066, PLL_NPLL, "npll", mux_pll_p, 0, RK3288_PLL_CON(16), | 212 | [npll] = PLL(pll_rk3066, PLL_NPLL, "npll", mux_pll_p, 0, RK3288_PLL_CON(16), |
213 | RK3288_MODE_CON, 14, 9, rk3288_pll_rates), | 213 | RK3288_MODE_CON, 14, 9, 0, rk3288_pll_rates), |
214 | }; | 214 | }; |
215 | 215 | ||
216 | static struct clk_div_table div_hclk_cpu_t[] = { | 216 | static struct clk_div_table div_hclk_cpu_t[] = { |
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index dec6f8d6dc13..3b8f26e2cd1a 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c | |||
@@ -199,7 +199,8 @@ void __init rockchip_clk_register_plls(struct rockchip_pll_clock *list, | |||
199 | list->parent_names, list->num_parents, | 199 | list->parent_names, list->num_parents, |
200 | reg_base, list->con_offset, grf_lock_offset, | 200 | reg_base, list->con_offset, grf_lock_offset, |
201 | list->lock_shift, list->mode_offset, | 201 | list->lock_shift, list->mode_offset, |
202 | list->mode_shift, list->rate_table, &clk_lock); | 202 | list->mode_shift, list->rate_table, |
203 | list->pll_flags, &clk_lock); | ||
203 | if (IS_ERR(clk)) { | 204 | if (IS_ERR(clk)) { |
204 | pr_err("%s: failed to register clock %s\n", __func__, | 205 | pr_err("%s: failed to register clock %s\n", __func__, |
205 | list->name); | 206 | list->name); |
diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h index 6baf6655b5c3..eefd39a3820b 100644 --- a/drivers/clk/rockchip/clk.h +++ b/drivers/clk/rockchip/clk.h | |||
@@ -90,6 +90,7 @@ struct rockchip_pll_rate_table { | |||
90 | * @mode_shift: offset inside the mode-register for the mode of this pll. | 90 | * @mode_shift: offset inside the mode-register for the mode of this pll. |
91 | * @lock_shift: offset inside the lock register for the lock status. | 91 | * @lock_shift: offset inside the lock register for the lock status. |
92 | * @type: Type of PLL to be registered. | 92 | * @type: Type of PLL to be registered. |
93 | * @pll_flags: hardware-specific flags | ||
93 | * @rate_table: Table of usable pll rates | 94 | * @rate_table: Table of usable pll rates |
94 | */ | 95 | */ |
95 | struct rockchip_pll_clock { | 96 | struct rockchip_pll_clock { |
@@ -103,11 +104,12 @@ struct rockchip_pll_clock { | |||
103 | int mode_shift; | 104 | int mode_shift; |
104 | int lock_shift; | 105 | int lock_shift; |
105 | enum rockchip_pll_type type; | 106 | enum rockchip_pll_type type; |
107 | u8 pll_flags; | ||
106 | struct rockchip_pll_rate_table *rate_table; | 108 | struct rockchip_pll_rate_table *rate_table; |
107 | }; | 109 | }; |
108 | 110 | ||
109 | #define PLL(_type, _id, _name, _pnames, _flags, _con, _mode, _mshift, \ | 111 | #define PLL(_type, _id, _name, _pnames, _flags, _con, _mode, _mshift, \ |
110 | _lshift, _rtable) \ | 112 | _lshift, _pflags, _rtable) \ |
111 | { \ | 113 | { \ |
112 | .id = _id, \ | 114 | .id = _id, \ |
113 | .type = _type, \ | 115 | .type = _type, \ |
@@ -119,6 +121,7 @@ struct rockchip_pll_clock { | |||
119 | .mode_offset = _mode, \ | 121 | .mode_offset = _mode, \ |
120 | .mode_shift = _mshift, \ | 122 | .mode_shift = _mshift, \ |
121 | .lock_shift = _lshift, \ | 123 | .lock_shift = _lshift, \ |
124 | .pll_flags = _pflags, \ | ||
122 | .rate_table = _rtable, \ | 125 | .rate_table = _rtable, \ |
123 | } | 126 | } |
124 | 127 | ||
@@ -127,7 +130,7 @@ struct clk *rockchip_clk_register_pll(enum rockchip_pll_type pll_type, | |||
127 | void __iomem *base, int con_offset, int grf_lock_offset, | 130 | void __iomem *base, int con_offset, int grf_lock_offset, |
128 | int lock_shift, int reg_mode, int mode_shift, | 131 | int lock_shift, int reg_mode, int mode_shift, |
129 | struct rockchip_pll_rate_table *rate_table, | 132 | struct rockchip_pll_rate_table *rate_table, |
130 | spinlock_t *lock); | 133 | u8 clk_pll_flags, spinlock_t *lock); |
131 | 134 | ||
132 | struct rockchip_cpuclk_clksel { | 135 | struct rockchip_cpuclk_clksel { |
133 | int reg; | 136 | int reg; |