[PATCH v3 06/14] usb: chipidea: udc: configure iso endpoints

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

 



The implementation is derived from the fsl_udc_core code in
fsl_ep_enable and makes basic iso handling possible.

Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
---
Changes since v1:
 - fixed coding style issues mentioned by Sergei
Changes since v2:
 - fixed usage of variable max
 - reworked on writel/readl patches

 drivers/usb/chipidea/udc.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 0ab7b0b..0c09542 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1011,6 +1011,9 @@ static int ep_enable(struct usb_ep *ep,
 	unsigned long flags;
 	u32 val = 0;
 
+	unsigned short max;
+	unsigned char mult = 0;
+
 	if (ep == NULL || desc == NULL)
 		return -EINVAL;
 
@@ -1027,19 +1030,22 @@ static int ep_enable(struct usb_ep *ep,
 	mEp->num  = usb_endpoint_num(desc);
 	mEp->type = usb_endpoint_type(desc);
 
-	mEp->ep.maxpacket = usb_endpoint_maxp(desc);
+	max = mEp->ep.maxpacket = usb_endpoint_maxp(desc);
 
 	trace_ci_ep_enable(mEp, 0);
 
-	if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
+	if (mEp->type == USB_ENDPOINT_XFER_CONTROL) {
 		val |= QH_IOS;
-	else if (mEp->type == USB_ENDPOINT_XFER_ISOC)
-		val &= ~QH_MULT;
-
+	} else if (mEp->type == USB_ENDPOINT_XFER_ISOC) {
+		/* Calculate transactions needed for high bandwidth iso */
+		mult = (unsigned char)(1 + ((max >> 11) & 0x03));
+		max &= 0x7ff;	/* bit 0~10 */
+		val |= mult << 30;
+	}
 	if (mEp->num)
 		val |= QH_ZLT;
 
-	val |= (mEp->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
+	val |= (max << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
 
 	writel(val, &mEp->qh.ptr->cap);
 
-- 
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