All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Liu <b-liu@ti.com>
To: Paul Cercueil <paul@crapouillou.net>, <od@zcrc.me>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: musb: Disable pullup in gadget setup
Date: Tue, 30 Apr 2019 10:10:43 -0500	[thread overview]
Message-ID: <20190430151043.GG20993@uda0271908> (raw)
In-Reply-To: <20190430150506.GF20993@uda0271908>

On Tue, Apr 30, 2019 at 10:05:06AM -0500, Bin Liu wrote:
> Hi Paul,
> 
> On Thu, Apr 04, 2019 at 11:10:46AM -0500, Bin Liu wrote:
> > On Thu, Apr 04, 2019 at 11:37:43AM +0200, Paul Cercueil wrote:
> > > The pullup may be already enabled before the driver is initialized.
> > > It has to be disabled at init time, as we cannot guarantee that a gadget
> > > driver will be bound to the UDC.
> > > 
> > > Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> > > ---
> > >  drivers/usb/musb/musb_gadget.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> > > index ffe462a657b1..094dc59c834c 100644
> > > --- a/drivers/usb/musb/musb_gadget.c
> > > +++ b/drivers/usb/musb/musb_gadget.c
> > > @@ -1794,6 +1794,7 @@ int musb_gadget_setup(struct musb *musb)
> > >  
> > >  	musb->is_active = 0;
> > >  	musb_platform_try_idle(musb, 0);
> > > +	musb_pullup(musb, 0);
> > >  
> > >  	status = usb_add_gadget_udc(musb->controller, &musb->g);
> > >  	if (status)
> > 
> > Applied.
> 
> Sorry, I have dropped this patch from my tree. I realized the gadget
> core already defines callbacks to control the pullup. I think the
> proper fix should be calling usb_udc_vbus_handler() in musb gadget or
> glue layers.

Basically besides the problem your patch tries to fix, there is another
problem related to the pullup, which is enabled right after bind a
gadget driver, regardless of vbus status. This violates the USB Spec.
Implementing the udc core callbacks should fix both issues.

-Bin.

WARNING: multiple messages have this Message-ID (diff)
From: Bin Liu <b-liu@ti.com>
To: Paul Cercueil <paul@crapouillou.net>,
	od@zcrc.me, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: usb: musb: Disable pullup in gadget setup
Date: Tue, 30 Apr 2019 10:10:43 -0500	[thread overview]
Message-ID: <20190430151043.GG20993@uda0271908> (raw)

On Tue, Apr 30, 2019 at 10:05:06AM -0500, Bin Liu wrote:
> Hi Paul,
> 
> On Thu, Apr 04, 2019 at 11:10:46AM -0500, Bin Liu wrote:
> > On Thu, Apr 04, 2019 at 11:37:43AM +0200, Paul Cercueil wrote:
> > > The pullup may be already enabled before the driver is initialized.
> > > It has to be disabled at init time, as we cannot guarantee that a gadget
> > > driver will be bound to the UDC.
> > > 
> > > Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> > > ---
> > >  drivers/usb/musb/musb_gadget.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> > > index ffe462a657b1..094dc59c834c 100644
> > > --- a/drivers/usb/musb/musb_gadget.c
> > > +++ b/drivers/usb/musb/musb_gadget.c
> > > @@ -1794,6 +1794,7 @@ int musb_gadget_setup(struct musb *musb)
> > >  
> > >  	musb->is_active = 0;
> > >  	musb_platform_try_idle(musb, 0);
> > > +	musb_pullup(musb, 0);
> > >  
> > >  	status = usb_add_gadget_udc(musb->controller, &musb->g);
> > >  	if (status)
> > 
> > Applied.
> 
> Sorry, I have dropped this patch from my tree. I realized the gadget
> core already defines callbacks to control the pullup. I think the
> proper fix should be calling usb_udc_vbus_handler() in musb gadget or
> glue layers.

Basically besides the problem your patch tries to fix, there is another
problem related to the pullup, which is enabled right after bind a
gadget driver, regardless of vbus status. This violates the USB Spec.
Implementing the udc core callbacks should fix both issues.

-Bin.

  reply	other threads:[~2019-04-30 15:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04  9:37 [PATCH] usb: musb: Disable pullup in gadget setup Paul Cercueil
2019-04-04  9:37 ` Paul Cercueil
2019-04-04 16:10 ` [PATCH] " Bin Liu
2019-04-04 16:10   ` Bin Liu
2019-04-30 15:05   ` [PATCH] " Bin Liu
2019-04-30 15:05     ` Bin Liu
2019-04-30 15:10     ` Bin Liu [this message]
2019-04-30 15:10       ` Bin Liu
2019-07-15  6:05     ` [PATCH] " Paul Cercueil

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=20190430151043.GG20993@uda0271908 \
    --to=b-liu@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=od@zcrc.me \
    --cc=paul@crapouillou.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.