summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2014-05-29 14:53:01 -0600
committerMarek Vasut <marex@denx.de>2014-06-01 19:22:40 +0200
commit054731b09e1944cdb130b755ac0f6c188920e98a (patch)
treef292c70f5b989e8b842cb3060ef80e17874276db /drivers/usb
parent7484d84cbb58e01ff1d2d458d899ea1fba012724 (diff)
downloadu-boot-imx-054731b09e1944cdb130b755ac0f6c188920e98a.zip
u-boot-imx-054731b09e1944cdb130b755ac0f6c188920e98a.tar.gz
u-boot-imx-054731b09e1944cdb130b755ac0f6c188920e98a.tar.bz2
usb: ci_udc: use a single descriptor for ep0
ci_udc currently points ep->desc at separate descriptors for IN and OUT. These descriptors only differ in the ep address IN/OUT field. Modify the code to use a single descriptor, and change that descriptor's ep address to indicate IN/OUT as required. This removes some data duplication. Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/ci_udc.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index a68a85f..77f8c9e 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -56,14 +56,7 @@ static const char *reqname(unsigned r)
}
#endif
-static struct usb_endpoint_descriptor ep0_out_desc = {
- .bLength = sizeof(struct usb_endpoint_descriptor),
- .bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0,
- .bmAttributes = USB_ENDPOINT_XFER_CONTROL,
-};
-
-static struct usb_endpoint_descriptor ep0_in_desc = {
+static struct usb_endpoint_descriptor ep0_desc = {
.bLength = sizeof(struct usb_endpoint_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
@@ -435,7 +428,7 @@ static void handle_ep_complete(struct ci_ep *ep)
num = ep->desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
in = (ep->desc->bEndpointAddress & USB_DIR_IN) != 0;
if (num == 0)
- ep->desc = &ep0_out_desc;
+ ep0_desc.bEndpointAddress = 0;
item = ci_get_qtd(num, in);
ci_invalidate_qtd(num);
@@ -460,7 +453,7 @@ static void handle_ep_complete(struct ci_ep *ep)
if (num == 0) {
ci_req->req.length = 0;
usb_ep_queue(&ep->ep, &ci_req->req, 0);
- ep->desc = &ep0_in_desc;
+ ep0_desc.bEndpointAddress = USB_DIR_IN;
}
}
@@ -771,7 +764,7 @@ static int ci_udc_probe(void)
/* Init EP 0 */
memcpy(&controller.ep[0].ep, &ci_ep_init[0], sizeof(*ci_ep_init));
- controller.ep[0].desc = &ep0_in_desc;
+ controller.ep[0].desc = &ep0_desc;
INIT_LIST_HEAD(&controller.ep[0].queue);
controller.ep[0].req_primed = false;
controller.gadget.ep0 = &controller.ep[0].ep;