devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/14] usb: dwc3: Introduce DWC_usb32
@ 2019-12-12  2:48 Thinh Nguyen
  2019-12-12  2:49 ` [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm Thinh Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-12  2:48 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Thinh Nguyen, linux-usb,
	devicetree, Rob Herring, Alan Stern, Mark Rutland, Roger Quadros,
	zhengbin
  Cc: John Youn

This patch series adds support to Synopsys DWC_usb32 controller which is
capable of dual-lane and USB speed up to 40 Gbps. In order to support this new
controller, we need to make a few updates the USB stack and dwc3 driver:

1) dwc3 driver needs to update its IP and revision check. The current scheme
does not support more than 2 controllers.

2) Introduce Lane Speed Mantissa and lane count on the gadget side. Devices
operating in SuperSpeed Plus can refer to gen2x1, gen1x2, or gen2x2.

3) Add a new gadget opts to set the sublink speed for drivers that are
constrained to certain lane count or lane speed mantissa.

4) Add miscellaneous initialization checks for DWC_usb32.


Any review comment is highly appreciated.

Thank you,
Thinh




This patch series depends on the following patches

usb: dwc3: Fix GTXFIFOSIZ.TXFDEP macro name
usb: dwc3: gadget: Properly set maxpacket limit

https://patchwork.kernel.org/cover/11283761/


Thinh Nguyen (14):
  usb: gadget: Add lane count and lsm
  usb: gadget: Add callback to set lane and transfer rate
  usb: composite: Properly report lsm
  usb: dwc3: Implement new id check for DWC_usb32
  usb: dwc3: Update IP checks to support DWC_usb32
  usb: devicetree: dwc3: Add max lane and lsm
  usb: dwc3: gadget: Set lane count and lsm
  usb: dwc3: gadget: Track connected lane count and speed
  usb: dwc3: gadget: Limit the setting of speed
  usb: dwc3: Update HWPARAMS0.MDWIDTH for DWC_usb32
  usb: devicetree: dwc3: Add TRB prefetch count
  usb: dwc3: gadget: Set number of TRB prefetch
  usb: devicetree: dwc3: Add property to disable mult TRB fetch
  usb: dwc3: gadget: Implement disabling of mult TRB fetch

 Documentation/devicetree/bindings/usb/dwc3.txt |   9 ++
 drivers/usb/dwc3/core.c                        |  88 ++++++++----
 drivers/usb/dwc3/core.h                        |  65 ++++++---
 drivers/usb/dwc3/debugfs.c                     |  14 +-
 drivers/usb/dwc3/gadget.c                      | 181 +++++++++++++++++++------
 drivers/usb/dwc3/host.c                        |   2 +-
 drivers/usb/gadget/composite.c                 |  16 ++-
 drivers/usb/gadget/legacy/mass_storage.c       |   2 +
 drivers/usb/gadget/udc/core.c                  |  38 +++++-
 include/linux/usb/composite.h                  |   4 +
 include/linux/usb/gadget.h                     |  15 ++
 11 files changed, 344 insertions(+), 90 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm
  2019-12-12  2:48 [RFC PATCH 00/14] usb: dwc3: Introduce DWC_usb32 Thinh Nguyen
@ 2019-12-12  2:49 ` Thinh Nguyen
  2019-12-12  8:06   ` Felipe Balbi
  2019-12-19 22:09   ` Rob Herring
  2019-12-12  2:50 ` [RFC PATCH 11/14] usb: devicetree: dwc3: Add TRB prefetch count Thinh Nguyen
  2019-12-12  2:50 ` [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch Thinh Nguyen
  2 siblings, 2 replies; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-12  2:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen, linux-usb, devicetree,
	Rob Herring, Mark Rutland
  Cc: John Youn

Add a new property to set maximum number of lanes and transfer rated
supported for DWC_usb32. By default, the driver will configure the
controller to use dual-lane at 10Gbps.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 Documentation/devicetree/bindings/usb/dwc3.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
index 66780a47ad85..7da1c4e7d380 100644
--- a/Documentation/devicetree/bindings/usb/dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/dwc3.txt
@@ -85,6 +85,10 @@ Optional properties:
  - snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of GFLADJ
 	register for post-silicon frame length adjustment when the
 	fladj_30mhz_sdbnd signal is invalid or incorrect.
+ - snps,maximum-lane-count: set to specify the number of lanes to use for
+			DWC_usb32 and later. Default is dual-lanes.
+ - snps,maximum-lsm: set to specify the lane speed mantissa to use in Gbps.
+ 			Default is 10Gbps for SuperSpeed Plus.
  - snps,rx-thr-num-pkt-prd: periodic ESS RX packet threshold count - host mode
 			only. Set this and rx-max-burst-prd to a valid,
 			non-zero value 1-16 (DWC_usb31 programming guide
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 11/14] usb: devicetree: dwc3: Add TRB prefetch count
  2019-12-12  2:48 [RFC PATCH 00/14] usb: dwc3: Introduce DWC_usb32 Thinh Nguyen
  2019-12-12  2:49 ` [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm Thinh Nguyen
@ 2019-12-12  2:50 ` Thinh Nguyen
  2019-12-12  8:18   ` Felipe Balbi
  2019-12-12  2:50 ` [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch Thinh Nguyen
  2 siblings, 1 reply; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-12  2:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen, linux-usb, devicetree,
	Rob Herring, Mark Rutland
  Cc: John Youn

DWC_usb32 has an enhancement that allows the controller to cache
multiple TRBs for non-control endpoints. Introduce a new property to
DWC3 to set the maximum number of TRBs to cache in advance. The property
can be set from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER (CoreConsultant
value). By default, the number of cache TRB is
DWC_USB32_CACHE_TRBS_PER_TRANSFER.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
index 7da1c4e7d380..ff35fa6de2eb 100644
--- a/Documentation/devicetree/bindings/usb/dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/dwc3.txt
@@ -105,6 +105,9 @@ Optional properties:
 			this and tx-thr-num-pkt-prd to a valid, non-zero value
 			1-16 (DWC_usb31 programming guide section 1.2.3) to
 			enable periodic ESS TX threshold.
+ - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
+			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
+			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
 
  - <DEPRECATED> tx-fifo-resize: determines if the FIFO *has* to be reallocated.
  - snps,incr-burst-type-adjustment: Value for INCR burst type of GSBUSCFG0
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-12  2:48 [RFC PATCH 00/14] usb: dwc3: Introduce DWC_usb32 Thinh Nguyen
  2019-12-12  2:49 ` [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm Thinh Nguyen
  2019-12-12  2:50 ` [RFC PATCH 11/14] usb: devicetree: dwc3: Add TRB prefetch count Thinh Nguyen
@ 2019-12-12  2:50 ` Thinh Nguyen
  2019-12-12  8:19   ` Felipe Balbi
  2 siblings, 1 reply; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-12  2:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Thinh Nguyen, linux-usb, devicetree,
	Rob Herring, Mark Rutland
  Cc: John Youn

DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
Add a new property to limit and only do only single TRB fetch request.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
index ff35fa6de2eb..29d6f9b1fc70 100644
--- a/Documentation/devicetree/bindings/usb/dwc3.txt
+++ b/Documentation/devicetree/bindings/usb/dwc3.txt
@@ -108,6 +108,8 @@ Optional properties:
  - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
 			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
 			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
+ - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
+			DWC_usb32.
 
  - <DEPRECATED> tx-fifo-resize: determines if the FIFO *has* to be reallocated.
  - snps,incr-burst-type-adjustment: Value for INCR burst type of GSBUSCFG0
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm
  2019-12-12  2:49 ` [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm Thinh Nguyen
@ 2019-12-12  8:06   ` Felipe Balbi
  2019-12-19 22:09   ` Rob Herring
  1 sibling, 0 replies; 17+ messages in thread
From: Felipe Balbi @ 2019-12-12  8:06 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, Thinh Nguyen, linux-usb,
	devicetree, Rob Herring, Mark Rutland
  Cc: John Youn

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:

> Add a new property to set maximum number of lanes and transfer rated
                                                                 ^^^^^
                                                                 rate?

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 11/14] usb: devicetree: dwc3: Add TRB prefetch count
  2019-12-12  2:50 ` [RFC PATCH 11/14] usb: devicetree: dwc3: Add TRB prefetch count Thinh Nguyen
@ 2019-12-12  8:18   ` Felipe Balbi
  2019-12-12 22:16     ` Thinh Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Felipe Balbi @ 2019-12-12  8:18 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, Thinh Nguyen, linux-usb,
	devicetree, Rob Herring, Mark Rutland
  Cc: John Youn

[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]


Hi,

Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> DWC_usb32 has an enhancement that allows the controller to cache
> multiple TRBs for non-control endpoints. Introduce a new property to
> DWC3 to set the maximum number of TRBs to cache in advance. The property
> can be set from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER (CoreConsultant
> value). By default, the number of cache TRB is
> DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>
> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> ---
>  Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
> index 7da1c4e7d380..ff35fa6de2eb 100644
> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> @@ -105,6 +105,9 @@ Optional properties:
>  			this and tx-thr-num-pkt-prd to a valid, non-zero value
>  			1-16 (DWC_usb31 programming guide section 1.2.3) to
>  			enable periodic ESS TX threshold.
> + - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
> +			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
> +			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.

how about we just leave it at the maximum and in case someone notices
problems, then we consider adding more DT bindings?

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-12  2:50 ` [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch Thinh Nguyen
@ 2019-12-12  8:19   ` Felipe Balbi
  2019-12-12 22:28     ` Thinh Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Felipe Balbi @ 2019-12-12  8:19 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman, Thinh Nguyen, linux-usb,
	devicetree, Rob Herring, Mark Rutland
  Cc: John Youn

[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]


Hi,

Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
> Add a new property to limit and only do only single TRB fetch request.
>
> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> ---
>  Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
> index ff35fa6de2eb..29d6f9b1fc70 100644
> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> @@ -108,6 +108,8 @@ Optional properties:
>   - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
>  			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>  			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
> + - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
> +			DWC_usb32.

two questions:

- how is this different from passing 1 to the previous DT binding
- do we know of anybody having issues with multi-trb prefetch?

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 11/14] usb: devicetree: dwc3: Add TRB prefetch count
  2019-12-12  8:18   ` Felipe Balbi
@ 2019-12-12 22:16     ` Thinh Nguyen
  0 siblings, 0 replies; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-12 22:16 UTC (permalink / raw)
  To: Felipe Balbi, Thinh Nguyen, Greg Kroah-Hartman, linux-usb,
	devicetree, Rob Herring, Mark Rutland
  Cc: John Youn

Hi,

Felipe Balbi wrote:
> Hi,
>
> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>> DWC_usb32 has an enhancement that allows the controller to cache
>> multiple TRBs for non-control endpoints. Introduce a new property to
>> DWC3 to set the maximum number of TRBs to cache in advance. The property
>> can be set from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER (CoreConsultant
>> value). By default, the number of cache TRB is
>> DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>
>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>> ---
>>   Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>> index 7da1c4e7d380..ff35fa6de2eb 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>> @@ -105,6 +105,9 @@ Optional properties:
>>   			this and tx-thr-num-pkt-prd to a valid, non-zero value
>>   			1-16 (DWC_usb31 programming guide section 1.2.3) to
>>   			enable periodic ESS TX threshold.
>> + - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
>> +			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>> +			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
> how about we just leave it at the maximum and in case someone notices
> problems, then we consider adding more DT bindings?
>

Sure. We can do that. I'll remove this.

Thinh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-12  8:19   ` Felipe Balbi
@ 2019-12-12 22:28     ` Thinh Nguyen
  2019-12-13  7:04       ` Felipe Balbi
  0 siblings, 1 reply; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-12 22:28 UTC (permalink / raw)
  To: Felipe Balbi, Thinh Nguyen, Greg Kroah-Hartman, linux-usb,
	devicetree, Rob Herring, Mark Rutland
  Cc: John Youn

Hi,

Felipe Balbi wrote:
> Hi,
>
> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>> DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
>> Add a new property to limit and only do only single TRB fetch request.
>>
>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>> ---
>>   Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>> index ff35fa6de2eb..29d6f9b1fc70 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>> @@ -108,6 +108,8 @@ Optional properties:
>>    - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
>>   			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>   			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>> + - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
>> +			DWC_usb32.
> two questions:
>
> - how is this different from passing 1 to the previous DT binding

The previous DT binding is related to the number TRBs to cache while 
this one is related to whether the controller will send multiple 
(internal) fetch commands to fetch the TRBs.

> - do we know of anybody having issues with multi-trb prefetch?

No, we added this for various internal tests.

BR,
Thinh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-12 22:28     ` Thinh Nguyen
@ 2019-12-13  7:04       ` Felipe Balbi
  2019-12-13 20:10         ` Thinh Nguyen
  2019-12-19 22:17         ` Rob Herring
  0 siblings, 2 replies; 17+ messages in thread
From: Felipe Balbi @ 2019-12-13  7:04 UTC (permalink / raw)
  To: Thinh Nguyen, Thinh Nguyen, Greg Kroah-Hartman, linux-usb,
	devicetree, Rob Herring, Mark Rutland
  Cc: John Youn

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]


Hi,

Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>> DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
>>> Add a new property to limit and only do only single TRB fetch request.
>>>
>>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>>> ---
>>>   Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>>> index ff35fa6de2eb..29d6f9b1fc70 100644
>>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>>> @@ -108,6 +108,8 @@ Optional properties:
>>>    - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
>>>   			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>>   			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>> + - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
>>> +			DWC_usb32.
>> two questions:
>>
>> - how is this different from passing 1 to the previous DT binding
>
> The previous DT binding is related to the number TRBs to cache while 
> this one is related to whether the controller will send multiple 
> (internal) fetch commands to fetch the TRBs.
>
>> - do we know of anybody having issues with multi-trb prefetch?
>
> No, we added this for various internal tests.

We really a better way for you guys to have your test coverage enabled
with upstream kernel. I wonder if DT guys would accept a set of bindings
marked as "for testing purposes". In any case, we really need to enable
Silicon Validation with upstream kernel.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-13  7:04       ` Felipe Balbi
@ 2019-12-13 20:10         ` Thinh Nguyen
  2019-12-19 22:17         ` Rob Herring
  1 sibling, 0 replies; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-13 20:10 UTC (permalink / raw)
  To: Felipe Balbi, Thinh Nguyen, Greg Kroah-Hartman, linux-usb,
	devicetree, Rob Herring, Mark Rutland
  Cc: John Youn


Hi,

Felipe Balbi wrote:
> Hi,
>
> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>>> DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
>>>> Add a new property to limit and only do only single TRB fetch request.
>>>>
>>>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>>>> ---
>>>>    Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
>>>>    1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>> index ff35fa6de2eb..29d6f9b1fc70 100644
>>>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>>>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>> @@ -108,6 +108,8 @@ Optional properties:
>>>>     - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
>>>>    			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>>>    			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>>> + - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
>>>> +			DWC_usb32.
>>> two questions:
>>>
>>> - how is this different from passing 1 to the previous DT binding
>> The previous DT binding is related to the number TRBs to cache while
>> this one is related to whether the controller will send multiple
>> (internal) fetch commands to fetch the TRBs.
>>
>>> - do we know of anybody having issues with multi-trb prefetch?
>> No, we added this for various internal tests.
> We really a better way for you guys to have your test coverage enabled
> with upstream kernel. I wonder if DT guys would accept a set of bindings
> marked as "for testing purposes". In any case, we really need to enable
> Silicon Validation with upstream kernel.
>

That would be great! If there's a sensible way to do so, we're open to 
suggestions.

Thanks,
Thinh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm
  2019-12-12  2:49 ` [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm Thinh Nguyen
  2019-12-12  8:06   ` Felipe Balbi
@ 2019-12-19 22:09   ` Rob Herring
  2019-12-19 22:49     ` Thinh Nguyen
  1 sibling, 1 reply; 17+ messages in thread
From: Rob Herring @ 2019-12-19 22:09 UTC (permalink / raw)
  To: Thinh Nguyen
  Cc: Greg Kroah-Hartman, linux-usb, devicetree, Mark Rutland, John Youn

On Wed, Dec 11, 2019 at 06:49:37PM -0800, Thinh Nguyen wrote:
> Add a new property to set maximum number of lanes and transfer rated
> supported for DWC_usb32. By default, the driver will configure the
> controller to use dual-lane at 10Gbps.
> 
> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> ---
>  Documentation/devicetree/bindings/usb/dwc3.txt | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
> index 66780a47ad85..7da1c4e7d380 100644
> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> @@ -85,6 +85,10 @@ Optional properties:
>   - snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of GFLADJ
>  	register for post-silicon frame length adjustment when the
>  	fladj_30mhz_sdbnd signal is invalid or incorrect.
> + - snps,maximum-lane-count: set to specify the number of lanes to use for
> +			DWC_usb32 and later. Default is dual-lanes.

Why do you need this? When is it not the number of lanes the phy has?

Reuse 'num-lanes' from PCI binding?

> + - snps,maximum-lsm: set to specify the lane speed mantissa to use in Gbps.
> + 			Default is 10Gbps for SuperSpeed Plus.

So the value is '10' or '10Gbps'. Other valid values?

>   - snps,rx-thr-num-pkt-prd: periodic ESS RX packet threshold count - host mode
>  			only. Set this and rx-max-burst-prd to a valid,
>  			non-zero value 1-16 (DWC_usb31 programming guide
> -- 
> 2.11.0
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-13  7:04       ` Felipe Balbi
  2019-12-13 20:10         ` Thinh Nguyen
@ 2019-12-19 22:17         ` Rob Herring
  2019-12-19 22:51           ` Thinh Nguyen
  1 sibling, 1 reply; 17+ messages in thread
From: Rob Herring @ 2019-12-19 22:17 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, devicetree,
	Mark Rutland, John Youn

On Fri, Dec 13, 2019 at 09:04:54AM +0200, Felipe Balbi wrote:
> 
> Hi,
> 
> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> >> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> >>> DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
> >>> Add a new property to limit and only do only single TRB fetch request.
> >>>
> >>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> >>> ---
> >>>   Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
> >>>   1 file changed, 2 insertions(+)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
> >>> index ff35fa6de2eb..29d6f9b1fc70 100644
> >>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> >>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> >>> @@ -108,6 +108,8 @@ Optional properties:
> >>>    - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
> >>>   			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
> >>>   			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
> >>> + - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
> >>> +			DWC_usb32.
> >> two questions:
> >>
> >> - how is this different from passing 1 to the previous DT binding
> >
> > The previous DT binding is related to the number TRBs to cache while 
> > this one is related to whether the controller will send multiple 
> > (internal) fetch commands to fetch the TRBs.
> >
> >> - do we know of anybody having issues with multi-trb prefetch?
> >
> > No, we added this for various internal tests.
> 
> We really a better way for you guys to have your test coverage enabled
> with upstream kernel. I wonder if DT guys would accept a set of bindings
> marked as "for testing purposes". In any case, we really need to enable
> Silicon Validation with upstream kernel.

Well, anything would be better than the endless stream of new 
properties. Include 'test-mode' in the property names would be fine I 
guess.

However, why do they need to be in DT rather than module params or 
debugfs settings? Changing at runtime or reloading the module is a 
better experience than editting a DT and rebooting.

Rob

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm
  2019-12-19 22:09   ` Rob Herring
@ 2019-12-19 22:49     ` Thinh Nguyen
  0 siblings, 0 replies; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-19 22:49 UTC (permalink / raw)
  To: Rob Herring, Thinh Nguyen
  Cc: Greg Kroah-Hartman, linux-usb, devicetree, Mark Rutland, John Youn

Hi,

Rob Herring wrote:
> On Wed, Dec 11, 2019 at 06:49:37PM -0800, Thinh Nguyen wrote:
>> Add a new property to set maximum number of lanes and transfer rated
>> supported for DWC_usb32. By default, the driver will configure the
>> controller to use dual-lane at 10Gbps.
>>
>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>> ---
>>   Documentation/devicetree/bindings/usb/dwc3.txt | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>> index 66780a47ad85..7da1c4e7d380 100644
>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>> @@ -85,6 +85,10 @@ Optional properties:
>>    - snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of GFLADJ
>>   	register for post-silicon frame length adjustment when the
>>   	fladj_30mhz_sdbnd signal is invalid or incorrect.
>> + - snps,maximum-lane-count: set to specify the number of lanes to use for
>> +			DWC_usb32 and later. Default is dual-lanes.
> Why do you need this? When is it not the number of lanes the phy has?

The issue is the controller doesn't know the number of lanes the phy 
supports. There's no HW parameter for this. The user needs to inform 
this to the controller.

>
> Reuse 'num-lanes' from PCI binding?

Ok.

>
>> + - snps,maximum-lsm: set to specify the lane speed mantissa to use in Gbps.
>> + 			Default is 10Gbps for SuperSpeed Plus.
> So the value is '10' or '10Gbps'. Other valid values?

I'm missing this in the description. It can be either 10 or 5. If not 
set, then default to 10Gbps for SSP. I'll update this.

>
>>    - snps,rx-thr-num-pkt-prd: periodic ESS RX packet threshold count - host mode
>>   			only. Set this and rx-max-burst-prd to a valid,
>>   			non-zero value 1-16 (DWC_usb31 programming guide
>> -- 
>> 2.11.0
>>

Thanks,
Thinh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-19 22:17         ` Rob Herring
@ 2019-12-19 22:51           ` Thinh Nguyen
  2019-12-20 22:11             ` Rob Herring
  0 siblings, 1 reply; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-19 22:51 UTC (permalink / raw)
  To: Rob Herring, Felipe Balbi
  Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, devicetree,
	Mark Rutland, John Youn

Hi,

Rob Herring wrote:
> On Fri, Dec 13, 2019 at 09:04:54AM +0200, Felipe Balbi wrote:
>> Hi,
>>
>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>>>> DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
>>>>> Add a new property to limit and only do only single TRB fetch request.
>>>>>
>>>>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>>>>> ---
>>>>>    Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
>>>>>    1 file changed, 2 insertions(+)
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>> index ff35fa6de2eb..29d6f9b1fc70 100644
>>>>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>> @@ -108,6 +108,8 @@ Optional properties:
>>>>>     - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
>>>>>    			can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>>>>    			Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>>>> + - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
>>>>> +			DWC_usb32.
>>>> two questions:
>>>>
>>>> - how is this different from passing 1 to the previous DT binding
>>> The previous DT binding is related to the number TRBs to cache while
>>> this one is related to whether the controller will send multiple
>>> (internal) fetch commands to fetch the TRBs.
>>>
>>>> - do we know of anybody having issues with multi-trb prefetch?
>>> No, we added this for various internal tests.
>> We really a better way for you guys to have your test coverage enabled
>> with upstream kernel. I wonder if DT guys would accept a set of bindings
>> marked as "for testing purposes". In any case, we really need to enable
>> Silicon Validation with upstream kernel.
> Well, anything would be better than the endless stream of new
> properties. Include 'test-mode' in the property names would be fine I
> guess.
>

Generally the properties are for some quirks or configurations that the 
controller must use to work properly and not for debugging purposes. 
Unfortunately, this list can be long..

> However, why do they need to be in DT rather than module params or
> debugfs settings? Changing at runtime or reloading the module is a
> better experience than editting a DT and rebooting.
>
> Rob

Internally, our tool can debug different properties as if they are 
module parameters. They can be changed at runtime. Setting properties is 
one of the options which we can configure without tampering much of the 
existing code.

BR,
Thinh


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-19 22:51           ` Thinh Nguyen
@ 2019-12-20 22:11             ` Rob Herring
  2019-12-20 23:52               ` Thinh Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Rob Herring @ 2019-12-20 22:11 UTC (permalink / raw)
  To: Thinh Nguyen
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, devicetree,
	Mark Rutland, John Youn

On Thu, Dec 19, 2019 at 3:52 PM Thinh Nguyen <Thinh.Nguyen@synopsys.com> wrote:
>
> Hi,
>
> Rob Herring wrote:
> > On Fri, Dec 13, 2019 at 09:04:54AM +0200, Felipe Balbi wrote:
> >> Hi,
> >>
> >> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> >>>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> >>>>> DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
> >>>>> Add a new property to limit and only do only single TRB fetch request.
> >>>>>
> >>>>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> >>>>> ---
> >>>>>    Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
> >>>>>    1 file changed, 2 insertions(+)
> >>>>>
> >>>>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
> >>>>> index ff35fa6de2eb..29d6f9b1fc70 100644
> >>>>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
> >>>>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
> >>>>> @@ -108,6 +108,8 @@ Optional properties:
> >>>>>     - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
> >>>>>                           can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
> >>>>>                           Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
> >>>>> + - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
> >>>>> +                 DWC_usb32.
> >>>> two questions:
> >>>>
> >>>> - how is this different from passing 1 to the previous DT binding
> >>> The previous DT binding is related to the number TRBs to cache while
> >>> this one is related to whether the controller will send multiple
> >>> (internal) fetch commands to fetch the TRBs.
> >>>
> >>>> - do we know of anybody having issues with multi-trb prefetch?
> >>> No, we added this for various internal tests.
> >> We really a better way for you guys to have your test coverage enabled
> >> with upstream kernel. I wonder if DT guys would accept a set of bindings
> >> marked as "for testing purposes". In any case, we really need to enable
> >> Silicon Validation with upstream kernel.
> > Well, anything would be better than the endless stream of new
> > properties. Include 'test-mode' in the property names would be fine I
> > guess.
> >
>
> Generally the properties are for some quirks or configurations that the
> controller must use to work properly and not for debugging purposes.
> Unfortunately, this list can be long..

quirks or testing? Now I'm confused, which is it?

I'm sure I've said this before (for DWC3), but it is better to have a
compatible string for each implementation (usually an SoC) so you can
address new quirks without a dtb change and continually adding new
properties.

Rob

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch
  2019-12-20 22:11             ` Rob Herring
@ 2019-12-20 23:52               ` Thinh Nguyen
  0 siblings, 0 replies; 17+ messages in thread
From: Thinh Nguyen @ 2019-12-20 23:52 UTC (permalink / raw)
  To: Rob Herring, Thinh Nguyen
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, devicetree,
	Mark Rutland, John Youn

Hi,

Rob Herring wrote:
> On Thu, Dec 19, 2019 at 3:52 PM Thinh Nguyen <Thinh.Nguyen@synopsys.com> wrote:
>> Hi,
>>
>> Rob Herring wrote:
>>> On Fri, Dec 13, 2019 at 09:04:54AM +0200, Felipe Balbi wrote:
>>>> Hi,
>>>>
>>>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>>>>> Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
>>>>>>> DWC_usb32 has a feature where it can issue multiple TRB fetch requests.
>>>>>>> Add a new property to limit and only do only single TRB fetch request.
>>>>>>>
>>>>>>> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
>>>>>>> ---
>>>>>>>     Documentation/devicetree/bindings/usb/dwc3.txt | 2 ++
>>>>>>>     1 file changed, 2 insertions(+)
>>>>>>>
>>>>>>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>>>> index ff35fa6de2eb..29d6f9b1fc70 100644
>>>>>>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>>>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>>>>> @@ -108,6 +108,8 @@ Optional properties:
>>>>>>>      - snps,num-trb-prefetch: max value to do TRBs cache for DWC_usb32. The value
>>>>>>>                            can be from 1 to DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>>>>>>                            Default value is DWC_USB32_CACHE_TRBS_PER_TRANSFER.
>>>>>>> + - snps,dis-mult-trb-fetch: set to issue only single TRB fetch request in
>>>>>>> +                 DWC_usb32.
>>>>>> two questions:
>>>>>>
>>>>>> - how is this different from passing 1 to the previous DT binding
>>>>> The previous DT binding is related to the number TRBs to cache while
>>>>> this one is related to whether the controller will send multiple
>>>>> (internal) fetch commands to fetch the TRBs.
>>>>>
>>>>>> - do we know of anybody having issues with multi-trb prefetch?
>>>>> No, we added this for various internal tests.
>>>> We really a better way for you guys to have your test coverage enabled
>>>> with upstream kernel. I wonder if DT guys would accept a set of bindings
>>>> marked as "for testing purposes". In any case, we really need to enable
>>>> Silicon Validation with upstream kernel.
>>> Well, anything would be better than the endless stream of new
>>> properties. Include 'test-mode' in the property names would be fine I
>>> guess.
>>>
>> Generally the properties are for some quirks or configurations that the
>> controller must use to work properly and not for debugging purposes.
>> Unfortunately, this list can be long..
> quirks or testing? Now I'm confused, which is it?

I was referring to the existing properties, they are necessary for a 
working device. Nothing "extra" solely for debugging purposes.

With the exception for these couple properties related to TRB fetching 
in this RFC series, they are for testing only. Regardless, I agreed to 
Felipe previously that we can remove them.


> I'm sure I've said this before (for DWC3), but it is better to have a
> compatible string for each implementation (usually an SoC) so you can
> address new quirks without a dtb change and continually adding new
> properties.
>
> Rob

Yes, you mentioned it before. It may work on SoC, but it won't work for 
PCI devices. We can't use VID:PID either, because the HAPS devices only 
have a set of VID:PID.

Please refer back to a couple discussions back:
1) https://www.spinics.net/lists/linux-usb/msg164494.html

This one is related to cadence's, but I think it's relevant:
2) https://www.spinics.net/lists/linux-usb/msg175199.html

There maybe more discussions previously, but I don't have the history of 
all the emails.

BR,
Thinh



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-12-20 23:53 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-12  2:48 [RFC PATCH 00/14] usb: dwc3: Introduce DWC_usb32 Thinh Nguyen
2019-12-12  2:49 ` [RFC PATCH 06/14] usb: devicetree: dwc3: Add max lane and lsm Thinh Nguyen
2019-12-12  8:06   ` Felipe Balbi
2019-12-19 22:09   ` Rob Herring
2019-12-19 22:49     ` Thinh Nguyen
2019-12-12  2:50 ` [RFC PATCH 11/14] usb: devicetree: dwc3: Add TRB prefetch count Thinh Nguyen
2019-12-12  8:18   ` Felipe Balbi
2019-12-12 22:16     ` Thinh Nguyen
2019-12-12  2:50 ` [RFC PATCH 13/14] usb: devicetree: dwc3: Add property to disable mult TRB fetch Thinh Nguyen
2019-12-12  8:19   ` Felipe Balbi
2019-12-12 22:28     ` Thinh Nguyen
2019-12-13  7:04       ` Felipe Balbi
2019-12-13 20:10         ` Thinh Nguyen
2019-12-19 22:17         ` Rob Herring
2019-12-19 22:51           ` Thinh Nguyen
2019-12-20 22:11             ` Rob Herring
2019-12-20 23:52               ` 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).