From: Felipe Balbi <balbi@ti.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: grant.likely@secretlab.ca, rob.herring@calxeda.com,
rob@landley.net, linux@arm.linux.org.uk, balbi@ti.com,
linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Moiz Sonasath <m-sonasath@ti.com>
Subject: Re: [PATCH 2/4] usb: dwc3: Fix gadget pullup in SS mode
Date: Wed, 19 Sep 2012 14:53:10 +0300 [thread overview]
Message-ID: <20120919115306.GG3772@arwen.pp.htv.fi> (raw)
In-Reply-To: <1348054229-27362-3-git-send-email-kishon@ti.com>
[-- Attachment #1: Type: text/plain, Size: 2909 bytes --]
Hi,
On Wed, Sep 19, 2012 at 05:00:27PM +0530, Kishon Vijay Abraham I wrote:
> From: Moiz Sonasath <m-sonasath@ti.com>
>
> For the gadget pullup functionality to work in
> SS mode it requires a particular sequence of
> toggling the run-stop bit. Here is the required
> sequence:
>
> - Set DCTL[31]
> - Clear DCTL[31]
> - Clear OMAP5430_CONTROL_CORE__PHY_POWER_USB[14]
> - Clear DCTL[8:5] = 0x00
> - Set DCTL[8:5] = 0x05
> - Wait 25 Ms
> - Set DCTL[31]
> - Set OMAP5430_CONTROL_CORE__PHY_POWER_USB[14]
>
> Tested rigourously the gadget pull-up functionality
> in bot HS and SS modes.
>
> Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
this needs to split into three patches:
add new poweron field, implement it on omap-usb3, use it on
dwc3/gadget.c
btw, I don't think the changes to run_stop bit are necessary and if they
are, that'd either be a silicon errata or it would've been mentioned on
the databook. I don't remember seeing that on the databook so I'm
assuming that this is caused by a bad use of the PHY.
Why that mdelay(25) ? why 25 ms ? That's quite a long time, actually.
> ---
> drivers/usb/dwc3/gadget.c | 21 +++++++++++++++------
> drivers/usb/phy/omap-usb3.c | 16 ++++++++++++++++
> include/linux/usb/phy.h | 10 +++++++++-
> 3 files changed, 40 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 58fdfad..bcc0102 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -49,6 +49,7 @@
>
> #include <linux/usb/ch9.h>
> #include <linux/usb/gadget.h>
> +#include <linux/usb/otg.h>
>
> #include "core.h"
> #include "gadget.h"
> @@ -1417,19 +1418,27 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on)
> reg = dwc3_readl(dwc->regs, DWC3_DCTL);
> if (is_on) {
> if (dwc->revision <= DWC3_REVISION_187A) {
> - reg &= ~DWC3_DCTL_TRGTULST_MASK;
> - reg |= DWC3_DCTL_TRGTULST_RX_DET;
> + reg &= ~DWC3_DCTL_ULSTCHNGREQ_MASK;
> + dwc3_writel(dwc->regs, DWC3_DCTL, reg);
> + reg |= DWC3_DCTL_ULSTCHNG_RX_DETECT;
> + dwc3_writel(dwc->regs, DWC3_DCTL, reg);
> + mdelay(25);
> + reg |= DWC3_DCTL_RUN_STOP;
> + dwc3_writel(dwc->regs, DWC3_DCTL, reg);
> + usb_phy_poweron(dwc->usb3_phy);
> }
>
> - if (dwc->revision >= DWC3_REVISION_194A)
> + if (dwc->revision >= DWC3_REVISION_194A) {
> reg &= ~DWC3_DCTL_KEEP_CONNECT;
> - reg |= DWC3_DCTL_RUN_STOP;
> + reg |= DWC3_DCTL_RUN_STOP;
> + dwc3_writel(dwc->regs, DWC3_DCTL, reg);
> + }
> } else {
> reg &= ~DWC3_DCTL_RUN_STOP;
> + dwc3_writel(dwc->regs, DWC3_DCTL, reg);
> + usb_phy_shutdown(dwc->usb3_phy);
> }
>
> - dwc3_writel(dwc->regs, DWC3_DCTL, reg);
I'd prefer to hold all values on the variable and write only one.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-09-19 11:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-19 11:30 [PATCH 0/4] usb: phy: add usb3 phy driver Kishon Vijay Abraham I
2012-09-19 11:30 ` [PATCH 1/4] usb: phy: add a new driver for usb3 phy Kishon Vijay Abraham I
2012-09-19 14:41 ` Marc Kleine-Budde
2012-09-21 6:08 ` ABRAHAM, KISHON VIJAY
2012-10-11 0:59 ` Tony Lindgren
2012-10-12 9:08 ` kishon
2012-10-12 15:03 ` Tony Lindgren
2012-09-19 11:30 ` [PATCH 2/4] usb: dwc3: Fix gadget pullup in SS mode Kishon Vijay Abraham I
2012-09-19 11:53 ` Felipe Balbi [this message]
[not found] ` <CAEgRx2zOVn0zV39-cuPuj4n4HRgQmywy_NY4KTe0qEgeC+NEkw@mail.gmail.com>
2012-09-19 16:04 ` Felipe Balbi
[not found] ` <CAEgRx2yXStORBknr2hoMcobMO8wFGuKr4bvzZwEQHQQcHVH76Q@mail.gmail.com>
2012-09-19 17:24 ` Felipe Balbi
2012-09-19 17:29 ` Felipe Balbi
2012-09-19 11:30 ` [PATCH 3/4] usb: phy: omap-usb3: Decrease the number of transitions to recovery Kishon Vijay Abraham I
2012-09-19 11:55 ` Felipe Balbi
2012-09-19 11:30 ` [PATCH 4/4] usb: phy: omap-usb2: enable 960Mhz clock for omap5 Kishon Vijay Abraham I
2012-09-19 11:56 ` Felipe Balbi
2012-09-19 14:45 ` Marc Kleine-Budde
2012-09-19 14:42 ` Felipe Balbi
2012-09-19 14:50 ` Marc Kleine-Budde
2012-09-26 5:40 ` ABRAHAM, KISHON VIJAY
2012-09-26 18:27 ` Felipe Balbi
2012-09-27 5:13 ` ABRAHAM, KISHON VIJAY
2012-09-27 5:13 ` Felipe Balbi
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=20120919115306.GG3772@arwen.pp.htv.fi \
--to=balbi@ti.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m-sonasath@ti.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
/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).