mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Macpaul Lin <macpaul.lin@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	<linux-usb@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: Miles Chen <miles.chen@mediatek.com>,
	Bear Wang <bear.wang@mediatek.com>,
	Pablo Sun <pablo.sun@mediatek.com>,
	Fabien Parent <fparent@baylibre.com>,
	Mediatek WSD Upstream <wsd_upstream@mediatek.com>,
	Macpaul Lin <macpaul@gmail.com>, <stable@vger.kernel.org>,
	Tainping Fang <tianping.fang@mediatek.com>
Subject: Re: [PATCH] usb: mtu3: fix USB 3.0 dual-role-switch from device to host
Date: Wed, 20 Apr 2022 17:18:38 +0800	[thread overview]
Message-ID: <37276fd01a518dadff57ef66c7971b78baa9dc15.camel@mediatek.com> (raw)
In-Reply-To: <20220419081245.21015-1-macpaul.lin@mediatek.com>

On Tue, 2022-04-19 at 16:12 +0800, Macpaul Lin wrote:
> Issue description:
>   When an OTG port has been switched to device role and then switch
> back
>   to host role again, the USB 3.0 Host (XHCI) will not be able to
> detect
>   "plug in event of a connected USB 2.0/1.0 ((Highspeed and
> Fullspeed)
>   devices until system reboot.
> 
> Root cause and Solution:
>   There is a condition checking flag "ssusb->otg_switch.is_u3_drd" in
>   toggle_opstate(). At the end of role switch procedure,
> toggle_opstate()
>   will be called to set DC_SESSION and SOFT_CONN bit. If "is_u3_drd"
> was
>   set and switched the role to USB host 3.0, bit DC_SESSION and
> SOFT_CONN
>   will be skipped hence caused the port cannot detect connected USB
> 2.0
>   (Highspeed and Fullspeed) devices. Simply remove the condition
> check to
>   solve this issue.
> 
> Fixes: d0ed062a8b75 ("usb: mtu3: dual-role mode support")
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> Signed-off-by: Tainping Fang <tianping.fang@mediatek.com>
> Tested-by: Fabien Parent <fparent@baylibre.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/usb/mtu3/mtu3_dr.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/mtu3/mtu3_dr.c b/drivers/usb/mtu3/mtu3_dr.c
> index ec6ec621838b..b820724c56e4 100644
> --- a/drivers/usb/mtu3/mtu3_dr.c
> +++ b/drivers/usb/mtu3/mtu3_dr.c
> @@ -21,10 +21,8 @@ static inline struct ssusb_mtk
> *otg_sx_to_ssusb(struct otg_switch_mtk *otg_sx)
>  
>  static void toggle_opstate(struct ssusb_mtk *ssusb)
>  {
> -	if (!ssusb->otg_switch.is_u3_drd) {
> -		mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL,
> DC_SESSION);
> -		mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT,
> SOFT_CONN);
> -	}
> +	mtu3_setbits(ssusb->mac_base, U3D_DEVICE_CONTROL, DC_SESSION);
> +	mtu3_setbits(ssusb->mac_base, U3D_POWER_MANAGEMENT, SOFT_CONN);
>  }
>  
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Thanks

>  /* only port0 supports dual-role mode */


      reply	other threads:[~2022-04-20  9:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19  8:12 Macpaul Lin
2022-04-20  9:18 ` Chunfeng Yun [this message]

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=37276fd01a518dadff57ef66c7971b78baa9dc15.camel@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=bear.wang@mediatek.com \
    --cc=fparent@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=macpaul.lin@mediatek.com \
    --cc=macpaul@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=miles.chen@mediatek.com \
    --cc=pablo.sun@mediatek.com \
    --cc=stable@vger.kernel.org \
    --cc=tianping.fang@mediatek.com \
    --cc=wsd_upstream@mediatek.com \
    /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®