From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.246.85.4 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796318213; b=aqQKGHKGiesPqWOuYkgKx5Xcsgxr6hNroWmTxFmQANc/AKLC4yYrdPR6YKoRZEHmu3qL xxjeoxZtDaXjv4EWnuTJc9MwgmvqV+l50ZOIv4M5AqVqzRaGyENTwmw+8wZWy9Va/mm7d uLKfCE84ZtsWNO0LsELZTG1MaOcqpr+tsmaRL2DqNac8iupuNAiZv52NwOOy1UKITKzzj b6AkZ07e95iSjMCjtvtM1KTkc6WAEqSIOetGMyzRudxOiPrkXm19VFiR3KIUtQmGnyvP7 Xb9DKwuZx2/lSJmXj9uxZX3eu9CALSsP7n49vmYwKM6Y9QakFqL5tWqH5nxh5mpf3Gg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796318213; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:From:To:Cc: Subject:Date:Message-ID:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Last-TLS-Session-Version; bh=pOFZUuFZ7tqRkN+cnlEh4/D7wrRPAQowXzQAFg7SHtI=; b=yDq4ZXt8ok4r0SqkqIdIKFqwZKA63ycoJ/DJm2rTkf5PRKAs38A94qY+viuJ6EAryphF soNAxCRngKaH52s9++87Cup2WI9Y4ivDCLv42XAQqi6HZmY1mRw0C4mR6+/27k5iW5f7E b/s/sL1t7f+f7Lpy6mtidT3z2m+9Fg4dAv8QWCpOasPXvgkoie2enn3uZCOdgIdxDOeYe FpCA6qfK8MUuYlRLBQhFZ0DS+crJGkdTPk1lmiWvXsyqB3ZQyakbeUfh/Hr1ntTQ3dUMp gzqwaTCEsXPGxomyE8bVcowxU+b62Ez0DFGjMow/J4i5Rm0ns+oXv5dVsERIdh2Nl+A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=i3iI2pCz; arc=none smtp.remote-ip=185.246.85.4 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 177AF606A322 for ; Thu, 3 Dec 2026 17:16:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 177AF606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com 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=i3iI2pCz Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 52AB24E4186C; Thu, 3 Dec 2026 17:16:51 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 1C34A604C0; Thu, 3 Dec 2026 17:16:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1A82E11EA18F4; Thu, 03 Dec 2026 18:16:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796318206; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=pOFZUuFZ7tqRkN+cnlEh4/D7wrRPAQowXzQAFg7SHtI=; b=i3iI2pCz+jql6ONv/1x63NilVv9/CoZjDghMd0G+XnRn+eVc+OnsxgxpihQcUKyjMZHXqD ElB6Zq2cekTjNWuqJMZ52Na6ZQsVnoTTnHspGEQLVv2G6fCT8+C52zE83C0bQVkMaov7Mq 4SFJFPwEYuTiHf7jjP7wgWmdjbb3H38MGH2WBT32s0I6xw/8rTOe9agUqfH1O03hUbAfKd 44U/pkAyIRC0TUlQXw4tvWSOyrHfLvbk2AFfhs9OeuWDZ1b5wdieE6VwdOEnlcQ0QYbL6E qYZmFy4DPHqPg0AVUl6vGjrehLb0ZbtgJPXUlB2r77BMt4bU/d4Atgq97muYiw== 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 17/22] phy: cadence-torrent: unify link configuration in the probe Date: Thu, 03 Dec 2026 18:16:43 +0100 Message-ID: In-Reply-To: References: <20261202-phy-cadence-torrent-ng-v2-0-0b493387347b@bootlin.com> <20261202-phy-cadence-torrent-ng-v2-17-0b493387347b@bootlin.com> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Last-TLS-Session-Version: TLSv1.3 On Wednesday, December 2, 2026 at 4:37=E2=80=AFPM, sashiko-bot@kernel.org w= rote: > 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 > -- >=20 > commit d9682d304dc8f77ceb7780c5aacc3465f1589265 > Author: Benjamin Robin >=20 > phy: cadence-torrent: unify link configuration in the probe >=20 > 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. >=20 > > diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/ca= dence/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(mla= ne + 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_d= ata, 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 *lin= k, > > - 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; >=20 > [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? >=20 > tp_dp_set_lanes() holds unused lanes (link->num_lanes .. link->max_lanes = =2D 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. This is the same issue that was reported in patch 21/22. This might be an issue. In v3 for the lanes in reset, do not try to go to POWERSTATE_A3 (ask 0), so it should fix the issue. =20 > 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. Yes indeed, same issue as above. >=20 > [ ... ] >=20 > > @@ -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; > > } >=20 > [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? >=20 > 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()). This might be an issue. In v3 that part will be updated. >=20 > [ ... ] >=20 > > +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); > > + } > > } >=20 > [Severity: High] > Does tp_configure_links() fall off the end without returning 0 on the > success path? >=20 > This breaks bisection by failing the build with -Werror=3Dreturn-type unt= il > commit "phy: cadence-torrent: rewrite Torrent PHY driver" later in the > series adds the return statement. This is indeed quite an issue... Sorry about that. =2D-=20 Benjamin Robin, Bootlin Embedded Linux and Kernel engineering https://bootlin.com