platform: msm_shared: Add support for INT EP type

Add support for interrupt type of EP

Change-Id: Ia1871849ca8f8114525d39c72eea3302b8d8701a
diff --git a/include/dev/udc.h b/include/dev/udc.h
index 42ced0e..31d9755 100644
--- a/include/dev/udc.h
+++ b/include/dev/udc.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2009, Google Inc.
  * All rights reserved.
- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -50,6 +50,8 @@
 
 #define UDC_TYPE_BULK_IN	1
 #define UDC_TYPE_BULK_OUT	2
+#define UDC_TYPE_INTR_IN	3
+#define UDC_TYPE_INTR_OUT	4
 
 struct udc_endpoint *udc_endpoint_alloc(unsigned type, unsigned maxpkt);
 void udc_endpoint_free(struct udc_endpoint *ept);
diff --git a/platform/msm_shared/usb30_dwc.c b/platform/msm_shared/usb30_dwc.c
index 6f419cd..5ae8801 100644
--- a/platform/msm_shared/usb30_dwc.c
+++ b/platform/msm_shared/usb30_dwc.c
@@ -1730,7 +1730,7 @@
 
 	ep->bytes_queued = 0;
 
-	if (ep->type == EP_TYPE_CONTROL)
+	if (ep->type == EP_TYPE_CONTROL || ep->type == EP_TYPE_INTERRUPT)
 	{
 		memset(trb, 0, sizeof(dwc_trb_t));
 
diff --git a/platform/msm_shared/usb30_dwc.h b/platform/msm_shared/usb30_dwc.h
index 1a69a61..14402e7 100644
--- a/platform/msm_shared/usb30_dwc.h
+++ b/platform/msm_shared/usb30_dwc.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -379,7 +379,7 @@
 } dwc_notify_event_t;
 
 /* maximum number of endpoints supported. */
-#define DWC_MAX_NUM_OF_EP     4
+#define DWC_MAX_NUM_OF_EP     8
 
 /* length of setup packet */
 #define DWC_SETUP_PKT_LEN    8
diff --git a/platform/msm_shared/usb30_udc.c b/platform/msm_shared/usb30_udc.c
index 0e5e1b0..d9d18a2 100644
--- a/platform/msm_shared/usb30_udc.c
+++ b/platform/msm_shared/usb30_udc.c
@@ -559,7 +559,7 @@
 
 						ep->number        = ept->num;
 						ep->dir           = ept->in;
-						ep->type          = EP_TYPE_BULK; /* the only one supported */
+						ep->type          = ept->type;
 						ep->max_pkt_size  = ept->maxpkt;
 						ep->burst_size    = ept->maxburst;
 						ep->zlp           = 0;             /* TODO: zlp could be made part of ept */
@@ -848,6 +848,7 @@
 
 static struct udc_endpoint *_udc_endpoint_alloc(uint8_t num,
 												uint8_t in,
+												uint8_t type,
 												uint16_t max_pkt)
 {
 	struct udc_endpoint *ept;
@@ -858,6 +859,7 @@
 
 	ept->maxpkt     = max_pkt;
 	ept->num        = num;
+	ept->type       = type;
 	ept->in         = !!in;
 	ept->maxburst   = 4;      /* no performance improvement is seen beyond burst size of 4 */
 	ept->trb_count  = 66;     /* each trb can transfer (16MB - 1). 65 for 1GB transfer + 1 for roundup/zero length pkt. */
@@ -881,8 +883,16 @@
 
 	if (type == UDC_TYPE_BULK_IN) {
 		in = 1;
+		type = EP_TYPE_BULK;
 	} else if (type == UDC_TYPE_BULK_OUT) {
 		in = 0;
+		type = EP_TYPE_BULK;
+	} else if (type == UDC_TYPE_INTR_IN) {
+		in = 1;
+		type = EP_TYPE_INTERRUPT;
+	} else if (type == UDC_TYPE_INTR_OUT){
+		in = 0;
+		type = EP_TYPE_INTERRUPT;
 	} else {
 		return 0;
 	}
@@ -891,7 +901,7 @@
 		uint32_t bit = in ? EPT_TX(n) : EPT_RX(n);
 		if (udc->ept_alloc_table & bit)
 			continue;
-		ept = _udc_endpoint_alloc(n, in, maxpkt);
+		ept = _udc_endpoint_alloc(n, in, type, maxpkt);
 		if (ept)
 			udc->ept_alloc_table |= bit;
 		return ept;
diff --git a/platform/msm_shared/usb30_udc.h b/platform/msm_shared/usb30_udc.h
index 02e86fa..97ef7e8 100644
--- a/platform/msm_shared/usb30_udc.h
+++ b/platform/msm_shared/usb30_udc.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013, 2015 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -84,6 +84,7 @@
 struct udc_endpoint {
 	struct udc_endpoint *next;
 	uint8_t              num;
+	uint8_t              type;
 	uint8_t              in;
 	uint16_t             maxpkt;
 	uint32_t             maxburst;  /* max pkts that this ep can transfer before waiting for ack. */