aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2013-03-30 06:54:05 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-30 11:20:48 -0400
commit1cd12a9cf055e72b3094ef38ac4d9afff2e9520e (patch)
tree46ac251c51aa1e0e2eb5e194abcfc6927c7dfe37
parent080ff5f4719e21c78f8ec96eea4f82b2fd047fa4 (diff)
usb: chipidea: udc: rework ep_enable cap setting
This patch reworks the cap value from several read and write operations to one single operation. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Reviewed-by: Felipe Balbi <balbi@ti.com> [Alex: removed useless isoc-related bit of code] Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/chipidea/udc.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 0e11172a4c84..3abd1ad5ced1 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -986,6 +986,7 @@ static int ep_enable(struct usb_ep *ep,
986 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); 986 struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
987 int retval = 0; 987 int retval = 0;
988 unsigned long flags; 988 unsigned long flags;
989 u32 cap = 0;
989 990
990 if (ep == NULL || desc == NULL) 991 if (ep == NULL || desc == NULL)
991 return -EINVAL; 992 return -EINVAL;
@@ -1005,17 +1006,12 @@ static int ep_enable(struct usb_ep *ep,
1005 1006
1006 mEp->ep.maxpacket = usb_endpoint_maxp(desc); 1007 mEp->ep.maxpacket = usb_endpoint_maxp(desc);
1007 1008
1008 mEp->qh.ptr->cap = 0;
1009
1010 if (mEp->type == USB_ENDPOINT_XFER_CONTROL) 1009 if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
1011 mEp->qh.ptr->cap |= cpu_to_le32(QH_IOS); 1010 cap |= QH_IOS;
1012 else if (mEp->type == USB_ENDPOINT_XFER_ISOC) 1011 cap |= (mEp->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
1013 mEp->qh.ptr->cap &= cpu_to_le32(~QH_MULT); 1012
1014 else 1013 mEp->qh.ptr->cap = cpu_to_le32(cap);
1015 mEp->qh.ptr->cap &= cpu_to_le32(~QH_ZLT);
1016 1014
1017 mEp->qh.ptr->cap |= cpu_to_le32((mEp->ep.maxpacket << __ffs(QH_MAX_PKT))
1018 & QH_MAX_PKT);
1019 mEp->qh.ptr->td.next |= cpu_to_le32(TD_TERMINATE); /* needed? */ 1015 mEp->qh.ptr->td.next |= cpu_to_le32(TD_TERMINATE); /* needed? */
1020 1016
1021 /* 1017 /*