All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/3] usb: s3c-otg: Fix short packet for request size > ep.maxpacket
Date: Tue, 19 Apr 2016 15:20:39 +0300	[thread overview]
Message-ID: <57162297.2030309@ti.com> (raw)
In-Reply-To: <1461050221-9268-3-git-send-email-rogerq@ti.com>

Request size can be greater than ep.packet and still end in a
short packet. We need to tackle this case as end of transfer
(if short_not_ok is not set) as indicated in USB 2.0 Specification [1],
else we get stuck up on certain protocols like fastboot.

[1] - USB2.0 Specification, Section 5.3.2 Pipes

Reported-by: Steve Rae <steve.rae@broadcom.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Steve Rae <steve.rae@broadcom.com>
---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
index bce9c30..9aa0f33 100644
--- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
+++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
@@ -229,7 +229,7 @@ static void complete_rx(struct dwc2_udc *dev, u8 ep_num)
 				ROUND(xfer_size, CONFIG_SYS_CACHELINE_SIZE));
 
 	req->req.actual += min(xfer_size, req->req.length - req->req.actual);
-	is_short = (xfer_size < ep->ep.maxpacket);
+	is_short = !!(xfer_size % ep->ep.maxpacket);
 
 	debug_cond(DEBUG_OUT_EP != 0,
 		   "%s: RX DMA done : ep = %d, rx bytes = %d/%d, "
-- 
2.5.0

  parent reply	other threads:[~2016-04-19 12:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19  7:16 [U-Boot] [PATCH 0/3] s3c-otg: fastboot: fixes and cleanup Roger Quadros
2016-04-19  7:16 ` [U-Boot] [PATCH 1/3] fastboot: Clean up bulk-out logic Roger Quadros
2016-04-19  9:00   ` Lukasz Majewski
2016-04-21 10:03   ` Lukasz Majewski
2016-04-22  2:59     ` Steve Rae
2016-04-22  3:52       ` Lukasz Majewski
2016-04-19  7:17 ` [U-Boot] [PATCH 2/3] usb: s3c-otg: Fix short packet for request size > ep.maxpacket Roger Quadros
2016-04-19  9:02   ` Lukasz Majewski
2016-04-19 10:21     ` Roger Quadros
2016-04-19 11:25       ` Lukasz Majewski
2016-04-19 11:52         ` Roger Quadros
2016-04-19 12:20   ` Roger Quadros [this message]
2016-04-21 10:04     ` [U-Boot] [PATCH v2 " Lukasz Majewski
2016-04-19  7:17 ` [U-Boot] [PATCH 3/3] usb: s3c-otg: Fix remaining bytes in debug messages Roger Quadros
2016-04-21 10:05   ` Lukasz Majewski
2016-04-22  2:49     ` Steve Rae
2016-04-22  3:03       ` Steve Rae

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=57162297.2030309@ti.com \
    --to=rogerq@ti.com \
    --cc=u-boot@lists.denx.de \
    /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.