Commit f5dd3bb5 authored by Rajendra Nayak's avatar Rajendra Nayak Committed by Paul Walmsley

ARM: OMAP: hwmod: Fix up hwmod based clkdm accesses

hwmod uses deferencing the clk pointer to acccess the clkdm.
With COMMON clk hwoever this will need to be deferenced through
the clk_hw_omap pointer, so do the necessary changes.
Signed-off-by: default avatarRajendra Nayak <rnayak@ti.com>
Signed-off-by: default avatarMike Turquette <mturquette@ti.com>
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
parent b5a2366c
...@@ -130,7 +130,11 @@ ...@@ -130,7 +130,11 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/io.h> #include <linux/io.h>
#ifdef CONFIG_COMMON_CLK
#include <linux/clk-provider.h>
#else
#include <linux/clk.h> #include <linux/clk.h>
#endif
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -614,6 +618,23 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) ...@@ -614,6 +618,23 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
return 0; return 0;
} }
static struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
{
if (oh->clkdm) {
return oh->clkdm;
} else if (oh->_clk) {
#ifdef CONFIG_COMMON_CLK
struct clk_hw_omap *clk;
clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
return clk->clkdm;
#else
return oh->_clk->clkdm;
#endif
}
return NULL;
}
/** /**
* _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active
* @oh: struct omap_hwmod * * @oh: struct omap_hwmod *
...@@ -629,13 +650,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) ...@@ -629,13 +650,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
*/ */
static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
{ {
if (!oh->_clk) struct clockdomain *clkdm, *init_clkdm;
clkdm = _get_clkdm(oh);
init_clkdm = _get_clkdm(init_oh);
if (!clkdm || !init_clkdm)
return -EINVAL; return -EINVAL;
if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
return 0; return 0;
return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); return clkdm_add_sleepdep(clkdm, init_clkdm);
} }
/** /**
...@@ -653,13 +679,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) ...@@ -653,13 +679,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
*/ */
static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
{ {
if (!oh->_clk) struct clockdomain *clkdm, *init_clkdm;
clkdm = _get_clkdm(oh);
init_clkdm = _get_clkdm(init_oh);
if (!clkdm || !init_clkdm)
return -EINVAL; return -EINVAL;
if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
return 0; return 0;
return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); return clkdm_del_sleepdep(clkdm, init_clkdm);
} }
/** /**
...@@ -693,7 +724,7 @@ static int _init_main_clk(struct omap_hwmod *oh) ...@@ -693,7 +724,7 @@ static int _init_main_clk(struct omap_hwmod *oh)
*/ */
clk_prepare(oh->_clk); clk_prepare(oh->_clk);
if (!oh->_clk->clkdm) if (!_get_clkdm(oh))
pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n", pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n",
oh->name, oh->main_clk); oh->name, oh->main_clk);
...@@ -1276,6 +1307,7 @@ static void _enable_sysc(struct omap_hwmod *oh) ...@@ -1276,6 +1307,7 @@ static void _enable_sysc(struct omap_hwmod *oh)
u8 idlemode, sf; u8 idlemode, sf;
u32 v; u32 v;
bool clkdm_act; bool clkdm_act;
struct clockdomain *clkdm;
if (!oh->class->sysc) if (!oh->class->sysc)
return; return;
...@@ -1283,11 +1315,9 @@ static void _enable_sysc(struct omap_hwmod *oh) ...@@ -1283,11 +1315,9 @@ static void _enable_sysc(struct omap_hwmod *oh)
v = oh->_sysc_cache; v = oh->_sysc_cache;
sf = oh->class->sysc->sysc_flags; sf = oh->class->sysc->sysc_flags;
clkdm = _get_clkdm(oh);
if (sf & SYSC_HAS_SIDLEMODE) { if (sf & SYSC_HAS_SIDLEMODE) {
clkdm_act = ((oh->clkdm && clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU);
oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) ||
(oh->_clk && oh->_clk->clkdm &&
oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU));
if (clkdm_act && !(oh->class->sysc->idlemodes & if (clkdm_act && !(oh->class->sysc->idlemodes &
(SIDLE_SMART | SIDLE_SMART_WKUP))) (SIDLE_SMART | SIDLE_SMART_WKUP)))
idlemode = HWMOD_IDLEMODE_FORCE; idlemode = HWMOD_IDLEMODE_FORCE;
...@@ -3556,10 +3586,17 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) ...@@ -3556,10 +3586,17 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
{ {
struct clk *c; struct clk *c;
struct omap_hwmod_ocp_if *oi; struct omap_hwmod_ocp_if *oi;
struct clockdomain *clkdm;
#ifdef CONFIG_COMMON_CLK
struct clk_hw_omap *clk;
#endif
if (!oh) if (!oh)
return NULL; return NULL;
if (oh->clkdm)
return oh->clkdm->pwrdm.ptr;
if (oh->_clk) { if (oh->_clk) {
c = oh->_clk; c = oh->_clk;
} else { } else {
...@@ -3569,11 +3606,16 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) ...@@ -3569,11 +3606,16 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
c = oi->_clk; c = oi->_clk;
} }
if (!c->clkdm) #ifdef CONFIG_COMMON_CLK
clk = to_clk_hw_omap(__clk_get_hw(c));
clkdm = clk->clkdm;
#else
clkdm = c->clkdm;
#endif
if (!clkdm)
return NULL; return NULL;
return c->clkdm->pwrdm.ptr; return clkdm->pwrdm.ptr;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment