From: sashiko-bot@kernel.org
To: "Kartik Rajput" <kkartik@nvidia.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2 4/4] scsi: ufs: tegra: Add Tegra264 UFS host controller driver
Date: Tue, 29 Sep 2026 10:07:48 +0000 [thread overview]
Message-ID: <20260929100749.37DDE1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929-tegra264-ufs-v2-4-f0467b9c503e@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] ufs: tegra: missing hardware reset assertion in teardown path
- [Medium] ufs: tegra: missing dummy readl() after writel() to guarantee delay timing and ordering
--
commit 1b8e042f5d752753eca62f28d9beaa880236dcb0
Author: Kartik Rajput <kkartik@nvidia.com>
scsi: ufs: tegra: Add Tegra264 UFS host controller driver
Add a driver for the UFS host controller found on NVIDIA Tegra264 SoCs.
The controller has Tegra-specific auxiliary registers, clocks and resets,
and it drives the four M-PHY lane directions exposed by the Tegra264
M-PHY driver.
> diff --git a/drivers/ufs/host/ufs-tegra.c b/drivers/ufs/host/ufs-tegra.c
> new file mode 100644
> index 0000000000000..f122654325924
> --- /dev/null
> +++ b/drivers/ufs/host/ufs-tegra.c
[ ... ]
> +static void ufs_tegra_configure_aux(struct ufs_hba *hba)
> +{
> + struct ufs_tegra *ufs = ufshcd_get_variant(hba);
> + u32 value;
> +
> + value = readl(ufs->aux + UFSHC_AUX_DEV_CTRL);
> + value |= DEV_CTRL_CLK_EN;
> + writel(value, ufs->aux + UFSHC_AUX_DEV_CTRL);
> +
> + /* Let the reference clock stabilise before deasserting device reset. */
> + usleep_range(1000, 2000);
[Severity: Medium]
Memory-mapped peripheral writes via writel() provide CPU ordering but do not
guarantee that the write has reached the interconnect. Does this sleep begin
without guaranteeing the clock enable write has reached the peripheral?
Without a dummy readl() to flush the posted write, the CPU can proceed while
the write is still buffered, causing the timing delay to execute prematurely.
> +
> + value |= DEV_CTRL_RESET;
> + writel(value, ufs->aux + UFSHC_AUX_DEV_CTRL);
> +}
> +
> +static void ufs_tegra_aux_init(struct ufs_hba *hba)
> +{
> + struct ufs_tegra *ufs = ufshcd_get_variant(hba);
> + u32 value;
> +
> + value = readl(ufs->aux + UFSHC_AUX_DEV_CTRL);
> + value &= ~(DEV_CTRL_CLK_EN | DEV_CTRL_RESET);
> + writel(value, ufs->aux + UFSHC_AUX_DEV_CTRL);
> +
> + /* Ensure the clear is observed before we re-enable. */
> + usleep_range(100, 200);
[Severity: Medium]
Similarly here, does this sleep begin without guaranteeing the clear operation
has reached the peripheral? A dummy readl() might be needed to flush the
posted write before delaying.
> +
> + ufs_tegra_configure_aux(hba);
> +}
[ ... ]
> +static int ufs_tegra_hce_enable_notify(struct ufs_hba *hba, enum ufs_notify_change_status status)
> +{
> + struct ufs_tegra *ufs = ufshcd_get_variant(hba);
> + u32 value;
> + int err;
> +
> + switch (status) {
> + case PRE_CHANGE:
> + err = ufs_tegra_power_up_sequence(hba);
> + if (err)
> + return err;
> +
> + /* Assert device reset; POST_CHANGE releases it via
> + * ufs_tegra_configure_aux() so the HCE toggle pulses it.
> + */
> + value = readl(ufs->aux + UFSHC_AUX_DEV_CTRL);
> + value &= ~DEV_CTRL_RESET;
> + writel(value, ufs->aux + UFSHC_AUX_DEV_CTRL);
> + break;
[Severity: Medium]
Does this write need to be flushed before returning? Without flushing the
auxiliary write, the core driver proceeds to write REG_CONTROLLER_ENABLE.
The HCE toggle might beat the reset assertion, causing hardware initialization
failures.
> + case POST_CHANGE:
[ ... ]
> +static void ufs_tegra_exit(struct ufs_hba *hba)
> +{
> + ufs_tegra_mphy_disable(hba);
> +}
[Severity: Medium]
Does this teardown function lack a call to reset_control_bulk_assert()?
The hardware resets are initially deasserted in ufs_tegra_init() via
reset_control_bulk_deassert(). However, the teardown callback
ufs_tegra_exit() misses the matching assertion. The API
devm_reset_control_bulk_get_exclusive() only releases the references but does
not auto-assert the reset lines upon unbind.
This leaves the UFS host controller hardware unquiesced (active) when the
driver is unbound, potentially leading to state issues on kexec or power
leaks.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929-tegra264-ufs-v2-0-f0467b9c503e@nvidia.com?part=4
next prev parent reply other threads:[~2026-09-29 10:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 9:45 [PATCH v2 0/4] Add UFS host controller support for NVIDIA Tegra264 Kartik Rajput
2026-09-29 9:45 ` [PATCH v2 1/4] dt-bindings: ufs: Add nvidia,tegra264-ufs Kartik Rajput
2026-09-30 10:43 ` Krzysztof Kozlowski
2026-09-30 10:45 ` Krzysztof Kozlowski
2026-09-29 9:45 ` [PATCH v2 2/4] scsi: ufs: Add UIC DEBUGSAVECONFIGTIME attribute and its field masks Kartik Rajput
2026-09-29 9:45 ` [PATCH v2 3/4] scsi: ufs: hisi: Use VS_DEBUGSAVECONFIGTIME instead of a literal address Kartik Rajput
2026-09-29 9:45 ` [PATCH v2 4/4] scsi: ufs: tegra: Add Tegra264 UFS host controller driver Kartik Rajput
2026-09-29 10:07 ` sashiko-bot [this message]
2026-09-30 10:44 ` Krzysztof Kozlowski
2026-09-30 11:34 ` Thierry Reding
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=20260929100749.37DDE1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kkartik@nvidia.com \
--cc=linux-scsi@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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