Commit 9c8b0ec7 authored by Paul Walmsley's avatar Paul Walmsley

ARM: OMAP2+: hwmod: control all hardreset lines attached to a hwmod

Parts of the hwmod code test to see if a module has one and only one
hardreset line before taking an action.  It seems more appropriate
to control all hardreset lines associated with a hwmod, not just one.

It so happens that with the current hwmod data, this patch will not
change any behavior, since hwmods with hardreset lines have only one
hardreset line associated with them, and 'pseudo-hwmods' are used to
handle the other hardreset lines.  But future hwmod data patches to
remove the pseudo-hwmods will change this.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Cc: Benoît Cousson <b-cousson@ti.com>
parent 1f5e6247
...@@ -1480,6 +1480,11 @@ static int _reset(struct omap_hwmod *oh) ...@@ -1480,6 +1480,11 @@ static int _reset(struct omap_hwmod *oh)
pr_debug("omap_hwmod: %s: resetting\n", oh->name); pr_debug("omap_hwmod: %s: resetting\n", oh->name);
/*
* XXX We're not resetting modules with hardreset lines
* automatically here. Should we do this also, or just expect
* those modules to define custom reset functions?
*/
ret = (oh->class->reset) ? oh->class->reset(oh) : _ocp_softreset(oh); ret = (oh->class->reset) ? oh->class->reset(oh) : _ocp_softreset(oh);
if (oh->class->sysc) { if (oh->class->sysc) {
...@@ -1500,7 +1505,7 @@ static int _reset(struct omap_hwmod *oh) ...@@ -1500,7 +1505,7 @@ static int _reset(struct omap_hwmod *oh)
*/ */
static int _enable(struct omap_hwmod *oh) static int _enable(struct omap_hwmod *oh)
{ {
int r; int r, i;
int hwsup = 0; int hwsup = 0;
pr_debug("omap_hwmod: %s: enabling\n", oh->name); pr_debug("omap_hwmod: %s: enabling\n", oh->name);
...@@ -1532,15 +1537,15 @@ static int _enable(struct omap_hwmod *oh) ...@@ -1532,15 +1537,15 @@ static int _enable(struct omap_hwmod *oh)
return -EINVAL; return -EINVAL;
} }
/* /*
* If an IP contains only one HW reset line, then de-assert it in order * If an IP contains HW reset lines, then de-assert them in order
* to allow the module state transition. Otherwise the PRCM will return * to allow the module state transition. Otherwise the PRCM will return
* Intransition status, and the init will failed. * Intransition status, and the init will failed.
*/ */
if ((oh->_state == _HWMOD_STATE_INITIALIZED || if (oh->_state == _HWMOD_STATE_INITIALIZED ||
oh->_state == _HWMOD_STATE_DISABLED) && oh->rst_lines_cnt == 1) oh->_state == _HWMOD_STATE_DISABLED)
_deassert_hardreset(oh, oh->rst_lines[0].name); for (i = 0; i < oh->rst_lines_cnt; i++)
_deassert_hardreset(oh, oh->rst_lines[i].name);
/* Mux pins for device runtime if populated */ /* Mux pins for device runtime if populated */
if (oh->mux && (!oh->mux->enabled || if (oh->mux && (!oh->mux->enabled ||
...@@ -1687,7 +1692,7 @@ int omap_hwmod_set_ocp_autoidle(struct omap_hwmod *oh, u8 autoidle) ...@@ -1687,7 +1692,7 @@ int omap_hwmod_set_ocp_autoidle(struct omap_hwmod *oh, u8 autoidle)
*/ */
static int _shutdown(struct omap_hwmod *oh) static int _shutdown(struct omap_hwmod *oh)
{ {
int ret; int ret, i;
u8 prev_state; u8 prev_state;
if (oh->_state != _HWMOD_STATE_IDLE && if (oh->_state != _HWMOD_STATE_IDLE &&
...@@ -1728,12 +1733,8 @@ static int _shutdown(struct omap_hwmod *oh) ...@@ -1728,12 +1733,8 @@ static int _shutdown(struct omap_hwmod *oh)
} }
/* XXX Should this code also force-disable the optional clocks? */ /* XXX Should this code also force-disable the optional clocks? */
/* for (i = 0; i < oh->rst_lines_cnt; i++)
* If an IP contains only one HW reset line, then assert it _assert_hardreset(oh, oh->rst_lines[i].name);
* after disabling the clocks and before shutting down the IP.
*/
if (oh->rst_lines_cnt == 1)
_assert_hardreset(oh, oh->rst_lines[0].name);
/* Mux pins to safe mode or use populated off mode values */ /* Mux pins to safe mode or use populated off mode values */
if (oh->mux) if (oh->mux)
...@@ -1786,7 +1787,7 @@ static int _setup(struct omap_hwmod *oh, void *data) ...@@ -1786,7 +1787,7 @@ static int _setup(struct omap_hwmod *oh, void *data)
* reset asserted. Exit without warning because that behavior is * reset asserted. Exit without warning because that behavior is
* expected. * expected.
*/ */
if ((oh->flags & HWMOD_INIT_NO_RESET) && oh->rst_lines_cnt == 1) if ((oh->flags & HWMOD_INIT_NO_RESET) && oh->rst_lines_cnt > 0)
return 0; return 0;
r = _enable(oh); r = _enable(oh);
......
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