All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: balbi@kernel.org
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, stable@vger.kernel.org,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Subject: [PATCH v2 6/6] usb: gadget: udc: renesas_usb3: disable the controller's irqs for reconnecting
Date: Tue, 10 Apr 2018 14:38:54 +0900	[thread overview]
Message-ID: <1523338734-20474-7-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw)
In-Reply-To: <1523338734-20474-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>

This patch fixes an issue that reconnection is possible to fail
because unexpected state handling happens by the irqs. To fix the issue,
the driver disables the controller's irqs when disconnected.

Fixes: 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---

Remarks:
 - A new file in v2

 drivers/usb/gadget/udc/renesas_usb3.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 0e70163..5caf78b 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -623,6 +623,13 @@ static void usb3_disconnect(struct renesas_usb3 *usb3)
 	usb3_usb2_pullup(usb3, 0);
 	usb3_clear_bit(usb3, USB30_CON_B3_CONNECT, USB3_USB30_CON);
 	usb3_reset_epc(usb3);
+	usb3_disable_irq_1(usb3, USB_INT_1_B2_RSUM | USB_INT_1_B3_PLLWKUP |
+			   USB_INT_1_B3_LUPSUCS | USB_INT_1_B3_DISABLE |
+			   USB_INT_1_SPEED | USB_INT_1_B3_WRMRST |
+			   USB_INT_1_B3_HOTRST | USB_INT_1_B2_SPND |
+			   USB_INT_1_B2_L1SPND | USB_INT_1_B2_USBRST);
+	usb3_clear_bit(usb3, USB_COM_CON_SPD_MODE, USB3_USB_COM_CON);
+	usb3_init_epc_registers(usb3);
 
 	if (usb3->driver)
 		usb3->driver->disconnect(&usb3->gadget);
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: balbi@kernel.org
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, stable@vger.kernel.org,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Subject: [v2,6/6] usb: gadget: udc: renesas_usb3: disable the controller's irqs for reconnecting
Date: Tue, 10 Apr 2018 14:38:54 +0900	[thread overview]
Message-ID: <1523338734-20474-7-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw)

This patch fixes an issue that reconnection is possible to fail
because unexpected state handling happens by the irqs. To fix the issue,
the driver disables the controller's irqs when disconnected.

Fixes: 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---

Remarks:
 - A new file in v2

 drivers/usb/gadget/udc/renesas_usb3.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 0e70163..5caf78b 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -623,6 +623,13 @@ static void usb3_disconnect(struct renesas_usb3 *usb3)
 	usb3_usb2_pullup(usb3, 0);
 	usb3_clear_bit(usb3, USB30_CON_B3_CONNECT, USB3_USB30_CON);
 	usb3_reset_epc(usb3);
+	usb3_disable_irq_1(usb3, USB_INT_1_B2_RSUM | USB_INT_1_B3_PLLWKUP |
+			   USB_INT_1_B3_LUPSUCS | USB_INT_1_B3_DISABLE |
+			   USB_INT_1_SPEED | USB_INT_1_B3_WRMRST |
+			   USB_INT_1_B3_HOTRST | USB_INT_1_B2_SPND |
+			   USB_INT_1_B2_L1SPND | USB_INT_1_B2_USBRST);
+	usb3_clear_bit(usb3, USB_COM_CON_SPD_MODE, USB3_USB_COM_CON);
+	usb3_init_epc_registers(usb3);
 
 	if (usb3->driver)
 		usb3->driver->disconnect(&usb3->gadget);

  parent reply	other threads:[~2018-04-10  5:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  5:38 [PATCH v2 0/6] usb: gadget: udc: renesas_usb3: fix some major issues Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 1/6] usb: gadget: udc: renesas_usb3: fix double phy_put() Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,1/6] " Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 2/6] usb: gadget: udc: renesas_usb3: should remove debugfs Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,2/6] " Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 3/6] usb: gadget: udc: renesas_usb3: should call pm_runtime_enable() before add udc Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,3/6] " Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 4/6] usb: gadget: udc: renesas_usb3: should call devm_phy_get() " Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,4/6] " Yoshihiro Shimoda
2018-04-10  5:38 ` [PATCH v2 5/6] usb: gadget: udc: renesas_usb3: should fail if devm_phy_get() returns error Yoshihiro Shimoda
2018-04-10  5:38   ` [v2,5/6] " Yoshihiro Shimoda
2018-04-10  9:35   ` [PATCH v2 5/6] " Simon Horman
2018-04-10  9:35     ` [v2,5/6] " Simon Horman
2018-05-15  7:31   ` [PATCH v2 5/6] " Simon Horman
2018-05-15  7:31     ` [v2,5/6] " Simon Horman
2018-04-10  5:38 ` Yoshihiro Shimoda [this message]
2018-04-10  5:38   ` [v2,6/6] usb: gadget: udc: renesas_usb3: disable the controller's irqs for reconnecting Yoshihiro Shimoda
2018-04-10  9:34   ` [PATCH v2 6/6] " Simon Horman
2018-04-10  9:34     ` [v2,6/6] " Simon Horman
2018-05-15  7:35   ` [PATCH v2 6/6] " Simon Horman
2018-05-15  7:35     ` [v2,6/6] " Simon Horman
2018-05-15  7:49     ` [PATCH v2 6/6] " Yoshihiro Shimoda
2018-05-15  7:49       ` [v2,6/6] " Yoshihiro Shimoda
2018-05-15  7:55       ` [PATCH v2 6/6] " Simon Horman
2018-05-15  7:55         ` [v2,6/6] " Simon Horman
2018-05-10  7:25 ` [PATCH v2 0/6] usb: gadget: udc: renesas_usb3: fix some major issues 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=1523338734-20474-7-git-send-email-yoshihiro.shimoda.uh@renesas.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.