Re: [RFC/PATCH 1/3] usb: Add SuperSpeed support to g_zero gadget

2011-07-08 Thread Felipe Balbi
Hi,

On Sun, Jul 03, 2011 at 05:29:31PM +0300, Amit Blay wrote:
 This patch adds SuperSpeed descriptors to the g_zero gadget.
 The SuperSpeed descriptors were added both for f_soursesink and f_loopback
 configurations of the g_zero gadget.
 
 Signed-off-by: Tatyana Brokhman tlin...@codeaurora.org
 Signed-off-by: Amit Blay ab...@codeaurora.org

applied this one alone. The others we need to dicuss a bit further. I'll
get to them after this merge window.

-- 
balbi


signature.asc
Description: Digital signature


[RFC/PATCH 1/3] usb: Add SuperSpeed support to g_zero gadget

2011-07-03 Thread Amit Blay
This patch adds SuperSpeed descriptors to the g_zero gadget.
The SuperSpeed descriptors were added both for f_soursesink and f_loopback
configurations of the g_zero gadget.

Signed-off-by: Tatyana Brokhman tlin...@codeaurora.org
Signed-off-by: Amit Blay ab...@codeaurora.org

---
 drivers/usb/gadget/f_loopback.c   |   55 -
 drivers/usb/gadget/f_sourcesink.c |   55 -
 drivers/usb/gadget/zero.c |2 +-
 3 files changed, 109 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c
index 3756326..ca660d4 100644
--- a/drivers/usb/gadget/f_loopback.c
+++ b/drivers/usb/gadget/f_loopback.c
@@ -118,6 +118,49 @@ static struct usb_descriptor_header *hs_loopback_descs[] = 
{
NULL,
 };
 
+/* super speed support: */
+
+static struct usb_endpoint_descriptor ss_loop_source_desc = {
+   .bLength =  USB_DT_ENDPOINT_SIZE,
+   .bDescriptorType =  USB_DT_ENDPOINT,
+
+   .bmAttributes = USB_ENDPOINT_XFER_BULK,
+   .wMaxPacketSize =   cpu_to_le16(1024),
+};
+
+struct usb_ss_ep_comp_descriptor ss_loop_source_comp_desc = {
+   .bLength =  USB_DT_SS_EP_COMP_SIZE,
+   .bDescriptorType =  USB_DT_SS_ENDPOINT_COMP,
+   .bMaxBurst =0,
+   .bmAttributes = 0,
+   .wBytesPerInterval =0,
+};
+
+static struct usb_endpoint_descriptor ss_loop_sink_desc = {
+   .bLength =  USB_DT_ENDPOINT_SIZE,
+   .bDescriptorType =  USB_DT_ENDPOINT,
+
+   .bmAttributes = USB_ENDPOINT_XFER_BULK,
+   .wMaxPacketSize =   cpu_to_le16(1024),
+};
+
+struct usb_ss_ep_comp_descriptor ss_loop_sink_comp_desc = {
+   .bLength =  USB_DT_SS_EP_COMP_SIZE,
+   .bDescriptorType =  USB_DT_SS_ENDPOINT_COMP,
+   .bMaxBurst =0,
+   .bmAttributes = 0,
+   .wBytesPerInterval =0,
+};
+
+static struct usb_descriptor_header *ss_loopback_descs[] = {
+   (struct usb_descriptor_header *) loopback_intf,
+   (struct usb_descriptor_header *) ss_loop_source_desc,
+   (struct usb_descriptor_header *) ss_loop_source_comp_desc,
+   (struct usb_descriptor_header *) ss_loop_sink_desc,
+   (struct usb_descriptor_header *) ss_loop_sink_comp_desc,
+   NULL,
+};
+
 /* function-specific strings: */
 
 static struct usb_string strings_loopback[] = {
@@ -175,8 +218,18 @@ autoconf_fail:
f-hs_descriptors = hs_loopback_descs;
}
 
+   /* support super speed hardware */
+   if (gadget_is_superspeed(c-cdev-gadget)) {
+   ss_loop_source_desc.bEndpointAddress =
+   fs_loop_source_desc.bEndpointAddress;
+   ss_loop_sink_desc.bEndpointAddress =
+   fs_loop_sink_desc.bEndpointAddress;
+   f-ss_descriptors = ss_loopback_descs;
+   }
+
DBG(cdev, %s speed %s: IN/%s, OUT/%s\n,
-   gadget_is_dualspeed(c-cdev-gadget) ? dual : full,
+   (gadget_is_superspeed(c-cdev-gadget) ? super :
+(gadget_is_dualspeed(c-cdev-gadget) ? dual : full)),
f-name, loop-in_ep-name, loop-out_ep-name);
return 0;
 }
diff --git a/drivers/usb/gadget/f_sourcesink.c 
b/drivers/usb/gadget/f_sourcesink.c
index caf2f95..5247f07 100644
--- a/drivers/usb/gadget/f_sourcesink.c
+++ b/drivers/usb/gadget/f_sourcesink.c
@@ -131,6 +131,49 @@ static struct usb_descriptor_header 
*hs_source_sink_descs[] = {
NULL,
 };
 
+/* super speed support: */
+
+static struct usb_endpoint_descriptor ss_source_desc = {
+   .bLength =  USB_DT_ENDPOINT_SIZE,
+   .bDescriptorType =  USB_DT_ENDPOINT,
+
+   .bmAttributes = USB_ENDPOINT_XFER_BULK,
+   .wMaxPacketSize =   cpu_to_le16(1024),
+};
+
+struct usb_ss_ep_comp_descriptor ss_source_comp_desc = {
+   .bLength =  USB_DT_SS_EP_COMP_SIZE,
+   .bDescriptorType =  USB_DT_SS_ENDPOINT_COMP,
+   .bMaxBurst =0,
+   .bmAttributes = 0,
+   .wBytesPerInterval =0,
+};
+
+static struct usb_endpoint_descriptor ss_sink_desc = {
+   .bLength =  USB_DT_ENDPOINT_SIZE,
+   .bDescriptorType =  USB_DT_ENDPOINT,
+
+   .bmAttributes = USB_ENDPOINT_XFER_BULK,
+   .wMaxPacketSize =   cpu_to_le16(1024),
+};
+
+struct usb_ss_ep_comp_descriptor ss_sink_comp_desc = {
+   .bLength =  USB_DT_SS_EP_COMP_SIZE,
+   .bDescriptorType =  USB_DT_SS_ENDPOINT_COMP,
+   .bMaxBurst =0,
+   .bmAttributes = 0,
+   .wBytesPerInterval =0,
+};
+
+static struct usb_descriptor_header *ss_source_sink_descs[] = {
+   (struct usb_descriptor_header *) source_sink_intf,
+   (struct usb_descriptor_header *) ss_source_desc,
+   (struct usb_descriptor_header *) ss_source_comp_desc,
+