usb: gadget: at91_udc: add ep capabilities support
authorRobert Baldyga <r.baldyga@samsung.com>
Fri, 31 Jul 2015 14:00:21 +0000 (16:00 +0200)
committerFelipe Balbi <balbi@ti.com>
Tue, 4 Aug 2015 17:26:38 +0000 (12:26 -0500)
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/udc/at91_udc.c

index 32f50a7944dd3b0cf86dabb9a88613100200d9fb..d0d18947f58bfdf4147057107d0c36cd2ca20063 100644 (file)
 #define        DRIVER_VERSION  "3 May 2006"
 
 static const char driver_name [] = "at91_udc";
-static const char * const ep_names[] = {
-       "ep0",
-       "ep1",
-       "ep2",
-       "ep3-int",
-       "ep4",
-       "ep5",
+
+static const struct {
+       const char *name;
+       const struct usb_ep_caps caps;
+} ep_info[] = {
+#define EP_INFO(_name, _caps) \
+       { \
+               .name = _name, \
+               .caps = _caps, \
+       }
+
+       EP_INFO("ep0",
+               USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, USB_EP_CAPS_DIR_ALL)),
+       EP_INFO("ep1",
+               USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_ALL)),
+       EP_INFO("ep2",
+               USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_ALL)),
+       EP_INFO("ep3-int",
+               USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_ALL)),
+       EP_INFO("ep4",
+               USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_ALL)),
+       EP_INFO("ep5",
+               USB_EP_CAPS(USB_EP_CAPS_TYPE_ALL, USB_EP_CAPS_DIR_ALL)),
+
+#undef EP_INFO
 };
-#define ep0name                ep_names[0]
+
+#define ep0name                ep_info[0].name
 
 #define VBUS_POLL_TIMEOUT      msecs_to_jiffies(1000)
 
@@ -1831,7 +1850,8 @@ static int at91udc_probe(struct platform_device *pdev)
 
        for (i = 0; i < NUM_ENDPOINTS; i++) {
                ep = &udc->ep[i];
-               ep->ep.name = ep_names[i];
+               ep->ep.name = ep_info[i].name;
+               ep->ep.caps = ep_info[i].caps;
                ep->ep.ops = &at91_ep_ops;
                ep->udc = udc;
                ep->int_mask = BIT(i);