Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-12-20 Thread Manu Gautam
On 11/26/2013 11:11 PM, Felipe Balbi wrote:
 
 any comments here ? nobody ? Manu, if nobody complains in another week,
 please send this hunk as a formal patch.
 

I have just sent a Patch (v3).

Thanks,
Manu

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-11-26 Thread Felipe Balbi
Hi,

On Tue, Oct 08, 2013 at 09:52:55AM +0530, Manu Gautam wrote:
 On 10/2/2013 10:06 AM, Manu Gautam wrote:
  On 10/1/2013 8:07 PM, Felipe Balbi wrote:
  Hi,
 
  On Mon, Sep 30, 2013 at 02:31:50PM +0530, Manu Gautam wrote:
  On 9/28/2013 1:52 AM, Paul Zimmerman wrote:
  From: linux-usb-ow...@vger.kernel.org 
  [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Manu Gautam
  Sent: Thursday, September 26, 2013 12:08 AM
 
  On 9/26/2013 2:10 AM, Felipe Balbi wrote:
 
  On Tue, Sep 24, 2013 at 03:00:20PM +0530, Manu Gautam wrote:
  Hi Felipe,
 
  I wanted to mention one point with respect to this patch: Below
  changes in the functionfs.h to add ss_count (super speed descriptors
  count) in desc_header (which is passed from userspace) make the driver
  incompatible with existing userspace applications compiled against old
  header file. Let me know if that is acceptable.  We are using this
  driver with Android for adbd (android debug bridge) and these changes
  are required to support adb over Super Speed controllers e.g. DWC3
  along with changed in adbd to pass SS EP and companion descriptors.
 
  Good you mentioned, it saves me the trouble of reviewing this patch :-)
 
  It's not acceptable to break userspace ABI at all. If you want
  SuperSpeed support on function fs, we need to figure out a way to do so
  without breaking userspace.
 
  This might mean adding a separate userspace interface to be used with
  superspeed. While at that, we might want to add a few bytes of 
  reserved,
  unused space in our structures for situations where we need to add more
  data into it, just to make it slightly future proof.
 
 
  Thanks for your reply.
  As you suggested we can have a different interface for super speed
  which would be optional to workaround ABI compatibility issue.
  Let me know if below interface looks fine to you, I will then implement
  accordingly:
 
  Just a suggestion: Instead of a new interface for SuperSpeed, why not
  just add the new fields to the end of the ffs_data struct? And have the
  functions that copy the struct to/from userspace check the 'len' value
  passed in, and only handle the SuperSpeed stuff if the length indicates
  it is new userspace?
 
 
  Initially I thought on similar lines but then adding a new interface for
  SS looked cleaner to me. But, your suggestion also make sense as we can
  avoid extra system call and the same interface can be extended later.
  One more thing we can do is to add a magic number after hs_desc (i.e. at
  the end of existing ffs_data) to specify that ss_descriptors are 
  following.
  This can be used by kernel driver to check if userspace is trying pass
  ss desc only or some invalid data. 
  Felipe: Your recommendation on this?
 
  We need to have some more people look at this. I remember there were
  always some concerns about Chris architecture when doing such changes.
 
  
  Can you please add appropriate folks to this thread who can check this as
  well?
  
 
 I have CC'ed  Michal and Andrzej as they have contributed to this driver.
 Followed is the interface enhancement that I am suggesting:
 
 diff --git a/include/uapi/linux/usb/functionfs.h 
 b/include/uapi/linux/usb/functionfs.h
 index d6b0128..0f8f7be 100644
 --- a/include/uapi/linux/usb/functionfs.h
 +++ b/include/uapi/linux/usb/functionfs.h
 @@ -13,6 +13,7 @@ enum {
 FUNCTIONFS_STRINGS_MAGIC = 2
  };
 
 +#define FUNCTIONFS_SS_DESC_MAGIC 0x0055DE5C
 
  #ifndef __KERNEL__
 
 @@ -50,7 +51,11 @@ struct usb_functionfs_descs_head {
   * |  12 | hs_count  | LE32 | number of high-speed descriptors |
   * |  16 | fs_descrs | Descriptor[] | list of full-speed descriptors   |
   * | | hs_descrs | Descriptor[] | list of high-speed descriptors   |
 + * | | ss_magic  | LE32 | FUNCTIONFS_SS_DESC_MAGIC |
 + * | | ss_count  | LE32 | number of super-speed descriptors|
 + * | | ss_descrs | Descriptor[] | list of super-speed descriptors  |
   *
 + * ss_magic: if present then it implies that SS_DESCs are also present
   * descs are just valid USB descriptors and have the following format:
   *
   * | off | name| type | description  |

any comments here ? nobody ? Manu, if nobody complains in another week,
please send this hunk as a formal patch.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-10-07 Thread Manu Gautam
On 10/2/2013 10:06 AM, Manu Gautam wrote:
 On 10/1/2013 8:07 PM, Felipe Balbi wrote:
 Hi,

 On Mon, Sep 30, 2013 at 02:31:50PM +0530, Manu Gautam wrote:
 On 9/28/2013 1:52 AM, Paul Zimmerman wrote:
 From: linux-usb-ow...@vger.kernel.org 
 [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Manu Gautam
 Sent: Thursday, September 26, 2013 12:08 AM

 On 9/26/2013 2:10 AM, Felipe Balbi wrote:

 On Tue, Sep 24, 2013 at 03:00:20PM +0530, Manu Gautam wrote:
 Hi Felipe,

 I wanted to mention one point with respect to this patch: Below
 changes in the functionfs.h to add ss_count (super speed descriptors
 count) in desc_header (which is passed from userspace) make the driver
 incompatible with existing userspace applications compiled against old
 header file. Let me know if that is acceptable.  We are using this
 driver with Android for adbd (android debug bridge) and these changes
 are required to support adb over Super Speed controllers e.g. DWC3
 along with changed in adbd to pass SS EP and companion descriptors.

 Good you mentioned, it saves me the trouble of reviewing this patch :-)

 It's not acceptable to break userspace ABI at all. If you want
 SuperSpeed support on function fs, we need to figure out a way to do so
 without breaking userspace.

 This might mean adding a separate userspace interface to be used with
 superspeed. While at that, we might want to add a few bytes of reserved,
 unused space in our structures for situations where we need to add more
 data into it, just to make it slightly future proof.


 Thanks for your reply.
 As you suggested we can have a different interface for super speed
 which would be optional to workaround ABI compatibility issue.
 Let me know if below interface looks fine to you, I will then implement
 accordingly:

 Just a suggestion: Instead of a new interface for SuperSpeed, why not
 just add the new fields to the end of the ffs_data struct? And have the
 functions that copy the struct to/from userspace check the 'len' value
 passed in, and only handle the SuperSpeed stuff if the length indicates
 it is new userspace?


 Initially I thought on similar lines but then adding a new interface for
 SS looked cleaner to me. But, your suggestion also make sense as we can
 avoid extra system call and the same interface can be extended later.
 One more thing we can do is to add a magic number after hs_desc (i.e. at
 the end of existing ffs_data) to specify that ss_descriptors are following.
 This can be used by kernel driver to check if userspace is trying pass
 ss desc only or some invalid data. 
 Felipe: Your recommendation on this?

 We need to have some more people look at this. I remember there were
 always some concerns about Chris architecture when doing such changes.

 
 Can you please add appropriate folks to this thread who can check this as
 well?
 

I have CC'ed  Michal and Andrzej as they have contributed to this driver.
Followed is the interface enhancement that I am suggesting:

diff --git a/include/uapi/linux/usb/functionfs.h 
b/include/uapi/linux/usb/functionfs.h
index d6b0128..0f8f7be 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -13,6 +13,7 @@ enum {
FUNCTIONFS_STRINGS_MAGIC = 2
 };

+#define FUNCTIONFS_SS_DESC_MAGIC 0x0055DE5C

 #ifndef __KERNEL__

@@ -50,7 +51,11 @@ struct usb_functionfs_descs_head {
  * |  12 | hs_count  | LE32 | number of high-speed descriptors |
  * |  16 | fs_descrs | Descriptor[] | list of full-speed descriptors   |
  * | | hs_descrs | Descriptor[] | list of high-speed descriptors   |
+ * | | ss_magic  | LE32 | FUNCTIONFS_SS_DESC_MAGIC |
+ * | | ss_count  | LE32 | number of super-speed descriptors|
+ * | | ss_descrs | Descriptor[] | list of super-speed descriptors  |
  *
+ * ss_magic: if present then it implies that SS_DESCs are also present
  * descs are just valid USB descriptors and have the following format:
  *
  * | off | name| type | description  |



-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-10-01 Thread Felipe Balbi
Hi,

On Mon, Sep 30, 2013 at 02:31:50PM +0530, Manu Gautam wrote:
 On 9/28/2013 1:52 AM, Paul Zimmerman wrote:
  From: linux-usb-ow...@vger.kernel.org 
  [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Manu Gautam
  Sent: Thursday, September 26, 2013 12:08 AM
 
  On 9/26/2013 2:10 AM, Felipe Balbi wrote:
 
  On Tue, Sep 24, 2013 at 03:00:20PM +0530, Manu Gautam wrote:
  Hi Felipe,
 
  I wanted to mention one point with respect to this patch: Below
  changes in the functionfs.h to add ss_count (super speed descriptors
  count) in desc_header (which is passed from userspace) make the driver
  incompatible with existing userspace applications compiled against old
  header file. Let me know if that is acceptable.  We are using this
  driver with Android for adbd (android debug bridge) and these changes
  are required to support adb over Super Speed controllers e.g. DWC3
  along with changed in adbd to pass SS EP and companion descriptors.
 
  Good you mentioned, it saves me the trouble of reviewing this patch :-)
 
  It's not acceptable to break userspace ABI at all. If you want
  SuperSpeed support on function fs, we need to figure out a way to do so
  without breaking userspace.
 
  This might mean adding a separate userspace interface to be used with
  superspeed. While at that, we might want to add a few bytes of reserved,
  unused space in our structures for situations where we need to add more
  data into it, just to make it slightly future proof.
 
 
  Thanks for your reply.
  As you suggested we can have a different interface for super speed
  which would be optional to workaround ABI compatibility issue.
  Let me know if below interface looks fine to you, I will then implement
  accordingly:
  
  Just a suggestion: Instead of a new interface for SuperSpeed, why not
  just add the new fields to the end of the ffs_data struct? And have the
  functions that copy the struct to/from userspace check the 'len' value
  passed in, and only handle the SuperSpeed stuff if the length indicates
  it is new userspace?
  
 
 Initially I thought on similar lines but then adding a new interface for
 SS looked cleaner to me. But, your suggestion also make sense as we can
 avoid extra system call and the same interface can be extended later.
 One more thing we can do is to add a magic number after hs_desc (i.e. at
 the end of existing ffs_data) to specify that ss_descriptors are following.
 This can be used by kernel driver to check if userspace is trying pass
 ss desc only or some invalid data. 
 Felipe: Your recommendation on this?

We need to have some more people look at this. I remember there were
always some concerns about Chris architecture when doing such changes.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-10-01 Thread Manu Gautam
On 10/1/2013 8:07 PM, Felipe Balbi wrote:
 Hi,
 
 On Mon, Sep 30, 2013 at 02:31:50PM +0530, Manu Gautam wrote:
 On 9/28/2013 1:52 AM, Paul Zimmerman wrote:
 From: linux-usb-ow...@vger.kernel.org 
 [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Manu Gautam
 Sent: Thursday, September 26, 2013 12:08 AM

 On 9/26/2013 2:10 AM, Felipe Balbi wrote:

 On Tue, Sep 24, 2013 at 03:00:20PM +0530, Manu Gautam wrote:
 Hi Felipe,

 I wanted to mention one point with respect to this patch: Below
 changes in the functionfs.h to add ss_count (super speed descriptors
 count) in desc_header (which is passed from userspace) make the driver
 incompatible with existing userspace applications compiled against old
 header file. Let me know if that is acceptable.  We are using this
 driver with Android for adbd (android debug bridge) and these changes
 are required to support adb over Super Speed controllers e.g. DWC3
 along with changed in adbd to pass SS EP and companion descriptors.

 Good you mentioned, it saves me the trouble of reviewing this patch :-)

 It's not acceptable to break userspace ABI at all. If you want
 SuperSpeed support on function fs, we need to figure out a way to do so
 without breaking userspace.

 This might mean adding a separate userspace interface to be used with
 superspeed. While at that, we might want to add a few bytes of reserved,
 unused space in our structures for situations where we need to add more
 data into it, just to make it slightly future proof.


 Thanks for your reply.
 As you suggested we can have a different interface for super speed
 which would be optional to workaround ABI compatibility issue.
 Let me know if below interface looks fine to you, I will then implement
 accordingly:

 Just a suggestion: Instead of a new interface for SuperSpeed, why not
 just add the new fields to the end of the ffs_data struct? And have the
 functions that copy the struct to/from userspace check the 'len' value
 passed in, and only handle the SuperSpeed stuff if the length indicates
 it is new userspace?


 Initially I thought on similar lines but then adding a new interface for
 SS looked cleaner to me. But, your suggestion also make sense as we can
 avoid extra system call and the same interface can be extended later.
 One more thing we can do is to add a magic number after hs_desc (i.e. at
 the end of existing ffs_data) to specify that ss_descriptors are following.
 This can be used by kernel driver to check if userspace is trying pass
 ss desc only or some invalid data. 
 Felipe: Your recommendation on this?
 
 We need to have some more people look at this. I remember there were
 always some concerns about Chris architecture when doing such changes.
 

Can you please add appropriate folks to this thread who can check this as
well?

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-09-30 Thread Manu Gautam
On 9/28/2013 1:52 AM, Paul Zimmerman wrote:
 From: linux-usb-ow...@vger.kernel.org 
 [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Manu Gautam
 Sent: Thursday, September 26, 2013 12:08 AM

 On 9/26/2013 2:10 AM, Felipe Balbi wrote:

 On Tue, Sep 24, 2013 at 03:00:20PM +0530, Manu Gautam wrote:
 Hi Felipe,

 I wanted to mention one point with respect to this patch: Below
 changes in the functionfs.h to add ss_count (super speed descriptors
 count) in desc_header (which is passed from userspace) make the driver
 incompatible with existing userspace applications compiled against old
 header file. Let me know if that is acceptable.  We are using this
 driver with Android for adbd (android debug bridge) and these changes
 are required to support adb over Super Speed controllers e.g. DWC3
 along with changed in adbd to pass SS EP and companion descriptors.

 Good you mentioned, it saves me the trouble of reviewing this patch :-)

 It's not acceptable to break userspace ABI at all. If you want
 SuperSpeed support on function fs, we need to figure out a way to do so
 without breaking userspace.

 This might mean adding a separate userspace interface to be used with
 superspeed. While at that, we might want to add a few bytes of reserved,
 unused space in our structures for situations where we need to add more
 data into it, just to make it slightly future proof.


 Thanks for your reply.
 As you suggested we can have a different interface for super speed
 which would be optional to workaround ABI compatibility issue.
 Let me know if below interface looks fine to you, I will then implement
 accordingly:
 
 Just a suggestion: Instead of a new interface for SuperSpeed, why not
 just add the new fields to the end of the ffs_data struct? And have the
 functions that copy the struct to/from userspace check the 'len' value
 passed in, and only handle the SuperSpeed stuff if the length indicates
 it is new userspace?
 

Initially I thought on similar lines but then adding a new interface for
SS looked cleaner to me. But, your suggestion also make sense as we can
avoid extra system call and the same interface can be extended later.
One more thing we can do is to add a magic number after hs_desc (i.e. at
the end of existing ffs_data) to specify that ss_descriptors are following.
This can be used by kernel driver to check if userspace is trying pass
ss desc only or some invalid data. 
Felipe: Your recommendation on this?

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-09-27 Thread Paul Zimmerman
 From: linux-usb-ow...@vger.kernel.org 
 [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Manu Gautam
 Sent: Thursday, September 26, 2013 12:08 AM
 
 On 9/26/2013 2:10 AM, Felipe Balbi wrote:
 
  On Tue, Sep 24, 2013 at 03:00:20PM +0530, Manu Gautam wrote:
  Hi Felipe,
 
  I wanted to mention one point with respect to this patch: Below
  changes in the functionfs.h to add ss_count (super speed descriptors
  count) in desc_header (which is passed from userspace) make the driver
  incompatible with existing userspace applications compiled against old
  header file. Let me know if that is acceptable.  We are using this
  driver with Android for adbd (android debug bridge) and these changes
  are required to support adb over Super Speed controllers e.g. DWC3
  along with changed in adbd to pass SS EP and companion descriptors.
 
  Good you mentioned, it saves me the trouble of reviewing this patch :-)
 
  It's not acceptable to break userspace ABI at all. If you want
  SuperSpeed support on function fs, we need to figure out a way to do so
  without breaking userspace.
 
  This might mean adding a separate userspace interface to be used with
  superspeed. While at that, we might want to add a few bytes of reserved,
  unused space in our structures for situations where we need to add more
  data into it, just to make it slightly future proof.
 
 
 Thanks for your reply.
 As you suggested we can have a different interface for super speed
 which would be optional to workaround ABI compatibility issue.
 Let me know if below interface looks fine to you, I will then implement
 accordingly:

Just a suggestion: Instead of a new interface for SuperSpeed, why not
just add the new fields to the end of the ffs_data struct? And have the
functions that copy the struct to/from userspace check the 'len' value
passed in, and only handle the SuperSpeed stuff if the length indicates
it is new userspace?

-- 
Paul

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-09-26 Thread Manu Gautam

On 9/26/2013 2:10 AM, Felipe Balbi wrote:

Hi,

(please avoid top-posting)

On Tue, Sep 24, 2013 at 03:00:20PM +0530, Manu Gautam wrote:

Hi Felipe,

I wanted to mention one point with respect to this patch: Below
changes in the functionfs.h to add ss_count (super speed descriptors
count) in desc_header (which is passed from userspace) make the driver
incompatible with existing userspace applications compiled against old
header file. Let me know if that is acceptable.  We are using this
driver with Android for adbd (android debug bridge) and these changes
are required to support adb over Super Speed controllers e.g. DWC3
along with changed in adbd to pass SS EP and companion descriptors.


Good you mentioned, it saves me the trouble of reviewing this patch :-)

It's not acceptable to break userspace ABI at all. If you want
SuperSpeed support on function fs, we need to figure out a way to do so
without breaking userspace.

This might mean adding a separate userspace interface to be used with
superspeed. While at that, we might want to add a few bytes of reserved,
unused space in our structures for situations where we need to add more
data into it, just to make it slightly future proof.



Thanks for your reply.
As you suggested we can have a different interface for super speed
which would be optional to workaround ABI compatibility issue.
Let me know if below interface looks fine to you, I will then implement
accordingly:

diff --git a/include/uapi/linux/usb/functionfs.h 
b/include/uapi/linux/usb/functionfs.h

index d6b0128..b8cb740 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -9,8 +9,9 @@


 enum {
-   FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
-   FUNCTIONFS_STRINGS_MAGIC = 2
+   FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
+   FUNCTIONFS_STRINGS_MAGIC = 2,
+   FUNCTIONFS_SS_DESCRIPTORS_MAGIC  = 3
 };


@@ -60,6 +61,25 @@ struct usb_functionfs_descs_head {
  * |   2 | payload |  | descriptor's payload |
  */

+struct usb_functionfs_ss_descs_head {
+   __le32 magic;
+   __le32 length;
+   __le32 reserved;
+   __le32 ss_count;
+} __attribute__((packed));
+
+/*
+ * SS Descriptors format:
+ *
+ * | off | name  | type | description 
|
+ * 
|-+---+--+--|
+ * |   0 | magic | LE32 | FUNCTIONFS_SS_DESCRIPTORS_MAGIC 
|
+ * |   4 | length| LE32 | length of the whole data chunk 
|
+ * |   8 | ss_count  | LE32 | number of super-speed descriptors 
   |
+ * |  12 | reserved field 
|
+ * |  16 | ss_descrs | Descriptor[] | list of super-speed descriptors 
|

+ */
+
 struct usb_functionfs_strings_head {
__le32 magic;
__le32 length;

--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-09-25 Thread Felipe Balbi
Hi,

(please avoid top-posting)

On Tue, Sep 24, 2013 at 03:00:20PM +0530, Manu Gautam wrote:
 Hi Felipe,
 
 I wanted to mention one point with respect to this patch: Below
 changes in the functionfs.h to add ss_count (super speed descriptors
 count) in desc_header (which is passed from userspace) make the driver
 incompatible with existing userspace applications compiled against old
 header file. Let me know if that is acceptable.  We are using this
 driver with Android for adbd (android debug bridge) and these changes
 are required to support adb over Super Speed controllers e.g. DWC3
 along with changed in adbd to pass SS EP and companion descriptors.

Good you mentioned, it saves me the trouble of reviewing this patch :-)

It's not acceptable to break userspace ABI at all. If you want
SuperSpeed support on function fs, we need to figure out a way to do so
without breaking userspace.

This might mean adding a separate userspace interface to be used with
superspeed. While at that, we might want to add a few bytes of reserved,
unused space in our structures for situations where we need to add more
data into it, just to make it slightly future proof.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-09-24 Thread Manu Gautam

Hi Felipe,

I wanted to mention one point with respect to this patch:
Below changes in the functionfs.h to add ss_count (super speed 
descriptors count) in desc_header (which is passed from userspace) make 
the driver incompatible with existing userspace applications compiled 
against old header file. Let me know if that is acceptable.
We are using this driver with Android for adbd (android debug bridge) 
and these changes are required to support adb over Super Speed 
controllers e.g. DWC3 along with changed in adbd to pass SS EP and 
companion descriptors.


Regards,
Manu

On 9/20/2013 5:25 PM, Manu Gautam wrote:

diff --git a/include/uapi/linux/usb/functionfs.h 
b/include/uapi/linux/usb/functionfs.h
index d6b0128..d6940d7 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -37,6 +37,7 @@ struct usb_functionfs_descs_head {
__le32 length;
__le32 fs_count;
__le32 hs_count;
+   __le32 ss_count;
  } __attribute__((packed));
  
  /*

@@ -48,8 +49,10 @@ struct usb_functionfs_descs_head {
   * |   4 | length| LE32 | length of the whole data chunk   |
   * |   8 | fs_count  | LE32 | number of full-speed descriptors |
   * |  12 | hs_count  | LE32 | number of high-speed descriptors |
- * |  16 | fs_descrs | Descriptor[] | list of full-speed descriptors   |
+ * |  16 | ss_count  | LE32 | number of super-speed descriptors|
+ * |  20 | fs_descrs | Descriptor[] | list of full-speed descriptors   |
   * | | hs_descrs | Descriptor[] | list of high-speed descriptors   |
+ * | | ss_descrs | Descriptor[] | list of super-speed descriptors  |


  



--
To unsubscribe from this list: send the line unsubscribe linux-arm-msm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/1] usb: gadget: f_fs: Add support for SuperSpeed Mode

2013-09-20 Thread Manu Gautam
Allow userspace to pass SuperSpeed descriptors and
handle them in the driver accordingly.
This also requires changing usb_functionfs_descs_head
to accommodate ss_count i.e. SuperSpeed Descriptors
count.

Signed-off-by: Manu Gautam mgau...@codeaurora.org
---
 drivers/usb/gadget/f_fs.c   | 148 +++-
 include/uapi/linux/usb/functionfs.h |   5 +-
 2 files changed, 115 insertions(+), 38 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index f394f29..95a5746 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -194,16 +194,18 @@ struct ffs_data {
 
/* filled by __ffs_data_got_descs() */
/*
-* Real descriptors are 16 bytes after raw_descs (so you need
-* to skip 16 bytes (ie. ffs-raw_descs + 16) to get to the
-* first full speed descriptor).  raw_descs_length and
-* raw_fs_descs_length do not have those 16 bytes added.
+* Real descriptors are 20 bytes after raw_descs (so you need
+* to skip 20 bytes (ie. ffs-raw_descs + 20) to get to the
+* first full speed descriptor).  raw_(fs|hs|ss)descs_length
+* do not have those 20 bytes added.
 */
const void  *raw_descs;
-   unsignedraw_descs_length;
+   unsignedraw_hs_descs_length;
unsignedraw_fs_descs_length;
+   unsignedraw_ss_descs_length;
unsignedfs_descs_count;
unsignedhs_descs_count;
+   unsignedss_descs_count;
 
unsigned short  strings_count;
unsigned short  interfaces_count;
@@ -301,8 +303,8 @@ struct ffs_ep {
struct usb_ep   *ep;/* P: ffs-eps_lock */
struct usb_request  *req;   /* P: epfile-mutex */
 
-   /* [0]: full speed, [1]: high speed */
-   struct usb_endpoint_descriptor  *descs[2];
+   /* [0]: full speed, [1]: high speed, [2]: super speed */
+   struct usb_endpoint_descriptor  *descs[3];
 
u8  num;
 
@@ -1358,10 +1360,12 @@ static void ffs_data_reset(struct ffs_data *ffs)
ffs-raw_strings = NULL;
ffs-stringtabs = NULL;
 
-   ffs-raw_descs_length = 0;
+   ffs-raw_hs_descs_length = 0;
ffs-raw_fs_descs_length = 0;
+   ffs-raw_ss_descs_length = 0;
ffs-fs_descs_count = 0;
ffs-hs_descs_count = 0;
+   ffs-ss_descs_count = 0;
 
ffs-strings_count = 0;
ffs-interfaces_count = 0;
@@ -1569,7 +1573,20 @@ static int ffs_func_eps_enable(struct ffs_function *func)
spin_lock_irqsave(func-ffs-eps_lock, flags);
do {
struct usb_endpoint_descriptor *ds;
-   ds = ep-descs[ep-descs[1] ? 1 : 0];
+   int desc_idx;
+
+   if (ffs-gadget-speed == USB_SPEED_SUPER)
+   desc_idx = 2;
+   else if (ffs-gadget-speed == USB_SPEED_HIGH)
+   desc_idx = 1;
+   else
+   desc_idx = 0;
+
+   ds = ep-descs[desc_idx];
+   if (!ds) {
+   ret = -EINVAL;
+   break;
+   }
 
ep-ep-driver_data = ep;
ep-ep-desc = ds;
@@ -1704,6 +1721,12 @@ static int __must_check ffs_do_desc(char *data, unsigned 
len,
}
break;
 
+   case USB_DT_SS_ENDPOINT_COMP:
+   pr_vdebug(EP SS companion descriptor\n);
+   if (length != sizeof(struct usb_ss_ep_comp_descriptor))
+   goto inv_length;
+   break;
+
case USB_DT_OTHER_SPEED_CONFIG:
case USB_DT_INTERFACE_POWER:
case USB_DT_DEBUG:
@@ -1814,8 +1837,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type,
 static int __ffs_data_got_descs(struct ffs_data *ffs,
char *const _data, size_t len)
 {
-   unsigned fs_count, hs_count;
-   int fs_len, ret = -EINVAL;
+   unsigned fs_count, hs_count, ss_count;
+   int fs_len, hs_len, ss_len, ret = -EINVAL;
char *data = _data;
 
ENTER();
@@ -1825,12 +1848,13 @@ static int __ffs_data_got_descs(struct ffs_data *ffs,
goto error;
fs_count = get_unaligned_le32(data +  8);
hs_count = get_unaligned_le32(data + 12);
+   ss_count = get_unaligned_le32(data + 16);
 
-   if (!fs_count  !hs_count)
+   if (!fs_count  !hs_count  !ss_count)
goto einval;
 
-   data += 16;
-   len  -= 16;
+   data += 20;
+   len  -= 20;
 
if (likely(fs_count)) {
fs_len = ffs_do_descs(fs_count, data, len,
@@ -1847,11 +1871,29 @@ static int __ffs_data_got_descs(struct ffs_data *ffs,
}
 
if (likely(hs_count)) {