Felipe,<br><br><div class="gmail_quote">On Wed, Sep 19, 2012 at 6:53 AM, Felipe Balbi <span dir="ltr"><<a href="mailto:balbi@ti.com" target="_blank">balbi@ti.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<div class="im"><br>
On Wed, Sep 19, 2012 at 05:00:27PM +0530, Kishon Vijay Abraham I wrote:<br>
> From: Moiz Sonasath <<a href="mailto:m-sonasath@ti.com">m-sonasath@ti.com</a>><br>
><br>
> For the gadget pullup functionality to work in<br>
> SS mode it requires a particular sequence of<br>
> toggling the run-stop bit. Here is the required<br>
> sequence:<br>
><br>
> - Set DCTL[31]<br>
> - Clear DCTL[31]<br>
> - Clear OMAP5430_CONTROL_CORE__PHY_POWER_USB[14]<br>
> - Clear DCTL[8:5] = 0x00<br>
> - Set DCTL[8:5] = 0x05<br>
> - Wait 25 Ms<br>
> - Set DCTL[31]<br>
> - Set OMAP5430_CONTROL_CORE__PHY_POWER_USB[14]<br>
><br>
> Tested rigourously the gadget pull-up functionality<br>
> in bot HS and SS modes.<br>
><br>
> Signed-off-by: Moiz Sonasath <<a href="mailto:m-sonasath@ti.com">m-sonasath@ti.com</a>><br>
> Signed-off-by: Kishon Vijay Abraham I <<a href="mailto:kishon@ti.com">kishon@ti.com</a>><br>
<br>
</div>this needs to split into three patches:<br>
<br>
add new poweron field, implement it on omap-usb3, use it on<br>
dwc3/gadget.c<br>
<br>
btw, I don't think the changes to run_stop bit are necessary and if they<br>
are, that'd either be a silicon errata or it would've been mentioned on<br>
the databook. I don't remember seeing that on the databook so I'm<br>
assuming that this is caused by a bad use of the PHY.<br>
<br>
Why that mdelay(25) ? why 25 ms ? That's quite a long time, actually.<br></blockquote><div><br>Felipe, This is infact a HW bug that the Si-Val team did accept and gave us this workaround sequence with the precise delay :-)<br>
<br>Supposedly this will be fixed in ES 2.0.<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div class="h5"><br>
> ---<br>
>  drivers/usb/dwc3/gadget.c   |   21 +++++++++++++++------<br>
>  drivers/usb/phy/omap-usb3.c |   16 ++++++++++++++++<br>
>  include/linux/usb/phy.h     |   10 +++++++++-<br>
>  3 files changed, 40 insertions(+), 7 deletions(-)<br>
><br>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c<br>
> index 58fdfad..bcc0102 100644<br>
> --- a/drivers/usb/dwc3/gadget.c<br>
> +++ b/drivers/usb/dwc3/gadget.c<br>
> @@ -49,6 +49,7 @@<br>
><br>
>  #include <linux/usb/ch9.h><br>
>  #include <linux/usb/gadget.h><br>
> +#include <linux/usb/otg.h><br>
><br>
>  #include "core.h"<br>
>  #include "gadget.h"<br>
> @@ -1417,19 +1418,27 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on)<br>
>       reg = dwc3_readl(dwc->regs, DWC3_DCTL);<br>
>       if (is_on) {<br>
>               if (dwc->revision <= DWC3_REVISION_187A) {<br>
> -                     reg &= ~DWC3_DCTL_TRGTULST_MASK;<br>
> -                     reg |= DWC3_DCTL_TRGTULST_RX_DET;<br>
> +                     reg &= ~DWC3_DCTL_ULSTCHNGREQ_MASK;<br>
> +                     dwc3_writel(dwc->regs, DWC3_DCTL, reg);<br>
> +                     reg |= DWC3_DCTL_ULSTCHNG_RX_DETECT;<br>
> +                     dwc3_writel(dwc->regs, DWC3_DCTL, reg);<br>
> +                     mdelay(25);<br>
> +                     reg |= DWC3_DCTL_RUN_STOP;<br>
> +                     dwc3_writel(dwc->regs, DWC3_DCTL, reg);<br>
> +                     usb_phy_poweron(dwc->usb3_phy);<br>
>               }<br>
><br>
> -             if (dwc->revision >= DWC3_REVISION_194A)<br>
> +             if (dwc->revision >= DWC3_REVISION_194A) {<br>
>                       reg &= ~DWC3_DCTL_KEEP_CONNECT;<br>
> -             reg |= DWC3_DCTL_RUN_STOP;<br>
> +                     reg |= DWC3_DCTL_RUN_STOP;<br>
> +                     dwc3_writel(dwc->regs, DWC3_DCTL, reg);<br>
> +             }<br>
>       } else {<br>
>               reg &= ~DWC3_DCTL_RUN_STOP;<br>
> +             dwc3_writel(dwc->regs, DWC3_DCTL, reg);<br>
> +             usb_phy_shutdown(dwc->usb3_phy);<br>
>       }<br>
><br>
> -     dwc3_writel(dwc->regs, DWC3_DCTL, reg);<br>
<br>
</div></div>I'd prefer to hold all values on the variable and write only one.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
balbi<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Regards<br>Moiz Sonasath<br>Android Kernel Team<br><br>