On Fri, Aug 12, 2016 at 09:18:59AM +0000, Jun Li wrote: > Hi, > > -----Original Message----- > > From: Peter Chen [mailto:hzpeterchen@xxxxxxxxx] > > Sent: Friday, August 12, 2016 4:48 PM > > To: Jun Li <jun.li@xxxxxxx> > > Cc: Peter Chen <peter.chen@xxxxxxx>; linux-usb@xxxxxxxxxxxxxxx > > Subject: Re: [PATCH] usb: chipidea: udc: don't touch DP when controller is > > in host mode > > > > On Thu, Aug 11, 2016 at 06:52:45PM +0800, Li Jun wrote: > > > When the controller is configured to be dual role and it's in host > > > mode, if bind udc and gadgt driver, those gadget operations will do > > > gadget disconnect and finally pull down DP line, which will break host > > function. > > > > > > Signed-off-by: Li Jun <jun.li@xxxxxxx> > > > --- > > > drivers/usb/chipidea/udc.c | 7 +++++-- > > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c > > > index 761b804..846b77bc 100644 > > > --- a/drivers/usb/chipidea/udc.c > > > +++ b/drivers/usb/chipidea/udc.c > > > @@ -1593,8 +1593,11 @@ static int ci_udc_pullup(struct usb_gadget > > > *_gadget, int is_on) { > > > struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget); > > > > > > - /* Data+ pullup controlled by OTG state machine in OTG fsm mode */ > > > - if (ci_otg_is_fsm_mode(ci)) > > > + /* > > > + * Data+ pullup controlled by OTG state machine in OTG fsm mode; > > > + * and don't touch Data+ in host mode for dual role config. > > > + */ > > > + if (ci_otg_is_fsm_mode(ci) || ci->role == CI_ROLE_HOST) > > > return 0; > > > > > > pm_runtime_get_sync(&ci->gadget.dev); > > > -- > > > > Would you show me how to reproduce it? I can't reproduce it. > > According to your description, the ci->vbus_active is false, > > then the pullup operation will NOT do real pull up. > > A pull *down*(not pull up) will be done when gadget driver load. > How to reproduce: > 1. Switch to host mode by ID cable + usb device > 2. Load a gadget driver, e.g. modprobe g_ether > 3. You will see the RS bit is cleared. > Good catch, please CC stable. -- Best Regards, Peter Chen -- 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