Re: [PATCH] usb: chipidea: udc: first start device on pullup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 11, 2013 at 09:42:35PM +0800, Peter Chen wrote:
> On Mon, Nov 11, 2013 at 12:39:30PM +0100, Michael Grzeschik wrote:
> > Don't pullup the resistors on hw_device_state. The gadget framework has
> > the prepared callback for this. This is necessary if we use gadgets
> > which need to be enabled after an userspace application got prepared, or
> > other delayed conditiions have passed.
> > 
> > Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> > ---
> >  drivers/usb/chipidea/udc.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> > index b34c819..976153f 100644
> > --- a/drivers/usb/chipidea/udc.c
> > +++ b/drivers/usb/chipidea/udc.c
> > @@ -84,10 +84,8 @@ static int hw_device_state(struct ci_hdrc *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);
> >  	}
> >  	return 0;
> >  }
> 
> Hi Michael, you submitted a similar patch before to fix uvc problem,
> but you can't simply delete it, it will cause the udc can't work
> if we load gadget first, then plug in the usb cable.

Yes, you also mentioned this the last time. But here, when the
gadget was loaded first and plugged in afterwarts works as well.

Did you see when the pullup function get called? I did also send a
patch that is changing the pullup call inside the gadget drivers.

> To fix it, it is better mark that gadget as defer_connect, and
> introduce such condition at udc driver.

No, I don't see why this needs to be specially handled inside this
driver. We have the framework for this. USBCMD_RS does pullup the
DP resistor.

The datasheet says, that we have to ensure that the device needs to be
properly setup before touching this bit. As the framework does call
usb_gadget_connect after the gadget has started and connected to the udc
this should be the case.

Thanks,
Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux