Adding SS support to the Gadget FW - fix
Subsystems (2)
Hi Felipe
Due to Greg comments on "[PATCH 06/41] usb: gadget: add max_speed to usb_composite_driver" I modified this patch and removed the #ifdef CONFIG_USB_GADGET_DUALSPEED from different gadget drivers, as he requested.
In "usb: gadget: add SuperSpeed support to the Gadget Framework" patch I removed one small unnecessary comment (that he commented about) and since I already touched this patch - merged the patch you had on your branch that fixed ARM compilation.
I also changed min()->min_t() in composite.c where the casting was done for both parameters. Unfortunately, due to personal reasons I woun't be able to continue with fixing all gadget drivers to use min_t() instead of min() in the near future. So I at least fixed the one place that pushed me into this change in the first place :)
I wasn't sure what is the best (and most convenient for you) branch to base this on so this is what I did:
- the patches are based on Greg's tree (usb-next branch)
- I took the patches from your for-next branch since you updated the commit messages and I wanted to preserve that.
Since these 2 patches are independent of the patches adding SS support to dummy_hcd, and the fact that Sebastian modified the code, I didn't touch the dummy_hcd patches and thus no point in resending those.
Hope this is ok with you. Let me know if you prefer this to be done in some other way.
Tatyana Brokhman (2):
usb: gadget: add max_speed to usb_composite_driver
usb: gadget: add SuperSpeed support to the Gadget Framework
drivers/usb/gadget/Kconfig | 6 + drivers/usb/gadget/audio.c | 1 + drivers/usb/gadget/cdc2.c | 1 + drivers/usb/gadget/composite.c | 259 ++++++++++++++++++++++++++++++++++--- drivers/usb/gadget/epautoconf.c | 6 +- drivers/usb/gadget/ether.c | 1 + drivers/usb/gadget/g_ffs.c | 1 + drivers/usb/gadget/hid.c | 1 + drivers/usb/gadget/mass_storage.c | 1 + drivers/usb/gadget/multi.c | 1 + drivers/usb/gadget/ncm.c | 1 + drivers/usb/gadget/nokia.c | 1 + drivers/usb/gadget/serial.c | 1 + drivers/usb/gadget/webcam.c | 1 + drivers/usb/gadget/zero.c | 1 + include/linux/usb/composite.h | 16 +++ include/linux/usb/gadget.h | 31 +++++ 17 files changed, 309 insertions(+), 21 deletions(-)
Signature · 9 lines
1.7.3.3 -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/2 usb: gadget: add max_speed to usb_composite_driver
This field is used by the Gadget drivers to specify the maximum speed they support, meaning: the maximum speed they can provide descriptors for.
The driver speed will be set in consideration of this value.
--- drivers/usb/gadget/audio.c | 1 + drivers/usb/gadget/cdc2.c | 1 + drivers/usb/gadget/composite.c | 2 ++ drivers/usb/gadget/ether.c | 1 + drivers/usb/gadget/g_ffs.c | 1 + drivers/usb/gadget/hid.c | 1 + drivers/usb/gadget/mass_storage.c | 1 + drivers/usb/gadget/multi.c | 1 + drivers/usb/gadget/ncm.c | 1 + drivers/usb/gadget/nokia.c | 1 + drivers/usb/gadget/serial.c | 1 + drivers/usb/gadget/webcam.c | 1 + drivers/usb/gadget/zero.c | 1 + include/linux/usb/composite.h | 2 ++ 14 files changed, 16 insertions(+), 0 deletions(-)
drivers/usb/gadget/audio.c +1 -0
@@ -165,6 +165,7 @@ static struct usb_composite_driver audio_driver = { .name = "g_audio", .dev = &device_desc, .strings = audio_strings, + .max_speed = USB_SPEED_HIGH, .unbind = __exit_p(audio_unbind), };
drivers/usb/gadget/cdc2.c +1 -0
@@ -244,6 +244,7 @@ static struct usb_composite_driver cdc_driver = { .name = "g_cdc", .dev = &device_desc, .strings = dev_strings, + .max_speed = USB_SPEED_HIGH, .unbind = __exit_p(cdc_unbind), };
drivers/usb/gadget/composite.c +2 -0
@@ -1386,6 +1386,8 @@ int usb_composite_probe(struct usb_composite_driver *driver, driver->iProduct = driver->name; composite_driver.function = (char *) driver->name; composite_driver.driver.name = driver->name; + composite_driver.speed =min_t (u8, composite_driver.speed, + driver->max_speed); composite = driver; composite_gadget_bind = bind;
drivers/usb/gadget/ether.c +1 -0
@@ -401,6 +401,7 @@ static struct usb_composite_driver eth_driver = { .name = "g_ether", .dev = &device_desc, .strings = dev_strings, + .max_speed = USB_SPEED_HIGH, .unbind = __exit_p(eth_unbind), };
drivers/usb/gadget/g_ffs.c +1 -0
@@ -162,6 +162,7 @@ static struct usb_composite_driver gfs_driver = { .name = DRIVER_NAME, .dev = &gfs_dev_desc, .strings = gfs_dev_strings, + .max_speed = USB_SPEED_HIGH, .unbind = gfs_unbind, .iProduct = DRIVER_DESC, };
drivers/usb/gadget/hid.c +1 -0
@@ -255,6 +255,7 @@ static struct usb_composite_driver hidg_driver = { .name = "g_hid", .dev = &device_desc, .strings = dev_strings, + .max_speed = USB_SPEED_HIGH, .unbind = __exit_p(hid_unbind), };
drivers/usb/gadget/mass_storage.c +1 -0
@@ -169,6 +169,7 @@ static struct usb_composite_driver msg_driver = { .name = "g_mass_storage", .dev = &msg_device_desc, .iProduct = DRIVER_DESC, + .max_speed = USB_SPEED_HIGH, .needs_serial = 1, };
drivers/usb/gadget/multi.c +1 -0
@@ -351,6 +351,7 @@ static struct usb_composite_driver multi_driver = { .name = "g_multi", .dev = &device_desc, .strings = dev_strings, + .max_speed = USB_SPEED_HIGH, .unbind = __exit_p(multi_unbind), .iProduct = DRIVER_DESC, .needs_serial = 1,
drivers/usb/gadget/ncm.c +1 -0
@@ -228,6 +228,7 @@ static struct usb_composite_driver ncm_driver = { .name = "g_ncm", .dev = &device_desc, .strings = dev_strings, + .max_speed = USB_SPEED_HIGH, .unbind = __exit_p(gncm_unbind), };
drivers/usb/gadget/nokia.c +1 -0
@@ -241,6 +241,7 @@ static struct usb_composite_driver nokia_driver = { .name = "g_nokia", .dev = &device_desc, .strings = dev_strings, + .max_speed = USB_SPEED_HIGH, .unbind = __exit_p(nokia_unbind), };
drivers/usb/gadget/serial.c +1 -0
@@ -242,6 +242,7 @@ static struct usb_composite_driver gserial_driver = { .name = "g_serial", .dev = &device_desc, .strings = dev_strings, + .max_speed = USB_SPEED_HIGH, };static int __init init (void )
drivers/usb/gadget/webcam.c +1 -0
@@ -373,6 +373,7 @@ static struct usb_composite_driver webcam_driver = { .name = "g_webcam", .dev = &webcam_device_descriptor, .strings = webcam_device_strings, + .max_speed = USB_SPEED_HIGH, .unbind = webcam_unbind, };
drivers/usb/gadget/zero.c +1 -0
@@ -340,6 +340,7 @@ static struct usb_composite_driver zero_driver = { .name = "zero", .dev = &device_desc, .strings = dev_strings, + .max_speed = USB_SPEED_HIGH, .unbind = zero_unbind, .suspend = zero_suspend, .resume = zero_resume,
include/linux/usb/composite.h +2 -0
@@ -240,6 +240,7 @@ int usb_add_config(struct usb_composite_dev *,* identifiers. * @strings: tables of strings, keyed by identifiers assigned during bind() * and language IDs provided in control requests +* @max_speed: Highest speed the driver supports. * @needs_serial: set to 1 if the gadget needs userspace to provide * a serial number. If one is not provided, warning will be printed. * @unbind: Reverses bind; called as a side effect of unregistering
@@ -267,6 +268,7 @@ struct usb_composite_driver {const char *iManufacturer;const struct usb_device_descriptor *dev;struct usb_gadget_strings **strings; +enum usb_device_speed max_speed; unsigned needs_serial:1;int (*unbind)(struct usb_composite_dev *);
Signature · 5 lines
1.7.3.3 -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Quoted 8 lines · Tatyana Brokhman
This field is used by the Gadget drivers to specify the maximum speed they support, meaning: the maximum speed they can provide descriptors for.
The driver speed will be set in consideration of this value.
Signed-off-by Tatyana Brokhman <[email protected]>
I have already fixed this one myself ;-)
Signature · 1 line
balbi
RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Quoted 3 lines
I have already fixed this one myself ;-)
Oh, ok :) Thank you!
Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Hi,
Quoted 4 lines · Tanya Brokhman
Quoted 2 lines
I have already fixed this one myself ;-)
Oh, ok :) Thank you!
it might take a while for kernel.org to replicate things, maybe that's why you didn't see before ;-)
give it a few more minutes and check my gadget branch to see if it's all good, I'm going to test it again on beagleboard to be sure nothing is broken.
Signature · 1 line
balbi
RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Quoted 8 lines
it might take a while for kernel.org to replicate things, maybe that's why you didn't see before ;-)
give it a few more minutes and check my gadget branch to see if it's all good, I'm going to test it again on beagleboard to be sure nothing is broken.
Hi Felipe
I went over the emails and all is ok. Thanks!
One question: Greg/Alan mentioned that the compilation warning should be fixed by __maybe_unused. I wasn't aware such thing existed. Just looked it up.
Do you want me to send you a patch that fixes that or have you done it already and I missed it again :) ?
Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Hi,
Quoted 8 lines · Tanya Brokhman
Quoted 7 lines
it might take a while for kernel.org to replicate things, maybe that's why you didn't see before ;-)
give it a few more minutes and check my gadget branch to see if it's all good, I'm going to test it again on beagleboard to be sure nothing is broken.
Quoted 6 lines
I went over the emails and all is ok. Thanks!
One question: Greg/Alan mentioned that the compilation warning should be fixed by__maybe_unused. I wasn't aware such thing existed. Just looked it up.
Do you want me to send you a patch that fixes that or have you done it already and I missed it again :) ?
Oops, I didn't. You can send a differential patch (just this change in particular) and I'll merge into the original.
Signature · 1 line
balbi
RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Good morning Felipe,
Quoted 10 lines
Quoted 5 lines
I went over the emails and all is ok. Thanks!
One question: Greg/Alan mentioned that the compilation warning should be fixed by__maybe_unused. I wasn't aware such thing existed. Just looked it up.
Do you want me to send you a patch that fixes that or have you doneit
Quoted 1 line
already and I missed it again :) ?
Oops, I didn't. You can send a differential patch (just this change in particular) and I'll merge into the original.
Just emailed you the fixing patch.
Just one thing. Greg already merged the patch that caused the compilation warning into his tree so perhaps you can't merge the fix into the original patch and need to post the fix as a different patch....
Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Quoted 10 lines · Tanya Brokhman
Good morning Felipe,
Quoted 8 lines
Quoted 5 lines
I went over the emails and all is ok. Thanks!
One question: Greg/Alan mentioned that the compilation warning should be fixed by__maybe_unused. I wasn't aware such thing existed. Just looked it up.
Do you want me to send you a patch that fixes that or have you doneit
Quoted 1 line
already and I missed it again :) ?
Quoted 7 lines
Quoted 2 lines
Oops, I didn't. You can send a differential patch (just this change in particular) and I'll merge into the original.
Just emailed you the fixing patch.
Just one thing. Greg already merged the patch that caused the compilation warning into his tree so perhaps you can't merge the fix into the original patch and need to post the fix as a different patch....
Nope, you can't, I need just a single patch that resolves this. I'll queue up the patch you just sent, thanks.
greg k-h
RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Quoted 11 lines
Quoted 3 lines
Just emailed you the fixing patch.
Just one thing. Greg already merged the patch that caused thecompilation
Quoted 1 line
warning into his tree so perhaps you can't merge the fix into the
original
Quoted 1 line
patch and need to post the fix as a different patch....
Nope, you can't, I need just a single patch that resolves this. I'll queue up the patch you just sent, thanks.
One sec! I just found out that I was running checkpatch.pl from a wrong location. There is a checkpatch warning. I'll send you the fix in a few minutes.
Sorry.
Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 1/2] usb: gadget: add max_speed to usb_composite_driver
Quoted 6 lines
One sec! I just found out that I was running checkpatch.pl from a wrong location. There is a checkpatch warning. I'll send you the fix in a few minutes.
Sorry.
Done! Please pick up "[PATCH v2] usb: gadget: Compilation warning fix". Sorry for the trouble...
Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v2 2/2 usb: gadget: add SuperSpeed support to the Gadget Framework
In reply to Tatyana BrokhmanSuperSpeed USB has defined a new descriptor, called the Binary Device Object Store (BOS) Descriptor. It has also changed a bit the definition of SET_FEATURE and GET_STATUS requests to add USB3-specific details.
This patch implements both changes to the Composite Gadget Framework.
--- drivers/usb/gadget/Kconfig | 6 + drivers/usb/gadget/composite.c | 257 ++++++++++++++++++++++++++++++++++++--- drivers/usb/gadget/epautoconf.c | 6 +- include/linux/usb/composite.h | 14 ++ include/linux/usb/gadget.h | 31 +++++ 5 files changed, 293 insertions(+), 21 deletions(-)
drivers/usb/gadget/Kconfig +6 -0
@@ -666,6 +666,12 @@ config USB_GADGET_DUALSPEED bool depends on USB_GADGET +# Selected by UDC drivers that support super-speed opperation +config USB_GADGET_SUPERSPEED + bool + depends on USB_GADGET + depends on USB_GADGET_DUALSPEED + # # USB Gadget Drivers #
drivers/usb/gadget/composite.c +239 -18
412 lines not on this page · raw message
drivers/usb/gadget/epautoconf.c +3 -3
@@ -161,13 +161,13 @@ ep_matches ( max =0x7ff &le16_to_cpu (desc->wMaxPacketSize);switch (type) {case USB_ENDPOINT_XFER_INT : -/* INT: limit 64 bytes full speed, 1024 high speed */ +/* INT: limit 64 bytes full speed, 1024 high/super speed */ if (!gadget->is_dualspeed && max >64 )return 0 ;/* FALLTHROUGH */ case USB_ENDPOINT_XFER_ISOC : -/* ISO: limit 1023 bytes full speed, 1024 high speed */ +/* ISO: limit 1023 bytes full speed, 1024 high/super speed */ if (ep->maxpacket < max)return 0 ;if (!gadget->is_dualspeed && max >1023 )
@@ -202,7 +202,7 @@ ep_matches ( }/* report (variable) full speed bulk maxpacket */ -if (USB_ENDPOINT_XFER_BULK == type) { +if ((USB_ENDPOINT_XFER_BULK == type) && !ep_comp) {int size = ep->maxpacket;/* min() doesn't work on bitfields with gcc-3.5 */
include/linux/usb/composite.h +14 -0
@@ -59,6 +59,10 @@ struct usb_configuration;* @hs_descriptors: Table of high speed descriptors, using interface and * string identifiers assigned during @bind(). If this pointer is null, * the function will not be available at high speed. +* @ss_descriptors: Table of super speed descriptors, using interface and +* string identifiers assigned during @bind(). If this +* pointer is null after initiation, the function will not +* be available at super speed. * @config: assigned when @usb_add_function() is called; this is the * configuration with which this function is associated. * @bind: Before the gadget can register, all of its functions bind() to the
@@ -77,6 +81,10 @@ struct usb_configuration;* @setup: Used for interface-specific control requests. * @suspend: Notifies functions when the host stops sending USB traffic. * @resume: Notifies functions when the host restarts USB traffic. +* @get_status: Returns function status as a reply to +* GetStatus() request when the recepient is Interface. +* @func_suspend: callback to be called when +* SetFeature(FUNCTION_SUSPEND) is reseived * * A single USB function uses one or more interfaces, and should in most * cases support operation at both full and high speeds. Each function is
@@ -106,6 +114,7 @@ struct usb_function {struct usb_gadget_strings **strings;struct usb_descriptor_header **descriptors;struct usb_descriptor_header **hs_descriptors; +struct usb_descriptor_header **ss_descriptors;struct usb_configuration *config;
@@ -132,6 +141,10 @@ struct usb_function {void (*suspend)(struct usb_function *);void (*resume)(struct usb_function *); +/* USB 3.0 additions */ +int (*get_status)(struct usb_function *); +int (*func_suspend)(struct usb_function *, +u8 suspend_opt);/* private: */ /* internals */ struct list_head list;
@@ -219,6 +232,7 @@ struct usb_configuration {struct list_head list;struct list_head functions;u8 next_interface_id; + unsigned superspeed:1; unsigned highspeed:1; unsigned fullspeed:1;struct usb_function *interface[MAX_CONFIG_INTERFACES ];
include/linux/usb/gadget.h +31 -0
@@ -136,6 +136,8 @@ struct usb_ep_ops {* the endpoint descriptor used to configure the endpoint. * @max_streams: The maximum number of streams supported * by this EP (0 - 16, actual number is 2^n) +* @mult: multiplier, 'mult' value for SS Isoc EPs +* @maxburst: the maximum number of bursts supported by this EP (for usb3) * @driver_data:for use by the gadget driver. * @address: used to identify the endpoint when finding descriptor that * matches connection speed
@@ -156,6 +158,8 @@ struct usb_ep {struct list_head ep_list; unsigned maxpacket:16; unsigned max_streams:16; + unsigned mult:2; + unsigned maxburst:4;u8 address;const struct usb_endpoint_descriptor *desc;const struct usb_ss_ep_comp_descriptor *comp_desc;
@@ -426,6 +430,14 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)/*-------------------------------------------------------------------------*/ +struct usb_dcd_config_params { +__u8 bU1devExitLat;/* U1 Device exit Latency */ +#define USB_DEFULT_U1_DEV_EXIT_LAT 0x01/* Less then 1 microsec */ +__le16 bU2DevExitLat;/* U2 Device exit Latency */ +#define USB_DEFULT_U2_DEV_EXIT_LAT 0x1F4/* Less then 500 microsec */ +}; + +struct usb_gadget ;struct usb_gadget_driver ;
@@ -441,6 +453,7 @@ struct usb_gadget_ops {int (*pullup) (struct usb_gadget *,int is_on);int (*ioctl)(struct usb_gadget *,unsigned code,unsigned long param); +void (*get_config_params)(struct usb_dcd_config_params *);int (*start)(struct usb_gadget_driver *,int (*bind)(struct usb_gadget *));int (*stop)(struct usb_gadget_driver *);
@@ -535,6 +548,24 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g) }/** +* gadget_is_superspeed() - return true if the hardware handles +* supperspeed +* @g: controller that might support supper speed +*/ +static inline int gadget_is_superspeed (struct usb_gadget *g) +{ +#ifdef CONFIG_USB_GADGET_SUPERSPEED +/* +* runtime test would check "g->is_superspeed" ... that might be +* useful to work around hardware bugs, but is mostly pointless +*/ +return 1 ; +#else +return 0 ; +#endif +} + +/** * gadget_is_otg - return true iff the hardware is OTG-ready * @g: controller that might have a Mini-AB connector *
Signature · 5 lines
1.7.3.3 -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH v2 2/2] usb: gadget: add SuperSpeed support to the Gadget Framework
Quoted 9 lines · Tatyana Brokhman
SuperSpeed USB has defined a new descriptor, called the Binary Device Object Store (BOS) Descriptor. It has also changed a bit the definition of
SET_FEATUREandGET_STATUSrequests to add USB3-specific details.This patch implements both changes to the Composite Gadget Framework.
Signed-off-by Tatyana Brokhman <[email protected]>
had already fixed this one too..
Signature · 1 line
balbi