[PATCH] 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>
Reviewed-by: Felipe Balbi <balbi@xxxxxx>
---
 drivers/usb/chipidea/core.c |  2 +-
 drivers/usb/chipidea/udc.c  | 12 ++++++++++++
 drivers/usb/chipidea/udc.h  |  1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 47d433a..5765a23 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -43,7 +43,7 @@
  *
  * TODO List
  * - OTG
- * - Isochronous & Interrupt Traffic
+ * - Interrupt Traffic
  * - Handle requests which spawns into several TDs
  * - GET_STATUS(device) - always reports 0
  * - Gadget API (majority of optional features)
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 18d7efb..e7bc3b7 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -685,6 +685,12 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
 		}
 	}
 
+	if (usb_endpoint_xfer_isoc(mEp->ep.desc)
+	    && mReq->req.length > 3 * mEp->ep.maxpacket) {
+		dev_err(mEp->ci->dev, "request length to big for isochronous\n");
+		return -EMSGSIZE;
+	}
+
 	/* first nuke then test link, e.g. previous status has not sent */
 	if (!list_empty(&mReq->queue)) {
 		dev_err(mEp->ci->dev, "request already in queue\n");
@@ -1071,6 +1077,9 @@ static int ep_enable(struct usb_ep *ep,
 
 	if (mEp->type == USB_ENDPOINT_XFER_CONTROL)
 		cap |= QH_IOS;
+	else if (mEp->type == USB_ENDPOINT_XFER_ISOC)
+		cap |= QH_ISO_TRANS(mEp->ep.maxpacket) << __ffs(QH_MULT);
+
 	if (mEp->num)
 		cap |= QH_ZLT;
 	cap |= (mEp->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
@@ -1253,6 +1262,9 @@ static int ep_set_halt(struct usb_ep *ep, int value)
 	if (ep == NULL || mEp->ep.desc == NULL)
 		return -EINVAL;
 
+	if (usb_endpoint_xfer_isoc(mEp->ep.desc))
+		return -EOPNOTSUPP;
+
 	spin_lock_irqsave(mEp->lock, flags);
 
 #ifndef STALL_IN
diff --git a/drivers/usb/chipidea/udc.h b/drivers/usb/chipidea/udc.h
index e13ad24..5539ee6 100644
--- a/drivers/usb/chipidea/udc.h
+++ b/drivers/usb/chipidea/udc.h
@@ -50,6 +50,7 @@ struct ci13xxx_qh {
 #define QH_MAX_PKT            (0x07FFUL << 16)
 #define QH_ZLT                BIT(29)
 #define QH_MULT               (0x0003UL << 30)
+#define QH_ISO_TRANS(x)		(1 + ((x >> 11) & 0x03))
 	/* 1 */
 	u32 curr;
 	/* 2 - 8 */
-- 
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