All of lore.kernel.org
 help / color / mirror / Atom feed
From: peter.chen@freescale.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v11 4/9] usb: chipidea: udc: add pullup/pulldown dp at hw_device_state
Date: Fri, 8 Mar 2013 09:28:34 +0800	[thread overview]
Message-ID: <20130308012833.GA16076@nchen-desktop> (raw)
In-Reply-To: <20130307095054.GK9171@arwen.pp.htv.fi>

On Thu, Mar 07, 2013 at 11:50:54AM +0200, Felipe Balbi wrote:
> Hi,
> 
> On Thu, Mar 07, 2013 at 10:36:13AM +0800, Peter Chen wrote:
> > > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> > > > index e82dae4..70f9f2d 100644
> > > > --- a/drivers/usb/chipidea/udc.c
> > > > +++ b/drivers/usb/chipidea/udc.c
> > > > @@ -91,8 +91,10 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma)
> > > >  		/* interrupt, error, port change, reset, sleep/suspend */
> > > >  		hw_write(ci, OP_USBINTR, ~0,
> > > >  			     USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI);
> > > > +		hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
> > > >  	} else {
> > > >  		hw_write(ci, OP_USBINTR, ~0, 0);
> > > > +		hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
> > > 
> > > this patch doesn't make sense to me. What will happen is that you will
> > > be enabling pullups when vbus_session() gets called and this might not
> > > be what gadget driver wants.
> > > 
> > > You don't want to fiddle with that yourself since I'm changing the
> > > framework so that gadget driver will always request pullups to be
> > > enabled.
> > 
> > Hi Felipe,
> > 
> > Do you think pullup dp without vbus is a valid operation?
> 
> why not ? What I want to connect pullups first and only then issue SRP ?

I am not familiar with OTG, but it only stands for special case, right?

> 
> > Current udc core code makes that possible.
> 
> so ?

Without vbus, but pullup dp, it will cause more power.

> 
> > But I think current your udc core code (add pullup after loading
> > gadget) make benefit for udc driver who has not vbus operation.
> > 
> > For chipidea driver:
> > 
> > - If vbus is there before load gadget module, the pullup dp is done by
> > udc core code.
> > - If vbus is not there before load gadget module, the pullup will be
> > done when the vbus is there.
> 
> This isn't legal. If you want to make sure vbus is alive before
> connecting pullups, then do it generically. Modify udc-core.c to make
> those checks for you. Bypassing the framework is dangerous because
> whenever I wanna change something, I might miss your private details and
> end up causing regressions.

Let thing be generic is a good idea. Then, is it ok I post a patch let
udc manage pullup by itself (through a flag) just you did for uvc?
UDC core doesn't know VBUS, so the pullup can't be managed by udc core
totally.

Besides, I looked four udc drivers (fsl_udc_core.c, at91_udc.c, mv_udc_core.c
and bcm63xx_udc.c), the first three manage pullup by itself, ony
bcm doesn't control it by itself.

> -- 
> balbi



-- 

Best Regards,
Peter Chen

  reply	other threads:[~2013-03-08  1:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06  9:56 [PATCH v11 0/9] Add tested id switch and vbus connect detect support for Chipidea Peter Chen
2013-03-06  9:56 ` [PATCH v11 1/9] Revert "USB: chipidea: add vbus detect for udc" Peter Chen
2013-03-06  9:56 ` [PATCH v11 2/9] usb: chipidea: add otg file Peter Chen
2013-03-06  9:56 ` [PATCH v11 3/9] usb: chipidea: add otg id switch and vbus connect/disconnect detect Peter Chen
2013-03-06 17:09   ` Alexander Shishkin
2013-03-07  5:50     ` Peter Chen
2013-03-08 12:42       ` Peter Chen
2013-03-06  9:56 ` [PATCH v11 4/9] usb: chipidea: udc: add pullup/pulldown dp at hw_device_state Peter Chen
2013-03-06 11:26   ` Felipe Balbi
2013-03-07  2:36     ` Peter Chen
2013-03-07  9:50       ` Felipe Balbi
2013-03-08  1:28         ` Peter Chen [this message]
2013-03-08  7:18           ` Felipe Balbi
2013-03-08  8:05             ` Peter Chen
2013-03-06  9:56 ` [PATCH v11 5/9] usb: chipidea: udc: retire the flag CI13_PULLUP_ON_VBUS Peter Chen
2013-03-06  9:56 ` [PATCH v11 6/9] usb: chipidea: add vbus regulator control Peter Chen
2013-03-06 11:29   ` Felipe Balbi
2013-03-07  2:41     ` Peter Chen
2013-03-07  9:52       ` Felipe Balbi
2013-03-08  6:27         ` Peter Chen
2013-03-08  7:26           ` Felipe Balbi
2013-03-08  8:32             ` Peter Chen
2013-03-08  8:42               ` Felipe Balbi
2013-03-08  8:52                 ` Peter Chen
2013-03-08  8:58                   ` Felipe Balbi
2013-03-06  9:56 ` [PATCH v11 7/9] usb: chipidea: delete the delayed work Peter Chen
2013-03-06  9:56 ` [PATCH v11 8/9] usb: chipidea: imx: add getting vbus regulator code Peter Chen
2013-03-06 10:11   ` Felipe Balbi
2013-03-07  2:18     ` Peter Chen
2013-03-06  9:56 ` [PATCH v11 9/9] usb: chipidea: udc: fix the oops when plugs in usb cable after rmmod gadget Peter Chen
2013-03-06 18:46   ` Russell King - ARM Linux
2013-03-07  2:48     ` Peter Chen

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=20130308012833.GA16076@nchen-desktop \
    --to=peter.chen@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.