LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 1/7] usb: mtu3: restore HS function when set SS/SSP
@ 2021-08-12 13:11 Chunfeng Yun
  2021-08-12 13:11 ` [PATCH v2 2/7] usb: mtu3: use @mult for HS isoc or intr Chunfeng Yun
  2021-08-12 13:11 ` [PATCH v2 3/7] usb: mtu3: fix the wrong HS mult value Chunfeng Yun
  0 siblings, 2 replies; 4+ messages in thread
From: Chunfeng Yun @ 2021-08-12 13:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Pawel Laszczak, Al Cooper, Thierry Reding, Jonathan Hunter,
	Chunfeng Yun, Matthias Brugger, Christophe JAILLET,
	Yang Yingliang, Rikard Falkeborn, linux-usb, linux-kernel,
	bcm-kernel-feedback-list, linux-tegra, linux-arm-kernel,
	linux-mediatek, Eddie Hung, stable

Due to HS function is disabled when set as FS, need restore
it when set as SS/SSP.

Fixes: dc4c1aa7eae9 ("usb: mtu3: add ->udc_set_speed()")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/mtu3/mtu3_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 562f4357831e..6403f01947b2 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -227,11 +227,13 @@ static void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed)
 		mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
 		break;
 	case USB_SPEED_SUPER:
+		mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
 		mtu3_clrbits(mtu->ippc_base, SSUSB_U3_CTRL(0),
 			     SSUSB_U3_PORT_SSP_SPEED);
 		break;
 	case USB_SPEED_SUPER_PLUS:
-			mtu3_setbits(mtu->ippc_base, SSUSB_U3_CTRL(0),
+		mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
+		mtu3_setbits(mtu->ippc_base, SSUSB_U3_CTRL(0),
 			     SSUSB_U3_PORT_SSP_SPEED);
 		break;
 	default:
-- 
2.18.0


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

* [PATCH v2 2/7] usb: mtu3: use @mult for HS isoc or intr
  2021-08-12 13:11 [PATCH v2 1/7] usb: mtu3: restore HS function when set SS/SSP Chunfeng Yun
@ 2021-08-12 13:11 ` Chunfeng Yun
  2021-08-12 13:11 ` [PATCH v2 3/7] usb: mtu3: fix the wrong HS mult value Chunfeng Yun
  1 sibling, 0 replies; 4+ messages in thread
From: Chunfeng Yun @ 2021-08-12 13:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Pawel Laszczak, Al Cooper, Thierry Reding, Jonathan Hunter,
	Chunfeng Yun, Matthias Brugger, Christophe JAILLET,
	Yang Yingliang, Rikard Falkeborn, linux-usb, linux-kernel,
	bcm-kernel-feedback-list, linux-tegra, linux-arm-kernel,
	linux-mediatek, Eddie Hung, stable

For HS isoc or intr, should use @mult but not @burst
to save mult value.

Fixes: 4d79e042ed8b ("usb: mtu3: add support for usb3.1 IP")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: new patch, split from [2/6] suggested by Felipe
---
 drivers/usb/mtu3/mtu3_gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 5e21ba05ebf0..635ad277cb13 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -92,7 +92,7 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
 				usb_endpoint_xfer_int(desc)) {
 			interval = desc->bInterval;
 			interval = clamp_val(interval, 1, 16) - 1;
-			burst = (max_packet & GENMASK(12, 11)) >> 11;
+			mult = (max_packet & GENMASK(12, 11)) >> 11;
 		}
 		break;
 	default:
-- 
2.18.0


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

* [PATCH v2 3/7] usb: mtu3: fix the wrong HS mult value
  2021-08-12 13:11 [PATCH v2 1/7] usb: mtu3: restore HS function when set SS/SSP Chunfeng Yun
  2021-08-12 13:11 ` [PATCH v2 2/7] usb: mtu3: use @mult for HS isoc or intr Chunfeng Yun
@ 2021-08-12 13:11 ` Chunfeng Yun
  1 sibling, 0 replies; 4+ messages in thread
From: Chunfeng Yun @ 2021-08-12 13:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Pawel Laszczak, Al Cooper, Thierry Reding, Jonathan Hunter,
	Chunfeng Yun, Matthias Brugger, Christophe JAILLET,
	Yang Yingliang, Rikard Falkeborn, linux-usb, linux-kernel,
	bcm-kernel-feedback-list, linux-tegra, linux-arm-kernel,
	linux-mediatek, Eddie Hung, stable

usb_endpoint_maxp() returns actual max packet size, @mult will
always be zero, fix it by using usb_endpoint_maxp_mult() instead
to get mult.

Fixes: 4d79e042ed8b ("usb: mtu3: add support for usb3.1 IP")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: split two patch [v2 2/7],[v2 3/7] suggested by Felipe
---
 drivers/usb/mtu3/mtu3_gadget.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 635ad277cb13..a399fd84c71f 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -64,14 +64,12 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
 	u32 interval = 0;
 	u32 mult = 0;
 	u32 burst = 0;
-	int max_packet;
 	int ret;
 
 	desc = mep->desc;
 	comp_desc = mep->comp_desc;
 	mep->type = usb_endpoint_type(desc);
-	max_packet = usb_endpoint_maxp(desc);
-	mep->maxp = max_packet & GENMASK(10, 0);
+	mep->maxp = usb_endpoint_maxp(desc);
 
 	switch (mtu->g.speed) {
 	case USB_SPEED_SUPER:
@@ -92,7 +90,7 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
 				usb_endpoint_xfer_int(desc)) {
 			interval = desc->bInterval;
 			interval = clamp_val(interval, 1, 16) - 1;
-			mult = (max_packet & GENMASK(12, 11)) >> 11;
+			mult = usb_endpoint_maxp_mult(desc) - 1;
 		}
 		break;
 	default:
-- 
2.18.0


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

* [PATCH v2 1/7] usb: mtu3: restore HS function when set SS/SSP
@ 2021-08-12 13:17 Chunfeng Yun
  0 siblings, 0 replies; 4+ messages in thread
From: Chunfeng Yun @ 2021-08-12 13:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Pawel Laszczak, Al Cooper, Thierry Reding, Jonathan Hunter,
	Chunfeng Yun, Matthias Brugger, Christophe JAILLET,
	Yang Yingliang, Rikard Falkeborn, linux-usb, linux-kernel,
	bcm-kernel-feedback-list, linux-tegra, linux-arm-kernel,
	linux-mediatek, Eddie Hung, stable

Due to HS function is disabled when set as FS, need restore
it when set as SS/SSP.

Fixes: dc4c1aa7eae9 ("usb: mtu3: add ->udc_set_speed()")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/mtu3/mtu3_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 562f4357831e..6403f01947b2 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -227,11 +227,13 @@ static void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed)
 		mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
 		break;
 	case USB_SPEED_SUPER:
+		mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
 		mtu3_clrbits(mtu->ippc_base, SSUSB_U3_CTRL(0),
 			     SSUSB_U3_PORT_SSP_SPEED);
 		break;
 	case USB_SPEED_SUPER_PLUS:
-			mtu3_setbits(mtu->ippc_base, SSUSB_U3_CTRL(0),
+		mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
+		mtu3_setbits(mtu->ippc_base, SSUSB_U3_CTRL(0),
 			     SSUSB_U3_PORT_SSP_SPEED);
 		break;
 	default:
-- 
2.18.0


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

end of thread, other threads:[~2021-08-12 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 13:11 [PATCH v2 1/7] usb: mtu3: restore HS function when set SS/SSP Chunfeng Yun
2021-08-12 13:11 ` [PATCH v2 2/7] usb: mtu3: use @mult for HS isoc or intr Chunfeng Yun
2021-08-12 13:11 ` [PATCH v2 3/7] usb: mtu3: fix the wrong HS mult value Chunfeng Yun
2021-08-12 13:17 [PATCH v2 1/7] usb: mtu3: restore HS function when set SS/SSP Chunfeng Yun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).