drivers: usb: phy: Add qoriq usb 3.0 phy driver support
Subsystems (5)
PATCH v2 1/3 drivers: usb: phy: Add qoriq usb 3.0 phy driver support
Adds qoriq usb 3.0 phy driver to implement erratum related workaround for qoriq SoC.
---
Change in v2:
- Replace funciont __raw_writel() by iowrite32be()
- Remove qoriq_usb3_phy_read() and qoriq_usb3_phy_write()
- Remove USB3PRM1CR_VAL define, use numbers directly
- Use C-style numeric constants on 32'h27672B2A in annotation
- Add prefix 'static' to struct qoriq_usb3_phy_erratum
.../devicetree/bindings/phy/phy-qoriq-usb3.txt | 36 ++++ drivers/phy/Kconfig | 9 + drivers/phy/Makefile | 1 + drivers/phy/phy-qoriq-usb3.c | 191 +++++++++++++++++++++ 4 files changed, 237 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt create mode 100644 drivers/phy/phy-qoriq-usb3.c
Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt new file +36 -0
@@ -0,0 +1,36 @@ +Driver for Freescale USB 3.0 PHY + +Required properties: + +- compatible : fsl,qoriq-usb3-phy +- reg : register mappings for Parameter Configuration Register + and Phy base offset. +- reg-names : "param_ctrl" and "phy_base" +- phy_type : For multi port host USB controllers, should be one of + "ulpi", or "serial". For dual role USB controllers, + should be one of "ulpi", "utmi", "utmi_wide", or "serial". + +Example: + usbphy0: usb-phy at 084F0000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x01570070 0x0 0xC>, <0x0 0x084F0000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; + + usbphy1: usb-phy at 08500000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x0157007C 0x0 0xC>, <0x0 0x08500000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; + + usbphy2: usb-phy at 08510000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x01570088 0x0 0xC>, <0x0 0x08510000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + };
drivers/phy/Kconfig +9 -0
@@ -41,6 +41,15 @@ config PHY_PISTACHIO_USB help Enable this to support the USB2.0 PHY on the IMG Pistachio SoC. + +config PHY_QORIQ_USB3 + tristate "Freescale QorIQ USB 3.0 PHY driver" + depends on ARCH_LAYERSCAPE + depends on OF + select GENERIC_PHY + help + Enable this to support the USB3.0 PHY on the QorIQ SoC. + config PHY_XGENE tristate "APM X-Gene 15Gbps PHY support" depends on HAS_IOMEM && OF && (ARM64 || COMPILE_TEST)
drivers/phy/Makefile +1 -0
@@ -21,3 +21,4 @@ obj-y += broadcom/ \ samsung/ \ st/ \ ti/ +obj-$(CONFIG_PHY_QORIQ_USB3) += phy-qoriq-usb3.o
drivers/phy/phy-qoriq-usb3.c new file +191 -0
191 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH v2 2/3 arm64: dts: ls1043a: Enable USB 3.0 phy driver
This patch adds entries in dts to enable USB 3.0 PHY driver.
---
Change in v2:
- Rename node name from 'usb3-phy' to 'usb-phy'
- Adjust phy node position
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +33 -0
@@ -620,6 +620,8 @@ reg = <0x0 0x2f00000 0x0 0x10000>; interrupts = <0 60 0x4>; dr_mode = "host"; + phys = <&usbphy0>; + phy-names = "usb-phy"; snps,quirk-frame-length-adjustment = <0x20>; snps,dis_rxdet_inp3_quirk; };
@@ -629,6 +631,8 @@ reg = <0x0 0x3000000 0x0 0x10000>; interrupts = <0 61 0x4>; dr_mode = "host"; + phys = <&usbphy1>; + phy-names = "usb-phy"; snps,quirk-frame-length-adjustment = <0x20>; snps,dis_rxdet_inp3_quirk; };
@@ -638,6 +642,8 @@ reg = <0x0 0x3100000 0x0 0x10000>; interrupts = <0 63 0x4>; dr_mode = "host"; + phys = <&usbphy2>; + phy-names = "usb-phy"; snps,quirk-frame-length-adjustment = <0x20>; snps,dis_rxdet_inp3_quirk; };
@@ -747,6 +753,33 @@ <0000 0 0 3 &gic 0 156 0x4>, <0000 0 0 4 &gic 0 157 0x4>; }; + + usbphy0: usb-phy at 084f0000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x01570070 0x0 0xC>, + <0x0 0x084F0000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; + + usbphy1: usb-phy at 08500000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x0157007C 0x0 0xC>, + <0x0 0x08500000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; + + usbphy2: usb-phy at 08510000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x01570088 0x0 0xC>, + <0x0 0x08510000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; }; };
Signature · 1 line
2.14.1
PATCH v2 3/3 usb: dwc3: Enable USB 3.0 phy driver
In reply to Ran WangAdds entry point at dwc3 core init function to enable USB 3.0 PHY driver.
---
Change in v2:
- New file
drivers/usb/dwc3/core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/usb/dwc3/core.c +15 -0
@@ -746,6 +746,8 @@ static int dwc3_core_init(struct dwc3 *dwc) {u32 reg;int ret; +int retval; +struct phy *phy;if (!dwc3_core_is_valid (dwc)) {dev_err (dwc->dev,"this is not a DesignWare USB3 DRD Core\n" );
@@ -770,6 +772,19 @@ static int dwc3_core_init(struct dwc3 *dwc)if (ret) goto err0; + phy =phy_get (dwc->dev,"usb-phy" ); +if (IS_ERR (phy)) { + retval =PTR_ERR (phy); +if (retval == -EPROBE_DEFER ) +dev_dbg (dwc->dev,"usb-phy no found\n" ); + }else { + retval =phy_init (phy); +if (retval) { +phy_put (phy); +dev_dbg (dwc->dev,"phy_init() error!\n" ); + } + } + ret =dwc3_core_soft_reset (dwc);if (ret) goto err0;
Signature · 1 line
2.14.1
Re: [PATCH v2 3/3] usb: dwc3: Enable USB 3.0 phy driver
Hi,
Quoted 31 lines · Ran Wang
Adds entry point at dwc3 core init function to enable USB 3.0 PHY driver.
Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- New filedrivers/usb/dwc3/core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/usb/dwc3/core.c +5
-0@@ -746,6 +746,8 @@ static int dwc3_core_init(struct dwc3 *dwc) {u32 reg;int ret; +int retval; +struct phy *phy;if (!dwc3_core_is_valid (dwc)) {dev_err (dwc->dev,"this is not a DesignWare USB3 DRD Core\n" );@@ -770,6 +772,19 @@ static int dwc3_core_init(struct dwc3 *dwc)if (ret) goto err0; + phy =phy_get (dwc->dev,"usb-phy" ); +if (IS_ERR (phy)) { + retval =PTR_ERR (phy);
drivers/usb/dwc3/core.c static int dwc3_core_init(struct dwc3 *dwc) · line 787
Quoted 10 lines
drivers/usb/dwc3/core.c +10
-0+if (retval == -EPROBE_DEFER ) +dev_dbg (dwc->dev,"usb-phy no found\n" ); + }else { + retval =phy_init (phy); +if (retval) { +phy_put (phy); +dev_dbg (dwc->dev,"phy_init() error!\n" ); + } + } +
what???? We already do this. See dwc3_core_get_phy().
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171107/b998e37c/attachment.sig>
Rob Herring
maintainerQuoted 13 lines · Ran Wang
Adds qoriq usb 3.0 phy driver to implement erratum related workaround for qoriq SoC.
Signed-off-by Sriram Dash <[email protected]>Signed-off-by Ran Wang <[email protected]>---
Change in v2:
- Replace funciont__raw_writel()byiowrite32be()
- Removeqoriq_usb3_phy_read()andqoriq_usb3_phy_write()
- RemoveUSB3PRM1CR_VALdefine, use numbers directly
- Use C-style numeric constants on 32'h27672B2A in annotation
- Add prefix 'static' to structqoriq_usb3_phy_erratum
Quoted 1 line
.../devicetree/bindings/phy/phy-qoriq-usb3.txt | 36 ++++
Please split bindings to separate patch.
Quoted 17 lines
drivers/phy/Kconfig | 9 + drivers/phy/Makefile | 1 + drivers/phy/phy-qoriq-usb3.c | 191 +++++++++++++++++++++ 4 files changed, 237 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt create mode 100644 drivers/phy/phy-qoriq-usb3.cDocumentation/devicetree/bindings/phy/phy-qoriq-usb3.txt new file +4
-0@@ -0,0 +1,36 @@ +Driver for Freescale USB 3.0 PHY + +Required properties: +
Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt line 14
Quoted 10 lines
Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt new file +10
-0+- compatible : fsl,qoriq-usb3-phy +- reg : register mappings for Parameter Configuration Register + and Phy base offset. +- reg-names : "param_ctrl" and "phy_base" +- phy_type : For multi port host USB controllers, should be one of + "ulpi", or "serial". For dual role USB controllers, + should be one of "ulpi", "utmi", "utmi_wide", or "serial". + +Example: + usbphy0: usb-phy at 084F0000 {
Drop leading 0s and use lower case hex. Building dts with W=2 will tell you this.
Quoted 22 lines
Documentation/devicetree/bindings/phy/phy-qoriq-usb3.txt new file +22
-0+ compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x01570070 0x0 0xC>, <0x0 0x084F0000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; + + usbphy1: usb-phy at 08500000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x0157007C 0x0 0xC>, <0x0 0x08500000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + }; + + usbphy2: usb-phy at 08510000 { + compatible = "fsl,qoriq-usb3-phy"; + reg = <0x0 0x01570088 0x0 0xC>, <0x0 0x08510000 0x0 0x5000>; + reg-names = "param_ctrl", "phy_base"; + #phy-cells = <0>; + phy_type = "utmi"; + };