This patch reworks the cap value from several read
and write operations to one single operation.

Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
Reviewed-by: Felipe Balbi <ba...@ti.com>
---
 drivers/usb/chipidea/udc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 19fc185..b2c227f 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1018,6 +1018,7 @@ static int ep_enable(struct usb_ep *ep,
        struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep);
        int retval = 0;
        unsigned long flags;
+       u32 val = 0;
 
        if (ep == NULL || desc == NULL)
                return -EINVAL;
@@ -1039,19 +1040,17 @@ static int ep_enable(struct usb_ep *ep,
 
        trace_ci_ep_enable(mEp, 0);
 
-       mEp->qh.ptr->cap = 0;
-
        if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
-               mEp->qh.ptr->cap |=  cpu_to_le32(QH_IOS);
+               val |= QH_IOS;
        else if (mEp->type == USB_ENDPOINT_XFER_ISOC)
-               mEp->qh.ptr->cap &= cpu_to_le32(~QH_MULT);
-       else
-               mEp->qh.ptr->cap &= cpu_to_le32(~QH_ZLT);
+               val &= ~QH_MULT;
+
        if (mEp->num)
-               mEp->qh.ptr->cap |= cpu_to_le32(QH_ZLT);
+               val |= QH_ZLT;
+
+       val |= (mEp->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
+       mEp->qh.ptr->cap = cpu_to_le32(val);
 
-       mEp->qh.ptr->cap |= cpu_to_le32((mEp->ep.maxpacket << __ffs(QH_MAX_PKT))
-                                       & QH_MAX_PKT);
        mEp->qh.ptr->td.next |= cpu_to_le32(TD_TERMINATE);   /* needed? */
 
        /*
-- 
1.8.2.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to