usb: dwc3: keystone: Convert binding to YAML
Subsystems (3)
cover usb: dwc3: keystone: Convert binding to YAML
Hi Felipe,
This series converts keystone-usb.txt to YAML and prepares for Super-Speed support for AM654 SoC.
cheers,
-roger
Roger Quadros (3):
dt-bindings: usb: convert keystone-usb.txt to YAML
dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property
usb: dwc3: keystone: Turn on USB3 PHY before controller
.../devicetree/bindings/usb/keystone-usb.txt | 56 ------------ .../bindings/usb/ti,keystone-dwc3.yaml | 88 +++++++++++++++++++ drivers/usb/dwc3/dwc3-keystone.c | 47 +++++++++- 3 files changed, 134 insertions(+), 57 deletions(-) delete mode 100644 Documentation/devicetree/bindings/usb/keystone-usb.txt create mode 100644 Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH 1/3 dt-bindings: usb: convert keystone-usb.txt to YAML
Convert keystone-usb documentation to YAML format.
--- .../devicetree/bindings/usb/keystone-usb.txt | 56 ---------------- .../bindings/usb/ti,keystone-dwc3.yaml | 67 +++++++++++++++++++ 2 files changed, 67 insertions(+), 56 deletions(-) delete mode 100644 Documentation/devicetree/bindings/usb/keystone-usb.txt create mode 100644 Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml
Documentation/devicetree/bindings/usb/keystone-usb.txt deleted +0 -56
@@ -1,56 +0,0 @@ -TI Keystone Soc USB Controller - -DWC3 GLUE - -Required properties: - - compatible: should be - "ti,keystone-dwc3" for Keystone 2 SoCs - "ti,am654-dwc3" for AM654 SoC - - #address-cells, #size-cells : should be '1' if the device has sub-nodes - with 'reg' property. - - reg : Address and length of the register set for the USB subsystem on - the SOC. - - interrupts : The irq number of this device that is used to interrupt the - MPU. - - ranges: allows valid 1:1 translation between child's address space and - parent's address space. - -SoC-specific Required Properties: -The following are mandatory properties for Keystone 2 66AK2HK, 66AK2L and 66AK2E -SoCs only: - -- clocks: Clock ID for USB functional clock. -- clock-names: Must be "usb". - - -The following are mandatory properties for 66AK2G and AM654: - -- power-domains: Should contain a phandle to a PM domain provider node - and an args specifier containing the USB device id - value. This property is as per the binding, - Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt - -Sub-nodes: -The dwc3 core should be added as subnode to Keystone DWC3 glue. -- dwc3 : - The binding details of dwc3 can be found in: - Documentation/devicetree/bindings/usb/dwc3.txt - -Example: - usb: usb@2680000 { - compatible = "ti,keystone-dwc3"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x2680000 0x10000>; - clocks = <&clkusb>; - clock-names = "usb"; - interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; - ranges; - - dwc3@2690000 { - compatible = "synopsys,dwc3"; - reg = <0x2690000 0x70000>; - interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; - usb-phy = <&usb_phy>, <&usb_phy>; - }; - };
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +67 -0
67 lines not on this page · raw message
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Rob Herring
maintainerRe: [PATCH 1/3] dt-bindings: usb: convert keystone-usb.txt to YAML
Quoted 84 lines · Roger Quadros
Convert keystone-usb documentation to YAML format.
Signed-off-by Roger Quadros <[email protected]>--- .../devicetree/bindings/usb/keystone-usb.txt | 56 ---------------- .../bindings/usb/ti,keystone-dwc3.yaml | 67 +++++++++++++++++++ 2 files changed, 67 insertions(+), 56 deletions(-) delete mode 100644 Documentation/devicetree/bindings/usb/keystone-usb.txt create mode 100644 Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yamlDocumentation/devicetree/bindings/usb/keystone-usb.txt deleted +0
-56@@ -1,56 +0,0 @@ -TI Keystone Soc USB Controller - -DWC3 GLUE - -Required properties: - - compatible: should be - "ti,keystone-dwc3" for Keystone 2 SoCs - "ti,am654-dwc3" for AM654 SoC - - #address-cells, #size-cells : should be '1' if the device has sub-nodes - with 'reg' property. - - reg : Address and length of the register set for the USB subsystem on - the SOC. - - interrupts : The irq number of this device that is used to interrupt the - MPU. - - ranges: allows valid 1:1 translation between child's address space and - parent's address space. - -SoC-specific Required Properties: -The following are mandatory properties for Keystone 2 66AK2HK, 66AK2L and 66AK2E -SoCs only: - -- clocks: Clock ID for USB functional clock. -- clock-names: Must be "usb". - - -The following are mandatory properties for 66AK2G and AM654: - -- power-domains: Should contain a phandle to a PM domain provider node - and an args specifier containing the USB device id - value. This property is as per the binding, - Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt - -Sub-nodes: -The dwc3 core should be added as subnode to Keystone DWC3 glue. -- dwc3 : - The binding details of dwc3 can be found in: - Documentation/devicetree/bindings/usb/dwc3.txt - -Example: - usb: usb@2680000 { - compatible = "ti,keystone-dwc3"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x2680000 0x10000>; - clocks = <&clkusb>; - clock-names = "usb"; - interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; - ranges; - - dwc3@2690000 { - compatible = "synopsys,dwc3"; - reg = <0x2690000 0x70000>; - interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; - usb-phy = <&usb_phy>, <&usb_phy>; - }; - };Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +6
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/ti,keystone-dwc3.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 16
Quoted 10 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +10
-0+title: TI Keystone Soc USB Controller + +maintainers: + - Roger Quadros <[email protected]> + +properties: + compatible: + oneOf: + - const: "ti,keystone-dwc3" + - const: "ti,am654-dwc3"
Use enum rather than oneOf+const.
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 25
Quoted 9 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +9
-0+ + reg: + maxItems: 1 + description: Address and length of the register set for the USB subsystem on + the SOC. + + interrupts: + maxItems: 1 + description: The irq number of this device that is used to interrupt the MPU.
No need for genericish descriptions when a single item.
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 29
Quoted 4 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +4
-0+ + + clocks: + description: Clock ID for USB functional clock.
How many?
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 35
Quoted 6 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +6
-0+ + power-domains: + description: Should contain a phandle to a PM domain provider node + and an args specifier containing the USB device id + value. This property is as per the binding, + Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
How many?
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 37
Quoted 2 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +2
-0+ + dwc3:
This doesn't work because there's a unit address. You need a pattern.
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 39
Quoted 2 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +2
-0+ description: This is the node representing the DWC3 controller instance + Documentation/devicetree/bindings/usb/dwc3.txt
type: object
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 45
Quoted 6 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +6
-0+ +required: + - compatible + - reg + - interrupts + - clocks
additionalProperties: false
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 54
Quoted 9 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +9
-0+ +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + usb: usb@2680000 { + compatible = "ti,keystone-dwc3"; + #address-cells = <1>; + #size-cells = <1>;
These have to be documented.
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 59
Quoted 5 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +5
-0+ reg = <0x2680000 0x10000>; + clocks = <&clkusb>; + clock-names = "usb"; + interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; + ranges;
This too.
Quoted 12 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +8
-0+ + dwc3@2690000 { + compatible = "synopsys,dwc3"; + reg = <0x2690000 0x70000>; + interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; + usb-phy = <&usb_phy>, <&usb_phy>; + }; + };Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Re: [PATCH 1/3] dt-bindings: usb: convert keystone-usb.txt to YAML
Rob,
Thanks for the review. Since this patch was already picked up I will address the issues in a follow up patch.
cheers,
-roger
Quoted 177 lines · Rob Herring
Quoted 84 lines · Roger Quadros
Convert keystone-usb documentation to YAML format.
Signed-off-by Roger Quadros <[email protected]>--- .../devicetree/bindings/usb/keystone-usb.txt | 56 ---------------- .../bindings/usb/ti,keystone-dwc3.yaml | 67 +++++++++++++++++++ 2 files changed, 67 insertions(+), 56 deletions(-)delete mode 100644
Documentation/devicetree/bindings/usb/keystone-usb.txtcreate mode 100644Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yamlDocumentation/devicetree/bindings/usb/keystone-usb.txt deleted +0
-56@@ -1,56 +0,0 @@ -TI Keystone Soc USB Controller - -DWC3 GLUE - -Required properties: - - compatible: should be - "ti,keystone-dwc3" for Keystone 2 SoCs - "ti,am654-dwc3" for AM654 SoC - - #address-cells, #size-cells : should be '1' if the device has sub-nodes - with 'reg' property. - - reg : Address and length of the register set for the USB subsystem on - the SOC. - - interrupts : The irq number of this device that is used to interrupt the - MPU. - - ranges: allows valid 1:1 translation between child's address space and - parent's address space. - -SoC-specific Required Properties: -The following are mandatory properties for Keystone 2 66AK2HK, 66AK2L and 66AK2E -SoCs only: - -- clocks: Clock ID for USB functional clock. -- clock-names: Must be "usb". - - -The following are mandatory properties for 66AK2G and AM654: - -- power-domains: Should contain a phandle to a PM domain provider node - and an args specifier containing the USB device id - value. This property is as per the binding, - Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt - -Sub-nodes: -The dwc3 core should be added as subnode to Keystone DWC3 glue. -- dwc3 : - The binding details of dwc3 can be found in: - Documentation/devicetree/bindings/usb/dwc3.txt - -Example: - usb: usb@2680000 { - compatible = "ti,keystone-dwc3"; - #address-cells = <1>; - #size-cells = <1>; - reg = <0x2680000 0x10000>; - clocks = <&clkusb>; - clock-names = "usb"; - interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; - ranges; - - dwc3@2690000 { - compatible = "synopsys,dwc3"; - reg = <0x2690000 0x70000>; - interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; - usb-phy = <&usb_phy>, <&usb_phy>; - }; - };Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +6
-0@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/ti,keystone-dwc3.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 16
Quoted 10 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +10
-0+title: TI Keystone Soc USB Controller + +maintainers: + - Roger Quadros <[email protected]> + +properties: + compatible: + oneOf: + - const: "ti,keystone-dwc3" + - const: "ti,am654-dwc3"Use enum rather than oneOf+const.
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 25
Quoted 9 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +9
-0+ + reg: + maxItems: 1 + description: Address and length of the register set for the USB subsystem on + the SOC. + + interrupts: + maxItems: 1 + description: The irq number of this device that is used to interrupt the MPU.No need for genericish descriptions when a single item.
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 29
Quoted 4 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +4
-0+ + + clocks: + description: Clock ID for USB functional clock.How many?
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 35
Quoted 6 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +6
-0+ + power-domains: + description: Should contain a phandle to a PM domain provider node + and an args specifier containing the USB device id + value. This property is as per the binding, + Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txtHow many?
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 37
Quoted 2 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +2
-0+ + dwc3:This doesn't work because there's a unit address. You need a pattern.
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 39
Quoted 2 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +2
-0+ description: This is the node representing the DWC3 controller instance + Documentation/devicetree/bindings/usb/dwc3.txttype: object
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 45
Quoted 6 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +6
-0+ +required: + - compatible + - reg + - interrupts + - clocksadditionalProperties: false
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 54
Quoted 9 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +9
-0+ +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + usb: usb@2680000 { + compatible = "ti,keystone-dwc3"; + #address-cells = <1>; + #size-cells = <1>;These have to be documented.
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml line 59
Quoted 5 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +5
-0+ reg = <0x2680000 0x10000>; + clocks = <&clkusb>; + clock-names = "usb"; + interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; + ranges;This too.
Quoted 12 lines
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml new file +8
-0+ + dwc3@2690000 { + compatible = "synopsys,dwc3"; + reg = <0x2690000 0x70000>; + interrupts = <GIC_SPI 393 IRQ_TYPE_EDGE_RISING>; + usb-phy = <&usb_phy>, <&usb_phy>; + }; + };Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH 2/3 dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property
In reply to Roger QuadrosAM654 SoC requires USB3.0 PHY to be turned on before the USB controller. For this SoC, the 'phys' property is used to provide the USB3.0 reference.
--- .../bindings/usb/ti,keystone-dwc3.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml +21 -0
@@ -34,6 +34,16 @@ properties: value. This property is as per the binding, Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt + phys: + description: + PHY specifier for the USB3.0 PHY. Some SoCs need the USB3.0 PHY + to be turned on before the controller. + Documentation/devicetree/bindings/phy/phy-bindings.txt + + phy-names: + items: + - const: "usb3-phy" + dwc3: description: This is the node representing the DWC3 controller instance Documentation/devicetree/bindings/usb/dwc3.txt
@@ -44,6 +54,17 @@ required: - interrupts - clocks +if: + properties: + compatible: + contains: + const: "ti,am654-dwc3" + +then: + required: + - phys + - phy-names + examples: - | #include <dt-bindings/interrupt-controller/arm-gic.h>
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH 3/3 usb: dwc3: keystone: Turn on USB3 PHY before controller
In reply to Roger QuadrosThe Local Power Sleep Controller (LPSC) dependency on AM65 requires SERDES0 to be powered on before USB.
We need to power up SERDES0 power domain and hold it on throughout the reset, init, power on sequence.
--- drivers/usb/dwc3/dwc3-keystone.c | 47 +++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-keystone.c +46 -1
@@ -14,6 +14,7 @@#include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/of_platform.h> +#include <linux/phy/phy.h> #include <linux/pm_runtime.h> /* USBSS register offsets */
@@ -34,6 +35,7 @@struct dwc3_keystone {struct device *dev;void __iomem *usbss; +struct phy *usb3_phy; };static inline u32 kdwc3_readl (void __iomem *base,u32 offset)
@@ -95,8 +97,44 @@ static int kdwc3_probe(struct platform_device *pdev)if (IS_ERR (kdwc->usbss))return PTR_ERR (kdwc->usbss); -pm_runtime_enable (kdwc->dev); +/* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */ + kdwc->usb3_phy =devm_phy_get (dev,"usb3-phy" ); +if (IS_ERR (kdwc->usb3_phy)) { + error =PTR_ERR (kdwc->usb3_phy); +if (error == -ENOSYS || error == -ENODEV ) { + kdwc->usb3_phy =NULL ; + }else { +if (error != -EPROBE_DEFER ) { +dev_err (dev,"couldn't get usb3 phy: %d\n" , + error); + } + +return error; + } + } + +phy_pm_runtime_get_sync (kdwc->usb3_phy); + + error =phy_reset (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy reset failed: %d\n" , error); +return error; + } + + error =phy_init (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy init failed: %d\n" , error); +return error; + } + error =phy_power_on (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy power on failed: %d\n" , error); +phy_exit (kdwc->usb3_phy); +return error; + } + +pm_runtime_enable (kdwc->dev); error =pm_runtime_get_sync (kdwc->dev);if (error <0 ) { dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n",
@@ -138,6 +176,9 @@ static int kdwc3_probe(struct platform_device *pdev) err_irq:pm_runtime_put_sync (kdwc->dev);pm_runtime_disable (kdwc->dev); +phy_power_off (kdwc->usb3_phy); +phy_exit (kdwc->usb3_phy); +phy_pm_runtime_put_sync (kdwc->usb3_phy);return error; }
@@ -163,6 +204,10 @@ static int kdwc3_remove(struct platform_device *pdev)pm_runtime_put_sync (kdwc->dev);pm_runtime_disable (kdwc->dev); +phy_power_off (kdwc->usb3_phy); +phy_exit (kdwc->usb3_phy); +phy_pm_runtime_put_sync (kdwc->usb3_phy); +platform_set_drvdata (pdev,NULL );return 0 ;
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Re: [PATCH 3/3] usb: dwc3: keystone: Turn on USB3 PHY before controller
Quoted 32 lines · Roger Quadros
The Local Power Sleep Controller (LPSC) dependency on AM65 requires SERDES0 to be powered on before USB.
We need to power up SERDES0 power domain and hold it on throughout the reset, init, power on sequence.
Signed-off-by Roger Quadros <[email protected]>--- drivers/usb/dwc3/dwc3-keystone.c | 47 +++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)drivers/usb/dwc3/dwc3-keystone.c +2
-0@@ -14,6 +14,7 @@#include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/of_platform.h> +#include <linux/phy/phy.h> #include <linux/pm_runtime.h> /* USBSS register offsets */ @@ -34,6 +35,7 @@struct dwc3_keystone {struct device *dev;void __iomem *usbss; +struct phy *usb3_phy; };static inline u32 kdwc3_readl (void __iomem *base,u32 offset)
drivers/usb/dwc3/dwc3-keystone.c static int kdwc3_probe(struct platform_device *pdev) · line 101
Quoted 6 lines
drivers/usb/dwc3/dwc3-keystone.c +2
-1@@ -95,8 +97,44 @@ static int kdwc3_probe(struct platform_device *pdev)if (IS_ERR (kdwc->usbss))return PTR_ERR (kdwc->usbss); -pm_runtime_enable (kdwc->dev); +/* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */ + kdwc->usb3_phy =devm_phy_get (dev,"usb3-phy" );
Use devm_phy_optional_get() instead?
Quoted 60 lines
drivers/usb/dwc3/dwc3-keystone.c +42
-0+if (IS_ERR (kdwc->usb3_phy)) { + error =PTR_ERR (kdwc->usb3_phy); +if (error == -ENOSYS || error == -ENODEV ) { + kdwc->usb3_phy =NULL ; + }else { +if (error != -EPROBE_DEFER ) { +dev_err (dev,"couldn't get usb3 phy: %d\n" , + error); + } + +return error; + } + } + +phy_pm_runtime_get_sync (kdwc->usb3_phy); + + error =phy_reset (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy reset failed: %d\n" , error); +return error; + } + + error =phy_init (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy init failed: %d\n" , error); +return error; + } + error =phy_power_on (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy power on failed: %d\n" , error); +phy_exit (kdwc->usb3_phy); +return error; + } + +pm_runtime_enable (kdwc->dev); error =pm_runtime_get_sync (kdwc->dev);if (error <0 ) { dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n",@@ -138,6 +176,9 @@ static int kdwc3_probe(struct platform_device *pdev) err_irq:pm_runtime_put_sync (kdwc->dev);pm_runtime_disable (kdwc->dev); +phy_power_off (kdwc->usb3_phy); +phy_exit (kdwc->usb3_phy); +phy_pm_runtime_put_sync (kdwc->usb3_phy);return error; }@@ -163,6 +204,10 @@ static int kdwc3_remove(struct platform_device *pdev)pm_runtime_put_sync (kdwc->dev);pm_runtime_disable (kdwc->dev); +phy_power_off (kdwc->usb3_phy); +phy_exit (kdwc->usb3_phy); +phy_pm_runtime_put_sync (kdwc->usb3_phy); +platform_set_drvdata (pdev,NULL );return 0 ;
Re: [PATCH 3/3] usb: dwc3: keystone: Turn on USB3 PHY before controller
Quoted 36 lines · Chunfeng Yun
Quoted 35 lines · Roger Quadros
The Local Power Sleep Controller (LPSC) dependency on AM65 requires SERDES0 to be powered on before USB.
We need to power up SERDES0 power domain and hold it on throughout the reset, init, power on sequence.
Signed-off-by Roger Quadros <[email protected]>--- drivers/usb/dwc3/dwc3-keystone.c | 47 +++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)drivers/usb/dwc3/dwc3-keystone.c +2
-0@@ -14,6 +14,7 @@#include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/of_platform.h> +#include <linux/phy/phy.h> #include <linux/pm_runtime.h> /* USBSS register offsets */ @@ -34,6 +35,7 @@struct dwc3_keystone {struct device *dev;void __iomem *usbss; +struct phy *usb3_phy; };static inline u32 kdwc3_readl (void __iomem *base,u32 offset)@@ -95,8 +97,44 @@ static int kdwc3_probe(struct platform_device *pdev)if (IS_ERR (kdwc->usbss))return PTR_ERR (kdwc->usbss);
Quoted 4 lines
drivers/usb/dwc3/dwc3-keystone.c static int kdwc3_probe(struct platform_device *pdev) · line 101
Quoted 3 lines
drivers/usb/dwc3/dwc3-keystone.c +2
-1-pm_runtime_enable (kdwc->dev); +/* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */ + kdwc->usb3_phy =devm_phy_get (dev,"usb3-phy" );Use
devm_phy_optional_get()instead?
Indeed, it seems better suited.
cheers,
-roger
Quoted 62 lines
Quoted 61 lines
drivers/usb/dwc3/dwc3-keystone.c +42
-0+if (IS_ERR (kdwc->usb3_phy)) { + error =PTR_ERR (kdwc->usb3_phy); +if (error == -ENOSYS || error == -ENODEV ) { + kdwc->usb3_phy =NULL ; + }else { +if (error != -EPROBE_DEFER ) { +dev_err (dev,"couldn't get usb3 phy: %d\n" , + error); + } + +return error; + } + } + +phy_pm_runtime_get_sync (kdwc->usb3_phy); + + error =phy_reset (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy reset failed: %d\n" , error); +return error; + } + + error =phy_init (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy init failed: %d\n" , error); +return error; + } + error =phy_power_on (kdwc->usb3_phy); +if (error <0 ) { +dev_err (dev,"usb3 phy power on failed: %d\n" , error); +phy_exit (kdwc->usb3_phy); +return error; + } + +pm_runtime_enable (kdwc->dev); error =pm_runtime_get_sync (kdwc->dev);if (error <0 ) { dev_err(kdwc->dev, "pm_runtime_get_sync failed, error %d\n",@@ -138,6 +176,9 @@ static int kdwc3_probe(struct platform_device *pdev) err_irq:pm_runtime_put_sync (kdwc->dev);pm_runtime_disable (kdwc->dev); +phy_power_off (kdwc->usb3_phy); +phy_exit (kdwc->usb3_phy); +phy_pm_runtime_put_sync (kdwc->usb3_phy);return error; }@@ -163,6 +204,10 @@ static int kdwc3_remove(struct platform_device *pdev)pm_runtime_put_sync (kdwc->dev);pm_runtime_disable (kdwc->dev); +phy_power_off (kdwc->usb3_phy); +phy_exit (kdwc->usb3_phy); +phy_pm_runtime_put_sync (kdwc->usb3_phy); +platform_set_drvdata (pdev,NULL );return 0 ;
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Re: [PATCH 3/3] usb: dwc3: keystone: Turn on USB3 PHY before controller
Quoted 37 lines · Roger Quadros
Quoted 36 lines · Chunfeng Yun
Quoted 35 lines · Roger Quadros
The Local Power Sleep Controller (LPSC) dependency on AM65 requires SERDES0 to be powered on before USB.
We need to power up SERDES0 power domain and hold it on throughout the reset, init, power on sequence.
Signed-off-by Roger Quadros <[email protected]>--- drivers/usb/dwc3/dwc3-keystone.c | 47 +++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)drivers/usb/dwc3/dwc3-keystone.c +2
-0@@ -14,6 +14,7 @@#include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/of_platform.h> +#include <linux/phy/phy.h> #include <linux/pm_runtime.h> /* USBSS register offsets */ @@ -34,6 +35,7 @@struct dwc3_keystone {struct device *dev;void __iomem *usbss; +struct phy *usb3_phy; };static inline u32 kdwc3_readl (void __iomem *base,u32 offset)@@ -95,8 +97,44 @@ static int kdwc3_probe(struct platform_device *pdev)if (IS_ERR (kdwc->usbss))return PTR_ERR (kdwc->usbss);
Quoted 6 lines
Quoted 4 lines
drivers/usb/dwc3/dwc3-keystone.c static int kdwc3_probe(struct platform_device *pdev) · line 101
Quoted 3 lines
drivers/usb/dwc3/dwc3-keystone.c +2
-1-pm_runtime_enable (kdwc->dev); +/* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */ + kdwc->usb3_phy =devm_phy_get (dev,"usb3-phy" );Use
devm_phy_optional_get()instead?Indeed, it seems better suited.
patches 1 and 2 are in testing/next
Signature · 1 line
balbi
Re: [PATCH 3/3] usb: dwc3: keystone: Turn on USB3 PHY before controller
Felipe,
Quoted 39 lines · Felipe Balbi
Quoted 37 lines · Roger Quadros
Quoted 36 lines · Chunfeng Yun
Quoted 35 lines · Roger Quadros
The Local Power Sleep Controller (LPSC) dependency on AM65 requires SERDES0 to be powered on before USB.
We need to power up SERDES0 power domain and hold it on throughout the reset, init, power on sequence.
Signed-off-by Roger Quadros <[email protected]>--- drivers/usb/dwc3/dwc3-keystone.c | 47 +++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-)drivers/usb/dwc3/dwc3-keystone.c +2
-0@@ -14,6 +14,7 @@#include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/of_platform.h> +#include <linux/phy/phy.h> #include <linux/pm_runtime.h> /* USBSS register offsets */ @@ -34,6 +35,7 @@struct dwc3_keystone {struct device *dev;void __iomem *usbss; +struct phy *usb3_phy; };static inline u32 kdwc3_readl (void __iomem *base,u32 offset)@@ -95,8 +97,44 @@ static int kdwc3_probe(struct platform_device *pdev)if (IS_ERR (kdwc->usbss))return PTR_ERR (kdwc->usbss);
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
drivers/usb/dwc3/dwc3-keystone.c static int kdwc3_probe(struct platform_device *pdev) · line 101
Quoted 3 lines
drivers/usb/dwc3/dwc3-keystone.c +2
-1-pm_runtime_enable (kdwc->dev); +/* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */ + kdwc->usb3_phy =devm_phy_get (dev,"usb3-phy" );Use
devm_phy_optional_get()instead?Indeed, it seems better suited.
patches 1 and 2 are in testing/next
Could you please drop them as I need to make changes to make the PHY optional. I will send v2 of entire series.
cheers,
-roger
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Re: [PATCH 3/3] usb: dwc3: keystone: Turn on USB3 PHY before controller
Quoted 44 lines · Roger Quadros
Felipe,
Quoted 41 lines · Felipe Balbi
Quoted 39 lines · Roger Quadros
Quoted 37 lines · Chunfeng Yun
Quoted 30 lines · Roger Quadros
The Local Power Sleep Controller (LPSC) dependency on AM65 requires SERDES0 to be powered on before USB.
We need to power up SERDES0 power domain and hold it on throughout the reset, init, power on sequence.
Signed-off-by Roger Quadros <[email protected]>---
drivers/usb/dwc3/dwc3-keystone.c| 47 +++++++++++++++++++++++++++++++-1 file changed, 46 insertions(+), 1 deletion(-)drivers/usb/dwc3/dwc3-keystone.c +2
-0@@ -14,6 +14,7 @@ #include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/of_platform.h> +#include <linux/phy/phy.h> #include <linux/pm_runtime.h> /* USBSS register offsets */@@ -34,6 +35,7 @@ struct dwc3_keystone { struct device *dev; void __iomem *usbss; + struct phy *usb3_phy; }; static inline u32 kdwc3_readl(void __iomem *base, u32 offset)drivers/usb/dwc3/dwc3-keystone.c static int kdwc3_probe(struct platform_device *pdev) · line 100
Quoted 5 lines
drivers/usb/dwc3/dwc3-keystone.c +2
-1@@ -95,8 +97,44 @@ static int kdwc3_probe(struct platform_device *pdev) if (IS_ERR(kdwc->usbss)) return PTR_ERR(kdwc->usbss); - pm_runtime_enable(kdwc->dev); + /* PSC dependency on AM65 needs SERDES0 to be powered before USB0 */ + kdwc->usb3_phy = devm_phy_get(dev, "usb3-phy");Use
devm_phy_optional_get()instead?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Indeed, it seems better suited.
patches 1 and 2 are in testing/next
Could you please drop them as I need to make changes to make the PHY optional. I will send v2 of entire series.
Actually only patch 2 and 3 need to be revised. Patch 1 is fine.
cheers,
-roger
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki