blob: f21c024491324e305ee9885d83b7dd10a5aaa728 [file] [log] [blame]
From ltsi-dev-bounces@lists.linuxfoundation.org Sun Feb 17 18:06:06 2013
From: Do Quang Thang <dq-thang@jinso.co.jp>
Date: Mon, 18 Feb 2013 11:05:33 +0900
Subject: usb: gadget: composite: fix ep->maxburst initialization
To: Greg KH <greg@kroah.com>
Cc: ltsi-dev@lists.linuxfoundation.org
Message-ID: <1361153138-5365-3-git-send-email-dq-thang@jinso.co.jp>
From: Felipe Balbi <balbi@ti.com>
bMaxBurst field on endpoint companion descriptor
is supposed to contain the number of burst minus
1. When passing that to controller drivers, we
should be passing the real number instead (by
incrementing 1).
While doing that, also fix the assumption on
dwc3 that value comes decremented by one.
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit b785ea7ce662c47f6208071320638a4813722803)
Signed-off-by: Do Quang Thang <dq-thang@jinso.co.jp>
---
drivers/usb/dwc3/gadget.c | 2 +-
drivers/usb/gadget/composite.c | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -390,7 +390,7 @@ static int dwc3_gadget_set_ep_config(str
params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc))
| DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc))
- | DWC3_DEPCFG_BURST_SIZE(dep->endpoint.maxburst);
+ | DWC3_DEPCFG_BURST_SIZE(dep->endpoint.maxburst - 1);
params.param1 = DWC3_DEPCFG_XFER_COMPLETE_EN
| DWC3_DEPCFG_XFER_NOT_READY_EN;
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -117,6 +117,7 @@ int config_ep_by_speed(struct usb_gadget
struct usb_function *f,
struct usb_ep *_ep)
{
+ struct usb_composite_dev *cdev = get_gadget_data(g);
struct usb_endpoint_descriptor *chosen_desc = NULL;
struct usb_descriptor_header **speed_desc = NULL;
@@ -180,10 +181,12 @@ ep_found:
_ep->mult = comp_desc->bmAttributes & 0x3;
case USB_ENDPOINT_XFER_BULK:
case USB_ENDPOINT_XFER_INT:
- _ep->maxburst = comp_desc->bMaxBurst;
+ _ep->maxburst = comp_desc->bMaxBurst + 1;
break;
default:
- /* Do nothing for control endpoints */
+ if (comp_desc->bMaxBurst != 0)
+ ERROR(cdev, "ep0 bMaxBurst must be 0\n");
+ _ep->maxburst = 1;
break;
}
}