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=1796374986; b=0uf/PwSP4Bzb0YitkrUzWlo0DtKVH2UB1qmLzIw4WGtbSvcRMXtwwU8fbLmarLlxDB59 LEPCrQCP1xCwvFkhuVrAr8vmfrMpUkoXCOXwCCDA0FT2D8wM6Z60FHyjdG9/uwDddCY5O 3va26IszOtMeVCIqRNlGiApWxeDUndqIWLwLufUhzT1TZZKOwDYRPkTGtL1Q6sJHjlivO lxeGoszLJVVAe0naQWuDcVJ0/dI+CaZqt5HV8Eo51J/RvF8W+PjRrDde7lppNvHpMRLtw MK2OaCfA1ToCpmnUqxgvs6mfVOdHRByuwTRZBVMhaWbdNXlSGLAOEhqxpZRsBcer8Fw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796374986; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=nhhfIrEGpY/4+IjboJ4R5fWVoz5g6B/qTB5jQkmB6aE=; b=3Py76QrFQOn2/dGULCyhr3zaEl+kra8gAfMiu1l8rdNaXqbYn5vh+v91CUC6Ao2t/6HJ XWCMJpGNY77X4ETak1n92sPr6/GufMVU24QRNjeMmY436WjlP7aOKw5699Wzv39xzMAr0 bLDvdGaM+YDORX28OiLQbyTYnOlM44wB+lpKDfnQ8SRRvEPsYf9w47luT/JRYkqjRkCgV 1BBWmfBp0Z0XFNOlXDgfvDKPk77HRY9H2LztZ7HXLsB4A3H7OSTUEnsDfztRogscjlmI6 OL9DKIhjsX5utxgRqVzx6PfdDtBOzF4YWu/iGkLBQr0WEIPTL81X8kkPodqzGqUg8Yg== 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="jNTBHN/7"; 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 92682606A32C; Fri, 4 Dec 2026 09:03:06 +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=jNTBHN/7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E89C31F000CE; Fri, 4 Dec 2026 09:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796374986; bh=nhhfIrEGpY/4+IjboJ4R5fWVoz5g6B/qTB5jQkmB6aE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=jNTBHN/7z99VUEsgmQ9cy6V7dgXtX1d7oJbbSsLdB7A3y9b8iXXGvTRU2/Sj0i9BG o8xjk1oRwEJ+T3RScikyLravclk6ancIImqXrCyEbA1w0+bjRZFsr0ba8EpyGCOs5s ep/p6iCkfqtWXWH5KmVwyGT06XfAdOIEJL8N8knc9dyQ+Nl3WIACxmmvGUfdrakIsm ojxdocC+SK/dc/6WaXYp6Ys87nIwqIiKBRkZW7q5ZU+Nz3nWRBywGgGCcNZoN0mzkT yGurLbdYhWX1v5MoKZS1WwqO5cwvaxfDGqpqtOFa2YErpe/NutzKvvgeU18gTTEnGv Szd59nAY6LaQQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v12 13/14] ufs: s32n7: Add NXP S32N79 UFS host controller driver Reply-To: sashiko-reviews@lists.linux.dev To: "Larisa Grigore" Cc: linux-scsi@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, Frank.Li@kernel.org, wsa+renesas@sang-engineering.com In-Reply-To: <20261204-b4-ufs-s32n7-v12-13-4cf32fc871a0@oss.nxp.com> References: <20261204-b4-ufs-s32n7-v12-0-4cf32fc871a0@oss.nxp.com> <20261204-b4-ufs-s32n7-v12-13-4cf32fc871a0@oss.nxp.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:03:05 +0000 X-Mailing-List: linux-scsi@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 2 potential issues to consider: - [Medium] ufs: s32n7: core clock validation deferred to ignored PRE_CHANGE callback - [Medium] ufs: s32n7: missing rx_ack handshake poll and RMW on M-PHY CR registers -- commit 71fbee8676eb46720c3c097be12d5179f583c74a Author: Larisa Grigore ufs: s32n7: Add NXP S32N79 UFS host controller driver This patch adds a platform UFS host controller driver for the NXP S32N79 SoC built on top of the UFSHCD DWC and platform glue. > diff --git a/drivers/ufs/host/ufs-nxp-s32n7.c b/drivers/ufs/host/ufs-nxp-= s32n7.c > new file mode 100644 > index 0000000000000..8d73a7179d992 > --- /dev/null > +++ b/drivers/ufs/host/ufs-nxp-s32n7.c > @@ -0,0 +1,546 @@ [ ... ] > +static int ufs_s32n7_configure_clocks(struct ufs_hba *hba) > +{ > + struct s32n7_ufs *ufs =3D ufshcd_get_variant(hba); > + struct device *dev =3D hba->dev; > + struct ufs_clk_info *clki; > + unsigned long clk_rate =3D 0; > + unsigned long one_us_tick; > + > + /* > + * The core reference clock is managed by the UFS core (it is listed in > + * the DT via clock-names as a fixed rate clock and added to > + * hba->clk_list_head). Read its rate from there to derive > + * ONE_US_TICK/HCLKDIV. > + */ > + list_for_each_entry(clki, &hba->clk_list_head, list) { > + if (!IS_ERR_OR_NULL(clki->clk) && > + !strcmp(clki->name, "core")) { > + clk_rate =3D clk_get_rate(clki->clk); > + break; > + } > + } > + > + if (!clk_rate) { > + dev_err(dev, "Failed to get valid clock rate.\n"); > + return -EINVAL; > + } > + > + one_us_tick =3D clk_rate / USEC_PER_SEC; > + if (one_us_tick =3D=3D 0 || one_us_tick > MAX_VALID_ONE_US_TICK) { > + dev_err(dev, "Invalid one_us_tick value: %lu (clk_rate: %lu Hz).\n", > + one_us_tick, clk_rate); > + return -EINVAL; > + } [Severity: Medium] Can an invalid or missing "core" clock slip past probe when validated here? ufs_s32n7_configure_clocks() only runs from ufs_s32n7_link_startup_pre_change(), and ufshcd_link_startup() ignores the return value of ufshcd_vops_link_startup_notify(hba, PRE_CHANGE) before calling ufshcd_dme_link_startup(). If the DT omits the "core" clock or reports an out-of-range rate, returning -EINVAL skips SCM_ONE_US_TICK, DWC_UFS_REG_HCLKDIV, PHY reset, and M-PHY calibration, yet link startup still runs and can silently succeed if firmware left the PHY active. Validating and caching one_us_tick in ufs_s32n7_init() (whose return value aborts probe in ufshcd_hba_init()) while keeping the register writes in ufs_s32n7_link_startup_pre_change() would reject bad clock setups cleanly. [ ... ] > +static int ufs_s32n7_pwr_change_pre_change(struct ufs_hba *hba, > + const struct ufs_pa_layer_attr *pwr) > +{ > + /* > + * RX rate-select override sequence: assert the override, then deassert > + * the value, then drop the override enable so normal operation resumes. > + */ > + static const struct s32n7_phy_reg pwr_change_phy_regs[] =3D { > + { RX_OVRD_IN_1(0), MPHY_RX_OVRD_EN | MPHY_RX_OVRD_VAL }, > + { RX_OVRD_IN_1(1), MPHY_RX_OVRD_EN | MPHY_RX_OVRD_VAL }, > + { RX_OVRD_IN_1(0), MPHY_RX_OVRD_EN }, > + { RX_OVRD_IN_1(1), MPHY_RX_OVRD_EN }, > + { RX_OVRD_IN_1(0), 0x0 }, > + { RX_OVRD_IN_1(1), 0x0 }, > + }; [Severity: Medium] Can writing RX_OVRD_IN_1 back-to-back without polling RX_PCS_OUT break the RX rate-select handshake during HS power mode changes? If the M-PHY RX PCS has not asserted rx_ack (MPHY_RX_ACK_MASK in RX_PCS_OUT) before MPHY_RX_OVRD_VAL is cleared, or deasserted it before MPHY_RX_OVRD_EN is dropped, the 4-phase rx_req/rx_ack handshake is violated and the HS rate change can fail or leave RX PCS wedged. In drivers/ufs/host/ufs-amd-versal2.c, ufs_versal2_phy_ratesel() operates on the same shared RX_OVRD_IN_1 and RX_PCS_OUT registers using read-modify-write and polling MPHY_RX_ACK_MASK for 1 and then 0. Raw writes to RX_OVRD_IN_1 here, FAST_FLAGS in s32n79_calib_mphy_disabled[], and FW_CALIB_CCFG in s32n79_calib_mphy_enabled[] also clear all other bits in those 16-bit CR registers instead of preserving reset or ROM defaults with read-modify-write as ufs_versal2_setup_phy() does. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-b4-ufs-s32= n7-v12-0-4cf32fc871a0@oss.nxp.com?part=3D13