aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-10-27 11:39:23 -0400
committerTony Lindgren <tony@atomide.com>2014-10-27 11:39:23 -0400
commit9907f85eb27d98c2184a56f3b636cb82536807a0 (patch)
tree15b7771a6bb7f686f2be9bfc7bed0d32fa4c5318 /arch
parent9002e921aa9a97de9de86fad34917c573dfc822b (diff)
ARM: AM33xx/OMAP4+: CM: remove cdoffs parameter from wait_module_idle/ready
This is not needed for anything. This also eases the consolidation of the wait_module_ready / wait_module_idle calls behind a generic CM driver API by reducing the number of needed parameters. Signed-off-by: Tero Kristo <t-kristo@ti.com> Tested-by: Nishanth Menon <nm@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/cm33xx.c18
-rw-r--r--arch/arm/mach-omap2/cm33xx.h13
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c19
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h5
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c4
5 files changed, 21 insertions, 38 deletions
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index b3f99e93def0..ef9e9018f4d5 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -96,13 +96,12 @@ static inline u32 am33xx_cm_read_reg_bits(u16 inst, s16 idx, u32 mask)
96/** 96/**
97 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield 97 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield
98 * @inst: CM instance register offset (*_INST macro) 98 * @inst: CM instance register offset (*_INST macro)
99 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
100 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 99 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
101 * 100 *
102 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to 101 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
103 * bit 0. 102 * bit 0.
104 */ 103 */
105static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 clkctrl_offs) 104static u32 _clkctrl_idlest(u16 inst, u16 clkctrl_offs)
106{ 105{
107 u32 v = am33xx_cm_read_reg(inst, clkctrl_offs); 106 u32 v = am33xx_cm_read_reg(inst, clkctrl_offs);
108 v &= AM33XX_IDLEST_MASK; 107 v &= AM33XX_IDLEST_MASK;
@@ -113,17 +112,16 @@ static u32 _clkctrl_idlest(u16 inst, s16 cdoffs, u16 clkctrl_offs)
113/** 112/**
114 * _is_module_ready - can module registers be accessed without causing an abort? 113 * _is_module_ready - can module registers be accessed without causing an abort?
115 * @inst: CM instance register offset (*_INST macro) 114 * @inst: CM instance register offset (*_INST macro)
116 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
117 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 115 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
118 * 116 *
119 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either 117 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
120 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise. 118 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
121 */ 119 */
122static bool _is_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs) 120static bool _is_module_ready(u16 inst, u16 clkctrl_offs)
123{ 121{
124 u32 v; 122 u32 v;
125 123
126 v = _clkctrl_idlest(inst, cdoffs, clkctrl_offs); 124 v = _clkctrl_idlest(inst, clkctrl_offs);
127 125
128 return (v == CLKCTRL_IDLEST_FUNCTIONAL || 126 return (v == CLKCTRL_IDLEST_FUNCTIONAL ||
129 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false; 127 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false;
@@ -229,7 +227,6 @@ void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs)
229/** 227/**
230 * am33xx_cm_wait_module_ready - wait for a module to be in 'func' state 228 * am33xx_cm_wait_module_ready - wait for a module to be in 'func' state
231 * @inst: CM instance register offset (*_INST macro) 229 * @inst: CM instance register offset (*_INST macro)
232 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
233 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 230 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
234 * 231 *
235 * Wait for the module IDLEST to be functional. If the idle state is in any 232 * Wait for the module IDLEST to be functional. If the idle state is in any
@@ -237,11 +234,11 @@ void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs)
237 * sysconfig cannot be accessed and will probably lead to an "imprecise 234 * sysconfig cannot be accessed and will probably lead to an "imprecise
238 * external abort" 235 * external abort"
239 */ 236 */
240int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs) 237int am33xx_cm_wait_module_ready(u16 inst, u16 clkctrl_offs)
241{ 238{
242 int i = 0; 239 int i = 0;
243 240
244 omap_test_timeout(_is_module_ready(inst, cdoffs, clkctrl_offs), 241 omap_test_timeout(_is_module_ready(inst, clkctrl_offs),
245 MAX_MODULE_READY_TIME, i); 242 MAX_MODULE_READY_TIME, i);
246 243
247 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 244 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
@@ -251,21 +248,20 @@ int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs, u16 clkctrl_offs)
251 * am33xx_cm_wait_module_idle - wait for a module to be in 'disabled' 248 * am33xx_cm_wait_module_idle - wait for a module to be in 'disabled'
252 * state 249 * state
253 * @inst: CM instance register offset (*_INST macro) 250 * @inst: CM instance register offset (*_INST macro)
254 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
255 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 251 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
256 * 252 *
257 * Wait for the module IDLEST to be disabled. Some PRCM transition, 253 * Wait for the module IDLEST to be disabled. Some PRCM transition,
258 * like reset assertion or parent clock de-activation must wait the 254 * like reset assertion or parent clock de-activation must wait the
259 * module to be fully disabled. 255 * module to be fully disabled.
260 */ 256 */
261int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, u16 clkctrl_offs) 257int am33xx_cm_wait_module_idle(u16 inst, u16 clkctrl_offs)
262{ 258{
263 int i = 0; 259 int i = 0;
264 260
265 if (!clkctrl_offs) 261 if (!clkctrl_offs)
266 return 0; 262 return 0;
267 263
268 omap_test_timeout((_clkctrl_idlest(inst, cdoffs, clkctrl_offs) == 264 omap_test_timeout((_clkctrl_idlest(inst, clkctrl_offs) ==
269 CLKCTRL_IDLEST_DISABLED), 265 CLKCTRL_IDLEST_DISABLED),
270 MAX_MODULE_READY_TIME, i); 266 MAX_MODULE_READY_TIME, i);
271 267
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index bd2441790779..1771fc17fd8c 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -381,17 +381,14 @@ void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs);
381void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs); 381void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs);
382 382
383#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) 383#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
384extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, 384int am33xx_cm_wait_module_idle(u16 inst, u16 clkctrl_offs);
385 u16 clkctrl_offs);
386extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, 385extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
387 u16 clkctrl_offs); 386 u16 clkctrl_offs);
388extern void am33xx_cm_module_disable(u16 inst, s16 cdoffs, 387extern void am33xx_cm_module_disable(u16 inst, s16 cdoffs,
389 u16 clkctrl_offs); 388 u16 clkctrl_offs);
390extern int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs, 389int am33xx_cm_wait_module_ready(u16 inst, u16 clkctrl_offs);
391 u16 clkctrl_offs);
392#else 390#else
393static inline int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, 391static inline int am33xx_cm_wait_module_idle(u16 inst, u16 clkctrl_offs)
394 u16 clkctrl_offs)
395{ 392{
396 return 0; 393 return 0;
397} 394}
@@ -403,8 +400,8 @@ static inline void am33xx_cm_module_disable(u16 inst, s16 cdoffs,
403 u16 clkctrl_offs) 400 u16 clkctrl_offs)
404{ 401{
405} 402}
406static inline int am33xx_cm_wait_module_ready(u16 inst, s16 cdoffs, 403
407 u16 clkctrl_offs) 404static inline int am33xx_cm_wait_module_ready(u16 inst, u16 clkctrl_offs)
408{ 405{
409 return 0; 406 return 0;
410} 407}
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 12aca56942c0..7e6970af1d66 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -78,13 +78,12 @@ void omap_cm_base_init(void)
78 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield 78 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield
79 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 79 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
80 * @inst: CM instance register offset (*_INST macro) 80 * @inst: CM instance register offset (*_INST macro)
81 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
82 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 81 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
83 * 82 *
84 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to 83 * Return the IDLEST bitfield of a CM_*_CLKCTRL register, shifted down to
85 * bit 0. 84 * bit 0.
86 */ 85 */
87static u32 _clkctrl_idlest(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs) 86static u32 _clkctrl_idlest(u8 part, u16 inst, u16 clkctrl_offs)
88{ 87{
89 u32 v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs); 88 u32 v = omap4_cminst_read_inst_reg(part, inst, clkctrl_offs);
90 v &= OMAP4430_IDLEST_MASK; 89 v &= OMAP4430_IDLEST_MASK;
@@ -96,17 +95,16 @@ static u32 _clkctrl_idlest(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs)
96 * _is_module_ready - can module registers be accessed without causing an abort? 95 * _is_module_ready - can module registers be accessed without causing an abort?
97 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 96 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
98 * @inst: CM instance register offset (*_INST macro) 97 * @inst: CM instance register offset (*_INST macro)
99 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
100 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 98 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
101 * 99 *
102 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either 100 * Returns true if the module's CM_*_CLKCTRL.IDLEST bitfield is either
103 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise. 101 * *FUNCTIONAL or *INTERFACE_IDLE; false otherwise.
104 */ 102 */
105static bool _is_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs) 103static bool _is_module_ready(u8 part, u16 inst, u16 clkctrl_offs)
106{ 104{
107 u32 v; 105 u32 v;
108 106
109 v = _clkctrl_idlest(part, inst, cdoffs, clkctrl_offs); 107 v = _clkctrl_idlest(part, inst, clkctrl_offs);
110 108
111 return (v == CLKCTRL_IDLEST_FUNCTIONAL || 109 return (v == CLKCTRL_IDLEST_FUNCTIONAL ||
112 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false; 110 v == CLKCTRL_IDLEST_INTERFACE_IDLE) ? true : false;
@@ -267,7 +265,6 @@ void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs)
267 * omap4_cminst_wait_module_ready - wait for a module to be in 'func' state 265 * omap4_cminst_wait_module_ready - wait for a module to be in 'func' state
268 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 266 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
269 * @inst: CM instance register offset (*_INST macro) 267 * @inst: CM instance register offset (*_INST macro)
270 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
271 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 268 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
272 * 269 *
273 * Wait for the module IDLEST to be functional. If the idle state is in any 270 * Wait for the module IDLEST to be functional. If the idle state is in any
@@ -275,15 +272,14 @@ void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs)
275 * sysconfig cannot be accessed and will probably lead to an "imprecise 272 * sysconfig cannot be accessed and will probably lead to an "imprecise
276 * external abort" 273 * external abort"
277 */ 274 */
278int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, 275int omap4_cminst_wait_module_ready(u8 part, u16 inst, u16 clkctrl_offs)
279 u16 clkctrl_offs)
280{ 276{
281 int i = 0; 277 int i = 0;
282 278
283 if (!clkctrl_offs) 279 if (!clkctrl_offs)
284 return 0; 280 return 0;
285 281
286 omap_test_timeout(_is_module_ready(part, inst, cdoffs, clkctrl_offs), 282 omap_test_timeout(_is_module_ready(part, inst, clkctrl_offs),
287 MAX_MODULE_READY_TIME, i); 283 MAX_MODULE_READY_TIME, i);
288 284
289 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 285 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
@@ -294,21 +290,20 @@ int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs,
294 * state 290 * state
295 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 291 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
296 * @inst: CM instance register offset (*_INST macro) 292 * @inst: CM instance register offset (*_INST macro)
297 * @cdoffs: Clockdomain register offset (*_CDOFFS macro)
298 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro) 293 * @clkctrl_offs: Module clock control register offset (*_CLKCTRL macro)
299 * 294 *
300 * Wait for the module IDLEST to be disabled. Some PRCM transition, 295 * Wait for the module IDLEST to be disabled. Some PRCM transition,
301 * like reset assertion or parent clock de-activation must wait the 296 * like reset assertion or parent clock de-activation must wait the
302 * module to be fully disabled. 297 * module to be fully disabled.
303 */ 298 */
304int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs) 299int omap4_cminst_wait_module_idle(u8 part, u16 inst, u16 clkctrl_offs)
305{ 300{
306 int i = 0; 301 int i = 0;
307 302
308 if (!clkctrl_offs) 303 if (!clkctrl_offs)
309 return 0; 304 return 0;
310 305
311 omap_test_timeout((_clkctrl_idlest(part, inst, cdoffs, clkctrl_offs) == 306 omap_test_timeout((_clkctrl_idlest(part, inst, clkctrl_offs) ==
312 CLKCTRL_IDLEST_DISABLED), 307 CLKCTRL_IDLEST_DISABLED),
313 MAX_MODULE_DISABLE_TIME, i); 308 MAX_MODULE_DISABLE_TIME, i);
314 309
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index 7f56ea444bc4..67a05f9f9eab 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -16,9 +16,8 @@ void omap4_cminst_clkdm_enable_hwsup(u8 part, u16 inst, u16 cdoffs);
16void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs); 16void omap4_cminst_clkdm_disable_hwsup(u8 part, u16 inst, u16 cdoffs);
17void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs); 17void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs);
18void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs); 18void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs);
19extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs); 19int omap4_cminst_wait_module_ready(u8 part, u16 inst, u16 clkctrl_offs);
20extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, 20int omap4_cminst_wait_module_idle(u8 part, u16 inst, u16 clkctrl_offs);
21 u16 clkctrl_offs);
22extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs, 21extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
23 u16 clkctrl_offs); 22 u16 clkctrl_offs);
24extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs, 23extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 67bf7274ce89..2dca1a896943 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1028,7 +1028,6 @@ static int _omap4_wait_target_disable(struct omap_hwmod *oh)
1028 1028
1029 return omap4_cminst_wait_module_idle(oh->clkdm->prcm_partition, 1029 return omap4_cminst_wait_module_idle(oh->clkdm->prcm_partition,
1030 oh->clkdm->cm_inst, 1030 oh->clkdm->cm_inst,
1031 oh->clkdm->clkdm_offs,
1032 oh->prcm.omap4.clkctrl_offs); 1031 oh->prcm.omap4.clkctrl_offs);
1033} 1032}
1034 1033
@@ -1053,7 +1052,6 @@ static int _am33xx_wait_target_disable(struct omap_hwmod *oh)
1053 return 0; 1052 return 0;
1054 1053
1055 return am33xx_cm_wait_module_idle(oh->clkdm->cm_inst, 1054 return am33xx_cm_wait_module_idle(oh->clkdm->cm_inst,
1056 oh->clkdm->clkdm_offs,
1057 oh->prcm.omap4.clkctrl_offs); 1055 oh->prcm.omap4.clkctrl_offs);
1058} 1056}
1059 1057
@@ -2977,7 +2975,6 @@ static int _omap4_wait_target_ready(struct omap_hwmod *oh)
2977 2975
2978 return omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition, 2976 return omap4_cminst_wait_module_ready(oh->clkdm->prcm_partition,
2979 oh->clkdm->cm_inst, 2977 oh->clkdm->cm_inst,
2980 oh->clkdm->clkdm_offs,
2981 oh->prcm.omap4.clkctrl_offs); 2978 oh->prcm.omap4.clkctrl_offs);
2982} 2979}
2983 2980
@@ -3004,7 +3001,6 @@ static int _am33xx_wait_target_ready(struct omap_hwmod *oh)
3004 /* XXX check module SIDLEMODE, hardreset status */ 3001 /* XXX check module SIDLEMODE, hardreset status */
3005 3002
3006 return am33xx_cm_wait_module_ready(oh->clkdm->cm_inst, 3003 return am33xx_cm_wait_module_ready(oh->clkdm->cm_inst,
3007 oh->clkdm->clkdm_offs,
3008 oh->prcm.omap4.clkctrl_offs); 3004 oh->prcm.omap4.clkctrl_offs);
3009} 3005}
3010 3006