RE: [PATCH] usb: chipidea: otg: handle vbus change for udc iff it's in device mode

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

 



Hi,

After double check for this issue, the logic seems wrong.
Please ignore this patch and sorry for inconvenience in advance.

Best Regard,
Xu Yang

> -----Original Message-----
> From: Xu Yang
> Sent: Wednesday, December 7, 2022 11:14 AM
> To: peter.chen@xxxxxxxxxx
> Cc: gregkh@xxxxxxxxxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx>; Jun Li <jun.li@xxxxxxx>;
> Xu Yang <xu.yang_2@xxxxxxx>
> Subject: [PATCH] usb: chipidea: otg: handle vbus change for udc iff it's in device mode
> 
> When in device mode at first (BSVIE is set),  OTGSC will assert both
> BSVIS and IDIS bit if changed to host mode. ID event will be handled
> in the first interrupt. Depends on whether BSVIE is cleared when call
> ci_role_stop() for udc, the 2rd interrupt may be asserted after a
> specific interrupt period (BSVIE and BSVIS is still 1). If it is, the
> driver will continue to handle VBUS change for udc. We should avoid
> this manner since the controller is not in device mode and the worser
> is gadget related code may be executed if a gadget driver is attached.
> 
> Fixes: a107f8c505cd ("usb: chipidea: add vbus interrupt handler")
> cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Xu Yang <xu.yang_2@xxxxxxx>
> ---
>  drivers/usb/chipidea/otg.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
> index f5490f2a5b6b..31c38a3ab990 100644
> --- a/drivers/usb/chipidea/otg.c
> +++ b/drivers/usb/chipidea/otg.c
> @@ -133,6 +133,9 @@ void ci_handle_vbus_change(struct ci_hdrc *ci)
>  	if (!ci->is_otg)
>  		return;
> 
> +	if (ci_otg_role(ci) != CI_ROLE_GADGET)
> +		return;
> +
>  	if (hw_read_otgsc(ci, OTGSC_BSV) && !ci->vbus_active)
>  		usb_gadget_vbus_connect(&ci->gadget);
>  	else if (!hw_read_otgsc(ci, OTGSC_BSV) && ci->vbus_active)
> --
> 2.34.1





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

  Powered by Linux