public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] fastboot: OUT transaction length must be aligned to wMaxPacketSize
@ 2016-04-05 18:31 Steve Rae
  2016-04-05 22:06 ` Marek Vasut
  0 siblings, 1 reply; 30+ messages in thread
From: Steve Rae @ 2016-04-05 18:31 UTC (permalink / raw)
  To: u-boot

commit 9e4b510 fastboot: OUT transaction length must be aligned to wMaxPacketSize
breaks some boards...

Therefore add a conditional Kconfig to optionally enable this feature.

Signed-off-by: Steve Rae <srae@broadcom.com>
---

Changes in v2:
- ammendment to the original patch

 drivers/usb/gadget/Kconfig      | 7 +++++++
 drivers/usb/gadget/f_fastboot.c | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index f4698f4..ab1c605 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -33,3 +33,10 @@ menuconfig USB_GADGET
 	   a USB peripheral device.  Configure one hardware driver for your
 	   peripheral/device side bus controller, and a "gadget driver" for
 	   your peripheral protocol.
+
+config USB_GADGET_FASTBOOT_DOWNLOAD_ALIGNMENT_REQUIRED
+	bool "fastboot download requires alignment with wMaxPacketSize"
+	help
+	   By default, the fastboot download OUT transactions are aligned
+	   to "ep->maxpacket". This option causes the fastboot download OUT
+	   transactions to be aligned with "wMaxPacketSize".
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 2e87fee..130b5d0 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -430,17 +430,19 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
 static unsigned int rx_bytes_expected(unsigned int maxpacket)
 {
 	int rx_remain = download_size - download_bytes;
-	int rem = 0;
+	int __maybe_unused rem = 0;
 	if (rx_remain < 0)
 		return 0;
 	if (rx_remain > EP_BUFFER_SIZE)
 		return EP_BUFFER_SIZE;
+#ifdef CONFIG_USB_GADGET_FASTBOOT_DOWNLOAD_ALIGNMENT_REQUIRED
 	if (rx_remain < maxpacket) {
 		rx_remain = maxpacket;
 	} else if (rx_remain % maxpacket != 0) {
 		rem = rx_remain % maxpacket;
 		rx_remain = rx_remain + (maxpacket - rem);
 	}
+#endif
 	return rx_remain;
 }
 
-- 
1.8.5

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

end of thread, other threads:[~2016-04-15 19:56 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 18:31 [U-Boot] [PATCH v2] fastboot: OUT transaction length must be aligned to wMaxPacketSize Steve Rae
2016-04-05 22:06 ` Marek Vasut
2016-04-06  5:35   ` Steve Rae
2016-04-06  7:09     ` Lukasz Majewski
2016-04-06 10:57       ` Marek Vasut
2016-04-06 11:01     ` Marek Vasut
2016-04-06 17:18       ` Steve Rae
2016-04-06 19:53         ` Marek Vasut
2016-04-06 20:45           ` Steve Rae
2016-04-06 20:57             ` Marek Vasut
2016-04-07  8:03               ` Lukasz Majewski
2016-04-07  7:36         ` Lukasz Majewski
2016-04-07 16:46           ` Sam Protsenko
2016-04-07 17:07             ` Steve Rae
2016-04-07 21:16               ` Sam Protsenko
2016-04-07 21:39                 ` Steve Rae
2016-04-07 23:11                   ` Sam Protsenko
2016-04-07 23:15                     ` Steve Rae
2016-04-08 19:44                     ` Tom Rini
2016-04-11 12:29                       ` B, Ravi
2016-04-07 18:40             ` Marek Vasut
2016-04-11 11:34               ` Mugunthan V N
2016-04-11 15:22                 ` Tom Rini
2016-04-12 11:19                   ` Lukasz Majewski
2016-04-12 12:40                     ` Roger Quadros
2016-04-12 13:37                       ` Lukasz Majewski
2016-04-12 13:50                         ` Roger Quadros
2016-04-13  1:55                           ` Steve Rae
2016-04-14 11:15                             ` Roger Quadros
2016-04-15 19:56                               ` Steve Rae

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox