[PATCH 05/14] usb: chipidea: udc: rework ep_enable cap setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
---
 drivers/usb/chipidea/udc.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index a86d9a6..0ab7b0b 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1009,6 +1009,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;
@@ -1030,18 +1031,18 @@ static int ep_enable(struct usb_ep *ep,
 
 	trace_ci_ep_enable(mEp, 0);
 
-	writel(0, &mEp->qh.ptr->cap);
-
 	if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
-		writel(readl(&mEp->qh.ptr->cap) | QH_IOS, &mEp->qh.ptr->cap);
+		val |= QH_IOS;
 	else if (mEp->type == USB_ENDPOINT_XFER_ISOC)
-		mEp->qh.ptr->cap &= ~QH_MULT;
-	else
-		writel(readl(&mEp->qh.ptr->cap) & ~QH_ZLT, &mEp->qh.ptr->cap);
+		val &= ~QH_MULT;
+
 	if (mEp->num)
-		writel(readl(&mEp->qh.ptr->cap) | QH_ZLT, &mEp->qh.ptr->cap);
+		val |= QH_ZLT;
+
+	val |= (mEp->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
+
+	writel(val, &mEp->qh.ptr->cap);
 
-	writel(readl(&mEp->qh.ptr->cap) | ((mEp->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT), &mEp->qh.ptr->cap);
 	writel(readl(&mEp->qh.ptr->td.next) | TD_TERMINATE, &mEp->qh.ptr->td.next);   /* needed? */
 
 	/*
-- 
1.8.2.rc2

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux