mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: Adam Ford <aford173@gmail.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: "linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>,
	"cstevens@beaconembedded.com" <cstevens@beaconembedded.com>,
	"aford@beaconembedded.com" <aford@beaconembedded.com>,
	Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Biju Das <biju.das@bp.renesas.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] usb: gadget: udc: renesas_usb3: Fix host to USB_ROLE_NONE transition
Date: Mon, 31 Jan 2022 00:23:25 +0000	[thread overview]
Message-ID: <TYBPR01MB53418BE9FC9E11B901DF561DD8259@TYBPR01MB5341.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20220128223603.2362621-1-aford173@gmail.com>

Hi Adam-san,

Thank you for the patch!

> From: Adam Ford, Sent: Saturday, January 29, 2022 7:36 AM
> 
> The support the external role switch a variety of situations were
> addressed, but the transition from USB_ROLE_HOST to USB_ROLE_NONE
> leaves the host up which can cause some error messages when
> switching from host to none, to gadget, to none, and then back
> to host again.

I think so. An external role switch in this driver is possible to
enter the role to USB_ROLE_NONE. (Just a record for me: in other words,
the "internal" role switch didn't enter the role to USB_ROLE_NONE.)

>  xhci-hcd ee000000.usb: Abort failed to stop command ring: -110
>  xhci-hcd ee000000.usb: xHCI host controller not responding, assume dead
>  xhci-hcd ee000000.usb: HC died; cleaning up
>  usb 4-1: device not accepting address 6, error -108
>  usb usb4-port1: couldn't allocate usb_device
> 
> After this happens it will not act as a host again.
> Fix this by releasing the host mode when transitioning to USB_ROLE_NONE.
> 
> Fixes: 0604160d8c0b ("usb: gadget: udc: renesas_usb3: Enhance role switch support")
> Signed-off-by: Adam Ford <aford173@gmail.com>
> 
> diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
> index 57d417a7c3e0..601829a6b4ba 100644
> --- a/drivers/usb/gadget/udc/renesas_usb3.c
> +++ b/drivers/usb/gadget/udc/renesas_usb3.c
> @@ -2378,6 +2378,8 @@ static void handle_ext_role_switch_states(struct device *dev,
>  	switch (role) {
>  	case USB_ROLE_NONE:
>  		usb3->connection_state = USB_ROLE_NONE;
> +		if (cur_role == USB_ROLE_HOST)
> +			device_release_driver(host);

The handle_ext_role_switch_states() with role = USB_ROLE_NONE seems
to be called multiple times. So, we have to avoid multiple calling of
device_release_driver() somehow.

Best regards,
Yoshihiro Shimoda

>  		if (usb3->driver)
>  			usb3_disconnect(usb3);
>  		usb3_vbus_out(usb3, false);
> --
> 2.32.0


  reply	other threads:[~2022-01-31  0:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 22:36 Adam Ford
2022-01-31  0:23 ` Yoshihiro Shimoda [this message]
2022-01-31  1:01   ` Adam Ford
2022-01-31  2:17     ` Yoshihiro Shimoda

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=TYBPR01MB53418BE9FC9E11B901DF561DD8259@TYBPR01MB5341.jpnprd01.prod.outlook.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=aford173@gmail.com \
    --cc=aford@beaconembedded.com \
    --cc=balbi@kernel.org \
    --cc=biju.das@bp.renesas.com \
    --cc=cstevens@beaconembedded.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®