Hi, On Thu, Sep 20, 2012 at 03:08:15PM +0800, Peter Chen wrote: > On Wed, Sep 12, 2012 at 7:58 PM, Alexander Shishkin > <alexander.shishkin@xxxxxxxxxxxxxxx> wrote: > > From: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> > > > > Add function to physicaly enable or disable of pullup connection on the USB-D+ > > line. The uvc gaget will fail, if this function is not implemented. > > > > Cc: <stable@xxxxxxxxxxxxxxx> > > Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx> > > Acked-by: Felipe Balbi <balbi@xxxxxx> > > Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> > > Signed-off-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx> > > --- > > drivers/usb/chipidea/udc.c | 21 +++++++++++++++++---- > > 1 file changed, 17 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c > > index 7801a3f..32ee870 100644 > > --- a/drivers/usb/chipidea/udc.c > > +++ b/drivers/usb/chipidea/udc.c > > @@ -78,8 +78,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n) > > } > > > > /** > > - * hw_device_state: enables/disables interrupts & starts/stops device (execute > > - * without interruption) > > + * hw_device_state: enables/disables interrupts (execute without interruption) > > * @dma: 0 => disable, !0 => enable and set dma engine > > * > > * This function returns an error code > > @@ -91,9 +90,7 @@ 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_USBCMD, USBCMD_RS, 0); > > hw_write(ci, OP_USBINTR, ~0, 0); > > } > > Hi Marc, your above change break the function that load gadget before > plug usb cable. What do you mean with that? When switching into device role, the otg can load every gadget-module without having the hardware pluged-in. > Does your change is because the set/clear usbcmd.rs twice at > usb_gadget_probe_driver > /usb_gadget_remove_driver? If it is, do you mind I submit a patch to re-add it? If really needed, i suggest to use the api calls instead: usb_gadget_{probe,remove}_driver > > > return 0; > > @@ -1420,6 +1417,21 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA) > > return -ENOTSUPP; > > } > > > > +/* Change Data+ pullup status > > + * this func is used by usb_gadget_connect/disconnet > > + */ > > +static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) > > +{ > > + struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); > > + > > + if (is_on) > > + hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); > > + else > > + hw_write(ci, OP_USBCMD, USBCMD_RS, 0); > > + > > + return 0; > > +} > > + > > static int ci13xxx_start(struct usb_gadget *gadget, > > struct usb_gadget_driver *driver); > > static int ci13xxx_stop(struct usb_gadget *gadget, > > @@ -1432,6 +1444,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget, > > static const struct usb_gadget_ops usb_gadget_ops = { > > .vbus_session = ci13xxx_vbus_session, > > .wakeup = ci13xxx_wakeup, > > + .pullup = ci13xxx_pullup, > > .vbus_draw = ci13xxx_vbus_draw, > > .udc_start = ci13xxx_start, > > .udc_stop = ci13xxx_stop, > > -- > > 1.7.10.4 > > > > -- > > 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 > -- 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