All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Felipe Balbi <balbi@kernel.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	<linux-usb@vger.kernel.org>
Cc: John Youn <John.Youn@synopsys.com>, <stable@vger.kernel.org>
Subject: [PATCH v2 1/2] usb: dwc3: gadget: Set maxpacket size for ep0 IN
Date: Wed, 10 Jan 2018 13:11:06 -0800	[thread overview]
Message-ID: <c4a0e8b7be2035eadf54fbf27dfb79f9efb852a7.1515618112.git.thinhn@synopsys.com> (raw)
In-Reply-To: <cover.1515618112.git.thinhn@synopsys.com>

There are 2 control endpoint structures for DWC3. However, the driver
only updates the OUT direction control endpoint structure during
ConnectDone event. DWC3 driver needs to update the endpoint max packet
size for control IN endpoint as well. If the max packet size is not
properly set, then the driver will incorrectly calculate the data
transfer size and fail to send ZLP for HS/FS 3-stage control read
transfer.

The fix is simply to update the max packet size for the ep0 IN direction
during ConnectDone event.

Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 drivers/usb/dwc3/gadget.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 639dd1b163a0..21abea0ac622 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2744,6 +2744,8 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
 		break;
 	}
 
+	dwc->eps[1]->endpoint.maxpacket = dwc->gadget.ep0->maxpacket;
+
 	/* Enable USB2 LPM Capability */
 
 	if ((dwc->revision > DWC3_REVISION_194A) &&
-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Felipe Balbi <balbi@kernel.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	linux-usb@vger.kernel.org
Cc: John Youn <John.Youn@synopsys.com>, stable@vger.kernel.org
Subject: [v2,1/2] usb: dwc3: gadget: Set maxpacket size for ep0 IN
Date: Wed, 10 Jan 2018 13:11:06 -0800	[thread overview]
Message-ID: <c4a0e8b7be2035eadf54fbf27dfb79f9efb852a7.1515618112.git.thinhn@synopsys.com> (raw)

There are 2 control endpoint structures for DWC3. However, the driver
only updates the OUT direction control endpoint structure during
ConnectDone event. DWC3 driver needs to update the endpoint max packet
size for control IN endpoint as well. If the max packet size is not
properly set, then the driver will incorrectly calculate the data
transfer size and fail to send ZLP for HS/FS 3-stage control read
transfer.

The fix is simply to update the max packet size for the ep0 IN direction
during ConnectDone event.

Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 drivers/usb/dwc3/gadget.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 639dd1b163a0..21abea0ac622 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2744,6 +2744,8 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
 		break;
 	}
 
+	dwc->eps[1]->endpoint.maxpacket = dwc->gadget.ep0->maxpacket;
+
 	/* Enable USB2 LPM Capability */
 
 	if ((dwc->revision > DWC3_REVISION_194A) &&

  reply	other threads:[~2018-01-10 21:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 21:10 [PATCH v2 0/2] usb: dwc3: Properly update ep0 for IN direction Thinh Nguyen
2018-01-10 21:11 ` Thinh Nguyen [this message]
2018-01-10 21:11   ` [v2,1/2] usb: dwc3: gadget: Set maxpacket size for ep0 IN Thinh Nguyen
2018-01-11  8:16   ` [PATCH v2 1/2] " Felipe Balbi
2018-01-11  8:16     ` [v2,1/2] " Felipe Balbi
2018-01-11 19:57     ` [PATCH v2 1/2] " Thinh Nguyen
2018-01-11 19:57       ` [v2,1/2] " Thinh Nguyen
2018-01-12  8:25       ` [PATCH v2 1/2] " Felipe Balbi
2018-01-12  8:25         ` [v2,1/2] " Felipe Balbi
2018-01-10 21:11 ` [PATCH v2 2/2] usb: dwc3: ep0: Reset TRB counter " Thinh Nguyen
2018-01-10 21:11   ` [v2,2/2] " Thinh Nguyen
2018-01-11  8:16   ` [PATCH v2 2/2] " Felipe Balbi
2018-01-11  8:16     ` [v2,2/2] " Felipe Balbi
2018-01-11 20:57     ` [PATCH v2 2/2] " Thinh Nguyen
2018-01-11 20:57       ` [v2,2/2] " Thinh Nguyen

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=c4a0e8b7be2035eadf54fbf27dfb79f9efb852a7.1515618112.git.thinhn@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=John.Youn@synopsys.com \
    --cc=balbi@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.