All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: robh@kernel.org, olteanv@gmail.com,
	linux-phy@lists.infradead.org, vkoul@kernel.org,
	devicetree@vger.kernel.org, neil.armstrong@linaro.org,
	conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] phy: airoha: add support for AN7583 Gen3 PCIe PHY driver
Date: Thu, 27 Aug 2026 12:29:30 +0000	[thread overview]
Message-ID: <20260827122931.5157C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827122127.18874-3-ansuelsmth@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing hardware state cleanup on error path in `an7583_pcie_phy_init()`.
--

commit 62d7cb2950076a9ff89670b2868f00bd58e5c43e
Author: Christian Marangi <ansuelsmth@gmail.com>

phy: airoha: add support for AN7583 Gen3 PCIe PHY driver
    
Add support for AN7583 PCIe PHY driver. This is required to make the
Gen3 PCIe port present on the Airoha AN7583 SoC correctly work.

> diff --git a/drivers/phy/airoha/phy-an7583-pcie.c b/drivers/phy/airoha/phy-an7583-pcie.c
> new file mode 100644
> index 0000000000000..61b5f1dd64c07
> --- /dev/null
> +++ b/drivers/phy/airoha/phy-an7583-pcie.c
[ ... ]
> +static int an7583_pcie_phy_init(struct phy *phy)
> +{
> +	struct an7583_pcie_phy *pcie_phy = phy_get_drvdata(phy);
> +	u32 val;
> +	int ret;
> +
> +	/* Setup Tx-Rx detection time */
> +	val = FIELD_PREP(PCIE_XTP_RXDET_VCM_OFF_STB_T_SEL, 0x33) |
> +	      FIELD_PREP(PCIE_XTP_RXDET_EN_STB_T_SEL, 0x1) |
> +	      FIELD_PREP(PCIE_XTP_RXDET_FINISH_STB_T_SEL, 0x2) |
> +	      FIELD_PREP(PCIE_XTP_TXPD_TX_DATA_EN_DLY, 0x3) |
> +	      FIELD_PREP(PCIE_XTP_RXDET_LATCH_STB_T_SEL, 0x1);
> +	regmap_write(pcie_phy->xr_dtime, REG_PCIE_PEXTP_DIG_GLB44, val);
[ ... ]
> +	regmap_set_bits(pcie_phy->g3_pma, REG_SS_DA_XPON_PWDB_0,
> +			G3_PMA_DA_XPON_CDR_PR_PWDB);
> +
> +	usleep_range(100, 200);
> +
> +	ret = phy_init(pcie_phy->qp_phy);
> +	if (ret) {
> +		dev_err(pcie_phy->dev, "failed to initialize QP phy\n");
> +		return ret;

[Severity: Medium]
Does this error path need to unwind the hardware state changes made earlier in
an7583_pcie_phy_init()?

If phy_init() fails, the PHY framework won't call the .exit callback because
init_count hasn't been incremented. This could leave hardware resources like
PLLs, LDOs, and clocks fully enabled and un-reset. Should there be a cleanup
sequence here or a call to a teardown helper?

> +	}
> +
> +	/* Wait for the PCIe PHY to complete initialization before returning */
> +	msleep(PHY_HW_INIT_TIME_MS);
> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827122127.18874-1-ansuelsmth@gmail.com?part=2

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: robh@kernel.org, olteanv@gmail.com,
	linux-phy@lists.infradead.org, vkoul@kernel.org,
	devicetree@vger.kernel.org, neil.armstrong@linaro.org,
	conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] phy: airoha: add support for AN7583 Gen3 PCIe PHY driver
Date: Thu, 27 Aug 2026 12:29:30 +0000	[thread overview]
Message-ID: <20260827122931.5157C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827122127.18874-3-ansuelsmth@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing hardware state cleanup on error path in `an7583_pcie_phy_init()`.
--

commit 62d7cb2950076a9ff89670b2868f00bd58e5c43e
Author: Christian Marangi <ansuelsmth@gmail.com>

phy: airoha: add support for AN7583 Gen3 PCIe PHY driver
    
Add support for AN7583 PCIe PHY driver. This is required to make the
Gen3 PCIe port present on the Airoha AN7583 SoC correctly work.

> diff --git a/drivers/phy/airoha/phy-an7583-pcie.c b/drivers/phy/airoha/phy-an7583-pcie.c
> new file mode 100644
> index 0000000000000..61b5f1dd64c07
> --- /dev/null
> +++ b/drivers/phy/airoha/phy-an7583-pcie.c
[ ... ]
> +static int an7583_pcie_phy_init(struct phy *phy)
> +{
> +	struct an7583_pcie_phy *pcie_phy = phy_get_drvdata(phy);
> +	u32 val;
> +	int ret;
> +
> +	/* Setup Tx-Rx detection time */
> +	val = FIELD_PREP(PCIE_XTP_RXDET_VCM_OFF_STB_T_SEL, 0x33) |
> +	      FIELD_PREP(PCIE_XTP_RXDET_EN_STB_T_SEL, 0x1) |
> +	      FIELD_PREP(PCIE_XTP_RXDET_FINISH_STB_T_SEL, 0x2) |
> +	      FIELD_PREP(PCIE_XTP_TXPD_TX_DATA_EN_DLY, 0x3) |
> +	      FIELD_PREP(PCIE_XTP_RXDET_LATCH_STB_T_SEL, 0x1);
> +	regmap_write(pcie_phy->xr_dtime, REG_PCIE_PEXTP_DIG_GLB44, val);
[ ... ]
> +	regmap_set_bits(pcie_phy->g3_pma, REG_SS_DA_XPON_PWDB_0,
> +			G3_PMA_DA_XPON_CDR_PR_PWDB);
> +
> +	usleep_range(100, 200);
> +
> +	ret = phy_init(pcie_phy->qp_phy);
> +	if (ret) {
> +		dev_err(pcie_phy->dev, "failed to initialize QP phy\n");
> +		return ret;

[Severity: Medium]
Does this error path need to unwind the hardware state changes made earlier in
an7583_pcie_phy_init()?

If phy_init() fails, the PHY framework won't call the .exit callback because
init_count hasn't been incremented. This could leave hardware resources like
PLLs, LDOs, and clocks fully enabled and un-reset. Should there be a cleanup
sequence here or a call to a teardown helper?

> +	}
> +
> +	/* Wait for the PCIe PHY to complete initialization before returning */
> +	msleep(PHY_HW_INIT_TIME_MS);
> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827122127.18874-1-ansuelsmth@gmail.com?part=2

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-08-27 12:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 12:21 [PATCH v2 0/2] phy: airoha: add support for AN7583 PCIe PHY driver Christian Marangi
2026-08-27 12:21 ` Christian Marangi
2026-08-27 12:21 ` [PATCH v2 1/2] dt-bindings: phy: airoha: Document support for AN7583 Gen3 PCIe PHY Christian Marangi
2026-08-27 12:21   ` Christian Marangi
2026-08-27 12:27   ` sashiko-bot
2026-08-27 12:27     ` sashiko-bot
2026-08-31  6:51   ` Krzysztof Kozlowski
2026-08-31  6:51     ` Krzysztof Kozlowski
2026-09-01 13:11     ` Christian Marangi
2026-09-01 13:11       ` Christian Marangi
2026-09-03  9:40       ` Krzysztof Kozlowski
2026-09-03  9:40         ` Krzysztof Kozlowski
2026-08-27 12:21 ` [PATCH v2 2/2] phy: airoha: add support for AN7583 Gen3 PCIe PHY driver Christian Marangi
2026-08-27 12:21   ` Christian Marangi
2026-08-27 12:29   ` sashiko-bot [this message]
2026-08-27 12:29     ` sashiko-bot

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=20260827122931.5157C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ansuelsmth@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --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.