From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796225849; b=R3D8KcryOewOGA0dBMN8w8p3gWZC6SQDW2XdfZ4YLoTHh+5VytG7wEgZuwg//ccA8JM0 gbvaU6ilWK0wTQMc+z7NJZDugZK3JWxmty3GEQeg7yt1Mw44ZRtb2kAhyoJjsxXQQPbDs 91afKNql1pTEIDgUqBUYG4v3gWidupiaksebUd7Xk5XcId6oCP60LOTDImZZkg/TUgdTc dw3FRLksTOSZzOeKamQgljwJCjT4U66dM+5l/ep/sVIz0NuheH6wtGkVxk5cRA0AmOba7 c5u28FWQYS6h26Up3LioHMNRgGbMUGnpZVYYt7FTCQGBHuWcO2EyTyh1pNvx40s/fgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796225849; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=b0KLj/mHp8CFMP89ybdE/d340mwioMWq5I2pR7L5flA=; b=IJo1n7KXYKEq5jfr3pxCrnNq8s31422KQ5nmZFQ64fEZ9yIHob6WjODCC/SP4aTzyJdn U6oHwftlEpIAfURnzvl/c+eo0ZSbjVPKGbsR0RDdLg1/TcKKgR+7Yj1sqWYeiaW2SSTQ5 9L/UmmFB0HDSG7yoZ3Hfwg1VlVFi3PQ5AE6zQ/fIXLvIz127CqwX39zkT1UAlIwSCM1o5 lRQLS70M2/CxM74osYE8Dapf0ZKsJ7DpDV2no2W7YdWWQmECUFkyWYne7L4JKhPk1U/cO 4HHD41Od5ynxmqNeewFljkoveIA6uK2yh7o9Nod4Pn7ah/zRdcCIHbN9dD4oazvMnaw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=loeD3Scc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 696E3606A31A for ; Wed, 2 Dec 2026 15:37:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=loeD3Scc Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48A8A1F00925; Wed, 2 Dec 2026 15:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796225848; bh=b0KLj/mHp8CFMP89ybdE/d340mwioMWq5I2pR7L5flA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=loeD3Scct8oKsTS/0TL95L9ddQHh0E4Ll2kBGW/oym6X8BrE1fwvVOeMPey8cofzK JaQG1I2XgJbCIpjHULSPpB82nG9hy460sFJ6eLBu827aevxh7s0c+KHtcK7O0GKYZE BgIBKfEN+p599rfh2Nhlmrjd7HQ3MW518L876ILKJim4yFqSdJnGA+ivb2ZANrVv27 NYlRgiOlheTztIlx4bZBDr/YQLgCRKXwdvU6yn1APGuySCk+sxsoXBKOya26UqemlW 1uJpr+QzKCUnfF49O4tKI41LgjWa4eVlQ258ljBFSV+Nc2BmlpLGZBbnf7F15rLh95 MB6Yu7jltE/Fw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 17/22] phy: cadence-torrent: unify link configuration in the probe Reply-To: sashiko-reviews@lists.linux.dev To: "Benjamin Robin" 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 In-Reply-To: <20261202-phy-cadence-torrent-ng-v2-17-0b493387347b@bootlin.com> References: <20261202-phy-cadence-torrent-ng-v2-0-0b493387347b@bootlin.com> <20261202-phy-cadence-torrent-ng-v2-17-0b493387347b@bootlin.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 15:37:27 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] phy: cadence-torrent: missing return statement in tp_configure_links() - [High] phy: cadence-torrent: A3 power-state timeout in tp_dp_set_rate() - [Medium] phy: cadence-torrent: tp_phy_off() leaves PHY in reset when already_configured -- commit d9682d304dc8f77ceb7780c5aacc3465f1589265 Author: Benjamin Robin phy: cadence-torrent: unify link configuration in the probe This commit moves PHY register configuration for both single-link and multi-link setups into probe and resume, and moves reset and DisplayPort link startup handling into the PHY power_on and power_off callbacks. > diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cade= nce/phy-cadence-torrent.c > index 9a2621fb3ac74..3b4d52ee7a531 100644 > --- a/drivers/phy/cadence/phy-cadence-torrent.c > +++ b/drivers/phy/cadence/phy-cadence-torrent.c [ ... ] > @@ -1065,6 +1089,13 @@ static int tp_dptx_set_power_state(const struct tp= _data *tp_data, u32 mlane, u32 > mask |=3D PMA_XCVR_POWER_STATE_REQ_LN_MASK << PHY_POWER_STATE_LN(mlane= + i); > } > =20 > + /* Do not got to power state A3 if already off */ > + if (powerstate =3D=3D POWERSTATE_A3) { > + read_val =3D tp_reg_dptx_read(tp_data, PHY_PMA_XCVR_POWER_STATE_ACK); > + if ((read_val & mask) =3D=3D 0) > + return 0; > + } > + > /* Set power state A. */ > tp_reg_dptx_write(tp_data, PHY_PMA_XCVR_POWER_STATE_REQ, value); [ ... ] > @@ -1353,55 +1368,29 @@ static int tp_dp_set_lanes(struct tp_data *tp_dat= a, struct tp_link *link, u32 nu > /* update the number of used lanes */ > link->num_lanes =3D num_lanes; [ ... ] > } > =20 > /* Configure link rate as required. */ > static int tp_dp_set_rate(struct tp_data *tp_data, struct tp_link *link, > - struct phy_configure_opts_dp *dp) > + const struct phy_configure_opts_dp *dp) > { > int ret; > =20 > - ret =3D tp_dptx_set_power_state(tp_data, link->mlane, link->num_lanes, = POWERSTATE_A3); > + ret =3D tp_dptx_set_power_state(tp_data, link->mlane, link->max_lanes, = POWERSTATE_A3); > if (ret) > return ret; [Severity: High] Will tp_dptx_set_power_state() time out waiting for POWERSTATE_A3 when a running DisplayPort link uses fewer than link->max_lanes lanes? tp_dp_set_lanes() holds unused lanes (link->num_lanes .. link->max_lanes - = 1) in reset with PHY_PMA_XCVR_PLLCLK_EN cleared, and tp_dp_run() only brings up link->num_lanes lanes to POWERSTATE_A0. When tp_dp_set_rate() passes link->max_lanes on an active link, the active lanes have non-zero bits in PHY_PMA_XCVR_POWER_STATE_ACK, so the early return in tp_dptx_set_power_state() is not taken. readl_poll_timeout() then waits for all link->max_lanes lanes to acknowledge POWERSTATE_A3 (0x08), which unused lanes held in reset never do, failing link rate changes for 1-lane or 2-lane configs on a 4-lane PHY with -ETIMEDOUT. Also, when tp_phy_configure() is called on a running link with both set_lanes and set_rate set, tp_dp_set_lanes() runs first and clears PHY_PMA_XCVR_PLLCLK_EN on all lanes and puts newly disabled lanes into reset before tp_dp_set_rate() requests POWERSTATE_A3. [ ... ] > @@ -1479,46 +1476,65 @@ static int tp_phy_on(struct phy *phy) > u16 val; > int ret; > =20 > + guard(mutex)(&tp_data->lock); > + > if (tp_data->already_configured) { > /* Give 5ms to 10ms delay for the PIPE clock to be stable */ > usleep_range(5000, 10000); > + tp_data->nb_phy_on++; > return 0; > } [ ... ] > static int tp_phy_off(struct phy *phy) > @@ -1527,112 +1543,79 @@ static int tp_phy_off(struct phy *phy) > struct tp_data *tp_data =3D dev_get_drvdata(phy->dev.parent); > int ret; > =20 > - if (tp_data->nb_links !=3D 1) > - return 0; > + guard(mutex)(&tp_data->lock); > =20 > - ret =3D reset_control_assert(tp_data->phy_rst); > + ret =3D reset_control_assert(link->lnk_rst); > if (ret) > return ret; > =20 > - return reset_control_assert(link->lnk_rst); > + if (tp_data->nb_phy_on =3D=3D 1) { > + ret =3D reset_control_assert(tp_data->phy_rst); > + if (ret) > + return ret; > + } > + > + tp_data->nb_phy_on--; > + return 0; > } [Severity: Medium] If tp_data->already_configured is true, does a runtime phy_power_off() followed by phy_power_on() leave the PHY held in reset? tp_phy_off() unconditionally asserts link->lnk_rst and tp_data->phy_rst, but tp_phy_on() returns early when tp_data->already_configured is set without deasserting either reset (and probe skipped tp_ref_clks_init() and tp_configure_links()). [ ... ] > +static int tp_configure_links(struct tp_data *tp_data) > +{ > + int ret; > + > + if (tp_data->nb_links > 1) > + ret =3D cdns_torrent_phy_configure_multilink(tp_data); > + else > + ret =3D tp_configure_single_link(tp_data, &tp_data->links[0]); > + > if (ret) > return ret; > =20 > - return 0; > + /* > + * PHY PMA registers configuration functions > + * Initialize PHY with max supported link rate, without SSC. > + */ > + for (u8 i =3D 0; i < tp_data->nb_links; ++i) { > + struct tp_link *link =3D &tp_data->links[i]; > + > + if (link->phy_type =3D=3D TYPE_DP) > + tp_dp_update_pll_freq(tp_data, link, link->max_bit_rate, false); > + } > } [Severity: High] Does tp_configure_links() fall off the end without returning 0 on the success path? This breaks bisection by failing the build with -Werror=3Dreturn-type until commit "phy: cadence-torrent: rewrite Torrent PHY driver" later in the series adds the return statement. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202-phy-cadenc= e-torrent-ng-v2-0-0b493387347b@bootlin.com?part=3D17