airoha: an7581: USB support
v10 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 v10:
- Rebase on top of linux-next
- Add review tag for DT patch
Changes v9:
- Add spinlock init
- Add ack tag
- Add review tag
- Add additional comments for phys on USB 3.0
- Add extra logic to make phys optional for USB 3.0
Changes v8:
- Squash header to clk Documentation patch
- Address comments from AI Bot
Changes v7:
- Rework to double PHY implementation
(suggested by Rob)
Now the clk driver expose a PHY for Serdes port
USB PHY driver selects it
- Rebase on top of linux-next
Changes v6:
- Fix kernel test robot (sparse warning)
Changes v5:
- Add Ack and Review tag from Connor
- Implement Ethernet support in the USB driver (testing support for this Serdes on a special reference board)
- Use an7581 prefix for USB PHY driver
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 (5):
dt-bindings: clock: airoha: Add PHY binding for Serdes port
dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
clk: en7523: Add support for selecting the Serdes port in SCU
phy: move and rename Airoha PCIe PHY driver to dedicated directory
phy: airoha: Add support for Airoha AN7581 USB PHY
.../bindings/clock/airoha,en7523-scu.yaml | 9 +
.../bindings/phy/airoha,an7581-usb-phy.yaml | 62 ++
MAINTAINERS | 11 +-
drivers/clk/Kconfig | 1 +
drivers/clk/clk-en7523.c | 218 ++++++-
drivers/phy/Kconfig | 11 +-
drivers/phy/Makefile | 4 +-
drivers/phy/airoha/Kconfig | 24 +
drivers/phy/airoha/Makefile | 4 +
.../phy-an7581-pcie-regs.h} | 2 +-
.../phy-an7581-pcie.c} | 6 +-
drivers/phy/airoha/phy-an7581-usb.c | 559 ++++++++++++++++++
include/dt-bindings/soc/airoha,scu-ssr.h | 11 +
13 files changed, 901 insertions(+), 21 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
rename drivers/phy/{phy-airoha-pcie-regs.h => airoha/phy-an7581-pcie-regs.h} (99%)
rename drivers/phy/{phy-airoha-pcie.c => airoha/phy-an7581-pcie.c} (99%)
create mode 100644 drivers/phy/airoha/phy-an7581-usb.c
create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.hSignature · 1 line
2.53.0
PATCH v10 1/5 dt-bindings: clock: airoha: Add PHY binding for Serdes port
Add PHY cell property for Serdes port selection. Currently supported only for Airoha AN7581 SoC, that support up to 4 Serdes port.
The Serdes port can support both PCIe, USB3 or Ethernet mode.
- PCIe1 Serdes can support PCIe or Ethernet mode.
- PCIe2 Serdes can support PCIe or Ethernet mode.
- USB1 Serdes can support USB3 or HSGMII mode.
- USB2 Serdes can support USB3 or PCIe mode.
Add bindings to permit correct reference of the Serdes ports in DT. Values are just symbolic and enumerates the Serdes port with a specific number for precise reference.
The available Serdes port can be selected following the dt-binding header in [2].
[2] <include/dt-bindings/soc/airoha,scu-ssr.h>
--- .../devicetree/bindings/clock/airoha,en7523-scu.yaml | 9 +++++++++ include/dt-bindings/soc/airoha,scu-ssr.h | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +9 -0
@@ -23,6 +23,7 @@ description: | All these identifiers can be found in: [1]: <include/dt-bindings/clock/en7523-clk.h>. + [2]: <include/dt-bindings/soc/airoha,scu-ssr.h>. The clocks are provided inside a system controller node.
@@ -50,6 +51,12 @@ properties: description: ID of the controller reset line const: 1 + '#phy-cells': + description: + The first cell indicates the serdes phy number, see [2] for the + available serdes port. + const: 1 + required: - compatible - reg
@@ -65,6 +72,8 @@ allOf: reg: minItems: 2 + '#phy-cells': false + - if: properties: compatible:
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.53.0
PATCH v10 2/5 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, a phys property is required with the phandle pointing to the correct Serdes port provided by the SCU node. Providing the phys property is optional if USB 3.0 is not used.
--- .../bindings/phy/airoha,an7581-usb-phy.yaml | 62 +++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +62 -0
@@ -0,0 +1,62 @@ +# 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. + +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] + + phys: + items: + - description: phandle to Serdes PHY. Optional if USB 3.0 is not used. + + '#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 + - '#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>; + phys = <&scu AIROHA_SCU_SERDES_USB1>; + + #phy-cells = <1>; + }; +
MAINTAINERS +6 -0
@@ -777,6 +777,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.53.0
PATCH v10 3/5 clk: en7523: Add support for selecting the Serdes port in SCU
In reply to Christian MarangiIn the SCU register for clock and reset, there are also some register to select the Serdes port mode. The Airoha AN7581 SoC have 4 different Serdes that can switch between PCIe, USB or Ethernet mode.
Add a simple PHY provider that expose the .set_mode OP to toggle the requested mode for the Serdes port.
--- drivers/clk/Kconfig | 1 + drivers/clk/clk-en7523.c | 218 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 216 insertions(+), 3 deletions(-)
drivers/clk/Kconfig +1 -0
@@ -221,6 +221,7 @@ config COMMON_CLK_EN7523 bool "Clock driver for Airoha/EcoNet SoC system clocks" depends on OF depends on ARCH_AIROHA || ECONET || COMPILE_TEST + select GENERIC_PHY default ARCH_AIROHA help This driver provides the fixed clocks and gates present on Airoha
drivers/clk/clk-en7523.c +215 -3
293 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v10 4/5 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 | 4 ++--
drivers/phy/airoha/Kconfig | 13 +++++++++++++
drivers/phy/airoha/Makefile | 3 +++
.../phy-an7581-pcie-regs.h} | 2 +-
.../{phy-airoha-pcie.c => airoha/phy-an7581-pcie.c} | 6 +++---
7 files changed, 25 insertions(+), 18 deletions(-)
create mode 100644 drivers/phy/airoha/Kconfig
create mode 100644 drivers/phy/airoha/Makefile
rename drivers/phy/{phy-airoha-pcie-regs.h => airoha/phy-an7581-pcie-regs.h} (99%)
rename drivers/phy/{phy-airoha-pcie.c => airoha/phy-an7581-pcie.c} (99%)MAINTAINERS +2 -2
@@ -765,8 +765,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
@@ -46,16 +46,6 @@ config GENERIC_PHY_MIPI_DPHY Provides a number of helpers a core functions for MIPI D-PHY drivers to us. -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_CAN_TRANSCEIVER tristate "CAN transceiver PHY" select GENERIC_PHY
@@ -168,6 +158,7 @@ config PHY_XGENE help This option enables support for APM X-Gene SoC multi-purpose PHY. +source "drivers/phy/airoha/Kconfig" source "drivers/phy/allwinner/Kconfig" source "drivers/phy/amlogic/Kconfig" source "drivers/phy/apple/Kconfig"
drivers/phy/Makefile +2 -2
@@ -7,7 +7,6 @@ obj-$(CONFIG_PHY_COMMON_PROPS) += phy-common-props.o obj-$(CONFIG_PHY_COMMON_PROPS_TEST) += phy-common-props-test.o obj-$(CONFIG_GENERIC_PHY) += phy-core.o obj-$(CONFIG_GENERIC_PHY_MIPI_DPHY) += phy-core-mipi-dphy.o -obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o obj-$(CONFIG_PHY_CAN_TRANSCEIVER) += phy-can-transceiver.o obj-$(CONFIG_PHY_ECONET_PCIE) += phy-econet-pcie.o obj-$(CONFIG_PHY_EYEQ5_ETH) += phy-eyeq5-eth.o
@@ -20,7 +19,8 @@ obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o obj-$(CONFIG_PHY_SNPS_EUSB2) += phy-snps-eusb2.o obj-$(CONFIG_PHY_XGENE) += phy-xgene.o -obj-$(CONFIG_GENERIC_PHY) += allwinner/ \ +obj-$(CONFIG_GENERIC_PHY) += airoha/ \ + allwinner/ \ amlogic/ \ apple/ \ axiado/ \
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 renamed from drivers/phy/phy-airoha-pcie-regs.h +1 -1
@@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2024 AIROHA Inc * Author: Lorenzo Bianconi <[email protected]>
drivers/phy/airoha/phy-an7581-pcie.c renamed from drivers/phy/phy-airoha-pcie.c +3 -3
@@ -13,7 +13,7 @@#include <linux/platform_device.h> #include <linux/slab.h> -#include "phy-airoha-pcie-regs.h" +#include "phy-an7581-pcie-regs.h" #define LEQ_LEN_CTRL_MAX_VAL 7#define FREQ_LOCK_MAX_ATTEMPT 10
@@ -1279,12 +1279,12 @@ MODULE_DEVICE_TABLE(of, airoha_pcie_phy_of_match);static struct platform_driver airoha_pcie_phy_driver = { .probe = airoha_pcie_phy_probe, .driver = { - .name ="airoha-pcie-phy" , + .name ="airoha-an7581-pcie-phy" , .of_match_table = airoha_pcie_phy_of_match, }, };module_platform_driver (airoha_pcie_phy_driver); -MODULE_DESCRIPTION ("Airoha PCIe PHY driver" ); +MODULE_DESCRIPTION ("Airoha AN7581 PCIe PHY driver" );MODULE_AUTHOR ("Lorenzo Bianconi <[email protected]>" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.53.0
PATCH v10 5/5 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.
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 | 11 + drivers/phy/airoha/Makefile | 1 + drivers/phy/airoha/phy-an7581-usb.c | 559 ++++++++++++++++++++++++++++ 4 files changed, 572 insertions(+) create mode 100644 drivers/phy/airoha/phy-an7581-usb.c
MAINTAINERS +1 -0
@@ -782,6 +782,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 +11 -0
@@ -11,3 +11,14 @@ 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 + select REGMAP_MMIO + 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 +559 -0
559 lines not on this page · raw message
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v10 1/5] dt-bindings: clock: airoha: Add PHY binding for Serdes port
In reply to Christian MarangiThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The `#phy-cells` property is implicitly allowed for the `econet,en751221-scu` compatible…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The #phy-cells property is implicitly allowed for the econet,en751221-scu compatible, contradicting the commit message which states it is exclusive to the Airoha AN7581 SoC.
- [Medium] The airoha,en7581-scu variant gains a new PHY provider capability, but #phy-cells is not added to its required properties, and the schema example is not updated. --
commit 6d3a613072b0007e76d5846629212f75c8dfc300
Author: Christian Marangi <[email protected]>
dt-bindings: clock: airoha: Add PHY binding for Serdes port
This commit adds the #phy-cells property for Serdes port selection, specifying that it is currently supported only for the Airoha AN7581 SoC.
Quoted 4 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +0
-0
[ ... ]
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml allOf: · line 79
Quoted 9 lines
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +2
-0@@ -65,6 +72,8 @@ allOf: reg: minItems: 2 + '#phy-cells': false + - if: properties: compatible:
[Severity: Medium]
The commit message states that the #phy-cells property is currently supported only for the Airoha AN7581 SoC. However, looking at the allOf conditional block:
- if:
properties:
compatible:
enum:
- airoha,en7581-scu
- econet,en751221-scu
Since econet,en751221-scu shares this block and does not explicitly have '#phy-cells': false like the previous block, does this implicitly allow the property for it and contradict the commit message?
[Severity: Medium]
Additionally, since the airoha,en7581-scu variant gains a new PHY provider capability, should #phy-cells be added to its required properties list?
The example for airoha,en7581-scu in the same file is also missing the property:
scuclk: clock-controller@1fb00000 {
compatible = "airoha,en7581-scu";
reg = <0x0 0x1fb00000 0x0 0x970>;
#clock-cells = <1>;
#reset-cells = <1>;
};Would it be better to update the schema to mandate the property and update the example to include #phy-cells = <1> so incomplete device tree nodes do not silently pass schema validation?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewRe: [PATCH v10 2/5] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Christian MarangiThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Encoding fixed internal SoC routing in the device tree via the `airoha,usb2-monitor-clk-sel`…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Encoding fixed internal SoC routing in the device tree via the airoha,usb2-monitor-clk-sel property. --
commit 82d75d6a8695c967604982f45c3db95efe45a784
Author: Christian Marangi <[email protected]>
dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
This commit adds device tree binding documentation for the Airoha AN7581 USB PHY. It details properties for configuring the always-supported USB 2.0 mode and the optional USB 3.0 mode, including slew rate calibration and Serdes configuration.
Quoted 6 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +0
-0@@ -0,0 +1,62 @@
[ ... ]
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 30
Quoted 8 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +8
-0+ 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]
[Severity: Low]
Since the commit message mentions that each port has only one of the 4 monitor clocks actually connected in HW, does this property encode a fixed internal SoC routing rather than a board-specific configuration?
Could the driver deduce the correct clock selection internally (for example, from the port's register address) instead of requiring a DT property for a fixed SoC hardware characteristic?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
[email protected]
AI reviewRe: [PATCH v10 4/5] phy: move and rename Airoha PCIe PHY driver to dedicated directory
In reply to Christian MarangiThank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [Low] The driver Kconfig symbol, file names, and platform driver name are incorrectly renamed using the…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Low] The driver Kconfig symbol, file names, and platform driver name are incorrectly renamed using the 'AN7581' prefix instead of 'EN7581', creating a mismatch with the hardware name and device tree bindings.
- [Low] The include guard in phy-an7581-pcie-regs.h was not updated after the file was renamed.
- [Low] Incorrect SPDX-License-Identifier comment style for a C header file.
- [Low] The newly added Kconfig and Makefile for the drivers/phy/airoha/ directory are missing from the MAINTAINERS file.
--
commit 6b7c73648fcebc4627d82c8ab33128623756a453
Author: Christian Marangi <[email protected]>
phy: move and rename Airoha PCIe PHY driver to dedicated directory
This commit moves the PCIe PHY driver for the Airoha AN7581 SoC to a dedicated directory to keep the generic PHY directory tidy. It also renames the driver and files to include the specific SoC name in preparation for adding AN7583 support, and updates the Kconfig symbol accordingly.
Quoted 6 lines
To 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
[Severity: Low]
This isn't a bug, but there might be a typo in the commit message. Is the SoC name EN7581 instead of AN7581, given the existing device tree bindings mention en7581?
MAINTAINERS M: Lorenzo Bianconi <[email protected]> · line 769
Quoted 12 lines
MAINTAINERS +2
-2@@ -765,8 +765,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
[Severity: Low]
By explicitly listing only the source files, the newly added Kconfig and Makefile in the drivers/phy/airoha/ directory are left without a maintainer mapping. Would it be better to use a directory wildcard like
F: drivers/phy/airoha/ to include the new build files?
drivers/phy/airoha/Kconfig line 6
Quoted 12 lines
drivers/phy/airoha/Kconfig new file +6
-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"
[Severity: Low]
Does this Kconfig symbol and prompt incorrectly use the AN7581 prefix despite the SoC hardware and device tree binding being named EN7581?
drivers/phy/airoha/phy-an7581-pcie-regs.h line 1
Quoted 10 lines
drivers/phy/airoha/phy-an7581-pcie-regs.h renamed from drivers/phy/phy-airoha-pcie-regs.h +1
-1@@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +// SPDX-License-Identifier: GPL-2.0-only
[Severity: Low]
Does this change to a C++ style line comment violate the kernel's SPDX license identifier rules for C header files, which require the /* ... */ block comment style?
[Severity: Low]
Also, since this file was renamed, does the include guard further down in the file (currently #ifndef _PHY_AIROHA_PCIE_H) need to be updated to match the new filename?
Quoted 7 lines
drivers/phy/airoha/phy-an7581-pcie.c renamed from drivers/phy/phy-airoha-pcie.c +0
-0
[ ... ]
drivers/phy/airoha/phy-an7581-pcie.c MODULE_DEVICE_TABLE(of, airoha_pcie_phy_of_match); · line 1282
Quoted 6 lines
drivers/phy/airoha/phy-an7581-pcie.c renamed from drivers/phy/phy-airoha-pcie.c +1
-1@@ -1279,12 +1279,12 @@ MODULE_DEVICE_TABLE(of, airoha_pcie_phy_of_match);static struct platform_driver airoha_pcie_phy_driver = { .probe = airoha_pcie_phy_probe, .driver = { - .name ="airoha-pcie-phy" , + .name ="airoha-an7581-pcie-phy" ,
[Severity: Low]
Does this platform driver name incorrectly use the misspelled an7581 prefix instead of en7581?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
[email protected]
AI reviewRe: [PATCH v10 5/5] phy: airoha: Add support for Airoha AN7581 USB PHY
In reply to Christian MarangiThank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Incorrect usage of `regmap_set_bits` with `FIELD_PREP` corrupts multi-bit register field…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Incorrect usage of regmap_set_bits with FIELD_PREP corrupts multi-bit register field
- [Medium] Missing PHY Lifecycle Management for SerDes PHY
- [Medium] Computed slew rate calibration value is not clamped, risking silent wraparound --
Note: The format of this review has been altered to use free-form summaries instead of inline diff quoting due to strict recitation restrictions.
commit 4d1e2d05354e7c1aad9463afa3c9c7ffd853f726
Author: Christian Marangi <[email protected]>
phy: airoha: Add support for Airoha AN7581 USB PHY
This commit adds support for the Airoha AN7581 USB PHY driver, which supports up to two USB ports. USB 2.0 is always supported, while USB 3.0 requires the SerDes port to be configured. It also introduces USB 2.0 slew rate calibration using a mandatory monitor clock.
[Severity: Medium]
In an7581_usb_phy_init() and an7581_usb_phy_power_on(), the driver sets the mode of the SerDes PHY but does not call phy_init(), phy_power_on(), phy_power_off(), or phy_exit() for the priv->serdes_phy. Is it safe to omit these generic PHY lifecycle calls?
Even if the current SerDes PHY driver for this SoC only implements the set_mode callback, omitting these lifecycle management functions might cause failures if the SerDes PHY driver is updated to require hardware initialization, or if this driver is used on a SoC variant where the underlying SerDes PHY requires power management to function.
[Severity: High]
In an7581_usb_phy_u3_init(), regmap_set_bits() is used alongside FIELD_PREP() to write a 16-bit value into the AIROHA_USB_PHY_SSUSB_XTAL_TOP_RESERVE register. Does this unintentionally leave old bits set in the multi-bit field?
Since regmap_set_bits() performs a bitwise OR and does not clear previously set bits like regmap_update_bits() does, any pre-existing overlapping bits from hardware defaults or bootloader initialization will remain set. This could result in a corrupted XTAL/PLL configuration and cause an unstable USB 3.0 clock or probe failures.
[Severity: Medium]
In an7581_usb_phy_u2_slew_rate_calibration(), the dynamically computed srctrl value is passed directly to FIELD_PREP() for the 3-bit AIROHA_USB_PHY_USB20_HSTX_SRCTRL field. Could this silently wrap around if fm_out is unexpectedly small?
If a transient clock issue causes fm_out to drop below expected values, the computed srctrl can exceed the maximum value of 7. Because FIELD_PREP() masks the value, an srctrl of 8 would silently wrap around to 0. This would convert what should be a maximum slew rate calibration into the minimum calibration, risking severe USB 2.0 signal degradation. Should the srctrl value be clamped before insertion?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5