From: sashiko-bot@kernel.org
To: "Navid Ghahremani" <ghahramani.navid@gmail.com>
Cc: linux-phy@lists.infradead.org, vkoul@kernel.org,
neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v2 11/24] phy: zte: Add ZTE ZX279128S PCIe PHY driver
Date: Thu, 15 Oct 2026 07:24:40 +0000 [thread overview]
Message-ID: <sashiko-outbox-172405@kernel.org> (raw)
In-Reply-To: <20261014072109.1759502-12-ghahramani.navid@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] phy: missing error path cleanup in zx_pcie_phy_init()
- [Low] phy: incomplete hardware teardown on error in zx_pcie_phy_exit()
- [Low] kconfig: PHY_ZX279128S_PCIE selects MFD_SYSCON without HAS_IOMEM
--
commit 9afe9a48cb2bc29d0bfd7f5b0a437a5d1621c1b4
Author: Navid Ghahremani <ghahramani.navid@gmail.com>
phy: zte: Add ZTE ZX279128S PCIe PHY driver
Add a generic PHY driver for the PCIe SerDes PHY inside the Top CRM
block of the ZTE ZX279128S SoC. This driver encapsulates PLL power
and analog SerDes calibration for the two PCIe ports.
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 19f3b7d12b7d4..3518d384be854 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
[ ... ]
> @@ -91,6 +91,18 @@ config PHY_ECONET_PCIE
> callback for PCIe GEN1 and GEN2 ports. This PHY is found on
> EcoNet SoCs including EN751221 and EN7528.
>
> +config PHY_ZX279128S_PCIE
> + tristate "ZTE ZX279128S PCIe PHY driver"
> + depends on ARCH_ZTE || COMPILE_TEST
> + depends on OF
> + select GENERIC_PHY
> + select MFD_SYSCON
[Severity: Low]
Does selecting MFD_SYSCON here without a HAS_IOMEM dependency cause an unmet
direct dependency warning? Because this driver supports COMPILE_TEST, it could
be built on architectures without HAS_IOMEM (like UML), where MFD_SYSCON
cannot be naturally enabled.
> + help
> + Enable support for the PCIe SerDes PHY found inside the Top CRM
> + of ZTE ZX279128S SoCs. This driver configures PLL power and analog
[ ... ]
> diff --git a/drivers/phy/phy-zx279128s-pcie.c b/drivers/phy/phy-zx279128s-pcie.c
> new file mode 100644
> index 0000000000000..33bf0eaac8f74
> --- /dev/null
> +++ b/drivers/phy/phy-zx279128s-pcie.c
[ ... ]
> +static int zx_pcie_phy_init(struct phy *phy)
> +{
> + struct zx_pcie_phy *zphy = phy_get_drvdata(phy);
> + const struct zx_pcie_phy_port *port = zphy->port;
> + int i, ret;
> +
> + for (i = 0; i < ARRAY_SIZE(port->phy_on); i++) {
> + ret = regmap_write_bits(zphy->regmap, CRM1_PHY_CTRL,
> + port->phy_on[i], port->phy_on[i]);
> + if (ret)
> + return ret;
[Severity: Medium]
Can this leave the PHY blocks in an inconsistent state? If regmap_write_bits()
fails on a later iteration (for example, when i > 0), this loop returns
immediately and leaves the hardware resources from previous iterations powered
on.
Since the PHY framework's phy_init() does not invoke the phy_exit() callback
if initialization fails, the driver likely needs to manually unwind the power
bits before returning the error.
> + fsleep(50);
> +
> + if (i == 0 && port->has_cal) {
> + ret = regmap_write(zphy->regmap, CRM1_PHY1_CAL1, 0x00202d5a);
> + if (ret)
> + return ret;
[Severity: Medium]
Similarly, if either of these calibration writes fail, we return without
clearing the CRM1_PHY_CTRL bits that were already successfully set. Should
there be an error path here that unwinds the state?
> + ret = regmap_write(zphy->regmap, CRM1_PHY1_CAL0, 0x0046c24a);
> + if (ret)
> + return ret;
> + }
> + }
[ ... ]
> +static int zx_pcie_phy_exit(struct phy *phy)
> +{
> + struct zx_pcie_phy *zphy = phy_get_drvdata(phy);
> + const struct zx_pcie_phy_port *port = zphy->port;
> + int i, ret;
> +
> + for (i = ARRAY_SIZE(port->phy_on) - 1; i >= 0; i--) {
> + ret = regmap_write_bits(zphy->regmap, CRM1_PHY_CTRL,
> + port->phy_on[i], 0);
> + if (ret)
> + return ret;
[Severity: Low]
Does this early return leave the hardware partially active on teardown? If
regmap_write_bits() fails while clearing one of the bits, we abort the loop
early.
It might be safer to record the error but continue unwinding the remaining
bits to ensure the fullest possible teardown.
> + }
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014072109.1759502-1-ghahramani.navid@gmail.com?part=11
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-10-15 7:24 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 7:20 [PATCH v2 00/24] ARM: zte: Add support for Sanechips ZX279128S and ZTE ZXHN H3600 Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 01/24] MAINTAINERS: Consolidate ARM/ZTE ZX SOC SUPPORT with Stefan Doesinger Navid Ghahremani
2026-10-14 20:11 ` Stefan Dösinger
2026-10-14 7:20 ` [PATCH v2 02/24] dt-bindings: arm: Add ZTE ZX279128S platform descriptions Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 03/24] ARM: zte: Add ZX279128S platform and CPU hotplug support Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 04/24] dt-bindings: clock: Add ZTE ZX279128S CRM clock bindings Navid Ghahremani
2026-10-14 21:48 ` Stefan Dösinger
2026-10-15 7:24 ` sashiko-bot
2026-10-15 9:25 ` Krzysztof Kozlowski
2026-10-15 9:26 ` Krzysztof Kozlowski
2026-10-14 7:20 ` [PATCH v2 05/24] dt-bindings: reset: Add ZTE ZX279128S reset controller bindings Navid Ghahremani
2026-10-15 7:24 ` sashiko-bot
2026-10-15 9:27 ` Krzysztof Kozlowski
2026-10-14 7:20 ` [PATCH v2 06/24] clk: zte: Add ZX279128S CRM clock and reset driver Navid Ghahremani
2026-10-14 13:21 ` Philipp Zabel
2026-10-14 19:39 ` Stefan Dösinger
2026-10-15 7:24 ` sashiko-bot
2026-10-14 7:20 ` [PATCH v2 07/24] dt-bindings: gpio: Add ZTE ZX279128S GPIO controller Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 08/24] gpio: Add ZTE ZX279128S GPIO driver Navid Ghahremani
2026-10-14 21:11 ` Stefan Dösinger
2026-10-15 12:25 ` Bartosz Golaszewski
2026-10-14 7:20 ` [PATCH v2 09/24] dt-bindings: pinctrl: pinctrl-single: Add ZTE ZX279128S pin mux Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 10/24] dt-bindings: phy: Add ZTE ZX279128S PCIe PHY binding Navid Ghahremani
2026-10-14 7:20 ` Navid Ghahremani
2026-10-15 7:24 ` sashiko-bot
2026-10-15 7:24 ` sashiko-bot
2026-10-15 9:29 ` Krzysztof Kozlowski
2026-10-15 9:29 ` Krzysztof Kozlowski
2026-10-14 7:20 ` [PATCH v2 11/24] phy: zte: Add ZTE ZX279128S PCIe PHY driver Navid Ghahremani
2026-10-14 7:20 ` Navid Ghahremani
2026-10-15 7:24 ` sashiko-bot [this message]
2026-10-14 7:20 ` [PATCH v2 12/24] dt-bindings: PCI: Add ZTE ZX279128S host controller Navid Ghahremani
2026-10-15 7:24 ` sashiko-bot
2026-10-14 7:20 ` [PATCH v2 13/24] PCI: dwc: Add ZTE ZX279128S host controller driver Navid Ghahremani
2026-10-14 13:19 ` Bjorn Helgaas
2026-10-14 21:06 ` Stefan Dösinger
2026-10-15 7:24 ` sashiko-bot
2026-10-14 7:20 ` [PATCH v2 14/24] dt-bindings: net: Add ZTE ZX279128S MDIO controller Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 15/24] net: mdio: " Navid Ghahremani
2026-10-14 12:13 ` Andrew Lunn
2026-10-14 7:20 ` [PATCH v2 16/24] net: phy: Add Sanechips ZX5201 PHY support Navid Ghahremani
2026-10-14 12:37 ` Andrew Lunn
2026-10-14 7:20 ` [PATCH v2 17/24] dt-bindings: net: Add ZTE ZX279128S Ethernet switch Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 18/24] net: ethernet: zte: Add ZX279128S Ethernet switch driver Navid Ghahremani
2026-10-14 7:20 ` [PATCH v2 19/24] dt-bindings: spi: Add ZTE ZX family SPI flash controller binding Navid Ghahremani
2026-10-14 20:33 ` Stefan Dösinger
2026-10-15 9:35 ` Krzysztof Kozlowski
2026-10-15 9:36 ` Krzysztof Kozlowski
2026-10-14 7:21 ` [PATCH v2 20/24] spi: zx: Add ZTE ZX family SPI flash controller driver Navid Ghahremani
2026-10-14 19:28 ` Stefan Dösinger
2026-10-15 9:34 ` Krzysztof Kozlowski
2026-10-15 14:29 ` kernel test robot
2026-10-14 7:21 ` [PATCH v2 21/24] dt-bindings: usb: Add ZTE ZX279128S DWC3 controller Navid Ghahremani
2026-10-15 7:24 ` sashiko-bot
2026-10-14 7:21 ` [PATCH v2 22/24] usb: dwc3: generic-plat: Add ZTE ZX279128S Navid Ghahremani
2026-10-15 7:24 ` sashiko-bot
2026-10-14 7:21 ` [PATCH v2 23/24] ARM: dts: zte: Add ZX279128S SoC description Navid Ghahremani
2026-10-14 7:21 ` [PATCH v2 24/24] ARM: dts: zte: Add ZTE ZXHN H3600 board Navid Ghahremani
2026-10-14 12:52 ` Andrew Lunn
2026-10-15 7:24 ` sashiko-bot
2026-10-14 20:00 ` [PATCH v2 00/24] ARM: zte: Add support for Sanechips ZX279128S and ZTE ZXHN H3600 Stefan Dösinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-172405@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ghahramani.navid@gmail.com \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.