airoha: an7581: USB support
Subsystems (2)
v4 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 v4:
- Rename PCIe and USB PHY to AN7581
- Drop airoha,scu (handled directly in driver)
- Drop dt-bindings for monitor clock in favor of raw values
- Better describe the usage of airoha,usb3-serdes
- Simplify values of dt-bindings SSR SERDES
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 and rename Airoha PCIe PHY driver to dedicated directory
phy: airoha: Add support for Airoha AN7581 USB PHY
.../bindings/phy/airoha,an7581-usb-phy.yaml | 71 + MAINTAINERS | 11 +- drivers/phy/Kconfig | 11 +- drivers/phy/Makefile | 5 +- drivers/phy/airoha/Kconfig | 23 + drivers/phy/airoha/Makefile | 4 + drivers/phy/airoha/phy-an7581-pcie-regs.h | 494 +++++++ drivers/phy/airoha/phy-an7581-pcie.c | 1290 +++++++++++++++++ drivers/phy/airoha/phy-an7581-usb.c | 614 ++++++++ include/dt-bindings/soc/airoha,scu-ssr.h | 11 + 10 files changed, 2520 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-an7581-pcie-regs.h create mode 100644 drivers/phy/airoha/phy-an7581-pcie.c create mode 100644 drivers/phy/airoha/phy-an7581-usb.c create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h
Signature · 1 line
2.51.0
PATCH v4 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 0 +#define AIROHA_SCU_SERDES_USB2 1 + +#endif /* __DT_BINDINGS_AIROHA_SCU_SSR_H */
Signature · 1 line
2.51.0
Re: [PATCH v4 1/4] dt-bindings: soc: Add bindings for Airoha SCU Serdes lines
Quoted 23 lines · Christian Marangi
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.
Signed-off-by Christian Marangi <[email protected]>--- include/dt-bindings/soc/airoha,scu-ssr.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.hinclude/dt-bindings/soc/airoha,scu-ssr.h new file +0
-0
include/dt-bindings/soc/airoha,scu-ssr.h line 9
Quoted 9 lines
include/dt-bindings/soc/airoha,scu-ssr.h new file +9
-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 0 +#define AIROHA_SCU_SERDES_USB2 1
I'm going to assume that 01 01 is correct here.
Re: [PATCH v4 1/4] dt-bindings: soc: Add bindings for Airoha SCU Serdes lines
Quoted 35 lines · Conor Dooley
Quoted 23 lines · Christian Marangi
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.
Signed-off-by Christian Marangi <[email protected]>--- include/dt-bindings/soc/airoha,scu-ssr.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.hinclude/dt-bindings/soc/airoha,scu-ssr.h new file +0
-0include/dt-bindings/soc/airoha,scu-ssr.h line 9
Quoted 9 lines
include/dt-bindings/soc/airoha,scu-ssr.h new file +9
-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 0 +#define AIROHA_SCU_SERDES_USB2 1I'm going to assume that 01 01 is correct here.
Quoted 1 line
Acked-by Conor Dooley <[email protected]>
Yes the value are then translated in the driver internally.
Signature · 1 line
Ansuel
PATCH v4 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.
To correctly calibrate, the USB 2.0 port require correct value in "airoha,usb2-monitor-clk-sel" property. Both the 2 USB 2.0 port permit selecting one of the 4 monitor clock for calibration (internal clock not exposed to the system) but each port have only one of the 4 actually connected in HW hence the correct value needs to be specified in DT based on board and the physical port. Normally it's monitor clock 1 for USB1 and monitor clock 2 for USB2.
To correctly setup the Serdes mode attached to the USB 3.0 mode, the "airoha,usb3-serdes" property is required. This can be either AIROHA_SCU_SERDES_USB1 or AIROHA_SCU_SERDES_USB2 and is used to identify what modes support the PHY and what register to use to setup the requested mode.
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.
--- .../bindings/phy/airoha,an7581-usb-phy.yaml | 71 +++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 77 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +71 -0
@@ -0,0 +1,71 @@ +# 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 AIROHA_SCU_SERDES_USB1 or AIROHA_SCU_SERDES_USB2 as + defined in dt-bindings/soc/airoha,scu-ssr.h + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + + '#phy-cells': + description: The cell contains the mode, PHY_TYPE_USB2 or PHY_TYPE_USB3, + as defined in dt-bindings/phy/phy.h. + const: 1 + +required: + - compatible + - reg + - airoha,usb2-monitor-clk-sel + - airoha,usb3-serdes + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/soc/airoha,scu-ssr.h> + + phy@1fac0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x1fac0000 0x10000>; + + airoha,usb2-monitor-clk-sel = <1>; + airoha,usb3-serdes = <AIROHA_SCU_SERDES_USB1>; + + #phy-cells = <1>; + }; +
MAINTAINERS +6 -0
@@ -763,6 +763,12 @@ 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 + AIRSPY MEDIA DRIVER L: [email protected] S: Orphan
Signature · 1 line
2.51.0
Re: [PATCH v4 2/4] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
Quoted 21 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.
To correctly calibrate, the USB 2.0 port require correct value in "airoha,usb2-monitor-clk-sel" property. Both the 2 USB 2.0 port permit selecting one of the 4 monitor clock for calibration (internal clock not exposed to the system) but each port have only one of the 4 actually connected in HW hence the correct value needs to be specified in DT based on board and the physical port. Normally it's monitor clock 1 for USB1 and monitor clock 2 for USB2.
To correctly setup the Serdes mode attached to the USB 3.0 mode, the "airoha,usb3-serdes" property is required. This can be either
AIROHA_SCU_SERDES_USB1orAIROHA_SCU_SERDES_USB2and is used to identify what modes support the PHY and what register to use to setup the requested mode.
Quoted 6 lines
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]>
Thanks for the updates.
PATCH v4 3/4 phy: move and rename Airoha PCIe PHY driver to dedicated directory
In reply to Christian MarangiTo keep the generic PHY directory tidy, move the PCIe PHY driver for Airoha AN7581 SoC to a dedicated directory.
Also rename the driver and add the relevant SoC name to the .c and .h file in preparation for support of PCIe and USB PHY driver for Airoha AN7583 SoC that use a completely different implementation and calibration for PHYs and will have their own dedicated drivers.
The rename permits to better identify the specific usage of the driver in the future once the airoha PHY directory will have multiple driver for multiple SoC.
The config is changed from PHY_AIROHA_PCIE to PHY_AIROHA_AN7581_PCIE.
--- MAINTAINERS | 4 +- drivers/phy/Kconfig | 11 +- drivers/phy/Makefile | 5 +- drivers/phy/airoha/Kconfig | 13 + drivers/phy/airoha/Makefile | 3 + drivers/phy/airoha/phy-an7581-pcie-regs.h | 494 ++++++++ drivers/phy/airoha/phy-an7581-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-an7581-pcie-regs.h create mode 100644 drivers/phy/airoha/phy-an7581-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-an7581-pcie-regs.h +F: drivers/phy/airoha/phy-an7581-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_AN7581_PCIE + tristate "Airoha AN7581 PCIe-PHY Driver" + depends on ARCH_AIROHA || COMPILE_TEST + depends on OF + select GENERIC_PHY + help + Say Y here to add support for Airoha AN7581 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_AN7581_PCIE) += phy-an7581-pcie.o
drivers/phy/airoha/phy-an7581-pcie-regs.h new file +494 -0
494 lines not on this page · raw message
drivers/phy/airoha/phy-an7581-pcie.c new file +1290 -0
1,290 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v4 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-an7581-usb.c | 614 ++++++++++++++++++++++++++++ 4 files changed, 626 insertions(+) create mode 100644 drivers/phy/airoha/phy-an7581-usb.c
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-an7581-usb.c AIRSPY MEDIA DRIVER L: [email protected]
drivers/phy/airoha/Kconfig +10 -0
@@ -11,3 +11,13 @@ config PHY_AIROHA_AN7581_PCIE Say Y here to add support for Airoha AN7581 PCIe PHY driver. This driver create the basic PHY instance and provides initialize callback for PCIe GEN3 port. + +config PHY_AIROHA_AN7581_USB + tristate "Airoha AN7581 USB PHY Driver" + depends on ARCH_AIROHA || COMPILE_TEST + depends on OF + select GENERIC_PHY + help + Say 'Y' here to add support for Airoha AN7581 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_AN7581_PCIE) += phy-an7581-pcie.o +obj-$(CONFIG_PHY_AIROHA_AN7581_USB) += phy-an7581-usb.o
drivers/phy/airoha/phy-an7581-usb.c new file +614 -0
614 lines not on this page · raw message
Signature · 1 line
2.51.0