Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks
@ 2020-07-27  7:14 Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 02/11] usb: mtu3: fix macro for maximum number of packets Chunfeng Yun
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

The class driver will ensure the parameters are valid
pointers before call the hook function of usb_ep_ops,
so no need check them again.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_gadget.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index f93732e..6b26cb8 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -263,23 +263,15 @@ void mtu3_free_request(struct usb_ep *ep, struct usb_request *req)
 static int mtu3_gadget_queue(struct usb_ep *ep,
 		struct usb_request *req, gfp_t gfp_flags)
 {
-	struct mtu3_ep *mep;
-	struct mtu3_request *mreq;
-	struct mtu3 *mtu;
+	struct mtu3_ep *mep = to_mtu3_ep(ep);
+	struct mtu3_request *mreq = to_mtu3_request(req);
+	struct mtu3 *mtu = mep->mtu;
 	unsigned long flags;
 	int ret = 0;
 
-	if (!ep || !req)
-		return -EINVAL;
-
 	if (!req->buf)
 		return -ENODATA;
 
-	mep = to_mtu3_ep(ep);
-	mtu = mep->mtu;
-	mreq = to_mtu3_request(req);
-	mreq->mtu = mtu;
-
 	if (mreq->mep != mep)
 		return -EINVAL;
 
@@ -303,6 +295,7 @@ static int mtu3_gadget_queue(struct usb_ep *ep,
 		return -ESHUTDOWN;
 	}
 
+	mreq->mtu = mtu;
 	mreq->request.actual = 0;
 	mreq->request.status = -EINPROGRESS;
 
@@ -335,11 +328,11 @@ static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req)
 	struct mtu3_ep *mep = to_mtu3_ep(ep);
 	struct mtu3_request *mreq = to_mtu3_request(req);
 	struct mtu3_request *r;
+	struct mtu3 *mtu = mep->mtu;
 	unsigned long flags;
 	int ret = 0;
-	struct mtu3 *mtu = mep->mtu;
 
-	if (!ep || !req || mreq->mep != mep)
+	if (mreq->mep != mep)
 		return -EINVAL;
 
 	dev_dbg(mtu->dev, "%s : req=%p\n", __func__, req);
@@ -379,9 +372,6 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value)
 	unsigned long flags;
 	int ret = 0;
 
-	if (!ep)
-		return -EINVAL;
-
 	dev_dbg(mtu->dev, "%s : %s...", __func__, ep->name);
 
 	spin_lock_irqsave(&mtu->lock, flags);
@@ -424,9 +414,6 @@ static int mtu3_gadget_ep_set_wedge(struct usb_ep *ep)
 {
 	struct mtu3_ep *mep = to_mtu3_ep(ep);
 
-	if (!ep)
-		return -EINVAL;
-
 	mep->wedged = 1;
 
 	return usb_ep_set_halt(ep);
-- 
1.9.1

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

* [PATCH 02/11] usb: mtu3: fix macro for maximum number of packets
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 03/11] usb: mtu3: reinitialize CSR registers Chunfeng Yun
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

The bits field for maximum number of packets is 8 bits.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_hw_regs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_hw_regs.h b/drivers/usb/mtu3/mtu3_hw_regs.h
index bf34f78..072db1f 100644
--- a/drivers/usb/mtu3/mtu3_hw_regs.h
+++ b/drivers/usb/mtu3/mtu3_hw_regs.h
@@ -134,7 +134,7 @@
 #define TX_W1C_BITS		(~(TX_SENTSTALL))
 
 /* U3D_TX1CSR1 */
-#define TX_MAX_PKT_G2(x)	(((x) & 0x7f) << 24)
+#define TX_MAX_PKT_G2(x)	(((x) & 0xff) << 24)
 #define TX_MULT_G2(x)		(((x) & 0x7) << 21)
 #define TX_MULT_OG(x)		(((x) & 0x3) << 22)
 #define TX_MAX_PKT_OG(x)	(((x) & 0x3f) << 16)
@@ -173,7 +173,7 @@
 #define RX_W1C_BITS		(~(RX_SENTSTALL | RX_RXPKTRDY))
 
 /* U3D_RX1CSR1 */
-#define RX_MAX_PKT_G2(x)	(((x) & 0x7f) << 24)
+#define RX_MAX_PKT_G2(x)	(((x) & 0xff) << 24)
 #define RX_MULT_G2(x)		(((x) & 0x7) << 21)
 #define RX_MULT_OG(x)		(((x) & 0x3) << 22)
 #define RX_MAX_PKT_OG(x)	(((x) & 0x3f) << 16)
-- 
1.9.1

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

* [PATCH 03/11] usb: mtu3: reinitialize CSR registers
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 02/11] usb: mtu3: fix macro for maximum number of packets Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 04/11] usb: mtu3: clear interrupts status when disable interrupts Chunfeng Yun
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

The CSR registers will be reset as default value if the
ports are disabled, so reinitialize them when the ports
are enabled again.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_core.c | 61 +++++++++++++++++++++++---------------------
 1 file changed, 32 insertions(+), 29 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 9dd0216..f3ad1cc 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -202,6 +202,36 @@ static void mtu3_intr_enable(struct mtu3 *mtu)
 	mtu3_writel(mbase, U3D_DEV_LINK_INTR_ENABLE, SSUSB_DEV_SPEED_CHG_INTR);
 }
 
+static void mtu3_set_speed(struct mtu3 *mtu);
+
+/* CSR registers will be reset to default value if port is disabled */
+static void mtu3_csr_init(struct mtu3 *mtu)
+{
+	void __iomem *mbase = mtu->mac_base;
+
+	if (mtu->is_u3_ip) {
+		/* disable LGO_U1/U2 by default */
+		mtu3_clrbits(mbase, U3D_LINK_POWER_CONTROL,
+				SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE);
+		/* enable accept LGO_U1/U2 link command from host */
+		mtu3_setbits(mbase, U3D_LINK_POWER_CONTROL,
+				SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE);
+		/* device responses to u3_exit from host automatically */
+		mtu3_clrbits(mbase, U3D_LTSSM_CTRL, SOFT_U3_EXIT_EN);
+		/* automatically build U2 link when U3 detect fail */
+		mtu3_setbits(mbase, U3D_USB2_TEST_MODE, U2U3_AUTO_SWITCH);
+		/* auto clear SOFT_CONN when clear USB3_EN if work as HS */
+		mtu3_setbits(mbase, U3D_U3U2_SWITCH_CTRL, SOFTCON_CLR_AUTO_EN);
+	}
+
+	mtu3_set_speed(mtu);
+
+	/* delay about 0.1us from detecting reset to send chirp-K */
+	mtu3_clrbits(mbase, U3D_LINK_RESET_INFO, WTCHRP_MSK);
+	/* enable automatical HWRW from L1 */
+	mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
+}
+
 /* reset: u2 - data toggle, u3 - SeqN, flow control status etc */
 static void mtu3_ep_reset(struct mtu3_ep *mep)
 {
@@ -267,13 +297,7 @@ void mtu3_start(struct mtu3 *mtu)
 
 	mtu3_clrbits(mtu->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
 
-	/*
-	 * When disable U2 port, USB2_CSR's register will be reset to
-	 * default value after re-enable it again(HS is enabled by default).
-	 * So if force mac to work as FS, disable HS function.
-	 */
-	if (mtu->max_speed == USB_SPEED_FULL)
-		mtu3_clrbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
+	mtu3_csr_init(mtu);
 
 	/* Initialize the default interrupts */
 	mtu3_intr_enable(mtu);
@@ -572,39 +596,18 @@ static void mtu3_set_speed(struct mtu3 *mtu)
 
 static void mtu3_regs_init(struct mtu3 *mtu)
 {
-
 	void __iomem *mbase = mtu->mac_base;
 
 	/* be sure interrupts are disabled before registration of ISR */
 	mtu3_intr_disable(mtu);
 	mtu3_intr_status_clear(mtu);
 
-	if (mtu->is_u3_ip) {
-		/* disable LGO_U1/U2 by default */
-		mtu3_clrbits(mbase, U3D_LINK_POWER_CONTROL,
-				SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE);
-		/* enable accept LGO_U1/U2 link command from host */
-		mtu3_setbits(mbase, U3D_LINK_POWER_CONTROL,
-				SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE);
-		/* device responses to u3_exit from host automatically */
-		mtu3_clrbits(mbase, U3D_LTSSM_CTRL, SOFT_U3_EXIT_EN);
-		/* automatically build U2 link when U3 detect fail */
-		mtu3_setbits(mbase, U3D_USB2_TEST_MODE, U2U3_AUTO_SWITCH);
-		/* auto clear SOFT_CONN when clear USB3_EN if work as HS */
-		mtu3_setbits(mbase, U3D_U3U2_SWITCH_CTRL, SOFTCON_CLR_AUTO_EN);
-	}
-
-	mtu3_set_speed(mtu);
+	mtu3_csr_init(mtu);
 
-	/* delay about 0.1us from detecting reset to send chirp-K */
-	mtu3_clrbits(mbase, U3D_LINK_RESET_INFO, WTCHRP_MSK);
 	/* U2/U3 detected by HW */
 	mtu3_writel(mbase, U3D_DEVICE_CONF, 0);
 	/* vbus detected by HW */
 	mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON);
-	/* enable automatical HWRW from L1 */
-	mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE);
-
 	/* use new QMU format when HW version >= 0x1003 */
 	if (mtu->gen2cp)
 		mtu3_writel(mbase, U3D_QFCR, ~0x0);
-- 
1.9.1

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

* [PATCH 04/11] usb: mtu3: clear interrupts status when disable interrupts
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 02/11] usb: mtu3: fix macro for maximum number of packets Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 03/11] usb: mtu3: reinitialize CSR registers Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 05/11] usb: mtu3: introduce a funtion to check maximum speed Chunfeng Yun
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

When disable interrupts, will also want to clear their status,
ensure it by calling mtu3_intr_status_clear() in
mtu3_intr_disable().

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_core.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index f3ad1cc..ece5b3e 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -147,17 +147,6 @@ static void mtu3_device_reset(struct mtu3 *mtu)
 	mtu3_clrbits(ibase, U3D_SSUSB_DEV_RST_CTRL, SSUSB_DEV_SW_RST);
 }
 
-/* disable all interrupts */
-static void mtu3_intr_disable(struct mtu3 *mtu)
-{
-	void __iomem *mbase = mtu->mac_base;
-
-	/* Disable level 1 interrupts */
-	mtu3_writel(mbase, U3D_LV1IECR, ~0x0);
-	/* Disable endpoint interrupts */
-	mtu3_writel(mbase, U3D_EPIECR, ~0x0);
-}
-
 static void mtu3_intr_status_clear(struct mtu3 *mtu)
 {
 	void __iomem *mbase = mtu->mac_base;
@@ -170,6 +159,18 @@ static void mtu3_intr_status_clear(struct mtu3 *mtu)
 	mtu3_writel(mbase, U3D_LTSSM_INTR, ~0x0);
 	/* Clear speed change interrupt status */
 	mtu3_writel(mbase, U3D_DEV_LINK_INTR, ~0x0);
+	/* Clear QMU interrupt status */
+	mtu3_writel(mbase, U3D_QISAR0, ~0x0);
+}
+
+/* disable all interrupts */
+static void mtu3_intr_disable(struct mtu3 *mtu)
+{
+	/* Disable level 1 interrupts */
+	mtu3_writel(mtu->mac_base, U3D_LV1IECR, ~0x0);
+	/* Disable endpoint interrupts */
+	mtu3_writel(mtu->mac_base, U3D_EPIECR, ~0x0);
+	mtu3_intr_status_clear(mtu);
 }
 
 /* enable system global interrupt */
@@ -312,7 +313,6 @@ void mtu3_stop(struct mtu3 *mtu)
 	dev_dbg(mtu->dev, "%s\n", __func__);
 
 	mtu3_intr_disable(mtu);
-	mtu3_intr_status_clear(mtu);
 
 	if (mtu->softconnect)
 		mtu3_dev_on_off(mtu, 0);
@@ -600,7 +600,6 @@ static void mtu3_regs_init(struct mtu3 *mtu)
 
 	/* be sure interrupts are disabled before registration of ISR */
 	mtu3_intr_disable(mtu);
-	mtu3_intr_status_clear(mtu);
 
 	mtu3_csr_init(mtu);
 
-- 
1.9.1

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

* [PATCH 05/11] usb: mtu3: introduce a funtion to check maximum speed
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
                   ` (2 preceding siblings ...)
  2020-07-27  7:14 ` [PATCH 04/11] usb: mtu3: clear interrupts status when disable interrupts Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 06/11] usb: mtu3: add ->udc_set_speed() Chunfeng Yun
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

The max_speed got from DTS may be not supported by the
hardware, so need check it, and assign a proper default
value. And make it clear by introducing a funtion.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_core.c | 48 ++++++++++++++++++++++++++------------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index ece5b3e..9694813 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -573,9 +573,6 @@ static void mtu3_set_speed(struct mtu3 *mtu)
 {
 	void __iomem *mbase = mtu->mac_base;
 
-	if (!mtu->is_u3_ip && (mtu->max_speed > USB_SPEED_HIGH))
-		mtu->max_speed = USB_SPEED_HIGH;
-
 	if (mtu->max_speed == USB_SPEED_FULL) {
 		/* disable U3 SS function */
 		mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN);
@@ -761,6 +758,32 @@ static irqreturn_t mtu3_irq(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static void mtu3_check_params(struct mtu3 *mtu)
+{
+	/* check the max_speed parameter */
+	switch (mtu->max_speed) {
+	case USB_SPEED_FULL:
+	case USB_SPEED_HIGH:
+	case USB_SPEED_SUPER:
+	case USB_SPEED_SUPER_PLUS:
+		break;
+	default:
+		dev_err(mtu->dev, "invalid max_speed: %s\n",
+			usb_speed_string(mtu->max_speed));
+		fallthrough;
+	case USB_SPEED_UNKNOWN:
+		/* default as SSP */
+		mtu->max_speed = USB_SPEED_SUPER_PLUS;
+		break;
+	}
+
+	if (!mtu->is_u3_ip && (mtu->max_speed > USB_SPEED_HIGH))
+		mtu->max_speed = USB_SPEED_HIGH;
+
+	dev_info(mtu->dev, "max_speed: %s\n",
+		 usb_speed_string(mtu->max_speed));
+}
+
 static int mtu3_hw_init(struct mtu3 *mtu)
 {
 	u32 value;
@@ -776,6 +799,8 @@ static int mtu3_hw_init(struct mtu3 *mtu)
 	dev_info(mtu->dev, "IP version 0x%x(%s IP)\n", mtu->hw_version,
 		mtu->is_u3_ip ? "U3" : "U2");
 
+	mtu3_check_params(mtu);
+
 	mtu3_device_reset(mtu);
 
 	ret = mtu3_device_enable(mtu);
@@ -857,23 +882,6 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb)
 	mtu->ssusb = ssusb;
 	mtu->max_speed = usb_get_maximum_speed(dev);
 
-	/* check the max_speed parameter */
-	switch (mtu->max_speed) {
-	case USB_SPEED_FULL:
-	case USB_SPEED_HIGH:
-	case USB_SPEED_SUPER:
-	case USB_SPEED_SUPER_PLUS:
-		break;
-	default:
-		dev_err(dev, "invalid max_speed: %s\n",
-			usb_speed_string(mtu->max_speed));
-		/* fall through */
-	case USB_SPEED_UNKNOWN:
-		/* default as SSP */
-		mtu->max_speed = USB_SPEED_SUPER_PLUS;
-		break;
-	}
-
 	dev_dbg(dev, "mac_base=0x%p, ippc_base=0x%p\n",
 		mtu->mac_base, mtu->ippc_base);
 
-- 
1.9.1

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

* [PATCH 06/11] usb: mtu3: add ->udc_set_speed()
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
                   ` (3 preceding siblings ...)
  2020-07-27  7:14 ` [PATCH 05/11] usb: mtu3: introduce a funtion to check maximum speed Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 07/11] usb: mtu3: remove repeated error log Chunfeng Yun
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

Make use of the method to make sure connect on speeds
supported by the gadget driver.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3.h        |  4 ++-
 drivers/usb/mtu3/mtu3_core.c   | 68 +++++++++++++++++++++++++-----------------
 drivers/usb/mtu3/mtu3_gadget.c | 14 +++++++++
 3 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
index d49db92..9d68f25 100644
--- a/drivers/usb/mtu3/mtu3.h
+++ b/drivers/usb/mtu3/mtu3.h
@@ -348,7 +348,8 @@ struct mtu3 {
 	struct usb_gadget_driver *gadget_driver;
 	struct mtu3_request ep0_req;
 	u8 setup_buf[EP0_RESPONSE_BUF];
-	u32 max_speed;
+	enum usb_device_speed max_speed;
+	enum usb_device_speed speed;
 
 	unsigned is_active:1;
 	unsigned may_wakeup:1;
@@ -433,6 +434,7 @@ int mtu3_config_ep(struct mtu3 *mtu, struct mtu3_ep *mep,
 void mtu3_start(struct mtu3 *mtu);
 void mtu3_stop(struct mtu3 *mtu);
 void mtu3_dev_on_off(struct mtu3 *mtu, int is_on);
+void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed);
 
 int mtu3_gadget_setup(struct mtu3 *mtu);
 void mtu3_gadget_cleanup(struct mtu3 *mtu);
diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 9694813..c875b22 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -203,7 +203,42 @@ static void mtu3_intr_enable(struct mtu3 *mtu)
 	mtu3_writel(mbase, U3D_DEV_LINK_INTR_ENABLE, SSUSB_DEV_SPEED_CHG_INTR);
 }
 
-static void mtu3_set_speed(struct mtu3 *mtu);
+void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed)
+{
+	void __iomem *mbase = mtu->mac_base;
+
+	if (speed > mtu->max_speed)
+		speed = mtu->max_speed;
+
+	switch (speed) {
+	case USB_SPEED_FULL:
+		/* disable U3 SS function */
+		mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN);
+		/* disable HS function */
+		mtu3_clrbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
+		break;
+	case USB_SPEED_HIGH:
+		mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN);
+		/* HS/FS detected by HW */
+		mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
+		break;
+	case USB_SPEED_SUPER:
+		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),
+			     SSUSB_U3_PORT_SSP_SPEED);
+		break;
+	default:
+		dev_err(mtu->dev, "invalid speed: %s\n",
+			usb_speed_string(speed));
+		return;
+	}
+
+	mtu->speed = speed;
+	dev_dbg(mtu->dev, "set speed: %s\n", usb_speed_string(speed));
+}
 
 /* CSR registers will be reset to default value if port is disabled */
 static void mtu3_csr_init(struct mtu3 *mtu)
@@ -225,8 +260,6 @@ static void mtu3_csr_init(struct mtu3 *mtu)
 		mtu3_setbits(mbase, U3D_U3U2_SWITCH_CTRL, SOFTCON_CLR_AUTO_EN);
 	}
 
-	mtu3_set_speed(mtu);
-
 	/* delay about 0.1us from detecting reset to send chirp-K */
 	mtu3_clrbits(mbase, U3D_LINK_RESET_INFO, WTCHRP_MSK);
 	/* enable automatical HWRW from L1 */
@@ -280,13 +313,13 @@ void mtu3_ep_stall_set(struct mtu3_ep *mep, bool set)
 
 void mtu3_dev_on_off(struct mtu3 *mtu, int is_on)
 {
-	if (mtu->is_u3_ip && mtu->max_speed >= USB_SPEED_SUPER)
+	if (mtu->is_u3_ip && mtu->speed >= USB_SPEED_SUPER)
 		mtu3_ss_func_set(mtu, is_on);
 	else
 		mtu3_hs_softconn_set(mtu, is_on);
 
 	dev_info(mtu->dev, "gadget (%s) pullup D%s\n",
-		usb_speed_string(mtu->max_speed), is_on ? "+" : "-");
+		usb_speed_string(mtu->speed), is_on ? "+" : "-");
 }
 
 void mtu3_start(struct mtu3 *mtu)
@@ -299,6 +332,7 @@ void mtu3_start(struct mtu3 *mtu)
 	mtu3_clrbits(mtu->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
 
 	mtu3_csr_init(mtu);
+	mtu3_set_speed(mtu, mtu->speed);
 
 	/* Initialize the default interrupts */
 	mtu3_intr_enable(mtu);
@@ -569,28 +603,6 @@ static void mtu3_mem_free(struct mtu3 *mtu)
 	kfree(mtu->ep_array);
 }
 
-static void mtu3_set_speed(struct mtu3 *mtu)
-{
-	void __iomem *mbase = mtu->mac_base;
-
-	if (mtu->max_speed == USB_SPEED_FULL) {
-		/* disable U3 SS function */
-		mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN);
-		/* disable HS function */
-		mtu3_clrbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
-	} else if (mtu->max_speed == USB_SPEED_HIGH) {
-		mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN);
-		/* HS/FS detected by HW */
-		mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE);
-	} else if (mtu->max_speed == USB_SPEED_SUPER) {
-		mtu3_clrbits(mtu->ippc_base, SSUSB_U3_CTRL(0),
-			     SSUSB_U3_PORT_SSP_SPEED);
-	}
-
-	dev_info(mtu->dev, "max_speed: %s\n",
-		usb_speed_string(mtu->max_speed));
-}
-
 static void mtu3_regs_init(struct mtu3 *mtu)
 {
 	void __iomem *mbase = mtu->mac_base;
@@ -780,6 +792,8 @@ static void mtu3_check_params(struct mtu3 *mtu)
 	if (!mtu->is_u3_ip && (mtu->max_speed > USB_SPEED_HIGH))
 		mtu->max_speed = USB_SPEED_HIGH;
 
+	mtu->speed = mtu->max_speed;
+
 	dev_info(mtu->dev, "max_speed: %s\n",
 		 usb_speed_string(mtu->max_speed));
 }
diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 6b26cb8..3d13129 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -577,6 +577,19 @@ static int mtu3_gadget_stop(struct usb_gadget *g)
 	return 0;
 }
 
+static void
+mtu3_gadget_set_speed(struct usb_gadget *g, enum usb_device_speed speed)
+{
+	struct mtu3 *mtu = gadget_to_mtu3(g);
+	unsigned long flags;
+
+	dev_dbg(mtu->dev, "%s %s\n", __func__, usb_speed_string(speed));
+
+	spin_lock_irqsave(&mtu->lock, flags);
+	mtu3_set_speed(mtu, speed);
+	spin_unlock_irqrestore(&mtu->lock, flags);
+}
+
 static const struct usb_gadget_ops mtu3_gadget_ops = {
 	.get_frame = mtu3_gadget_get_frame,
 	.wakeup = mtu3_gadget_wakeup,
@@ -584,6 +597,7 @@ static int mtu3_gadget_stop(struct usb_gadget *g)
 	.pullup = mtu3_gadget_pullup,
 	.udc_start = mtu3_gadget_start,
 	.udc_stop = mtu3_gadget_stop,
+	.udc_set_speed = mtu3_gadget_set_speed,
 };
 
 static void mtu3_state_reset(struct mtu3 *mtu)
-- 
1.9.1

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

* [PATCH 07/11] usb: mtu3: remove repeated error log
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
                   ` (4 preceding siblings ...)
  2020-07-27  7:14 ` [PATCH 06/11] usb: mtu3: add ->udc_set_speed() Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 08/11] usb: mtu3: remove useless member @busy in mtu3_ep struct Chunfeng Yun
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

The caller already print error log.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_gadget.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 3d13129..2bc9a95 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -673,8 +673,6 @@ static void mtu3_gadget_init_eps(struct mtu3 *mtu)
 
 int mtu3_gadget_setup(struct mtu3 *mtu)
 {
-	int ret;
-
 	mtu->g.ops = &mtu3_gadget_ops;
 	mtu->g.max_speed = mtu->max_speed;
 	mtu->g.speed = USB_SPEED_UNKNOWN;
@@ -685,11 +683,7 @@ int mtu3_gadget_setup(struct mtu3 *mtu)
 
 	mtu3_gadget_init_eps(mtu);
 
-	ret = usb_add_gadget_udc(mtu->dev, &mtu->g);
-	if (ret)
-		dev_err(mtu->dev, "failed to register udc\n");
-
-	return ret;
+	return usb_add_gadget_udc(mtu->dev, &mtu->g);
 }
 
 void mtu3_gadget_cleanup(struct mtu3 *mtu)
-- 
1.9.1

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

* [PATCH 08/11] usb: mtu3: remove useless member @busy in mtu3_ep struct
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
                   ` (5 preceding siblings ...)
  2020-07-27  7:14 ` [PATCH 07/11] usb: mtu3: remove repeated error log Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 09/11] usb: mtu3: use MTU3_EP_WEDGE flag Chunfeng Yun
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

The member @busy in mtu3_ep struct is unnecessary, so remove it.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3.h        | 1 -
 drivers/usb/mtu3/mtu3_gadget.c | 6 ------
 2 files changed, 7 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
index 9d68f25..8fd83bd 100644
--- a/drivers/usb/mtu3/mtu3.h
+++ b/drivers/usb/mtu3/mtu3.h
@@ -294,7 +294,6 @@ struct mtu3_ep {
 
 	int flags;
 	u8 wedged;
-	u8 busy;
 };
 
 struct mtu3_request {
diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 2bc9a95..ef9fcd5 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -17,7 +17,6 @@ void mtu3_req_complete(struct mtu3_ep *mep,
 {
 	struct mtu3_request *mreq;
 	struct mtu3 *mtu;
-	int busy = mep->busy;
 
 	mreq = to_mtu3_request(req);
 	list_del(&mreq->list);
@@ -25,8 +24,6 @@ void mtu3_req_complete(struct mtu3_ep *mep,
 		mreq->request.status = status;
 
 	mtu = mreq->mtu;
-	mep->busy = 1;
-
 	trace_mtu3_req_complete(mreq);
 	spin_unlock(&mtu->lock);
 
@@ -40,14 +37,12 @@ void mtu3_req_complete(struct mtu3_ep *mep,
 	usb_gadget_giveback_request(&mep->ep, &mreq->request);
 
 	spin_lock(&mtu->lock);
-	mep->busy = busy;
 }
 
 static void nuke(struct mtu3_ep *mep, const int status)
 {
 	struct mtu3_request *mreq = NULL;
 
-	mep->busy = 1;
 	if (list_empty(&mep->req_list))
 		return;
 
@@ -195,7 +190,6 @@ static int mtu3_gadget_ep_enable(struct usb_ep *ep,
 	if (ret)
 		goto error;
 
-	mep->busy = 0;
 	mep->wedged = 0;
 	mep->flags |= MTU3_EP_ENABLED;
 	mtu->active_ep++;
-- 
1.9.1

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

* [PATCH 09/11] usb: mtu3: use MTU3_EP_WEDGE flag
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
                   ` (6 preceding siblings ...)
  2020-07-27  7:14 ` [PATCH 08/11] usb: mtu3: remove useless member @busy in mtu3_ep struct Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  7:14 ` [PATCH 10/11] usb: mtu3: clear dual mode of u3port when disable device Chunfeng Yun
  2020-07-27  7:15 ` [PATCH 11/11] usb: mtu3: simplify mtu3_req_complete() Chunfeng Yun
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

Use MTU3_EP_WEDGE flag instead of the member @wedged in mtu3_ep
struct, then @wedged can be removed.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3.h            | 1 -
 drivers/usb/mtu3/mtu3_gadget.c     | 9 ++++-----
 drivers/usb/mtu3/mtu3_gadget_ep0.c | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h
index 8fd83bd..71f4f02 100644
--- a/drivers/usb/mtu3/mtu3.h
+++ b/drivers/usb/mtu3/mtu3.h
@@ -293,7 +293,6 @@ struct mtu3_ep {
 	const struct usb_endpoint_descriptor *desc;
 
 	int flags;
-	u8 wedged;
 };
 
 struct mtu3_request {
diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index ef9fcd5..73a8536 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -190,8 +190,7 @@ static int mtu3_gadget_ep_enable(struct usb_ep *ep,
 	if (ret)
 		goto error;
 
-	mep->wedged = 0;
-	mep->flags |= MTU3_EP_ENABLED;
+	mep->flags = MTU3_EP_ENABLED;
 	mtu->active_ep++;
 
 error:
@@ -219,7 +218,7 @@ static int mtu3_gadget_ep_disable(struct usb_ep *ep)
 
 	spin_lock_irqsave(&mtu->lock, flags);
 	mtu3_ep_disable(mep);
-	mep->flags &= ~MTU3_EP_ENABLED;
+	mep->flags = 0;
 	mtu->active_ep--;
 	spin_unlock_irqrestore(&(mtu->lock), flags);
 
@@ -389,7 +388,7 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value)
 			goto done;
 		}
 	} else {
-		mep->wedged = 0;
+		mep->flags &= ~MTU3_EP_WEDGE;
 	}
 
 	dev_dbg(mtu->dev, "%s %s stall\n", ep->name, value ? "set" : "clear");
@@ -408,7 +407,7 @@ static int mtu3_gadget_ep_set_wedge(struct usb_ep *ep)
 {
 	struct mtu3_ep *mep = to_mtu3_ep(ep);
 
-	mep->wedged = 1;
+	mep->flags |= MTU3_EP_WEDGE;
 
 	return usb_ep_set_halt(ep);
 }
diff --git a/drivers/usb/mtu3/mtu3_gadget_ep0.c b/drivers/usb/mtu3/mtu3_gadget_ep0.c
index 563a0a2..0ca4721 100644
--- a/drivers/usb/mtu3/mtu3_gadget_ep0.c
+++ b/drivers/usb/mtu3/mtu3_gadget_ep0.c
@@ -417,7 +417,7 @@ static int ep0_handle_feature(struct mtu3 *mtu,
 
 		handled = 1;
 		/* ignore request if endpoint is wedged */
-		if (mep->wedged)
+		if (mep->flags & MTU3_EP_WEDGE)
 			break;
 
 		mtu3_ep_stall_set(mep, set);
-- 
1.9.1

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

* [PATCH 10/11] usb: mtu3: clear dual mode of u3port when disable device
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
                   ` (7 preceding siblings ...)
  2020-07-27  7:14 ` [PATCH 09/11] usb: mtu3: use MTU3_EP_WEDGE flag Chunfeng Yun
@ 2020-07-27  7:14 ` Chunfeng Yun
  2020-07-27  8:07   ` Sergei Shtylyov
  2020-07-27  7:15 ` [PATCH 11/11] usb: mtu3: simplify mtu3_req_complete() Chunfeng Yun
  9 siblings, 1 reply; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:14 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

If not clear u3port's dual mode when disable device, the IP
will fail to enter sleep mode when suspend.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index c875b22..a9c5c32 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -131,8 +131,12 @@ static void mtu3_device_disable(struct mtu3 *mtu)
 	mtu3_setbits(ibase, SSUSB_U2_CTRL(0),
 		SSUSB_U2_PORT_DIS | SSUSB_U2_PORT_PDN);
 
-	if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG)
+	if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) {
 		mtu3_clrbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_OTG_SEL);
+		if (mtu->is_u3_ip)
+			mtu3_clrbits(ibase, SSUSB_U3_CTRL(0),
+				     SSUSB_U3_PORT_DUAL_MODE);
+	}
 
 	mtu3_setbits(ibase, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
 }
-- 
1.9.1

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

* [PATCH 11/11] usb: mtu3: simplify mtu3_req_complete()
  2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
                   ` (8 preceding siblings ...)
  2020-07-27  7:14 ` [PATCH 10/11] usb: mtu3: clear dual mode of u3port when disable device Chunfeng Yun
@ 2020-07-27  7:15 ` Chunfeng Yun
  9 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-27  7:15 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek, Eddie Hung

Use argument req directly instead of mreq->request, they
are the same usb request.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_gadget.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
index 73a8536..1de5c9a 100644
--- a/drivers/usb/mtu3/mtu3_gadget.c
+++ b/drivers/usb/mtu3/mtu3_gadget.c
@@ -15,15 +15,13 @@ void mtu3_req_complete(struct mtu3_ep *mep,
 __releases(mep->mtu->lock)
 __acquires(mep->mtu->lock)
 {
-	struct mtu3_request *mreq;
-	struct mtu3 *mtu;
+	struct mtu3_request *mreq = to_mtu3_request(req);
+	struct mtu3 *mtu = mreq->mtu;
 
-	mreq = to_mtu3_request(req);
 	list_del(&mreq->list);
-	if (mreq->request.status == -EINPROGRESS)
-		mreq->request.status = status;
+	if (req->status == -EINPROGRESS)
+		req->status = status;
 
-	mtu = mreq->mtu;
 	trace_mtu3_req_complete(mreq);
 	spin_unlock(&mtu->lock);
 
@@ -31,11 +29,10 @@ void mtu3_req_complete(struct mtu3_ep *mep,
 	if (mep->epnum)
 		usb_gadget_unmap_request(&mtu->g, req, mep->is_in);
 
-	dev_dbg(mtu->dev, "%s complete req: %p, sts %d, %d/%d\n", mep->name,
-		req, req->status, mreq->request.actual, mreq->request.length);
-
-	usb_gadget_giveback_request(&mep->ep, &mreq->request);
+	dev_dbg(mtu->dev, "%s complete req: %p, sts %d, %d/%d\n",
+		mep->name, req, req->status, req->actual, req->length);
 
+	usb_gadget_giveback_request(&mep->ep, req);
 	spin_lock(&mtu->lock);
 }
 
-- 
1.9.1

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

* Re: [PATCH 10/11] usb: mtu3: clear dual mode of u3port when disable device
  2020-07-27  7:14 ` [PATCH 10/11] usb: mtu3: clear dual mode of u3port when disable device Chunfeng Yun
@ 2020-07-27  8:07   ` Sergei Shtylyov
  2020-07-28  6:05     ` Chunfeng Yun
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2020-07-27  8:07 UTC (permalink / raw)
  To: Chunfeng Yun, Felipe Balbi, Greg Kroah-Hartman
  Cc: Matthias Brugger, linux-usb, linux-kernel, linux-arm-kernel,
	linux-mediatek, Eddie Hung

Hello!

On 27.07.2020 10:14, Chunfeng Yun wrote:

> If not clear u3port's dual mode when disable device, the IP

    If we don't clear ... when disabling ...?

> will fail to enter sleep mode when suspend.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
[...]

MBR, Sergei

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

* Re: [PATCH 10/11] usb: mtu3: clear dual mode of u3port when disable device
  2020-07-27  8:07   ` Sergei Shtylyov
@ 2020-07-28  6:05     ` Chunfeng Yun
  0 siblings, 0 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-07-28  6:05 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Felipe Balbi, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-kernel, linux-arm-kernel, linux-mediatek, Eddie Hung

On Mon, 2020-07-27 at 11:07 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 27.07.2020 10:14, Chunfeng Yun wrote:
> 
> > If not clear u3port's dual mode when disable device, the IP
> 
>     If we don't clear ... when disabling ...?
> 
> > will fail to enter sleep mode when suspend.
Ok, thanks a lot

> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> [...]
> 
> MBR, Sergei


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

end of thread, back to index

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27  7:14 [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Chunfeng Yun
2020-07-27  7:14 ` [PATCH 02/11] usb: mtu3: fix macro for maximum number of packets Chunfeng Yun
2020-07-27  7:14 ` [PATCH 03/11] usb: mtu3: reinitialize CSR registers Chunfeng Yun
2020-07-27  7:14 ` [PATCH 04/11] usb: mtu3: clear interrupts status when disable interrupts Chunfeng Yun
2020-07-27  7:14 ` [PATCH 05/11] usb: mtu3: introduce a funtion to check maximum speed Chunfeng Yun
2020-07-27  7:14 ` [PATCH 06/11] usb: mtu3: add ->udc_set_speed() Chunfeng Yun
2020-07-27  7:14 ` [PATCH 07/11] usb: mtu3: remove repeated error log Chunfeng Yun
2020-07-27  7:14 ` [PATCH 08/11] usb: mtu3: remove useless member @busy in mtu3_ep struct Chunfeng Yun
2020-07-27  7:14 ` [PATCH 09/11] usb: mtu3: use MTU3_EP_WEDGE flag Chunfeng Yun
2020-07-27  7:14 ` [PATCH 10/11] usb: mtu3: clear dual mode of u3port when disable device Chunfeng Yun
2020-07-27  8:07   ` Sergei Shtylyov
2020-07-28  6:05     ` Chunfeng Yun
2020-07-27  7:15 ` [PATCH 11/11] usb: mtu3: simplify mtu3_req_complete() Chunfeng Yun

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git