A USB SuperSpeed Plus device may operate at different speed and lane count
(i.e. gen2x2, gen1x2, or gen2x1). The DWC_usb32 IP supports SuperSpeed Plus
gen2x2. To support this, this series update a few things to the USB gadget
stack and dwc3 driver:
* Accept and parse new maximum_speed devicetree property strings
* Introduce enum usb_ssp_rate to describe the speed in SuperSpeed Plus genXxY
* Capture the connected and max supported usb_ssp_rate
* Report the device sublink speeds base on the usb_ssp_rate in the BOS
descriptor
* Introduce gadget ops to select SuperSpeed Plus various transfer rate and lane
count
* Update dwc3 driver to support the above changes
Changes in v7:
- Greg picked up the first few patches of the series to his usb-testing
branch. Rebase the remaining patches on Greg's usb-testing branch
Changes in v6:
- Rebase on Greg's usb-testing branch
- Update cover letter and title since there are many updates
* Previous version 5: https://lore.kernel.org/linux-usb/cover.1601001199.git.Thinh.Nguyen@synopsys.com/
- To simplify things, use usb_ssp_rate enum to specify the signaling rate
generation and lane count instead of separately tracking them.
- Convert the sublink speed attributes to macros and move it to uapi
- Remove usb_sublink_speed struct
- Remove "usb: dwc3: gadget: Report sublink speed capability"
- Update dwc3 to support the new changes
Changes in v5:
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
- Add Rob's Reviewed-by
Changes in v4:
- Instead of using a single function to parse "maximum-speed" property for
speed, gen X, and number of lanes, split those tasks to separate common
functions
- Revise DWC3 driver to use those new common functions
- Fix checkpatch warnings for using "unsigned" rather than "unsigned int" and
missing identifier name in udc_set_num_lanes_and_speed gadget ops
Changes in v3:
- Remove "num-lanes" and "lane-speed-mantissa-gbps" common properties
- Remove "num-lanes" and "lane-speed-mantissa-gbps" properties validation in dwc3
- Update "maximum-speed" to support variations of SSP Gen X x Y
- Update common function to parse new strings for "maximum-speed"
- Update commit messages for the new changes
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 (6):
dt-binding: usb: Include USB SSP rates in GenXxY
usb: common: Parse for USB SSP genXxY
usb: dwc3: core: Check maximum_speed SSP genXxY
usb: dwc3: gadget: Implement setting of SSP rate
usb: dwc3: gadget: Track connected SSP rate and lane count
usb: dwc3: gadget: Set speed only up to the max supported
.../devicetree/bindings/usb/usb.yaml | 3 +
drivers/usb/common/common.c | 26 +++++-
drivers/usb/dwc3/core.c | 37 +++++++++
drivers/usb/dwc3/core.h | 9 +++
drivers/usb/dwc3/gadget.c | 80 ++++++++++++++++++-
include/linux/usb/ch9.h | 11 +++
6 files changed, 162 insertions(+), 4 deletions(-)
base-commit: 7a79f1f7f7e75e532c5a803ab3ebf42a3e79497c
--
2.28.0
Implement gadget ops udc_set_ssp_rate(). This allows the gadget/core
driver to select SSP signaling rate and number of lanes to for DWC_usb32
controller.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Update to use usb_ssp_rate enum
- Rebase on Greg's usb-testing branch
- Update to match with the latest flow in dwc3 for setting speed
Changes in v5:
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- None
Changes in v3:
- None
Changes in v2:
- None
drivers/usb/dwc3/core.h | 5 +++++
drivers/usb/dwc3/gadget.c | 47 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 51 insertions(+), 1 deletion(-)
The setting of the device speed should be limited by the device's
maximum_speed. Check and prevent the driver from attempting to configure
higher than the maximum_speed.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Rebase on Greg's usb-testing branch
- Update to follow the latest change of dwc3 on Greg's usb-testing branch
- Update commit message
Changes in v5:
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- None
Changes in v3:
- None
Changes in v2:
- None
drivers/usb/dwc3/gadget.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
Track the number of connected lanes and speed in corresponding enum
usb_ssp_rate for SuperSpeed Plus capable device.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Rebase on Greg's usb-testing branch
- Update commmit message
- Update to report the rate and lane count in usb_ssp_rate enum
Changes in v5:
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- None
Changes in v3:
- Update commit with updated field name
- No longer use DWC3_LSM_5/10_GBPS macros
Changes in v2:
- Fix missing check for gen1x2 when writing to sublink speed attributes
- Minor fix in commit message (first commit sentence ended with comma)
drivers/usb/dwc3/core.h | 2 ++
drivers/usb/dwc3/gadget.c | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+)
The DWC_usb32 controller supports dual-lane SuperSpeed Plus. Check the
maximum_speed property for any limitation in the HW to initialize and
validate the maximum number of lanes and speed the device will operate.
Currently the controller has no visibility into the HW parameter to
determine the maximum number of lanes the HW supports. If the number of
lanes is not specified for SSP, then set the default rate to gen2x2 for
DWC_usb32 and gen2x1 for DWC_usb31.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Rebase on Greg's usb-testing branch
- Update to check for lane count and gen# via usb_ssp_rate enum
- Update commit message
Changes in v5:
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- Use new common funtions to get SSP Gen and number of lanes
Changes in v3:
- Use new common function to get maximum-speed
- Remove num_lanes and lsm validation since they are no longer separate
properties
- Replace dwc->maxmum_lsm field with dwc->maximum_ssp_rate for gen1/gen2
Changes in v2:
- Use common functions to get num_lanes and lsm properties
drivers/usb/dwc3/core.c | 37 +++++++++++++++++++++++++++++++++++++
drivers/usb/dwc3/core.h | 2 ++
drivers/usb/dwc3/gadget.c | 1 +
3 files changed, 40 insertions(+)
@@ -1423,6 +1424,42 @@ static void dwc3_check_params(struct dwc3 *dwc)}break;}++/*+*CurrentlythecontrollerdoesnothavevisibilityintotheHW+*parametertodeterminethemaximumnumberoflanestheHWsupports.+*Ifthenumberoflanesisnotspecifiedinthedeviceproperty,then+*setthedefaulttosupportdual-laneforDWC_usb32andsingle-lane+*forDWC_usb31forsuper-speed-plus.+*/+if(dwc->maximum_speed==USB_SPEED_SUPER_PLUS){+switch(dwc->max_ssp_rate){+caseUSB_SSP_GEN_2x1:+if(hwparam_gen==DWC3_GHWPARAMS3_SSPHY_IFC_GEN1)+dev_warn(dev,"UDC only supports Gen 1\n");+break;+caseUSB_SSP_GEN_1x2:+caseUSB_SSP_GEN_2x2:+if(DWC3_IP_IS(DWC31))+dev_warn(dev,"UDC only supports single lane\n");+break;+caseUSB_SSP_GEN_UNKNOWN:+default:+switch(hwparam_gen){+caseDWC3_GHWPARAMS3_SSPHY_IFC_GEN2:+if(DWC3_IP_IS(DWC32))+dwc->max_ssp_rate=USB_SSP_GEN_2x2;+else+dwc->max_ssp_rate=USB_SSP_GEN_2x1;+break;+caseDWC3_GHWPARAMS3_SSPHY_IFC_GEN1:+if(DWC3_IP_IS(DWC32))+dwc->max_ssp_rate=USB_SSP_GEN_1x2;+break;+}+break;+}+}}staticintdwc3_probe(structplatform_device*pdev)
According to the USB 3.2 spec, a SuperSpeed Plus device can operate at
gen2x2, gen2x1, or gen1x2. If the USB controller device supports
multiple lanes at different transfer rates, the user can specify the HW
capability via these new speed strings:
"super-speed-plus-gen2x2"
"super-speed-plus-gen2x1"
"super-speed-plus-gen1x2"
If the argument is simply "super-speed-plus", USB controllers should
default to their maximum transfer rate and number of lanes.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Update the different maximum_speed enums to the usb.yaml
- Remove Reviewed-by: Rob Herring [off-list ref] because the commit is updated
- Rebase on Greg's usb-testing branch
- Update commit message
Changes in v5:
- Add Reviewed-by: Rob Herring [off-list ref]
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- None
Changes in v3:
- Use "maximum-speed" to include both the num-lane and transfer rate for SSP
- Remove "num-lanes" and "lane-speed-mantissa-gbps" properties
Changes in v2:
- Make "num-lanes" and "lane-speed-mantissa-gbps" common USB properties
Documentation/devicetree/bindings/usb/usb.yaml | 3 +++
1 file changed, 3 insertions(+)
According to the USB 3.2 spec, a SuperSpeed Plus device can operate at
gen2x2, gen2x1, or gen1x2. If the USB controller device supports
multiple lanes at different transfer rates, the user can specify the HW
capability via these new speed strings:
"super-speed-plus-gen2x2"
"super-speed-plus-gen2x1"
"super-speed-plus-gen1x2"
If the argument is simply "super-speed-plus", USB controllers should
default to their maximum transfer rate and number of lanes.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Update the different maximum_speed enums to the usb.yaml
- Remove Reviewed-by: Rob Herring [off-list ref] because the commit is updated
- Rebase on Greg's usb-testing branch
- Update commit message
Changes in v5:
- Add Reviewed-by: Rob Herring [off-list ref]
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- None
Changes in v3:
- Use "maximum-speed" to include both the num-lane and transfer rate for SSP
- Remove "num-lanes" and "lane-speed-mantissa-gbps" properties
Changes in v2:
- Make "num-lanes" and "lane-speed-mantissa-gbps" common USB properties
Documentation/devicetree/bindings/usb/usb.yaml | 3 +++
1 file changed, 3 insertions(+)
From: Rob Herring <robh@kernel.org> Date: 2021-02-05 20:57:11
On Tue, 19 Jan 2021 17:36:08 -0800, Thinh Nguyen wrote:
According to the USB 3.2 spec, a SuperSpeed Plus device can operate at
gen2x2, gen2x1, or gen1x2. If the USB controller device supports
multiple lanes at different transfer rates, the user can specify the HW
capability via these new speed strings:
"super-speed-plus-gen2x2"
"super-speed-plus-gen2x1"
"super-speed-plus-gen1x2"
If the argument is simply "super-speed-plus", USB controllers should
default to their maximum transfer rate and number of lanes.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Update the different maximum_speed enums to the usb.yaml
- Remove Reviewed-by: Rob Herring [off-list ref] because the commit is updated
- Rebase on Greg's usb-testing branch
- Update commit message
Changes in v5:
- Add Reviewed-by: Rob Herring [off-list ref]
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- None
Changes in v3:
- Use "maximum-speed" to include both the num-lane and transfer rate for SSP
- Remove "num-lanes" and "lane-speed-mantissa-gbps" properties
Changes in v2:
- Make "num-lanes" and "lane-speed-mantissa-gbps" common USB properties
Documentation/devicetree/bindings/usb/usb.yaml | 3 +++
1 file changed, 3 insertions(+)
On Tue, 19 Jan 2021 17:36:08 -0800, Thinh Nguyen wrote:
quoted
According to the USB 3.2 spec, a SuperSpeed Plus device can operate at
gen2x2, gen2x1, or gen1x2. If the USB controller device supports
multiple lanes at different transfer rates, the user can specify the HW
capability via these new speed strings:
"super-speed-plus-gen2x2"
"super-speed-plus-gen2x1"
"super-speed-plus-gen1x2"
If the argument is simply "super-speed-plus", USB controllers should
default to their maximum transfer rate and number of lanes.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Update the different maximum_speed enums to the usb.yaml
- Remove Reviewed-by: Rob Herring [off-list ref] because the commit is updated
- Rebase on Greg's usb-testing branch
- Update commit message
Changes in v5:
- Add Reviewed-by: Rob Herring [off-list ref]
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- None
Changes in v3:
- Use "maximum-speed" to include both the num-lane and transfer rate for SSP
- Remove "num-lanes" and "lane-speed-mantissa-gbps" properties
Changes in v2:
- Make "num-lanes" and "lane-speed-mantissa-gbps" common USB properties
Documentation/devicetree/bindings/usb/usb.yaml | 3 +++
1 file changed, 3 insertions(+)
The USB "maximum-speed" property can now take the SSP signaling rate
generation and lane count with these new strings:
"super-speed-plus-gen2x2"
"super-speed-plus-gen2x1"
"super-speed-plus-gen1x2"
Introduce usb_get_maximum_ssp_rate() to parse for the corresponding
usb_ssp_rate enum. The original usb_get_maximum_speed() will return
USB_SPEED_SUPER_PLUS if it matches one of these new strings.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
Changes in v7:
- Rebase on Greg's usb-testing branch
Changes in v6:
- Rebase on Greg's usb-testing branch
- Remove usb_get_ssp_num_lanes() and usb_get_ssp_phy_gen() and use
usb_get_ssp_rate() to return the corresponding usb_ssp_rate enum instead
- Update commit message
Changes in v5:
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
Changes in v4:
- Create 2 functions to get the SSP gen and number of lanes from "maximum-speed" property
- Update usb_get_maximum_speed() to check new SSP strings with genXxY
- Update commit message and subject title to reflect the new changes
Changes in v3:
- Add new function to parse "maximum-speed" for lanes and transfer rate
- Remove separate functions getting num_lanes and transfer rate properties
Changes in v2:
- New commit
drivers/usb/common/common.c | 26 +++++++++++++++++++++++++-
include/linux/usb/ch9.h | 11 +++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
A USB SuperSpeed Plus device may operate at different speed and lane count
(i.e. gen2x2, gen1x2, or gen2x1). The DWC_usb32 IP supports SuperSpeed Plus
gen2x2. To support this, this series update a few things to the USB gadget
stack and dwc3 driver:
* Accept and parse new maximum_speed devicetree property strings
* Introduce enum usb_ssp_rate to describe the speed in SuperSpeed Plus genXxY
* Capture the connected and max supported usb_ssp_rate
* Report the device sublink speeds base on the usb_ssp_rate in the BOS
descriptor
* Introduce gadget ops to select SuperSpeed Plus various transfer rate and lane
count
* Update dwc3 driver to support the above changes
Changes in v7:
- Greg picked up the first few patches of the series to his usb-testing
branch. Rebase the remaining patches on Greg's usb-testing branch
Changes in v6:
- Rebase on Greg's usb-testing branch
- Update cover letter and title since there are many updates
* Previous version 5: https://lore.kernel.org/linux-usb/cover.1601001199.git.Thinh.Nguyen@synopsys.com/
- To simplify things, use usb_ssp_rate enum to specify the signaling rate
generation and lane count instead of separately tracking them.
- Convert the sublink speed attributes to macros and move it to uapi
- Remove usb_sublink_speed struct
- Remove "usb: dwc3: gadget: Report sublink speed capability"
- Update dwc3 to support the new changes
Changes in v5:
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
- Add Rob's Reviewed-by
Changes in v4:
- Instead of using a single function to parse "maximum-speed" property for
speed, gen X, and number of lanes, split those tasks to separate common
functions
- Revise DWC3 driver to use those new common functions
- Fix checkpatch warnings for using "unsigned" rather than "unsigned int" and
missing identifier name in udc_set_num_lanes_and_speed gadget ops
Changes in v3:
- Remove "num-lanes" and "lane-speed-mantissa-gbps" common properties
- Remove "num-lanes" and "lane-speed-mantissa-gbps" properties validation in dwc3
- Update "maximum-speed" to support variations of SSP Gen X x Y
- Update common function to parse new strings for "maximum-speed"
- Update commit messages for the new changes
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 (6):
dt-binding: usb: Include USB SSP rates in GenXxY
usb: common: Parse for USB SSP genXxY
usb: dwc3: core: Check maximum_speed SSP genXxY
usb: dwc3: gadget: Implement setting of SSP rate
usb: dwc3: gadget: Track connected SSP rate and lane count
usb: dwc3: gadget: Set speed only up to the max supported
.../devicetree/bindings/usb/usb.yaml | 3 +
drivers/usb/common/common.c | 26 +++++-
drivers/usb/dwc3/core.c | 37 +++++++++
drivers/usb/dwc3/core.h | 9 +++
drivers/usb/dwc3/gadget.c | 80 ++++++++++++++++++-
include/linux/usb/ch9.h | 11 +++
6 files changed, 162 insertions(+), 4 deletions(-)
base-commit: 7a79f1f7f7e75e532c5a803ab3ebf42a3e79497c
Let me know if there's any issue with these remaining patches. It'd be
great if they can go on the "next" branch at some point.
Thanks,
Thinh
On Fri, Feb 05, 2021 at 02:39:41AM +0000, Thinh Nguyen wrote:
Hi Felipe, Greg,
Thinh Nguyen wrote:
quoted
A USB SuperSpeed Plus device may operate at different speed and lane count
(i.e. gen2x2, gen1x2, or gen2x1). The DWC_usb32 IP supports SuperSpeed Plus
gen2x2. To support this, this series update a few things to the USB gadget
stack and dwc3 driver:
* Accept and parse new maximum_speed devicetree property strings
* Introduce enum usb_ssp_rate to describe the speed in SuperSpeed Plus genXxY
* Capture the connected and max supported usb_ssp_rate
* Report the device sublink speeds base on the usb_ssp_rate in the BOS
descriptor
* Introduce gadget ops to select SuperSpeed Plus various transfer rate and lane
count
* Update dwc3 driver to support the above changes
Changes in v7:
- Greg picked up the first few patches of the series to his usb-testing
branch. Rebase the remaining patches on Greg's usb-testing branch
Changes in v6:
- Rebase on Greg's usb-testing branch
- Update cover letter and title since there are many updates
* Previous version 5: https://lore.kernel.org/linux-usb/cover.1601001199.git.Thinh.Nguyen@synopsys.com/
- To simplify things, use usb_ssp_rate enum to specify the signaling rate
generation and lane count instead of separately tracking them.
- Convert the sublink speed attributes to macros and move it to uapi
- Remove usb_sublink_speed struct
- Remove "usb: dwc3: gadget: Report sublink speed capability"
- Update dwc3 to support the new changes
Changes in v5:
- Rebase on Felipe's testing/next branch
- Changed Signed-off-by email to match From: email header
- Add Rob's Reviewed-by
Changes in v4:
- Instead of using a single function to parse "maximum-speed" property for
speed, gen X, and number of lanes, split those tasks to separate common
functions
- Revise DWC3 driver to use those new common functions
- Fix checkpatch warnings for using "unsigned" rather than "unsigned int" and
missing identifier name in udc_set_num_lanes_and_speed gadget ops
Changes in v3:
- Remove "num-lanes" and "lane-speed-mantissa-gbps" common properties
- Remove "num-lanes" and "lane-speed-mantissa-gbps" properties validation in dwc3
- Update "maximum-speed" to support variations of SSP Gen X x Y
- Update common function to parse new strings for "maximum-speed"
- Update commit messages for the new changes
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 (6):
dt-binding: usb: Include USB SSP rates in GenXxY
usb: common: Parse for USB SSP genXxY
usb: dwc3: core: Check maximum_speed SSP genXxY
usb: dwc3: gadget: Implement setting of SSP rate
usb: dwc3: gadget: Track connected SSP rate and lane count
usb: dwc3: gadget: Set speed only up to the max supported
.../devicetree/bindings/usb/usb.yaml | 3 +
drivers/usb/common/common.c | 26 +++++-
drivers/usb/dwc3/core.c | 37 +++++++++
drivers/usb/dwc3/core.h | 9 +++
drivers/usb/dwc3/gadget.c | 80 ++++++++++++++++++-
include/linux/usb/ch9.h | 11 +++
6 files changed, 162 insertions(+), 4 deletions(-)
base-commit: 7a79f1f7f7e75e532c5a803ab3ebf42a3e79497c
Let me know if there's any issue with these remaining patches. It'd be
great if they can go on the "next" branch at some point.
I was waiting for Rob's review of the dt changes...