From: Roger Quadros <rogerq@ti.com>
To: <bcousson@baylibre.com>, <paul@pwsan.com>, <tony@atomide.com>
Cc: <tomi.valkeinen@ti.com>, <balbi@ti.com>, <sr@denx.de>,
<David.Laight@ACULAB.COM>, <michael@amarulasolutions.com>,
<bigeasy@linutronix.de>, <linux-omap@vger.kernel.org>,
<linux-usb@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com>
Subject: [PATCH 2/3] ARM: OMAP2+: hwmod: Fix RESET logic
Date: Tue, 3 Dec 2013 16:25:47 +0200 [thread overview]
Message-ID: <1386080748-17005-3-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1386080748-17005-1-git-send-email-rogerq@ti.com>
In _ocp_softreset(), after _set_softreset() + write_sysconfig(),
the hwmod's sysc_cache will always contain SOFTRESET bit set
so all further writes to sysconfig using this cache will initiate
a repeated SOFTRESET e.g. enable_sysc(). This is true for OMAP3 like
platforms that have RESET_DONE status in the SYSSTATUS register and
so the the SOFTRESET bit in SYSCONFIG is not automatically cleared.
It is not a problem for OMAP4 like platforms that indicate RESET
completion by clearing the SOFTRESET bit in the SYSCONFIG register.
This repeated SOFTRESET is undesired and was the root cause of
USB host issues on OMAP3 platforms when hwmod was allowed to do the
SOFTRESET for the USB Host module.
To fix this we clear the SOFTRESET bit and update the sysconfig
register + sysc_cache using write_sysconfig().
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 43 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index e3f0eca..615acec 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -399,7 +399,7 @@ static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v)
}
/**
- * _set_softreset: set OCP_SYSCONFIG.CLOCKACTIVITY bits in @v
+ * _set_softreset: set OCP_SYSCONFIG.SOFTRESET bit in @v
* @oh: struct omap_hwmod *
* @v: pointer to register contents to modify
*
@@ -427,6 +427,36 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v)
}
/**
+ * _clr_softreset: clear OCP_SYSCONFIG.SOFTRESET bit in @v
+ * @oh: struct omap_hwmod *
+ * @v: pointer to register contents to modify
+ *
+ * Clear the SOFTRESET bit in @v for hwmod @oh. Returns -EINVAL upon
+ * error or 0 upon success.
+ */
+static int _clr_softreset(struct omap_hwmod *oh, u32 *v)
+{
+ u32 softrst_mask;
+
+ if (!oh->class->sysc ||
+ !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET))
+ return -EINVAL;
+
+ if (!oh->class->sysc->sysc_fields) {
+ WARN(1,
+ "omap_hwmod: %s: sysc_fields absent for sysconfig class\n",
+ oh->name);
+ return -EINVAL;
+ }
+
+ softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);
+
+ *v &= ~softrst_mask;
+
+ return 0;
+}
+
+/**
* _wait_softreset_complete - wait for an OCP softreset to complete
* @oh: struct omap_hwmod * to wait on
*
@@ -1911,6 +1941,12 @@ static int _ocp_softreset(struct omap_hwmod *oh)
ret = _set_softreset(oh, &v);
if (ret)
goto dis_opt_clks;
+
+ _write_sysconfig(v, oh);
+ ret = _clr_softreset(oh, &v);
+ if (ret)
+ goto dis_opt_clks;
+
_write_sysconfig(v, oh);
if (oh->class->sysc->srst_udelay)
@@ -3169,6 +3205,11 @@ int omap_hwmod_softreset(struct omap_hwmod *oh)
goto error;
_write_sysconfig(v, oh);
+ ret = _clr_softreset(oh, &v);
+ if (ret)
+ goto error;
+ _write_sysconfig(v, oh);
+
error:
return ret;
}
--
1.8.3.2
next prev parent reply other threads:[~2013-12-03 14:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 14:25 [PATCH v2 0/3] ARM: OMAP2+: USB Host bug fixes for 3.13 rc Roger Quadros
2013-12-03 14:25 ` [PATCH 1/3] ARM: OMAP4+: hwmod data: Don't prevent RESET of USB Host module Roger Quadros
2013-12-09 1:26 ` Paul Walmsley
2013-12-09 1:58 ` Tony Lindgren
2013-12-09 2:15 ` Paul Walmsley
2013-12-09 17:52 ` Benoit Cousson
2013-12-03 14:25 ` Roger Quadros [this message]
2013-12-09 1:32 ` [PATCH 2/3] ARM: OMAP2+: hwmod: Fix RESET logic Paul Walmsley
2013-12-03 14:25 ` [PATCH 3/3] ARM: OMAP3: hwmod data: Don't prevent RESET of USB Host module Roger Quadros
2013-12-09 1:34 ` Paul Walmsley
2013-12-04 10:00 ` [PATCH v2 0/3] ARM: OMAP2+: USB Host bug fixes for 3.13 rc Tomi Valkeinen
2013-12-05 18:48 ` Tony Lindgren
2013-12-06 9:14 ` Roger Quadros
2013-12-09 1:35 ` Paul Walmsley
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=1386080748-17005-3-git-send-email-rogerq@ti.com \
--to=rogerq@ti.com \
--cc=David.Laight@ACULAB.COM \
--cc=balbi@ti.com \
--cc=bcousson@baylibre.com \
--cc=bigeasy@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael@amarulasolutions.com \
--cc=paul@pwsan.com \
--cc=sr@denx.de \
--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
all inboxes | Powered by JetHome®