usb: dwc3: Add node to update cache type setting
Subsystems (3)
PATCH v2 1/2 usb: dwc3: Add node to update cache type setting
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) encounter USB detect failues when adding dma-coherent to DWC3 node. This is because the HW default cache type configuration of those SoC are not right, need to be updated in DTS.
---
Change in v2:
- New file.
Documentation/devicetree/bindings/usb/dwc3.txt | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
Documentation/devicetree/bindings/usb/dwc3.txt +43 -0
@@ -110,6 +110,43 @@ Optional properties: - in addition all properties from usb-xhci.txt from the current directory are supported as well +* Cache type nodes (optional) + +The Cache type node is used to tell how to configure cache type on 4 different +transfer types: Data Read, Desc Read, Data Write and Desc write. For each +treasfer type, controller has a 4-bit register field to enable different cache +type. Quoted from DWC3 data book Table 6-5 Cache Type Bit Assignments: +---------------------------------------------------------------- +MBUS_TYPE| bit[3] |bit[2] |bit[1] |bit[0] +---------------------------------------------------------------- +AHB |Cacheable |Bufferable |Privilegge |Data +AXI3 |Write Allocate|Read Allocate|Cacheable |Bufferable +AXI4 |Allocate Other|Allocate |Modifiable |Bufferable +AXI4 |Other Allocate|Allocate |Modifiable |Bufferable +Native |Same as AXI |Same as AXI |Same as AXI|Same as AXI +---------------------------------------------------------------- +Note: The AHB, AXI3, AXI4, and PCIe busses use different names for certain +signals, which have the same meaning: + Bufferable = Posted + Cacheable = Modifiable = Snoop (negation of No Snoop) + +In most cases, this node is not required unless the default values of related +registers are not correct *and* DWC3 node has enabled dma-coherent. So far we +have observed USB device detect failure on some Layerscape platforms if this +programming is not conducted properly. + +Required properties: +- transfer_type_datard: A value for 4-bit register which decide cache type of + Data Read transfer. According to above table, we can know that different + master bus type will cause different definition of cache type control bit. So + developer need to know which master bus type his platforms are using in + advance, then decide the value for this transfer type. +- transfer_type_descrd: A value for 4-bit register which decide cache type of + Desc Read transfer. +- transfer_type_datawr: A value for 4-bit register which decide cache type of + Data Write transfer. +- transfer_type_descwr: A value for 4-bit register which decide cache type of + Desc Write transfer. This is usually a subnode to DWC3 glue to which it is connected.
@@ -119,4 +156,10 @@ dwc3@4a030000 { interrupts = <0 92 4> usb-phy = <&usb2_phy>, <&usb3,phy>; snps,incr-burst-type-adjustment = <1>, <4>, <8>, <16>; + cache_type: cache_type { + transfer_type_datard = <0x2>; + transfer_type_descrd = <0x2>; + transfer_type_datawr = <0x2>; + transfer_type_descwr = <0x2>; + }; };
Signature · 1 line
2.7.4
PATCH v2 2/2 usb: dwc3: Add cache type configuration support
Add support to configure cache type for 4 different transfer types: Data Read, Desc Read, Data Write and Desc write. For each treasfer type, controller has a 4-bit register field to enable different cache type.
Some Layerscape platforms might need this to resolve USB detect problem when DWC3 node apply dma-coherent.
---
Change in v2:
- Change most program logic to meet new DTS property define.
- Rename related register address macros.
- Rename function dwc3_enable_snooping() to dwc3_set_cache_type().
drivers/usb/dwc3/core.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 12 ++++++++++ 2 files changed, 76 insertions(+)
drivers/usb/dwc3/core.c +64 -0
@@ -284,6 +284,69 @@ static const struct clk_bulk_data dwc3_core_clks[] = { };/* +* dwc3_set_cache_type - Configure cache type +* @dwc3: Pointer to our controller context structure +*/ +static void dwc3_set_cache_type (struct dwc3 *dwc) +{ +int ret; +u32 tmp, reg, cache_type; +struct fwnode_handle *fwnode; + + reg =dwc3_readl (dwc->regs,DWC3_GSBUSCFG0 ); + tmp = reg; + + fwnode =device_get_named_child_node (dwc->dev,"cache_type" ); +if (!fwnode) { +dev_info (dwc->dev,"Cache_type node no found, skip.\n" ); +return ; + } + + ret =fwnode_property_read_u32 (fwnode, +"transfer_type_datard" , &cache_type); +if (ret) { +dev_err (dwc->dev, +"Can't find property transfer_type_datard.\n" ); +return ; + } + reg &= ~DWC3_GSBUSCFG0_DATARD (~0 ); + reg |=DWC3_GSBUSCFG0_DATARD (cache_type); + + ret =fwnode_property_read_u32 (fwnode, +"transfer_type_descrd" , &cache_type); +if (ret) { +dev_err (dwc->dev, +"Can't find property transfer_type_descrd.\n" ); +return ; + } + reg &= ~DWC3_GSBUSCFG0_DESCRD (~0 ); + reg |=DWC3_GSBUSCFG0_DESCRD (cache_type); + + ret =fwnode_property_read_u32 (fwnode, +"transfer_type_datawr" , &cache_type); +if (ret) { +dev_err (dwc->dev, +"Can't find property transfer_type_datawr.\n" ); +return ; + } + reg &= ~DWC3_GSBUSCFG0_DATAWR (~0 ); + reg |=DWC3_GSBUSCFG0_DATAWR (cache_type); + + ret =fwnode_property_read_u32 (fwnode, +"transfer_type_descwr" , &cache_type); +if (ret) { +dev_err (dwc->dev, +"Can't find property transfer_type_descwr.\n" ); +return ; + } + reg &= ~DWC3_GSBUSCFG0_DESCWR (~0 ); + reg |=DWC3_GSBUSCFG0_DESCWR (cache_type); + +if (tmp != reg) +dwc3_writel (dwc->regs,DWC3_GSBUSCFG0 , reg); +} + +/* * dwc3_frame_length_adjustment - Adjusts frame length if required * @dwc3: Pointer to our controller context structure */
@@ -942,6 +1005,7 @@ static int dwc3_core_init(struct dwc3 *dwc)dwc3_frame_length_adjustment (dwc);dwc3_set_incr_burst_type (dwc); +dwc3_set_cache_type (dwc);usb_phy_set_suspend (dwc->usb2_phy,0 );usb_phy_set_suspend (dwc->usb3_phy,0 );
drivers/usb/dwc3/core.h +12 -0
@@ -165,6 +165,18 @@/* Bit fields */ /* Global SoC Bus Configuration INCRx Register 0 */ +#define DWC3_GSBUSCFG0_DATARD_SHIFT 28 +#define DWC3_GSBUSCFG0_DATARD (n) (((n) & 0xf) \ + << DWC3_GSBUSCFG0_DATARD_SHIFT) +#define DWC3_GSBUSCFG0_DESCRD_SHIFT 24 +#define DWC3_GSBUSCFG0_DESCRD (n) (((n) & 0xf) \ + << DWC3_GSBUSCFG0_DESCRD_SHIFT) +#define DWC3_GSBUSCFG0_DATAWR_SHIFT 20 +#define DWC3_GSBUSCFG0_DATAWR (n) (((n) & 0xf) \ + << DWC3_GSBUSCFG0_DATAWR_SHIFT) +#define DWC3_GSBUSCFG0_DESCWR_SHIFT 16 +#define DWC3_GSBUSCFG0_DESCWR (n) (((n) & 0xf) \ + << DWC3_GSBUSCFG0_DESCWR_SHIFT)#define DWC3_GSBUSCFG0_INCR256BRSTENA (1 << 7)/* INCR256 burst */ #define DWC3_GSBUSCFG0_INCR128BRSTENA (1 << 6)/* INCR128 burst */ #define DWC3_GSBUSCFG0_INCR64BRSTENA (1 << 5)/* INCR64 burst */
Signature · 1 line
2.7.4
Rob Herring
maintainerQuoted 30 lines · Ran Wang
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) encounter USB detect failues when adding dma-coherent to DWC3 node. This is because the HW default cache type configuration of those SoC are not right, need to be updated in DTS.
Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- New file.Documentation/devicetree/bindings/usb/dwc3.txt | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)Documentation/devicetree/bindings/usb/dwc3.txt +9
-0@@ -110,6 +110,43 @@ Optional properties: - in addition all properties from usb-xhci.txt from the current directory are supported as well +* Cache type nodes (optional) + +The Cache type node is used to tell how to configure cache type on 4 different +transfer types: Data Read, Desc Read, Data Write and Desc write. For each +treasfer type, controller has a 4-bit register field to enable different cache +type. Quoted from DWC3 data book Table 6-5 Cache Type Bit Assignments: +---------------------------------------------------------------- +MBUS_TYPE| bit[3] |bit[2] |bit[1] |bit[0] +----------------------------------------------------------------
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 131
Quoted 10 lines
Documentation/devicetree/bindings/usb/dwc3.txt +10
-0+AHB |Cacheable |Bufferable |Privilegge |Data +AXI3 |Write Allocate|Read Allocate|Cacheable |Bufferable +AXI4 |Allocate Other|Allocate |Modifiable |Bufferable +AXI4 |Other Allocate|Allocate |Modifiable |Bufferable +Native |Same as AXI |Same as AXI |Same as AXI|Same as AXI +---------------------------------------------------------------- +Note: The AHB, AXI3, AXI4, and PCIe busses use different names for certain +signals, which have the same meaning: + Bufferable = Posted + Cacheable = Modifiable = Snoop (negation of No Snoop)
This should all be implied from the SoC specific compatible strings.
Rob
Hi Rob,
Quoted 32 lines · On Thursday, July 25, 2019 04:42 Rob Herring <[email protected]> wrote:
Quoted 20 lines · Ran Wang
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) encounter USB detect failues when adding dma-coherent to DWC3 node. This is because the HW default cache type configuration of those SoC are not right, need to be updated in DTS.
Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- New file.Documentation/devicetree/bindings/usb/dwc3.txt | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)Documentation/devicetree/bindings/usb/dwc3.txt +0
-0Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 118
Quoted 9 lines
Documentation/devicetree/bindings/usb/dwc3.txt +6
-0@@ -110,6 +110,43 @@ Optional properties: - in addition all properties from usb-xhci.txt from the current directory are supported as well +* Cache type nodes (optional) + +The Cache type node is used to tell how to configure cache type on 4 +different transfer types: Data Read, Desc Read, Data Write and Desc +write. For each treasfer type, controller has a 4-bit register field +to enable different cache type. Quoted from DWC3 data book Table 6-5Cache Type Bit Assignments:
Quoted 15 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 131
Quoted 13 lines
Documentation/devicetree/bindings/usb/dwc3.txt +13
-0+---------------------------------------------------------------- +MBUS_TYPE| bit[3] |bit[2] |bit[1] |bit[0] +---------------------------------------------------------------- +AHB |Cacheable |Bufferable |Privilegge |Data +AXI3 |Write Allocate|Read Allocate|Cacheable |Bufferable +AXI4 |Allocate Other|Allocate |Modifiable |Bufferable +AXI4 |Other Allocate|Allocate |Modifiable |Bufferable +Native |Same as AXI |Same as AXI |Same as AXI|Same as AXI +---------------------------------------------------------------- +Note: The AHB, AXI3, AXI4, and PCIe busses use different names for +certain signals, which have the same meaning: + Bufferable = Posted + Cacheable = Modifiable = Snoop (negation of No Snoop)This should all be implied from the SoC specific compatible strings.
Did you mean I could implement a soc driver which can be matched by compatible of 'fsl,ls1088a-dwc3' which will pass known bus type to DWC3 driver? If yes, how to pass?
Or I need to add a property snps,mbus_type="AXI3" to DWC3 node, which will co-work with property transfer_type-datard = "cacheable" to set cache type properly?
Thanks & Regards,
Ran
Rob Herring
maintainerQuoted 52 lines · Ran Wang
Hi Rob,
Quoted 32 lines · On Thursday, July 25, 2019 04:42 Rob Herring <[email protected]> wrote:
Quoted 20 lines · Ran Wang
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) encounter USB detect failues when adding dma-coherent to DWC3 node. This is because the HW default cache type configuration of those SoC are not right, need to be updated in DTS.
Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- New file.Documentation/devicetree/bindings/usb/dwc3.txt | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)Documentation/devicetree/bindings/usb/dwc3.txt +0
-0Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 118
Quoted 9 lines
Documentation/devicetree/bindings/usb/dwc3.txt +6
-0@@ -110,6 +110,43 @@ Optional properties: - in addition all properties from usb-xhci.txt from the current directory are supported as well +* Cache type nodes (optional) + +The Cache type node is used to tell how to configure cache type on 4 +different transfer types: Data Read, Desc Read, Data Write and Desc +write. For each treasfer type, controller has a 4-bit register field +to enable different cache type. Quoted from DWC3 data book Table 6-5Cache Type Bit Assignments:
Quoted 15 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 131
Quoted 13 lines
Documentation/devicetree/bindings/usb/dwc3.txt +13
-0+---------------------------------------------------------------- +MBUS_TYPE| bit[3] |bit[2] |bit[1] |bit[0] +---------------------------------------------------------------- +AHB |Cacheable |Bufferable |Privilegge |Data +AXI3 |Write Allocate|Read Allocate|Cacheable |Bufferable +AXI4 |Allocate Other|Allocate |Modifiable |Bufferable +AXI4 |Other Allocate|Allocate |Modifiable |Bufferable +Native |Same as AXI |Same as AXI |Same as AXI|Same as AXI +---------------------------------------------------------------- +Note: The AHB, AXI3, AXI4, and PCIe busses use different names for +certain signals, which have the same meaning: + Bufferable = Posted + Cacheable = Modifiable = Snoop (negation of No Snoop)This should all be implied from the SoC specific compatible strings.
Quoted 1 line
Did you mean I could implement a soc driver which can be matched by compatible of 'fsl,ls1088a-dwc3' which will pass known bus type to DWC3 driver? If yes, how to pass?
Yes. The DT match table can have data associated with that compatible string. Beyond that, I'm not really familiar with the DWC3 driver.
Rob
Hi Felipe,
Quoted 55 lines · Rob Herring
Quoted 53 lines · Ran Wang
Hi Rob,
Quoted 48 lines · On Thursday, July 25, 2019 04:42 Rob Herring <[email protected]> wrote:
Quoted 20 lines · Ran Wang
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) encounter USB detect failues when adding dma-coherent to DWC3 node. This is because the HW default cache type configuration of those SoC are not right, need to be updated in DTS.
Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- New file.Documentation/devicetree/bindings/usb/dwc3.txt | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)Documentation/devicetree/bindings/usb/dwc3.txt +0
-0Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 119
Quoted 10 lines
Documentation/devicetree/bindings/usb/dwc3.txt +7
-0@@ -110,6 +110,43 @@ Optional properties: - in addition all properties from usb-xhci.txt from the current directory are supported as well +* Cache type nodes (optional) + +The Cache type node is used to tell how to configure cache type +on 4 different transfer types: Data Read, Desc Read, Data Write +and Desc write. For each treasfer type, controller has a 4-bit +register field to enable different cache type. Quoted from DWC3 +data book Table 6-5Cache Type Bit Assignments:
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 131
Quoted 13 lines
Documentation/devicetree/bindings/usb/dwc3.txt +13
-0+---------------------------------------------------------------- +MBUS_TYPE| bit[3] |bit[2] |bit[1] |bit[0] +---------------------------------------------------------------- +AHB |Cacheable |Bufferable |Privilegge |Data +AXI3 |Write Allocate|Read Allocate|Cacheable |Bufferable +AXI4 |Allocate Other|Allocate |Modifiable |Bufferable +AXI4 |Other Allocate|Allocate |Modifiable |Bufferable +Native |Same as AXI |Same as AXI |Same as AXI|Same as AXI +---------------------------------------------------------------- +Note: The AHB, AXI3, AXI4, and PCIe busses use different names +for certain signals, which have the same meaning: + Bufferable = Posted + Cacheable = Modifiable = Snoop (negation of No Snoop)This should all be implied from the SoC specific compatible strings.
Quoted 6 lines
Quoted 1 line
Did you mean I could implement a soc driver which can be matched by
compatible of 'fsl,ls1088a-dwc3' which will pass known bus type to DWC3 driver? If yes, how to pass?
Yes. The DT match table can have data associated with that compatible string. Beyond that, I'm not really familiar with the DWC3 driver.
Do you have any suggestion here?
If I add a glue driver on DWC3 core driver (I know you are not happy on this way), I don't know how to pass the MBUS_TYPE info. from my glue driver to DWC3 core driver (I think cache type related programming should be done by DWC3 core driver, am I right?)
Thanks
Ran
Hi Felipe
Quoted 66 lines · On Friday, July 26, 2019 11:30 Ran Wang wrote:
Hi Felipe,
Quoted 22 lines · Rob Herring
Quoted 20 lines · Ran Wang
Hi Rob,
Quoted 16 lines · On Thursday, July 25, 2019 04:42 Rob Herring <[email protected]> wrote:
Quoted 14 lines · Ran Wang
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) encounter USB detect failues when adding dma-coherent to DWC3 node. This is because the HW default cache type configuration of those SoC are not right, need to be updated in DTS.
Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- New file.Documentation/devicetree/bindings/usb/dwc3.txt | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 110
Quoted 7 lines
Documentation/devicetree/bindings/usb/dwc3.txt +0
-0@@ -110,6 +110,43 @@ Optional properties: - in addition all properties from usb-xhci.txt from the current directoryare
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 119
Quoted 9 lines
Documentation/devicetree/bindings/usb/dwc3.txt +7
-0supported as well +* Cache type nodes (optional) + +The Cache type node is used to tell how to configure cache type +on 4 different transfer types: Data Read, Desc Read, Data Write +and Desc write. For each treasfer type, controller has a 4-bit +register field to enable different cache type. Quoted from DWC3 +data book Table 6-5Cache Type Bit Assignments:
Quoted 4 lines
Documentation/devicetree/bindings/usb/dwc3.txt +4
-0+---------------------------------------------------------------- +MBUS_TYPE| bit[3] |bit[2] |bit[1] |bit[0] +---------------------------------------------------------------- +AHB |Cacheable |Bufferable |Privilegge |DataDocumentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 131
Quoted 10 lines
Documentation/devicetree/bindings/usb/dwc3.txt +10
-0+AXI3 |Write Allocate|Read Allocate|Cacheable |Bufferable +AXI4 |Allocate Other|Allocate |Modifiable |Bufferable +AXI4 |Other Allocate|Allocate |Modifiable |Bufferable +Native |Same as AXI |Same as AXI |Same as AXI|Same as AXI +--------------------------------------------------------------- +- +Note: The AHB, AXI3, AXI4, and PCIe busses use different names +for certain signals, which have the same meaning: + Bufferable = Posted + Cacheable = Modifiable = Snoop (negation of No Snoop)This should all be implied from the SoC specific compatible strings.
Quoted 2 lines
Quoted 1 line
Did you mean I could implement a soc driver which can be matched by
compatible of 'fsl,ls1088a-dwc3' which will pass known bus type to DWC3
driver?
Quoted 2 lines
If yes, how to pass?
Quoted 8 lines
Quoted 2 lines
Yes. The DT match table can have data associated with that compatible string. Beyond that, I'm not really familiar with the DWC3 driver.
Do you have any suggestion here?
If I add a glue driver on DWC3 core driver (I know you are not happy on this way), I don't know how to pass theMBUS_TYPEinfo. from my glue driver to DWC3 core driver (I think cache type related programming should be done by DWC3 core driver, am I right?)
Or I add SoC specific handling code in DWC3 driver to do this cache type setting according to SoC specific compatible strings
(such as compatible = "fsl,ls1088a-dwc3", "snps,dwc3";) ?
I know that so far DWC3 driver doesn't have any SoC specific handling code, this might be the first one. Any comment or suggestion are welcome, thanks.
Regards,
Ran
Quoted 54 lines · Rob Herring
Quoted 52 lines · Ran Wang
Hi Rob,
Quoted 47 lines · On Thursday, July 25, 2019 04:42 Rob Herring <[email protected]> wrote:
Quoted 20 lines · Ran Wang
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) encounter USB detect failues when adding dma-coherent to DWC3 node. This is because the HW default cache type configuration of those SoC are not right, need to be updated in DTS.
Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- New file.Documentation/devicetree/bindings/usb/dwc3.txt | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)Documentation/devicetree/bindings/usb/dwc3.txt +0
-0Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 118
Quoted 9 lines
Documentation/devicetree/bindings/usb/dwc3.txt +6
-0@@ -110,6 +110,43 @@ Optional properties: - in addition all properties from usb-xhci.txt from the current directory are supported as well +* Cache type nodes (optional) + +The Cache type node is used to tell how to configure cache type on 4 +different transfer types: Data Read, Desc Read, Data Write and Desc +write. For each treasfer type, controller has a 4-bit register field +to enable different cache type. Quoted from DWC3 data book Table 6-5Cache Type Bit Assignments:
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 131
Quoted 13 lines
Documentation/devicetree/bindings/usb/dwc3.txt +13
-0+---------------------------------------------------------------- +MBUS_TYPE| bit[3] |bit[2] |bit[1] |bit[0] +---------------------------------------------------------------- +AHB |Cacheable |Bufferable |Privilegge |Data +AXI3 |Write Allocate|Read Allocate|Cacheable |Bufferable +AXI4 |Allocate Other|Allocate |Modifiable |Bufferable +AXI4 |Other Allocate|Allocate |Modifiable |Bufferable +Native |Same as AXI |Same as AXI |Same as AXI|Same as AXI +---------------------------------------------------------------- +Note: The AHB, AXI3, AXI4, and PCIe busses use different names for +certain signals, which have the same meaning: + Bufferable = Posted + Cacheable = Modifiable = Snoop (negation of No Snoop)This should all be implied from the SoC specific compatible strings.
Quoted 4 lines
Quoted 1 line
Did you mean I could implement a soc driver which can be matched by compatible of 'fsl,ls1088a-dwc3' which will pass known bus type to DWC3 driver? If yes, how to pass?
Yes. The DT match table can have data associated with that compatible string. Beyond that, I'm not really familiar with the DWC3 driver.
Hi Rob,
It looks like that the current dwc3 binding perfers to define general quirks in device tree properties instead of trying to rely on the compatible string to determine quirks. In this case, can we keep following the existing preference instead of choosing the other way?
Regards,
Leo
Hi Rob, Felipe,
Quoted 66 lines · Yang Li
Quoted 22 lines · Rob Herring
Quoted 20 lines · Ran Wang
Hi Rob,
Quoted 16 lines · On Thursday, July 25, 2019 04:42 Rob Herring <[email protected]> wrote:
Quoted 14 lines · Ran Wang
Some Layerscape paltforms (such as LS1088A, LS2088A, etc) encounter USB detect failues when adding dma-coherent to DWC3 node. This is because the HW default cache type configuration of those SoC are not right, need to be updated in DTS.
Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- New file.Documentation/devicetree/bindings/usb/dwc3.txt | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 110
Quoted 7 lines
Documentation/devicetree/bindings/usb/dwc3.txt +0
-0@@ -110,6 +110,43 @@ Optional properties: - in addition all properties from usb-xhci.txt from the current directoryare
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 119
Quoted 9 lines
Documentation/devicetree/bindings/usb/dwc3.txt +7
-0supported as well +* Cache type nodes (optional) + +The Cache type node is used to tell how to configure cache type +on 4 different transfer types: Data Read, Desc Read, Data Write +and Desc write. For each treasfer type, controller has a 4-bit +register field to enable different cache type. Quoted from DWC3 +data book Table 6-5Cache Type Bit Assignments:
Quoted 4 lines
Documentation/devicetree/bindings/usb/dwc3.txt +4
-0+---------------------------------------------------------------- +MBUS_TYPE| bit[3] |bit[2] |bit[1] |bit[0] +---------------------------------------------------------------- +AHB |Cacheable |Bufferable |Privilegge |DataDocumentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 131
Quoted 10 lines
Documentation/devicetree/bindings/usb/dwc3.txt +10
-0+AXI3 |Write Allocate|Read Allocate|Cacheable |Bufferable +AXI4 |Allocate Other|Allocate |Modifiable |Bufferable +AXI4 |Other Allocate|Allocate |Modifiable |Bufferable +Native |Same as AXI |Same as AXI |Same as AXI|Same as AXI +--------------------------------------------------------------- +- +Note: The AHB, AXI3, AXI4, and PCIe busses use different names +for certain signals, which have the same meaning: + Bufferable = Posted + Cacheable = Modifiable = Snoop (negation of No Snoop)This should all be implied from the SoC specific compatible strings.
Quoted 1 line
Quoted 1 line
Did you mean I could implement a soc driver which can be matched by
compatible of 'fsl,ls1088a-dwc3' which will pass known bus type to DWC3 driver? If yes, how to pass?
Quoted 3 lines
Yes. The DT match table can have data associated with that compatible string. Beyond that, I'm not really familiar with the DWC3 driver.
Quoted 6 lines
Hi Rob,
It looks like that the current dwc3 binding perfers to define general quirks in device tree properties instead of trying to rely on the compatible string to determine quirks. In this case, can we keep following the existing preference instead of choosing the other way?
Looks like you have different opinions on this solution, so I 'd like to have all opens get settled here to help me find a acceptable solution for both of you. Please let me explain more about this:
1. This feature (configure cache type) is natively from DWC3 IP (we can find it from data book),
not a SoC specific feature (more details please see v1 discussion: https://lore.kernel.org/patchwork/patch/851306/)
2. However, in most SoC, the HW default setting looks fine (no need driver help), but some case (like Layerscape) might need driver to do some programming to fix USB no detect issue. That's why I implement this patch.
3. For now, Rob think this should be handled by SoC specific code rather than adding a property to control it (by DWC3 core driver). And Felipe prefer to avoid using glue diver. So I am not sure how to meet this requirements at the same time.
Any further suggestion are really appreciated. Thank you.
Regards,
Ran