From: Roger Quadros <rogerq@ti.com>
To: David Laight <David.Laight@ACULAB.COM>,
lee.jones@linaro.org, sameo@linux.intel.com
Cc: tomi.valkeinen@ti.com, balbi@ti.com, sr@denx.de,
ljkenny.mailinglists@gmail.com, linux-omap@vger.kernel.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 1/1] mfd: omap-usb-host: Fix USB device detection problems on OMAP4 Panda
Date: Mon, 2 Dec 2013 10:39:02 +0200 [thread overview]
Message-ID: <529C4726.6080708@ti.com> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B744D@saturn3.aculab.com>
Hi David,
On 11/29/2013 03:17 PM, David Laight wrote:
>> From: Of Roger Quadros
>> With u-boot 2013.10, USB devices are sometimes not detected
>> on OMAP4 Panda. To make us independent of what bootloader does
>> with the USB Host module, we must RESET it to get it to a known
>> good state. This patch Soft RESETs the USB Host module.
> ...
>> +++ b/drivers/mfd/omap-usb-host.c
>> @@ -43,14 +43,18 @@
>> /* UHH Register Set */
>> #define OMAP_UHH_REVISION (0x00)
>> #define OMAP_UHH_SYSCONFIG (0x10)
>> -#define OMAP_UHH_SYSCONFIG_MIDLEMODE (1 << 12)
>> +#define OMAP_UHH_SYSCONFIG_MIDLEMASK (3 << 12)
>> +#define OMAP_UHH_SYSCONFIG_MIDLESHIFT (12)
>
> (tab/space issue)
Weird, original code seems to use a tab instead of space after #define.
>
> Wouldn't it be clearer to define these in the opposite order with:
> +#define OMAP_UHH_SYSCONFIG_MIDLEMASK (3 << OMAP_UHH_SYSCONFIG_MIDLESHIFT)
Right.
>
> ...
>> +static void omap_usbhs_rev1_reset(struct device *dev)
>> +{
>> + struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
>> + u32 reg;
>> + unsigned long timeout;
>> +
>> + reg = usbhs_read(omap->uhh_base, OMAP_UHH_SYSCONFIG);
>> +
>> + /* Soft Reset */
>> + usbhs_write(omap->uhh_base, OMAP_UHH_SYSCONFIG,
>> + reg | OMAP_UHH_SYSCONFIG_SOFTRESET);
>> +
>> + timeout = jiffies + msecs_to_jiffies(100);
>> + while (!(usbhs_read(omap->uhh_base, OMAP_UHH_SYSSTATUS)
>> + & OMAP_UHH_SYSSTATUS_RESETDONE)) {
>> + cpu_relax();
You mean use msleep(1) here instead of cpu_relax()?
Shouldn't be a problem IMO, but can you please tell me why that is better
as the reset seems to complete usually in the first iteration.
>> +
>> + if (time_after(jiffies, timeout)) {
>> + dev_err(dev, "Soft RESET operation timed out\n");
>> + break;
>> + }
>> + }
>> +
>> + /* Set No-Standby */
>> + reg &= ~OMAP_UHH_SYSCONFIG_MIDLEMASK;
>> + reg |= OMAP_UHH_SYSCONFIG_MIDLE_NOSTANDBY
>> + << OMAP_UHH_SYSCONFIG_MIDLESHIFT;
>> +
>> + /* Set No-Idle */
>> + reg &= ~OMAP_UHH_SYSCONFIG_SIDLEMASK;
>> + reg |= OMAP_UHH_SYSCONFIG_SIDLE_NOIDLE
>> + << OMAP_UHH_SYSCONFIG_SIDLESHIFT;
>
> Why not pass in the mask and value and avoid replicating the
> entire function. I can't see any other significant differences,
> the udelay(2) won't be significant.
OK, I can pass the mask and value, but still there is a difference
in the way reset complete is checked between v1 and v2. But that
be in omap_usbhs_softreset() and the individual reset functions can be
replaced by a single omap_usbhs_set_sysconfig().
It seems the udelay() is not required for the USB Host module, so I'll
get rid of that.
>
> I'm not sure of the context this code runs in, but if the reset
> is likely to take a significant portion of the 100ms timeout
> period, why not just sleep for a few ms between status polls.
covered in the related code above.
cheers,
-roger
next prev parent reply other threads:[~2013-12-02 8:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 13:01 [PATCH 0/1] mfd: omap-usb-host: Bug fix for 3.13 rc Roger Quadros
2013-11-29 13:01 ` [PATCH 1/1] mfd: omap-usb-host: Fix USB device detection problems on OMAP4 Panda Roger Quadros
2013-11-29 13:17 ` David Laight
2013-12-02 8:39 ` Roger Quadros [this message]
2013-12-02 16:28 ` David Laight
2013-12-03 9:43 ` Roger Quadros
[not found] ` <1385730118-26402-2-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2013-11-29 15:32 ` Michael Trimarchi
2013-12-02 9:41 ` Roger Quadros
2013-12-02 12:01 ` Sebastian Andrzej Siewior
2013-12-02 12:12 ` Roger Quadros
2013-12-02 13:04 ` Sebastian Andrzej Siewior
2013-12-02 13:35 ` Roger Quadros
2013-12-02 13:39 ` Sebastian Andrzej Siewior
2013-12-02 13:44 ` Roger Quadros
[not found] ` <529C8ED0.6060805-l0cyMroinI0@public.gmane.org>
2013-12-02 14:03 ` Sebastian Andrzej Siewior
2013-12-02 15:12 ` Roger Quadros
2013-11-30 4:48 ` Michael Trimarchi
2013-11-30 5:10 ` Michael Trimarchi
2013-12-01 3:14 ` Michael Trimarchi
2013-12-02 9:39 ` Roger Quadros
2013-12-02 9:51 ` Michael Trimarchi
[not found] ` <CAOf5uwmpiOv_GED23hWDArcOvs6DpHNEy=OJ9vnKem1pg8jSgw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-12-02 12:05 ` Roger Quadros
2013-12-02 15:00 ` 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=529C4726.6080708@ti.com \
--to=rogerq@ti.com \
--cc=David.Laight@ACULAB.COM \
--cc=balbi@ti.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ljkenny.mailinglists@gmail.com \
--cc=sameo@linux.intel.com \
--cc=sr@denx.de \
--cc=stable@vger.kernel.org \
--cc=tomi.valkeinen@ti.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).