diff mbox

[U-Boot,V5,04/18] usb: gadget: ether set wMaxPacketSize

Message ID 1380159678-26416-5-git-send-email-troy.kisky@boundarydevices.com
State Awaiting Upstream
Delegated to: Marek Vasut
Headers show

Commit Message

Troy Kisky Sept. 26, 2013, 1:41 a.m. UTC
set wMaxPacketSize for full speed descriptors
fs_source_desc, fs_sink_desc to 64.

Full-speed bulk endpoint can have a maximum packet size of
8, 16, 32, or 64 bytes, so choice 64.

The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
set to 512. That is the only legal value for high speed bulk endpoints.

Strictly speaking, this patch is not needed because
usb_ep_autoconfig will call ep_matches which will
override wMaxPacketSize for BULK endpoints only with
the size associated with the endpoint setup by the udc driver.
But if you want to rely on this, you may as well combine the
full speed descriptor with the high speed descriptor to
minimize confusion.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

---
v4: expanded commit message
v5: expanded commit message
---
 drivers/usb/gadget/ether.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Marek Vasut Sept. 27, 2013, 5:54 p.m. UTC | #1
Dear Troy Kisky,

> set wMaxPacketSize for full speed descriptors
> fs_source_desc, fs_sink_desc to 64.
> 
> Full-speed bulk endpoint can have a maximum packet size of
> 8, 16, 32, or 64 bytes, so choice 64.
> 
> The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
> set to 512. That is the only legal value for high speed bulk endpoints.
> 
> Strictly speaking, this patch is not needed because
> usb_ep_autoconfig will call ep_matches which will
> override wMaxPacketSize for BULK endpoints only with
> the size associated with the endpoint setup by the udc driver.
> But if you want to rely on this, you may as well combine the
> full speed descriptor with the high speed descriptor to
> minimize confusion.
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

Picking for -next, thanks

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 700d5fb..988cffb 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -635,6 +635,7 @@  fs_source_desc = {
 
 	.bEndpointAddress =	USB_DIR_IN,
 	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
+	.wMaxPacketSize =	__constant_cpu_to_le16(64),
 };
 
 static struct usb_endpoint_descriptor
@@ -644,6 +645,7 @@  fs_sink_desc = {
 
 	.bEndpointAddress =	USB_DIR_OUT,
 	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
+	.wMaxPacketSize =	__constant_cpu_to_le16(64),
 };
 
 static const struct usb_descriptor_header *fs_eth_function[11] = {