From: Omar Ramirez Luna <omar.luna@linaro.org>
To: Benoit Cousson <b-cousson@ti.com>, Paul Walmsley <paul@pwsan.com>,
Kevin Hilman <khilman@ti.com>
Cc: Tony Lindgren <tony@atomide.com>,
Russell King <linux@arm.linux.org.uk>,
Ohad Ben-Cohen <ohad@wizery.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Omar Ramirez Luna <omar.luna@linaro.org>
Subject: [PATCH 2/3] ARM: OMAP: hwmod: revise deassert sequence
Date: Fri, 15 Jun 2012 20:54:40 -0500 [thread overview]
Message-ID: <1339811681-5256-3-git-send-email-omar.luna@linaro.org> (raw)
In-Reply-To: <1339811681-5256-1-git-send-email-omar.luna@linaro.org>
For a reset sequence to complete cleanly, a module needs its
associated clocks to be enabled, otherwise the timeout check
in prcm code can print a false failure (failed to hardreset)
that occurs because the clocks aren't powered ON and the status
bit checked can't transition without them.
Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org>
---
arch/arm/mach-omap2/omap_hwmod.c | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 5f0811a..8a7e5bc 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1472,7 +1472,7 @@ static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
{
struct omap_hwmod_rst_info ohri;
- int ret;
+ int ret, hwsup = 0;
if (!oh)
return -EINVAL;
@@ -1481,6 +1481,23 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
if (IS_ERR_VALUE(ret))
return ret;
+ if (oh->clkdm) {
+ /*
+ * A clockdomain must be in SW_SUP otherwise reset
+ * might not be completed. The clockdomain can be set
+ * in HW_AUTO only when the module become ready.
+ */
+ hwsup = clkdm_in_hwsup(oh->clkdm);
+ ret = clkdm_hwmod_enable(oh->clkdm, oh);
+ if (ret) {
+ WARN(1, "omap_hwmod: %s: could not enable clockdomain %s: %d\n",
+ oh->name, oh->clkdm->name, ret);
+ return ret;
+ }
+ }
+
+ _enable_clocks(oh);
+
if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
ret = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs,
ohri.rst_shift,
@@ -1497,9 +1514,23 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
return -EINVAL;
}
+ _disable_clocks(oh);
+
if (ret == -EBUSY)
pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name);
+ if (!ret) {
+ /*
+ * Set the clockdomain to HW_AUTO, assuming that the
+ * previous state was HW_AUTO.
+ */
+ if (oh->clkdm && hwsup)
+ clkdm_allow_idle(oh->clkdm);
+ } else {
+ if (oh->clkdm)
+ clkdm_hwmod_disable(oh->clkdm, oh);
+ }
+
return ret;
}
--
1.7.4.1
next prev parent reply other threads:[~2012-06-16 1:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-16 1:54 [PATCH 0/3] OMAP: hwmod: reset API proposal Omar Ramirez Luna
2012-06-16 1:54 ` [PATCH 1/3] ARM: OMAP: hwmod: partially un-reset hwmods might not be properly enabled Omar Ramirez Luna
2012-06-16 1:54 ` Omar Ramirez Luna [this message]
2012-06-16 1:54 ` [PATCH 3/3] ARM: OMAP: omap_device: expose hwmod assert/deassert to omap devices Omar Ramirez Luna
2012-06-28 1:23 ` [PATCH 0/3] OMAP: hwmod: reset API proposal Omar Ramirez Luna
-- strict thread matches above, loose matches on Subject: below --
2012-07-16 19:21 Omar Ramirez Luna
2012-07-16 19:21 ` [PATCH 2/3] ARM: OMAP: hwmod: revise deassert sequence Omar Ramirez Luna
2012-08-02 7:52 ` Paul Walmsley
2012-08-02 22:20 ` Omar Ramirez Luna
2012-08-03 5:24 ` Vaibhav Hiremath
2012-08-03 15:52 ` Omar Ramirez Luna
2012-08-20 10:21 ` Benoit Cousson
2012-08-21 1:15 ` Omar Ramirez Luna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339811681-5256-3-git-send-email-omar.luna@linaro.org \
--to=omar.luna@linaro.org \
--cc=b-cousson@ti.com \
--cc=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=ohad@wizery.com \
--cc=paul@pwsan.com \
--cc=tomi.valkeinen@ti.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).