mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: mtu3: Don't check the USB3 status bits if the max speed is USB2
@ 2023-04-26 19:24 amergnat
  2023-05-04  7:48 ` Chunfeng Yun (云春峰)
  0 siblings, 1 reply; 2+ messages in thread
From: amergnat @ 2023-04-26 19:24 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman
  Cc: linux-usb, linux-arm-kernel, linux-mediatek, linux-kernel,
	Alexandre Bailon, Fabien Parent, Alexandre Mergnat

From: Alexandre Bailon <abailon@baylibre.com>

If the IP is U3, the driver will check some USB3 status bits.
This could fail if only USB2 is used.
This only check these bits if USB operate at USB3 speed.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
---
This patch is ported from downstream. Without this fix, USB doesn't
work if USB2 protocol is used first.
---
 drivers/usb/mtu3/mtu3_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index a3a6282893d0..00dba871aff8 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -100,7 +100,7 @@ static int mtu3_device_enable(struct mtu3 *mtu)
 
 	mtu3_clrbits(ibase, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
 
-	if (mtu->u3_capable) {
+	if (mtu->u3_capable && mtu->max_speed >= USB_SPEED_SUPER) {
 		check_clk = SSUSB_U3_MAC_RST_B_STS;
 		mtu3_clrbits(ibase, SSUSB_U3_CTRL(0),
 			(SSUSB_U3_PORT_DIS | SSUSB_U3_PORT_PDN |

---
base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
change-id: 20230426-usb-mtu3-improvement-77d987def9fe

Best regards,
-- 
Alexandre Mergnat <amergnat@baylibre.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: mtu3: Don't check the USB3 status bits if the max speed is USB2
  2023-04-26 19:24 [PATCH] usb: mtu3: Don't check the USB3 status bits if the max speed is USB2 amergnat
@ 2023-05-04  7:48 ` Chunfeng Yun (云春峰)
  0 siblings, 0 replies; 2+ messages in thread
From: Chunfeng Yun (云春峰) @ 2023-05-04  7:48 UTC (permalink / raw)
  To: amergnat, gregkh
  Cc: linux-arm-kernel, linux-kernel, linux-mediatek, fparent,
	linux-usb, abailon

On Wed, 2023-04-26 at 21:24 +0200, amergnat@baylibre.com wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> From: Alexandre Bailon <abailon@baylibre.com>
> 
> If the IP is U3, the driver will check some USB3 status bits.
> This could fail if only USB2 is used.
> This only check these bits if USB operate at USB3 speed.
> 
> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
> Signed-off-by: Fabien Parent <fparent@baylibre.com>
> Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
> ---
> This patch is ported from downstream. Without this fix, USB doesn't
> work if USB2 protocol is used first.
> ---
>  drivers/usb/mtu3/mtu3_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/mtu3/mtu3_core.c
> b/drivers/usb/mtu3/mtu3_core.c
> index a3a6282893d0..00dba871aff8 100644
> --- a/drivers/usb/mtu3/mtu3_core.c
> +++ b/drivers/usb/mtu3/mtu3_core.c
> @@ -100,7 +100,7 @@ static int mtu3_device_enable(struct mtu3 *mtu)
> 
>         mtu3_clrbits(ibase, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
> 
> -       if (mtu->u3_capable) {
> +       if (mtu->u3_capable && mtu->max_speed >= USB_SPEED_SUPER) {
NAK

Maybe you misunderstand the usage of @u3_capable, if you only use u2
function but the controller support u3 function, shall disable u3 by  
property "mediatek,u3p-dis-msk", then no need check speed here.

Thanks

>                 check_clk = SSUSB_U3_MAC_RST_B_STS;
>                 mtu3_clrbits(ibase, SSUSB_U3_CTRL(0),
>                         (SSUSB_U3_PORT_DIS | SSUSB_U3_PORT_PDN |
> 
> ---
> base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
> change-id: 20230426-usb-mtu3-improvement-77d987def9fe
> 
> Best regards,
> --
> Alexandre Mergnat <amergnat@baylibre.com>
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-04  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 19:24 [PATCH] usb: mtu3: Don't check the USB3 status bits if the max speed is USB2 amergnat
2023-05-04  7:48 ` Chunfeng Yun (云春峰)

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®