Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Benjamin Robin" <benjamin.robin@bootlin.com>
Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-phy@lists.infradead.org, robh@kernel.org,
	conor+dt@kernel.org, vkoul@kernel.org, neil.armstrong@linaro.org,
	olteanv@gmail.com
Subject: Re: [PATCH v2 11/22] phy: cadence-torrent: use link lane count and mlane for DP config
Date: Wed, 02 Dec 2026 15:28:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-246100@kernel.org> (raw)
In-Reply-To: <20261202-phy-cadence-torrent-ng-v2-11-0b493387347b@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] phy: cadence-torrent: per-lane CDB init uses num_lanes
  instead of max_lanes
--

commit a7bb6d81b805f076baf2e912724f7f59b580f8d8
Author: Benjamin Robin <benjamin.robin@bootlin.com>

phy: cadence-torrent: use link lane count and mlane for DP config

This commit splits the link lane count into max_lanes and num_lanes in
struct tp_link so DisplayPort reconfiguration uses the active lane count
when set_lanes is not set, and shifts per-lane register masks by
link->mlane.

> diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
> index 28627bd234458..6e48c315e6b1a 100644
> --- a/drivers/phy/cadence/phy-cadence-torrent.c
> +++ b/drivers/phy/cadence/phy-cadence-torrent.c
[ ... ]
> @@ -1190,7 +1209,7 @@ static int tp_dp_configure_rate(struct tp_data *tp_data, struct tp_link *link,
>  		/* PMA common configuration 100MHz */
>  		cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(tp_data, dp->link_rate, dp->ssc);
>  
> -	cdns_torrent_dp_pma_cmn_rate(tp_data, link, dp->link_rate, dp->lanes);
> +	cdns_torrent_dp_pma_cmn_rate(tp_data, link, dp->link_rate, link->num_lanes);
>  
>  	/* Enable the associated PLL (cmn_pll0_en or cmn_pll1_en) */
>  	tp_reg_set_bits(reg_base, PHY_PMA_PLL_RAW_CTRL, pll_mask);
[ ... ]
> @@ -1286,58 +1295,53 @@ static void cdns_torrent_dp_set_a0_pll(struct tp_data *tp_data,
[ ... ]
> +	/* release master lane reset */
> +	value |= 1 << mlane;
>  	tp_reg_dptx_write(tp_data, PHY_RESET, value);
>  
> +	/* update the number of used lanes */
> +	link->num_lanes = num_lanes;
> +
>  	/* Wait, until PHY gets ready after releasing PHY reset signal. */
>  	ret = tp_dptx_wait_pma_cmn_ready(tp_data);

[Severity: Medium]
Does updating link->num_lanes to the active DisplayPort lane count leave
upper physical lanes unconfigured when the lane count is later increased?

After tp_dp_set_lanes() reduces link->num_lanes below link->max_lanes (for
example from 4 lanes to 1 or 2), cdns_torrent_phy_configure_multilink()
(called on system resume by tp_resume_noirq() after reset assertion) and
tp_phy_init() still loop up to link->num_lanes instead of link->max_lanes
when programming per-lane CDB tables (xcvr_diag_vals, tx_ln_vals,
rx_ln_vals):

drivers/phy/cadence/phy-cadence-torrent.c:cdns_torrent_phy_configure_multilink() {
    ...
			mlane = tp_data->links[node].mlane;
			ssc = tp_data->links[node].ssc_mode;
			num_lanes = tp_data->links[node].num_lanes;
    ...
			if (xcvr_diag_vals) {
				reg_pairs = xcvr_diag_vals->reg_pairs;
				num_regs = xcvr_diag_vals->num_regs;
				for (i = 0; i < num_lanes; i++) {
    ...
}

If the system suspends and resumes while fewer than max_lanes are active
and a later phy_configure() increases dp->lanes back to 4,
tp_dp_set_lanes() releases the upper lanes from reset without their
per-lane CDB registers initialized (which also remains the case in
tp_configure_links() after commit "phy: cadence-torrent: rewrite Torrent
PHY driver").

Similarly, tp_dp_configure_rate() passes link->num_lanes to
cdns_torrent_dp_pma_cmn_rate(), which only writes XCVR_DIAG_HSCLK_DIV for
0 .. link->num_lanes - 1; if a rate change happens at 1 or 2 lanes and a
subsequent phy_configure() increases the lane count via set_lanes without
set_rate, the newly enabled lanes keep stale XCVR_DIAG_HSCLK_DIV values
(though commit "phy: cadence-torrent: rewrite Torrent PHY driver" later
updates the XCVR_DIAG_HSCLK_DIV write to use link->max_lanes).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-phy-cadence-torrent-ng-v2-0-0b493387347b@bootlin.com?part=11

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

  reply	other threads:[~2026-12-02 15:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261202-phy-cadence-torrent-ng-v2-0-0b493387347b@bootlin.com>
2026-12-02 15:08 ` [PATCH v2 04/22] dt-bindings: phy: cadence-torrent: add phy-mode constants Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 07/22] phy: cadence-torrent: rename symbols to prepare for rewrite Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 08/22] phy: cadence-torrent: replace regmap with readw/writew Benjamin Robin
2026-12-02 15:08 ` [PATCH v2 11/22] phy: cadence-torrent: use link lane count and mlane for DP config Benjamin Robin
2026-12-02 15:28   ` sashiko-bot [this message]
2026-12-02 15:08 ` [PATCH v2 14/22] phy: cadence-torrent: rework ref clock init and probe cleanup Benjamin Robin
2026-12-02 15:24   ` sashiko-bot
2026-12-02 15:09 ` [PATCH v2 16/22] phy: cadence-torrent: store clock and reset handles only on success Benjamin Robin
2026-12-02 15:09 ` [PATCH v2 17/22] phy: cadence-torrent: unify link configuration in the probe Benjamin Robin
2026-12-02 15:37   ` sashiko-bot
     [not found] ` <20261202-phy-cadence-torrent-ng-v2-1-0b493387347b@bootlin.com>
2026-12-02 15:24   ` [PATCH v2 01/22] arm64: dts: ti: k3-j7200: Fix QSGMII overlay by adding SERDES PHY sashiko-bot
     [not found] ` <20261202-phy-cadence-torrent-ng-v2-22-0b493387347b@bootlin.com>
2026-12-02 15:30   ` [PATCH v2 22/22] phy: cadence-torrent: support 8 lanes on the sd0801 PHY sashiko-bot
     [not found] ` <20261202-phy-cadence-torrent-ng-v2-18-0b493387347b@bootlin.com>
2026-12-02 15:31   ` [PATCH v2 18/22] phy: cadence-torrent: allow config on an already-configured DP link sashiko-bot
     [not found] ` <20261202-phy-cadence-torrent-ng-v2-20-0b493387347b@bootlin.com>
2026-12-02 15:34   ` [PATCH v2 20/22] phy: cadence-torrent: rework suspend/resume to restore link config sashiko-bot
     [not found] ` <20261202-phy-cadence-torrent-ng-v2-21-0b493387347b@bootlin.com>
2026-12-02 15:38   ` [PATCH v2 21/22] phy: cadence-torrent: rewrite Torrent PHY driver 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=sashiko-outbox-246100@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=benjamin.robin@bootlin.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox