airoha: an7581: USB support
Subsystems (2)
v3 cover airoha: an7581: USB support
This is a major rework of the old v2 series.
The SoC always support USB 2.0 but for USB 3.0 it needs additional configuration for the Serdes port. Such port can be either configured for USB usage or for PCIe lines or HSGMII and these are configured in the SCU space.
The previous implementation of a dedicated SSR driver was too complex and fragile for the simple task of configuring a register hence it was dropped and the handling is entirely in the PHY driver.
Everything was reducted to the dt-bindings to describe the Serdes line.
Also the property for the PHY are renamed to a more suitable name and everything is now mandatory to simplify the implementation. (the PHY are always present and active on the SoC)
Also other unrelated patch are dropped from this series.
Changes v3:
- Drop clk changes
- Drop SSR driver
- Rename property in Documentation
- Simplify PHY handling
- Move SSR handling inside the PHY driver Changes v2:
- Drop changes for simple-mfd
- Rework PHY node structure to single node
- Drop port-id property in favor of serdes-port and usb2-monitor-clock-sel
- Make the SSR driver probe from the clock driver
Christian Marangi (4):
dt-bindings: soc: Add bindings for Airoha SCU Serdes lines
dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
phy: move Airoha PCIe PHY driver to dedicated directory
phy: airoha: Add support for Airoha AN7581 USB PHY
.../bindings/phy/airoha,an7581-usb-phy.yaml | 76 + MAINTAINERS | 12 +- drivers/phy/Kconfig | 11 +- drivers/phy/Makefile | 5 +- drivers/phy/airoha/Kconfig | 23 + drivers/phy/airoha/Makefile | 4 + drivers/phy/airoha/phy-airoha-pcie-regs.h | 494 +++++++ drivers/phy/airoha/phy-airoha-pcie.c | 1290 +++++++++++++++++ drivers/phy/airoha/phy-airoha-usb.c | 615 ++++++++ .../dt-bindings/phy/airoha,an7581-usb-phy.h | 11 + include/dt-bindings/soc/airoha,scu-ssr.h | 11 + scripts/tracepoint-update | Bin 0 -> 22952 bytes 12 files changed, 2538 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 drivers/phy/airoha/Kconfig create mode 100644 drivers/phy/airoha/Makefile create mode 100644 drivers/phy/airoha/phy-airoha-pcie-regs.h create mode 100644 drivers/phy/airoha/phy-airoha-pcie.c create mode 100644 drivers/phy/airoha/phy-airoha-usb.c create mode 100644 include/dt-bindings/phy/airoha,an7581-usb-phy.h create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h create mode 100755 scripts/tracepoint-update
Signature · 1 line
2.51.0
PATCH v3 1/4 dt-bindings: soc: Add bindings for Airoha SCU Serdes lines
The Airoha AN7581 SoC can configure the SCU serdes lines for multiple purpose. For example the Serdes for the USB1 port can be both used for USB 3.0 operation or for Ethernet. Or the USB2 serdes can both used for USB 3.0 operation or for PCIe.
The PCIe Serdes can be both used for PCIe operation or for Ethernet.
Add bindings to permit correct reference of the different ports in DT, mostly to differentiate the different supported modes internally to the drivers.
--- include/dt-bindings/soc/airoha,scu-ssr.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h
include/dt-bindings/soc/airoha,scu-ssr.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ + +#ifndef __DT_BINDINGS_AIROHA_SCU_SSR_H +#define __DT_BINDINGS_AIROHA_SCU_SSR_H + +#define AIROHA_SCU_SERDES_PCIE1 0 +#define AIROHA_SCU_SERDES_PCIE2 1 +#define AIROHA_SCU_SERDES_USB1 2 +#define AIROHA_SCU_SERDES_USB2 3 + +#endif /* __DT_BINDINGS_AIROHA_SCU_SSR_H */
Signature · 1 line
2.51.0
PATCH v3 2/4 dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Christian MarangiAdd documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the relevant USB port.
The first USB port on the SoC can be both used for USB 3.0 operation or Ethernet (HSGMII).
The second USB port on the SoC can be both used for USB 3.0 operation or for an additional PCIe line.
---
For DT maintainers, in v2 there were some comments, hope the new description and names of the property better clarify the usage and why they are needed.
.../bindings/phy/airoha,an7581-usb-phy.yaml | 76 +++++++++++++++++++ MAINTAINERS | 7 ++ .../dt-bindings/phy/airoha,an7581-usb-phy.h | 11 +++ 3 files changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 include/dt-bindings/phy/airoha,an7581-usb-phy.h
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +76 -0
@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the relevant USB port. + + The first USB port on the SoC can be both used for USB 3.0 operation or + Ethernet (HSGMII). + The second USB port on the SoC can be both used for USB 3.0 operation or + for an additional PCIe line. + +properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1 + + airoha,usb2-monitor-clk-sel: + description: Describe what oscillator across the available 4 + should be selected for USB 2.0 Slew Rate calibration. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + airoha,usb3-serdes: + description: Describe what Serdes line is attached to the USB 3.0 port. + Can be either Serdes USB1 or Serdes USB2. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [2, 3] + + airoha,scu: + description: Phandle to the SCU syscon to configure the Serdes line. + $ref: /schemas/types.yaml#/definitions/phandle + + '#phy-cells': + description: Describe if the referred PHY is the USB 2.0 PHY or USB 3.0 PHY. + const: 1 + +required: + - compatible + - reg + - airoha,usb2-monitor-clk-sel + - airoha,usb3-serdes + - airoha,scu + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/phy/airoha,an7581-usb-phy.h> + #include <dt-bindings/soc/airoha,scu-ssr.h> + + phy@1fac0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x1fac0000 0x10000>; + + airoha,usb2-monitor-clk-sel = <AIROHA_USB2_MONCLK_SEL1>; + airoha,usb3-serdes = <AIROHA_SCU_SERDES_USB1>; + airoha,scu = <&scu>; + + #phy-cells = <1>; + }; +
MAINTAINERS +7 -0
@@ -763,6 +763,13 @@ S: Maintained F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml F: drivers/spi/spi-airoha-snfi.c +AIROHA USB PHY DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml +F: include/dt-bindings/phy/airoha,an7581-usb-phy.h + AIRSPY MEDIA DRIVER L: [email protected] S: Orphan
include/dt-bindings/phy/airoha,an7581-usb-phy.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#ifndef _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ +#define _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ + +#define AIROHA_USB2_MONCLK_SEL0 0 +#define AIROHA_USB2_MONCLK_SEL1 1 +#define AIROHA_USB2_MONCLK_SEL2 2 +#define AIROHA_USB2_MONCLK_SEL3 3 + +#endif
Signature · 1 line
2.51.0
Re: [PATCH v3 2/4] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
Quoted 55 lines · Christian Marangi
Add documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the relevant USB port.
The first USB port on the SoC can be both used for USB 3.0 operation or Ethernet (HSGMII).
The second USB port on the SoC can be both used for USB 3.0 operation or for an additional PCIe line.Signed-off-by Christian Marangi <[email protected]>---
For DT maintainers, in v2 there were some comments, hope the new description and names of the property better clarify the usage and why they are needed.
.../bindings/phy/airoha,an7581-usb-phy.yaml | 76 +++++++++++++++++++ MAINTAINERS | 7 ++ .../dt-bindings/phy/airoha,an7581-usb-phy.h | 11 +++ 3 files changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 include/dt-bindings/phy/airoha,an7581-usb-phy.hDocumentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +23
-0@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the relevant USB port. + + The first USB port on the SoC can be both used for USB 3.0 operation or + Ethernet (HSGMII). + The second USB port on the SoC can be both used for USB 3.0 operation or + for an additional PCIe line. +
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 33
Quoted 10 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +10
-0+properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1 + + airoha,usb2-monitor-clk-sel: + description: Describe what oscillator across the available 4 + should be selected for USB 2.0 Slew Rate calibration.
Why's this being set in dt? What actually determines what oscillator should be used? Do they have different performance characteristics? How is someone meant to know which one to use?
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 41
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + airoha,usb3-serdes: + description: Describe what Serdes line is attached to the USB 3.0 port. + Can be either Serdes USB1 or Serdes USB2. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [2, 3]
This is confusing. Why 2 and 3 for usb1 and usb2? What even is the mapping? Is it 2:1/3:2 or 2:2/3:1?
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 49
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ + airoha,scu: + description: Phandle to the SCU syscon to configure the Serdes line. + $ref: /schemas/types.yaml#/definitions/phandle + + '#phy-cells': + description: Describe if the referred PHY is the USB 2.0 PHY or USB 3.0 PHY. + const: 1
Which is which here?
Quoted 51 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +27
-0+ +required: + - compatible + - reg + - airoha,usb2-monitor-clk-sel + - airoha,usb3-serdes + - airoha,scu + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/phy/airoha,an7581-usb-phy.h> + #include <dt-bindings/soc/airoha,scu-ssr.h> + + phy@1fac0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x1fac0000 0x10000>; + + airoha,usb2-monitor-clk-sel = <AIROHA_USB2_MONCLK_SEL1>; + airoha,usb3-serdes = <AIROHA_SCU_SERDES_USB1>; + airoha,scu = <&scu>; + + #phy-cells = <1>; + }; +MAINTAINERS +7
-0@@ -763,6 +763,13 @@ S: Maintained F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml F: drivers/spi/spi-airoha-snfi.c +AIROHA USB PHY DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml +F: include/dt-bindings/phy/airoha,an7581-usb-phy.h + AIRSPY MEDIA DRIVER L: [email protected] S: Orphaninclude/dt-bindings/phy/airoha,an7581-usb-phy.h new file +0
-0
include/dt-bindings/phy/airoha,an7581-usb-phy.h line 9
Quoted 9 lines
include/dt-bindings/phy/airoha,an7581-usb-phy.h new file +9
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#ifndef _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ +#define _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ + +#define AIROHA_USB2_MONCLK_SEL0 0 +#define AIROHA_USB2_MONCLK_SEL1 1 +#define AIROHA_USB2_MONCLK_SEL2 2 +#define AIROHA_USB2_MONCLK_SEL3 3
These definitions seem completely pointless. The property is called "airoha,usb2-monitor-clk-sel" so any use will look like "airoha,usb2-monitor-clk-sel = <3>;"
That's more informative than the define is, since it doesn't even truncate "monitor". I'd just delete this header entirely and use the number. If you want the define in the driver to avoid magic numbers, just define it in the driver.
pw-bot: changes-requested
Cheers,
Conor.
Quoted 5 lines
include/dt-bindings/phy/airoha,an7581-usb-phy.h new file +2
-0+ +#endif Signature · 1 line
2.51.0
Re: [PATCH v3 2/4] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
Quoted 62 lines · Conor Dooley
Quoted 61 lines · Christian Marangi
Add documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the relevant USB port.
The first USB port on the SoC can be both used for USB 3.0 operation or Ethernet (HSGMII).
The second USB port on the SoC can be both used for USB 3.0 operation or for an additional PCIe line.Signed-off-by Christian Marangi <[email protected]>---
For DT maintainers, in v2 there were some comments, hope the new description and names of the property better clarify the usage and why they are needed.
.../bindings/phy/airoha,an7581-usb-phy.yaml | 76 +++++++++++++++++++ MAINTAINERS | 7 ++ .../dt-bindings/phy/airoha,an7581-usb-phy.h | 11 +++ 3 files changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 include/dt-bindings/phy/airoha,an7581-usb-phy.hDocumentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +29
-0@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the relevant USB port. + + The first USB port on the SoC can be both used for USB 3.0 operation or + Ethernet (HSGMII). + The second USB port on the SoC can be both used for USB 3.0 operation or + for an additional PCIe line. + +properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1
Quoted 9 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 33
Quoted 4 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +4
-0+ + airoha,usb2-monitor-clk-sel: + description: Describe what oscillator across the available 4 + should be selected for USB 2.0 Slew Rate calibration.Why's this being set in dt? What actually determines what oscillator should be used? Do they have different performance characteristics? How is someone meant to know which one to use?
Hi Conor,
thanks a lot for the review.
The airoha,usb2-monitor-clk-sel is set in DT because it describe the HW and to what oscillator the PHY should be connected to.
There are 2 PHY at different register space. One PHY needs to calibrate for oscillator 1 and the other PHY for oscillator 2 or the PHY doesn't work for USB 2.0 (the calibration fails)
The previous implementation used an index property but that was rejected as it wasn't descriptive of the HW.
Quoted 9 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 41
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + airoha,usb3-serdes: + description: Describe what Serdes line is attached to the USB 3.0 port. + Can be either Serdes USB1 or Serdes USB2. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [2, 3]
Quoted 3 lines
This is confusing. Why 2 and 3 for usb1 and usb2? What even is the mapping? Is it 2:1/3:2 or 2:2/3:1?
AFAIK there isn't a way to directly reference dt-bindings.
2 and 3 are from include/dt-bindings/soc/airoha,scu-ssr.h
#define AIROHA_SCU_SERDES_USB1 2
#define AIROHA_SCU_SERDES_USB2 3
Quoted 11 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 49
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ + airoha,scu: + description: Phandle to the SCU syscon to configure the Serdes line. + $ref: /schemas/types.yaml#/definitions/phandle + + '#phy-cells': + description: Describe if the referred PHY is the USB 2.0 PHY or USB 3.0 PHY. + const: 1Which is which here?
Mhh I think I didn't understand here. #phy-cells describe the parameters to be used for phys property in a different node.
The current usage would be
<&usb0_phy PHY_TYPE_USB2> for USB 2.0
or <&usb0_phy PHY_TYPE_USB3> for USB 3.0
This node expose 2 PHY that can be referenced by the single parameters.
Quoted 61 lines
Quoted 51 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +27
-0+ +required: + - compatible + - reg + - airoha,usb2-monitor-clk-sel + - airoha,usb3-serdes + - airoha,scu + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/phy/airoha,an7581-usb-phy.h> + #include <dt-bindings/soc/airoha,scu-ssr.h> + + phy@1fac0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x1fac0000 0x10000>; + + airoha,usb2-monitor-clk-sel = <AIROHA_USB2_MONCLK_SEL1>; + airoha,usb3-serdes = <AIROHA_SCU_SERDES_USB1>; + airoha,scu = <&scu>; + + #phy-cells = <1>; + }; +MAINTAINERS +7
-0@@ -763,6 +763,13 @@ S: Maintained F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml F: drivers/spi/spi-airoha-snfi.c +AIROHA USB PHY DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml +F: include/dt-bindings/phy/airoha,an7581-usb-phy.h + AIRSPY MEDIA DRIVER L: [email protected] S: Orphaninclude/dt-bindings/phy/airoha,an7581-usb-phy.h new file +0
-0include/dt-bindings/phy/airoha,an7581-usb-phy.h line 9
Quoted 9 lines
include/dt-bindings/phy/airoha,an7581-usb-phy.h new file +9
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#ifndef _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ +#define _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ + +#define AIROHA_USB2_MONCLK_SEL0 0 +#define AIROHA_USB2_MONCLK_SEL1 1 +#define AIROHA_USB2_MONCLK_SEL2 2 +#define AIROHA_USB2_MONCLK_SEL3 3
Quoted 8 lines
These definitions seem completely pointless. The property is called "airoha,usb2-monitor-clk-sel" so any use will look like "airoha,usb2-monitor-clk-sel = <3>;"
That's more informative than the define is, since it doesn't even truncate "monitor". I'd just delete this header entirely and use the number. If you want the define in the driver to avoid magic numbers, just define it in the driver.
Well yes the idea here is to not have to use magic numbers in DT and try to use the naming in the SoC documentation since they are called monclk_sel0, monclk_sel1 ...
Will drop.
Quoted 10 lines
pw-bot: changes-requested
Cheers,
Conor.Quoted 5 lines
include/dt-bindings/phy/airoha,an7581-usb-phy.h new file +2
-0+ +#endif Signature · 1 line
2.51.0
Signature · 1 line
Ansuel
Re: [PATCH v3 2/4] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
Quoted 75 lines · Christian Marangi
Quoted 62 lines · Conor Dooley
Quoted 61 lines · Christian Marangi
Add documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the relevant USB port.
The first USB port on the SoC can be both used for USB 3.0 operation or Ethernet (HSGMII).
The second USB port on the SoC can be both used for USB 3.0 operation or for an additional PCIe line.Signed-off-by Christian Marangi <[email protected]>---
For DT maintainers, in v2 there were some comments, hope the new description and names of the property better clarify the usage and why they are needed.
.../bindings/phy/airoha,an7581-usb-phy.yaml | 76 +++++++++++++++++++ MAINTAINERS | 7 ++ .../dt-bindings/phy/airoha,an7581-usb-phy.h | 11 +++ 3 files changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 include/dt-bindings/phy/airoha,an7581-usb-phy.hDocumentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +29
-0@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the relevant USB port. + + The first USB port on the SoC can be both used for USB 3.0 operation or + Ethernet (HSGMII). + The second USB port on the SoC can be both used for USB 3.0 operation or + for an additional PCIe line. + +properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1Quoted 9 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 33
Quoted 4 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +4
-0+ + airoha,usb2-monitor-clk-sel: + description: Describe what oscillator across the available 4 + should be selected for USB 2.0 Slew Rate calibration.Why's this being set in dt? What actually determines what oscillator should be used? Do they have different performance characteristics? How is someone meant to know which one to use?
Hi Conor,
Quoted 8 lines
thanks a lot for the review.
The airoha,usb2-monitor-clk-sel is set in DT because it describe the HW and to what oscillator the PHY should be connected to.
There are 2 PHY at different register space. One PHY needs to calibrate for oscillator 1 and the other PHY for oscillator 2 or the PHY doesn't work for USB 2.0 (the calibration fails)
This implies that the oscillator is not part of the phy block, if there's multiple competing for the same one. Why are these oscillators not represented as clocks?
Quoted 12 lines
The previous implementation used an index property but that was rejected as it wasn't descriptive of the HW.
Quoted 9 lines
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + airoha,usb3-serdes: + description: Describe what Serdes line is attached to the USB 3.0 port. + Can be either Serdes USB1 or Serdes USB2. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [2, 3]
Quoted 5 lines
Quoted 3 lines
This is confusing. Why 2 and 3 for usb1 and usb2? What even is the mapping? Is it 2:1/3:2 or 2:2/3:1?
AFAIK there isn't a way to directly reference dt-bindings.
Usually people put the name of the file in.
Quoted 5 lines
2 and 3 are from
include/dt-bindings/soc/airoha,scu-ssr.h#define
AIROHA_SCU_SERDES_USB12
#defineAIROHA_SCU_SERDES_USB23
Why overcomplicate like this? Just use 1 and 2. If that corresponds to register settings of 2 and 3, do that conversion in the driver. Properties are not shoving just register settings etc into, what happens, for example, when the next soc comes along and these are actually usb1 is 3 and usb2 is 4 there? All of a sudden, your property has different meanings depending on which device is being used.
Quoted 15 lines
Quoted 11 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 49
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ + airoha,scu: + description: Phandle to the SCU syscon to configure the Serdes line. + $ref: /schemas/types.yaml#/definitions/phandle + + '#phy-cells': + description: Describe if the referred PHY is the USB 2.0 PHY or USB 3.0 PHY. + const: 1Which is which here?
Mhh I think I didn't understand here. #phy-cells describe the parameters to be used for phys property in a different node.
Quoted 6 lines
The current usage would be
<
&usb0_phyPHY_TYPE_USB2> for USB 2.0
or <&usb0_phyPHY_TYPE_USB3> for USB 3.0This node expose 2 PHY that can be referenced by the single parameters.
Ah, I didn't know that the 1 cell variant here was type not index.
Quoted 69 lines
Quoted 60 lines
Quoted 50 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +26
-0+required: + - compatible + - reg + - airoha,usb2-monitor-clk-sel + - airoha,usb3-serdes + - airoha,scu + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/phy/airoha,an7581-usb-phy.h> + #include <dt-bindings/soc/airoha,scu-ssr.h> + + phy@1fac0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x1fac0000 0x10000>; + + airoha,usb2-monitor-clk-sel = <AIROHA_USB2_MONCLK_SEL1>; + airoha,usb3-serdes = <AIROHA_SCU_SERDES_USB1>; + airoha,scu = <&scu>; + + #phy-cells = <1>; + }; +MAINTAINERS +7
-0@@ -763,6 +763,13 @@ S: Maintained F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml F: drivers/spi/spi-airoha-snfi.c +AIROHA USB PHY DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml +F: include/dt-bindings/phy/airoha,an7581-usb-phy.h + AIRSPY MEDIA DRIVER L: [email protected] S: Orphaninclude/dt-bindings/phy/airoha,an7581-usb-phy.h new file +0
-0include/dt-bindings/phy/airoha,an7581-usb-phy.h line 9
Quoted 9 lines
include/dt-bindings/phy/airoha,an7581-usb-phy.h new file +9
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#ifndef _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ +#define _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ + +#define AIROHA_USB2_MONCLK_SEL0 0 +#define AIROHA_USB2_MONCLK_SEL1 1 +#define AIROHA_USB2_MONCLK_SEL2 2 +#define AIROHA_USB2_MONCLK_SEL3 3Quoted 8 lines
These definitions seem completely pointless. The property is called "airoha,usb2-monitor-clk-sel" so any use will look like "airoha,usb2-monitor-clk-sel = <3>;"
That's more informative than the define is, since it doesn't even truncate "monitor". I'd just delete this header entirely and use the number. If you want the define in the driver to avoid magic numbers, just define it in the driver.
Quoted 3 lines
Well yes the idea here is to not have to use magic numbers in DT and try to use the naming in the SoC documentation since they are called
monclk_sel0,monclk_sel1...
Sometimes the "magic" number just makes sense to use. If something is completely arbitrary, then sure use one to make it readable. If literally the number itself, as it is here, don't bother.
Re: [PATCH v3 2/4] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
Quoted 81 lines · Conor Dooley
Quoted 80 lines · Christian Marangi
Quoted 62 lines · Conor Dooley
Quoted 61 lines · Christian Marangi
Add documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the relevant USB port.
The first USB port on the SoC can be both used for USB 3.0 operation or Ethernet (HSGMII).
The second USB port on the SoC can be both used for USB 3.0 operation or for an additional PCIe line.Signed-off-by Christian Marangi <[email protected]>---
For DT maintainers, in v2 there were some comments, hope the new description and names of the property better clarify the usage and why they are needed.
.../bindings/phy/airoha,an7581-usb-phy.yaml | 76 +++++++++++++++++++ MAINTAINERS | 7 ++ .../dt-bindings/phy/airoha,an7581-usb-phy.h | 11 +++ 3 files changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 include/dt-bindings/phy/airoha,an7581-usb-phy.hDocumentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +29
-0@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the relevant USB port. + + The first USB port on the SoC can be both used for USB 3.0 operation or + Ethernet (HSGMII). + The second USB port on the SoC can be both used for USB 3.0 operation or + for an additional PCIe line. + +properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1Quoted 9 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 33
Quoted 4 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +4
-0+ + airoha,usb2-monitor-clk-sel: + description: Describe what oscillator across the available 4 + should be selected for USB 2.0 Slew Rate calibration.Why's this being set in dt? What actually determines what oscillator should be used? Do they have different performance characteristics? How is someone meant to know which one to use?
Hi Conor,
thanks a lot for the review.
The airoha,usb2-monitor-clk-sel is set in DT because it describe the HW and to what oscillator the PHY should be connected to.
Quoted 8 lines
Quoted 3 lines
There are 2 PHY at different register space. One PHY needs to calibrate for oscillator 1 and the other PHY for oscillator 2 or the PHY doesn't work for USB 2.0 (the calibration fails)
This implies that the oscillator is not part of the phy block, if there's multiple competing for the same one. Why are these oscillators not represented as clocks?
This was also pointed out in the old revision. The oscillator is internal and there isn't a register to read the frequency or to enable/disable.
The PHY register block have the same exact bits to select from 0 to 3. The HW internally is then connected to 1 or 2 basted on the physical PHY.
So yes they are part of the PHY block, just the register map is too ""liberal"" on the configuration.
I verified if the same oscillator could be used for both but it does end up in the port not working as the calibration fails.
Quoted 12 lines
Quoted 12 lines
The previous implementation used an index property but that was rejected as it wasn't descriptive of the HW.
Quoted 9 lines
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + airoha,usb3-serdes: + description: Describe what Serdes line is attached to the USB 3.0 port. + Can be either Serdes USB1 or Serdes USB2. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [2, 3]
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
This is confusing. Why 2 and 3 for usb1 and usb2? What even is the mapping? Is it 2:1/3:2 or 2:2/3:1?
AFAIK there isn't a way to directly reference dt-bindings.
Usually people put the name of the file in.
Yes on this I have seen mixed implementation with only the enum and some adding the link to it. I will add in the description.
Quoted 6 lines
Quoted 5 lines
2 and 3 are from
include/dt-bindings/soc/airoha,scu-ssr.h#define
AIROHA_SCU_SERDES_USB12
#defineAIROHA_SCU_SERDES_USB23
Quoted 7 lines
Why overcomplicate like this? Just use 1 and 2. If that corresponds to register settings of 2 and 3, do that conversion in the driver. Properties are not shoving just register settings etc into, what happens, for example, when the next soc comes along and these are actually usb1 is 3 and usb2 is 4 there? All of a sudden, your property has different meanings depending on which device is being used.
This is really just to identify the serdes line that can have multiple usage, they don't refer to a specific register.
The PCIe one are added as they can also be used for PCIe or Ethernet usage and in the future this feature will be implemented in the PCIe PHY.
It's ok to change it 1 but then I hope we won't fall in the monclk case where we end up with
airoha,usb3-serdes = <1>;
as that will be VERY confusing in DT.
(again I'm using dt-bindings here to give clear indication of the hardware since it's already confusing as is with all the double usage of the different PHY)
Quoted 15 lines
Quoted 15 lines
Quoted 11 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 49
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ + airoha,scu: + description: Phandle to the SCU syscon to configure the Serdes line. + $ref: /schemas/types.yaml#/definitions/phandle + + '#phy-cells': + description: Describe if the referred PHY is the USB 2.0 PHY or USB 3.0 PHY. + const: 1Which is which here?
Mhh I think I didn't understand here. #phy-cells describe the parameters to be used for phys property in a different node.
Quoted 9 lines
Quoted 6 lines
The current usage would be
<
&usb0_phyPHY_TYPE_USB2> for USB 2.0
or <&usb0_phyPHY_TYPE_USB3> for USB 3.0This node expose 2 PHY that can be referenced by the single parameters.
Ah, I didn't know that the 1 cell variant here was type not index.
Yes in the driver I'm maching for type not index as it's very confusing. Any hint on better describe it on the schema? Maybe I can reword with
"Describe if the referred PHY is PHY_TYPE_USB2 or PHY_TYPE_USB3"
Should be more direct. I understand now the confusion.
Quoted 69 lines
Quoted 69 lines
Quoted 68 lines
Quoted 50 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +26
-0+required: + - compatible + - reg + - airoha,usb2-monitor-clk-sel + - airoha,usb3-serdes + - airoha,scu + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/phy/airoha,an7581-usb-phy.h> + #include <dt-bindings/soc/airoha,scu-ssr.h> + + phy@1fac0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x1fac0000 0x10000>; + + airoha,usb2-monitor-clk-sel = <AIROHA_USB2_MONCLK_SEL1>; + airoha,usb3-serdes = <AIROHA_SCU_SERDES_USB1>; + airoha,scu = <&scu>; + + #phy-cells = <1>; + }; +MAINTAINERS +7
-0@@ -763,6 +763,13 @@ S: Maintained F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml F: drivers/spi/spi-airoha-snfi.c +AIROHA USB PHY DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml +F: include/dt-bindings/phy/airoha,an7581-usb-phy.h + AIRSPY MEDIA DRIVER L: [email protected] S: Orphaninclude/dt-bindings/phy/airoha,an7581-usb-phy.h new file +0
-0include/dt-bindings/phy/airoha,an7581-usb-phy.h line 9
Quoted 9 lines
include/dt-bindings/phy/airoha,an7581-usb-phy.h new file +9
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#ifndef _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ +#define _DT_BINDINGS_AIROHA_AN7581_USB_PHY_H_ + +#define AIROHA_USB2_MONCLK_SEL0 0 +#define AIROHA_USB2_MONCLK_SEL1 1 +#define AIROHA_USB2_MONCLK_SEL2 2 +#define AIROHA_USB2_MONCLK_SEL3 3These definitions seem completely pointless. The property is called "airoha,usb2-monitor-clk-sel" so any use will look like "airoha,usb2-monitor-clk-sel = <3>;"
That's more informative than the define is, since it doesn't even truncate "monitor". I'd just delete this header entirely and use the number. If you want the define in the driver to avoid magic numbers, just define it in the driver.
Quoted 7 lines
Quoted 3 lines
Well yes the idea here is to not have to use magic numbers in DT and try to use the naming in the SoC documentation since they are called
monclk_sel0,monclk_sel1...Sometimes the "magic" number just makes sense to use. If something is completely arbitrary, then sure use one to make it readable. If literally the number itself, as it is here, don't bother.
Ok no problem, thanks for hint. More than happy to make this easier and have less redundant headers.
Signature · 1 line
Ansuel
Re: [PATCH v3 2/4] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
Quoted 86 lines · Christian Marangi
Quoted 85 lines · Conor Dooley
Quoted 83 lines · Christian Marangi
Quoted 62 lines · Conor Dooley
Quoted 61 lines · Christian Marangi
Add documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the relevant USB port.
The first USB port on the SoC can be both used for USB 3.0 operation or Ethernet (HSGMII).
The second USB port on the SoC can be both used for USB 3.0 operation or for an additional PCIe line.Signed-off-by Christian Marangi <[email protected]>---
For DT maintainers, in v2 there were some comments, hope the new description and names of the property better clarify the usage and why they are needed.
.../bindings/phy/airoha,an7581-usb-phy.yaml | 76 +++++++++++++++++++ MAINTAINERS | 7 ++ .../dt-bindings/phy/airoha,an7581-usb-phy.h | 11 +++ 3 files changed, 94 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 include/dt-bindings/phy/airoha,an7581-usb-phy.hDocumentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +29
-0@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the relevant USB port. + + The first USB port on the SoC can be both used for USB 3.0 operation or + Ethernet (HSGMII). + The second USB port on the SoC can be both used for USB 3.0 operation or + for an additional PCIe line. + +properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1Quoted 9 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 33
Quoted 4 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +4
-0+ + airoha,usb2-monitor-clk-sel: + description: Describe what oscillator across the available 4 + should be selected for USB 2.0 Slew Rate calibration.Why's this being set in dt? What actually determines what oscillator should be used? Do they have different performance characteristics? How is someone meant to know which one to use?
Hi Conor,
thanks a lot for the review.
The airoha,usb2-monitor-clk-sel is set in DT because it describe the HW and to what oscillator the PHY should be connected to.
There are 2 PHY at different register space. One PHY needs to calibrate for oscillator 1 and the other PHY for oscillator 2 or the PHY doesn't work for USB 2.0 (the calibration fails)
Quoted 8 lines
Quoted 4 lines
This implies that the oscillator is not part of the phy block, if there's multiple competing for the same one. Why are these oscillators not represented as clocks?
This was also pointed out in the old revision. The oscillator is internal and there isn't a register to read the frequency or to enable/disable.
If it has come up twice, that's a sure sign that you're not explaining how this property works correctly. Since it's more about suitability and less on usage, put it in the commit message.
Quoted 47 lines
The PHY register block have the same exact bits to select from 0 to 3. The HW internally is then connected to 1 or 2 basted on the physical PHY.
So yes they are part of the PHY block, just the register map is too ""liberal"" on the configuration.
I verified if the same oscillator could be used for both but it does end up in the port not working as the calibration fails.
Quoted 12 lines
Quoted 12 lines
The previous implementation used an index property but that was rejected as it wasn't descriptive of the HW.
Quoted 9 lines
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + airoha,usb3-serdes: + description: Describe what Serdes line is attached to the USB 3.0 port. + Can be either Serdes USB1 or Serdes USB2. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [2, 3]Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
This is confusing. Why 2 and 3 for usb1 and usb2? What even is the mapping? Is it 2:1/3:2 or 2:2/3:1?
AFAIK there isn't a way to directly reference dt-bindings.
Usually people put the name of the file in.
Yes on this I have seen mixed implementation with only the enum and some adding the link to it. I will add in the description.
Quoted 6 lines
Quoted 5 lines
2 and 3 are from
include/dt-bindings/soc/airoha,scu-ssr.h#define
AIROHA_SCU_SERDES_USB12
#defineAIROHA_SCU_SERDES_USB23Quoted 7 lines
Why overcomplicate like this? Just use 1 and 2. If that corresponds to register settings of 2 and 3, do that conversion in the driver. Properties are not shoving just register settings etc into, what happens, for example, when the next soc comes along and these are actually usb1 is 3 and usb2 is 4 there? All of a sudden, your property has different meanings depending on which device is being used.
Quoted 8 lines
This is really just to identify the serdes line that can have multiple usage, they don't refer to a specific register.
The PCIe one are added as they can also be used for PCIe or Ethernet usage and in the future this feature will be implemented in the PCIe PHY.
It's ok to change it 1 but then I hope we won't fall in the monclk case where we end up with
What is the "monclk" case?
Quoted 3 lines
airoha,usb3-serdes = <1>;
as that will be VERY confusing in DT.
Why would this be confusing for whatever "monclk" is?
I think the best argument for keeping it behaving how it does, is that you've got pcie1 and pcie2 as potential options too.
Honestly, this whole patch comes across as doing weird or not needed stuff, until the explanations arrive for why you're doing it this way a few mails later. Just put the explanations for anything non-obvious like this into either the property description (if usage is what's weird or non-obvious) or into the commit message (if it's about suitability) and we'll save a bunch of time in the future ;)
Rob Herring
maintainerRe: [PATCH v3 2/4] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Christian MarangiQuoted 37 lines · Christian Marangi
Quoted 36 lines · Conor Dooley
Quoted 34 lines · Christian Marangi
Quoted 17 lines · Conor Dooley
Quoted 14 lines · Christian Marangi
Add documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the relevant USB port.
The first USB port on the SoC can be both used for USB 3.0 operation or Ethernet (HSGMII).
The second USB port on the SoC can be both used for USB 3.0 operation or for an additional PCIe line.Signed-off-by Christian Marangi <[email protected]>---
Quoted 6 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 49
Quoted 3 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +3
-0+ '#phy-cells': + description: Describe if the referred PHY is the USB 2.0 PHY or USB 3.0 PHY. + const: 1Which is which here?
Mhh I think I didn't understand here. #phy-cells describe the parameters to be used for phys property in a different node.
The current usage would be
<
&usb0_phyPHY_TYPE_USB2> for USB 2.0
or <&usb0_phyPHY_TYPE_USB3> for USB 3.0This node expose 2 PHY that can be referenced by the single parameters.
Quoted 7 lines
Quoted 2 lines
Ah, I didn't know that the 1 cell variant here was type not index.
Yes in the driver I'm maching for type not index as it's very confusing. Any hint on better describe it on the schema? Maybe I can reword with
"Describe if the referred PHY is
PHY_TYPE_USB2orPHY_TYPE_USB3"
"The cell contains the mode, PHY_TYPE_USB2 or PHY_TYPE_USB3, as defined in dt-bindings/phy/phy.h."
Rob
PATCH v3 3/4 phy: move Airoha PCIe PHY driver to dedicated directory
In reply to Christian MarangiTo keep the generic PHY directory tidy, move the PCIe PHY driver to a dedicated directory.
This is also in preparation for support of the Airoha USB PHY driver.
--- MAINTAINERS | 4 +- drivers/phy/Kconfig | 11 +- drivers/phy/Makefile | 5 +- drivers/phy/airoha/Kconfig | 13 + drivers/phy/airoha/Makefile | 3 + drivers/phy/airoha/phy-airoha-pcie-regs.h | 494 ++++++++ drivers/phy/airoha/phy-airoha-pcie.c | 1290 +++++++++++++++++++++ 7 files changed, 1806 insertions(+), 14 deletions(-) create mode 100644 drivers/phy/airoha/Kconfig create mode 100644 drivers/phy/airoha/Makefile create mode 100644 drivers/phy/airoha/phy-airoha-pcie-regs.h create mode 100644 drivers/phy/airoha/phy-airoha-pcie.c
MAINTAINERS +2 -2
@@ -751,8 +751,8 @@ M: Lorenzo Bianconi <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained F: Documentation/devicetree/bindings/phy/airoha,en7581-pcie-phy.yaml -F: drivers/phy/phy-airoha-pcie-regs.h -F: drivers/phy/phy-airoha-pcie.c +F: drivers/phy/airoha/phy-airoha-pcie-regs.h +F: drivers/phy/airoha/phy-airoha-pcie.c AIROHA SPI SNFI DRIVER M: Lorenzo Bianconi <[email protected]>
drivers/phy/Kconfig +1 -10
@@ -80,16 +80,6 @@ config PHY_CAN_TRANSCEIVER functional modes using gpios and sets the attribute max link rate, for CAN drivers. -config PHY_AIROHA_PCIE - tristate "Airoha PCIe-PHY Driver" - depends on ARCH_AIROHA || COMPILE_TEST - depends on OF - select GENERIC_PHY - help - Say Y here to add support for Airoha PCIe PHY driver. - This driver create the basic PHY instance and provides initialize - callback for PCIe GEN3 port. - config PHY_NXP_PTN3222 tristate "NXP PTN3222 1-port eUSB2 to USB2 redriver" depends on I2C
@@ -101,6 +91,7 @@ config PHY_NXP_PTN3222 schemes. It supports all three USB 2.0 data rates: Low Speed, Full Speed and High Speed. +source "drivers/phy/airoha/Kconfig" source "drivers/phy/allwinner/Kconfig" source "drivers/phy/amlogic/Kconfig" source "drivers/phy/broadcom/Kconfig"
drivers/phy/Makefile +3 -2
@@ -11,9 +11,10 @@ obj-$(CONFIG_PHY_XGENE) += phy-xgene.o obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o -obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o + obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o -obj-y += allwinner/ \ +obj-y += airoha/ \ + allwinner/ \ amlogic/ \ broadcom/ \ cadence/ \
drivers/phy/airoha/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Phy drivers for Airoha devices +# +config PHY_AIROHA_PCIE + tristate "Airoha PCIe-PHY Driver" + depends on ARCH_AIROHA || COMPILE_TEST + depends on OF + select GENERIC_PHY + help + Say Y here to add support for Airoha PCIe PHY driver. + This driver create the basic PHY instance and provides initialize + callback for PCIe GEN3 port.
drivers/phy/airoha/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o
drivers/phy/airoha/phy-airoha-pcie-regs.h new file +494 -0
494 lines not on this page · raw message
drivers/phy/airoha/phy-airoha-pcie.c new file +1290 -0
1,290 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v3 4/4 phy: airoha: Add support for Airoha AN7581 USB PHY
In reply to Christian MarangiAdd support for Airoha AN7581 USB PHY driver. AN7581 supports up to 2 USB port with USB 2.0 mode always supported and USB 3.0 mode available only if the Serdes port is correctly configured for USB 3.0.
The first USB port on the SoC can be both used for USB 3.0 operation or Ethernet.
The second USB port on the SoC can be both used for USB 3.0 operation or PCIe.
Both port operation toggled by the SCU SSR register and configured by the USB PHY driver.
If the USB 3.0 mode is not configured, the modes needs to be also disabled in the xHCI node or the driver will report unsable clock and fail probe.
For USB 2.0 Slew Rate calibration, airoha,usb2-monitor-clk-sel is mandatory and is used to select the monitor clock for calibration.
Normally it's 1 for USB port 1 and 2 for USB port 2.
--- MAINTAINERS | 1 + drivers/phy/airoha/Kconfig | 10 + drivers/phy/airoha/Makefile | 1 + drivers/phy/airoha/phy-airoha-usb.c | 615 ++++++++++++++++++++++++++++ scripts/tracepoint-update | Bin 0 -> 22952 bytes 5 files changed, 627 insertions(+) create mode 100644 drivers/phy/airoha/phy-airoha-usb.c create mode 100755 scripts/tracepoint-update
MAINTAINERS +1 -0
@@ -768,6 +768,7 @@ M: Christian Marangi <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml +F: drivers/phy/airoha/phy-airoha-usb.c F: include/dt-bindings/phy/airoha,an7581-usb-phy.h AIRSPY MEDIA DRIVER
drivers/phy/airoha/Kconfig +10 -0
@@ -11,3 +11,13 @@ config PHY_AIROHA_PCIE Say Y here to add support for Airoha PCIe PHY driver. This driver create the basic PHY instance and provides initialize callback for PCIe GEN3 port. + +config PHY_AIROHA_USB + tristate "Airoha USB PHY Driver" + depends on ARCH_AIROHA || COMPILE_TEST + depends on OF + select GENERIC_PHY + help + Say 'Y' here to add support for Airoha USB PHY driver. + This driver create the basic PHY instance and provides initialize + callback for USB port.
drivers/phy/airoha/Makefile +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o +obj-$(CONFIG_PHY_AIROHA_USB) += phy-airoha-usb.o
drivers/phy/airoha/phy-airoha-usb.c new file +615 -0
615 lines not on this page · raw message
scripts/tracepoint-update new file binary +0 -0
Signature · 1 line
2.51.0