* [PATCH v2 00/12] usb: Handle different sublink speeds @ 2020-07-23 2:12 Thinh Nguyen 2020-07-23 2:12 ` [PATCH v2 06/12] usb: devicetree: Introduce num-lanes and lsm Thinh Nguyen 0 siblings, 1 reply; 4+ messages in thread From: Thinh Nguyen @ 2020-07-23 2:12 UTC (permalink / raw) To: Felipe Balbi, Greg Kroah-Hartman, Thinh Nguyen, linux-usb, devicetree, Rob Herring, Peter Chen, Alan Stern, Dejin Zheng, Roger Quadros, Marek Szyprowski Cc: John Youn A USB super-speed-plus device may operate at different sublink speed and lane count (e.g. gen2x2, gen1x2, or gen2x1). The usb gadget stack needs to be able to handle a couple things: 1) Report the sublink speed attributes the device support 2) Select the sublink speed attribute This series introduces sublink speed attribute structure to ch9.h to capture the device capability of the gadget. It also introduces a new gadget ops udc_set_num_lanes_and_speed to select a specific sublink speed. DWC3 needs this support for DWC_usb32 IP. Implement the new changes for DWC3. Changes in v2: - Move usb_sublink_speed attribute struct and enum to include/linux/usb/ch9.h - Use "num-lanes" and "lane-speed-mantissa-gbps" as common properties instead - Add common functions to get num-lanes and lsm properties - Fix missing gen1x2 sublink speed attribute check report in dwc3 Thinh Nguyen (12): usb: ch9: Add sublink speed struct usb: gadget: composite: Avoid using magic numbers usb: gadget: Expose sublink speed attributes usb: gadget: Set max speed for SSP devices usb: composite: Properly report sublink speed usb: devicetree: Introduce num-lanes and lsm usb: common: Add functions to get lanes and lsm usb: dwc3: Initialize lane count and sublink speed usb: dwc3: gadget: Report sublink speed capability usb: dwc3: gadget: Implement setting of sublink speed usb: dwc3: gadget: Track connected lane and sublink speed usb: dwc3: gadget: Set speed only up to the max supported Documentation/devicetree/bindings/usb/generic.txt | 11 ++ drivers/usb/common/common.c | 26 ++++ drivers/usb/dwc3/core.c | 62 ++++++++++ drivers/usb/dwc3/core.h | 18 +++ drivers/usb/dwc3/gadget.c | 143 +++++++++++++++++++++- drivers/usb/gadget/composite.c | 81 ++++++++---- drivers/usb/gadget/udc/core.c | 24 +++- include/linux/usb/ch9.h | 62 ++++++++++ include/linux/usb/gadget.h | 23 ++++ 9 files changed, 414 insertions(+), 36 deletions(-) base-commit: 5db5ea26a2469d8899f995e82e8b718dc9e9d168 -- 2.11.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 06/12] usb: devicetree: Introduce num-lanes and lsm 2020-07-23 2:12 [PATCH v2 00/12] usb: Handle different sublink speeds Thinh Nguyen @ 2020-07-23 2:12 ` Thinh Nguyen 2020-07-23 20:29 ` Rob Herring 0 siblings, 1 reply; 4+ messages in thread From: Thinh Nguyen @ 2020-07-23 2:12 UTC (permalink / raw) To: Felipe Balbi, Greg Kroah-Hartman, Thinh Nguyen, linux-usb, devicetree, Rob Herring Cc: John Youn According to USB 3.2 spec, a super-speed-plus device can operate at gen2x2, gen2x1, or gen1x2. Introduce "num-lanes" and "lane-speed-mantissa-gbps" properties for devices operating in super-speed-plus. If the USB controller device supports multiple lanes at different transfer rate, the user can specify the HW capability via these properties. Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> --- Changes in v2: - Make "num-lanes" and "lane-speed-mantissa-gbps" common USB properties Documentation/devicetree/bindings/usb/generic.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt index ba472e7aefc9..a8253da684af 100644 --- a/Documentation/devicetree/bindings/usb/generic.txt +++ b/Documentation/devicetree/bindings/usb/generic.txt @@ -7,6 +7,17 @@ Optional properties: "low-speed". In case this isn't passed via DT, USB controllers should default to their maximum HW capability. + - num-lanes: tells USB controllers that we want to work up to a certain number + of lanes. Valid arguments are 1 or 2. Apply if the + maximum-speed is super-speed-plus. In case this isn't + passed via DT, the USB controllers should default to + their maximum HW capability. + - lane-speed-mantissa-gbps: tells USB controllers that we want the symmetric + lanes to operate up to a certain rate in Gbps. Valid + inputs are 5 or 10 (i.e. Gen 1/Gen 2 transfer rate). + Apply if the maximum-speed is super-speed-plus. In case + this isn't passed via DT, the USB controllers should + default to their maximum HW capability. - dr_mode: tells Dual-Role USB controllers that we want to work on a particular mode. Valid arguments are "host", "peripheral" and "otg". In case this attribute isn't -- 2.11.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 06/12] usb: devicetree: Introduce num-lanes and lsm 2020-07-23 2:12 ` [PATCH v2 06/12] usb: devicetree: Introduce num-lanes and lsm Thinh Nguyen @ 2020-07-23 20:29 ` Rob Herring 2020-07-24 2:39 ` Thinh Nguyen 0 siblings, 1 reply; 4+ messages in thread From: Rob Herring @ 2020-07-23 20:29 UTC (permalink / raw) To: Thinh Nguyen Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, devicetree, John Youn On Wed, Jul 22, 2020 at 07:12:39PM -0700, Thinh Nguyen wrote: > According to USB 3.2 spec, a super-speed-plus device can operate at > gen2x2, gen2x1, or gen1x2. Introduce "num-lanes" and > "lane-speed-mantissa-gbps" properties for devices operating in > super-speed-plus. If the USB controller device supports multiple lanes > at different transfer rate, the user can specify the HW capability via > these properties. > > Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> > --- > Changes in v2: > - Make "num-lanes" and "lane-speed-mantissa-gbps" common USB properties > > Documentation/devicetree/bindings/usb/generic.txt | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt > index ba472e7aefc9..a8253da684af 100644 > --- a/Documentation/devicetree/bindings/usb/generic.txt > +++ b/Documentation/devicetree/bindings/usb/generic.txt > @@ -7,6 +7,17 @@ Optional properties: > "low-speed". In case this isn't passed via DT, USB > controllers should default to their maximum HW > capability. > + - num-lanes: tells USB controllers that we want to work up to a certain number > + of lanes. Valid arguments are 1 or 2. Apply if the > + maximum-speed is super-speed-plus. In case this isn't > + passed via DT, the USB controllers should default to > + their maximum HW capability. > + - lane-speed-mantissa-gbps: tells USB controllers that we want the symmetric > + lanes to operate up to a certain rate in Gbps. Valid > + inputs are 5 or 10 (i.e. Gen 1/Gen 2 transfer rate). > + Apply if the maximum-speed is super-speed-plus. In case > + this isn't passed via DT, the USB controllers should > + default to their maximum HW capability. This still leaves 'maximum-speed = "super-speed-plus"' ambiguous. Fix that please. To put it another way, we already have one way to define USB speeds. Don't define a new and different way that only covers a fraction of the possibilities. Rob ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 06/12] usb: devicetree: Introduce num-lanes and lsm 2020-07-23 20:29 ` Rob Herring @ 2020-07-24 2:39 ` Thinh Nguyen 0 siblings, 0 replies; 4+ messages in thread From: Thinh Nguyen @ 2020-07-24 2:39 UTC (permalink / raw) To: Rob Herring, Thinh Nguyen Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, John Youn Rob Herring wrote: > On Wed, Jul 22, 2020 at 07:12:39PM -0700, Thinh Nguyen wrote: >> According to USB 3.2 spec, a super-speed-plus device can operate at >> gen2x2, gen2x1, or gen1x2. Introduce "num-lanes" and >> "lane-speed-mantissa-gbps" properties for devices operating in >> super-speed-plus. If the USB controller device supports multiple lanes >> at different transfer rate, the user can specify the HW capability via >> these properties. >> >> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com> >> --- >> Changes in v2: >> - Make "num-lanes" and "lane-speed-mantissa-gbps" common USB properties >> >> Documentation/devicetree/bindings/usb/generic.txt | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt >> index ba472e7aefc9..a8253da684af 100644 >> --- a/Documentation/devicetree/bindings/usb/generic.txt >> +++ b/Documentation/devicetree/bindings/usb/generic.txt >> @@ -7,6 +7,17 @@ Optional properties: >> "low-speed". In case this isn't passed via DT, USB >> controllers should default to their maximum HW >> capability. >> + - num-lanes: tells USB controllers that we want to work up to a certain number >> + of lanes. Valid arguments are 1 or 2. Apply if the >> + maximum-speed is super-speed-plus. In case this isn't >> + passed via DT, the USB controllers should default to >> + their maximum HW capability. >> + - lane-speed-mantissa-gbps: tells USB controllers that we want the symmetric >> + lanes to operate up to a certain rate in Gbps. Valid >> + inputs are 5 or 10 (i.e. Gen 1/Gen 2 transfer rate). >> + Apply if the maximum-speed is super-speed-plus. In case >> + this isn't passed via DT, the USB controllers should >> + default to their maximum HW capability. > This still leaves 'maximum-speed = "super-speed-plus"' ambiguous. Fix > that please. > > To put it another way, we already have one way to define USB speeds. > Don't define a new and different way that only covers a fraction of the > possibilities. > Then, we can just do away with the "num-lanes" property, and change it to something like this as you suggested? diff --git a/Documentation/devicetree/bindings/usb/generic.txt b/Documentation/devicetree/bindings/usb/generic.txt index ba472e7aefc9..8541b9571f2f 100644 --- a/Documentation/devicetree/bindings/usb/generic.txt +++ b/Documentation/devicetree/bindings/usb/generic.txt @@ -3,10 +3,13 @@ Generic USB Properties Optional properties: - maximum-speed: tells USB controllers we want to work up to a certain speed. Valid arguments are "super-speed-plus", - "super-speed", "high-speed", "full-speed" and - "low-speed". In case this isn't passed via DT, USB - controllers should default to their maximum HW - capability. + "super-speed-plus-gen2x2", "super-speed-plus-gen2x1", + "super-speed-plus-gen1x2", "super-speed", "high-speed", + "full-speed" and "low-speed". In case this isn't passed + via DT, USB controllers should default to their maximum + HW capability. Similarly, if the argument is + "super-speed-plus", USB controllers should default to + their maximum transfer rate and number of lanes. - dr_mode: tells Dual-Role USB controllers that we want to work on a particular mode. Valid arguments are "host", "peripheral" and "otg". In case this attribute isn't Is that ok? BR, Thinh ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-24 2:39 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-07-23 2:12 [PATCH v2 00/12] usb: Handle different sublink speeds Thinh Nguyen 2020-07-23 2:12 ` [PATCH v2 06/12] usb: devicetree: Introduce num-lanes and lsm Thinh Nguyen 2020-07-23 20:29 ` Rob Herring 2020-07-24 2:39 ` Thinh Nguyen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).