From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8147606A32F for ; Thu, 3 Dec 2026 15:11:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=PjUGi1gp Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 385B910E70F; Thu, 3 Dec 2026 15:11:53 +0000 (UTC) Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id DAD5410E74D for ; Thu, 3 Dec 2026 15:11:46 +0000 (UTC) Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 41A2B1A18DE; Thu, 3 Dec 2026 15:11:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0E292604ED; Thu, 3 Dec 2026 15:11:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A078A11EA1896; Thu, 03 Dec 2026 16:11:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796310700; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=tn0+7eax+tLt45/53c8f/61NKOWn+n+aRA8e9bLnfaU=; b=PjUGi1gp5q7ooubSfIhPrZOMtM69OtA5TyXClXPAy5RyGGbUfBnDEpyXDnhoN59ElQvM7f a//ZBJJfnIXTtV0YtThTx7JMiDeDgjeqtTRw8eMnqdaeIhjAdxx5UMH9xsg49ZtURbS4b1 TU0uSj7bv8YeQ/044TCFu2271EqKfsRofwdDuBy+uXyawkP1Pdy8WulOyByHtMT5XaPnLo y81OGTZW3PtaQhJ2tCdgPd3Vl907yo8rETzFmFOZNLk1RKLGTaIkGq/khXN33XsrrH5zkH G+DVTL5nM2p1tVhBi4P7vxbqNqgSrLgc7F3v3ycz37NEmMRDDeFdgnruBdjMKQ== From: Benjamin Robin To: sashiko-reviews@lists.linux.dev 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: Thu, 03 Dec 2026 16:11:36 +0100 Message-ID: In-Reply-To: References: <20261202-phy-cadence-torrent-ng-v2-0-0b493387347b@bootlin.com> <20261202-phy-cadence-torrent-ng-v2-11-0b493387347b@bootlin.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wednesday, December 2, 2026 at 4:28=E2=80=AFPM, sashiko-bot@kernel.org w= rote: > 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 > -- >=20 > commit a7bb6d81b805f076baf2e912724f7f59b580f8d8 > Author: Benjamin Robin >=20 > phy: cadence-torrent: use link lane count and mlane for DP config >=20 > 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. >=20 > > diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/ca= dence/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 *t= p_data, struct tp_link *link, > > /* PMA common configuration 100MHz */ > > cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(tp_data, dp->link_rate, dp->s= sc); > > =20 > > - 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); > > =20 > > /* 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 t= p_data *tp_data, > [ ... ] > > + /* release master lane reset */ > > + value |=3D 1 << mlane; > > tp_reg_dptx_write(tp_data, PHY_RESET, value); > > =20 > > + /* update the number of used lanes */ > > + link->num_lanes =3D num_lanes; > > + > > /* Wait, until PHY gets ready after releasing PHY reset signal. */ > > ret =3D tp_dptx_wait_pma_cmn_ready(tp_data); >=20 > [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? This indeed could be an issue. A lot of registers should be programmed by using the max_lanes instead of num_lanes. This will be fixed in v3. =20 > 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): >=20 > drivers/phy/cadence/phy-cadence-torrent.c:cdns_torrent_phy_configure_mult= ilink() { > ... > mlane =3D tp_data->links[node].mlane; > ssc =3D tp_data->links[node].ssc_mode; > num_lanes =3D tp_data->links[node].num_lanes; > ... > if (xcvr_diag_vals) { > reg_pairs =3D xcvr_diag_vals->reg_pairs; > num_regs =3D xcvr_diag_vals->num_regs; > for (i =3D 0; i < num_lanes; i++) { > ... > } >=20 > 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"). >=20 > 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). =2D-=20 Benjamin Robin, Bootlin Embedded Linux and Kernel engineering https://bootlin.com