usb: dwc3: ep0: implement support for Set Isoch Delay request
authorFelipe Balbi <balbi@ti.com>
Wed, 25 Apr 2012 07:45:05 +0000 (10:45 +0300)
committerFelipe Balbi <balbi@ti.com>
Wed, 2 May 2012 06:43:09 +0000 (09:43 +0300)
This is basically a noop for DWC3. We don't have
to do anything. Basically we test if the request
parameters are correct, cache the Isochronous
Delay and return success.

Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/core.h
drivers/usb/dwc3/ep0.c

index 39fbd154dc1177173fc51bf59b7a438b039b53f6..ef28bd5680c551645ef573ee232606f6e1c4166c 100644 (file)
@@ -575,6 +575,7 @@ struct dwc3_request {
  * @setup_packet_pending: true when there's a Setup Packet in FIFO. Workaround
  * @needs_fifo_resize: not all users might want fifo resizing, flag it
  * @resize_fifos: tells us it's ok to reconfigure our TxFIFO sizes.
+ * @isoch_delay: wValue from Set Isochronous Delay request;
  * @u2sel: parameter from Set SEL request.
  * @u2pel: parameter from Set SEL request.
  * @u1sel: parameter from Set SEL request.
@@ -645,6 +646,7 @@ struct dwc3 {
        enum dwc3_link_state    link_state;
        enum dwc3_device_state  dev_state;
 
+       u16                     isoch_delay;
        u16                     u2sel;
        u16                     u2pel;
        u8                      u1sel;
index 9683d98bbb5dbf85c334c4e5d5ae5e855d871f18..8d41b6a6192a803c1e565d3db2f96eabfb04cb87 100644 (file)
@@ -569,6 +569,28 @@ static int dwc3_ep0_set_sel(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
        return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req);
 }
 
+static int dwc3_ep0_set_isoch_delay(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
+{
+       u16             wLength;
+       u16             wValue;
+       u16             wIndex;
+
+       wValue = le16_to_cpu(ctrl->wValue);
+       wLength = le16_to_cpu(ctrl->wLength);
+       wIndex = le16_to_cpu(ctrl->wIndex);
+
+       if (wIndex || wLength)
+               return -EINVAL;
+
+       /*
+        * REVISIT It's unclear from Databook what to do with this
+        * value. For now, just cache it.
+        */
+       dwc->isoch_delay = wValue;
+
+       return 0;
+}
+
 static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
 {
        int ret;
@@ -598,6 +620,10 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
                dev_vdbg(dwc->dev, "USB_REQ_SET_SEL\n");
                ret = dwc3_ep0_set_sel(dwc, ctrl);
                break;
+       case USB_REQ_SET_ISOCH_DELAY:
+               dev_vdbg(dwc->dev, "USB_REQ_SET_ISOCH_DELAY\n");
+               ret = dwc3_ep0_set_isoch_delay(dwc, ctrl);
+               break;
        default:
                dev_vdbg(dwc->dev, "Forwarding to gadget driver\n");
                ret = dwc3_ep0_delegate_req(dwc, ctrl);