From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Yixun Lan" <dlan@kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Avri Altman" <avri.altman@sandisk.com>,
"Bart Van Assche" <bvanassche@acm.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Martin K. Petersen" <mkp@kernel.org>
Cc: "Anirudh Srinivasan" <asrinivasan@oss.tenstorrent.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jennifer Berringer" <jberring@redhat.com>,
<linux-scsi@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-riscv@lists.infradead.org>, <spacemit@lists.linux.dev>,
<linux-kernel@vger.kernel.org>,
"Troy Mitchell" <troy.mitchell@linux.spacemit.com>
Subject: Re: [PATCH v6 2/2] scsi: ufs: spacemit: k3: Add UFS Host Controller driver
Date: Tue, 22 Sep 2026 17:25:03 +0800 [thread overview]
Message-ID: <DLLQJDEA91FU.18Q1TSX09AUR3@linux.spacemit.com> (raw)
In-Reply-To: <20260921-08-k3-ufs-support-v6-2-3479768a2299@kernel.org>
[-- Attachment #1.1: Type: text/plain, Size: 1347 bytes --]
On Mon Sep 21, 2026 at 8:36 PM +08, Yixun Lan wrote:
> [...]
>
> +static int ufs_spacemit_link_startup_pre_change(struct ufs_hba *hba)
> +{
> + u32 value, sys1clk_1us;
> + int err;
> +
> + err = ufs_spacemit_mphy_init(hba);
> + if (err < 0)
> + return err;
> +
> + err = ufs_spacemit_uniprov1p6_init(hba);
> + if (err < 0)
> + return err;
> +
Should this be `if (err)`? The call chain is:
ufs_spacemit_uniprov1p6_init()
-> ufs_spacemit_dme_set()
-> ufshcd_dme_set()
-> ufshcd_dme_set_attr()
ufshcd_dme_set_attr() returns 0 on success and non-zero on failure,
including positive UIC error codes. The current check misses those.
Also, ufshcd_link_startup() ignores the PRE_CHANGE return value in this
series' base, so returning an error here alone will not abort startup.
> [...]
>
> +static int ufs_spacemit_apply_dev_quirks(struct ufs_hba *hba)
> +{
> [...]
> + err = ufs_spacemit_dme_set(hba, setup_attrs, ARRAY_SIZE(setup_attrs));
> + if (err < 0)
> + return err;
The same `if (err)` check is needed here for positive DME errors.
> +
> + return ufs_spacemit_wait_mphy_pll_lock(hba);
> +}
> +
> [...]
>
> +static int ufs_spacemit_init(struct ufs_hba *hba)
> +{
> [...]
> + hba->caps |= UFSHCD_CAP_RPM_AUTOSUSPEND;
> +
> + return 0;
> +}
> +
--
Troy Mitchell
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 248 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Yixun Lan" <dlan@kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Avri Altman" <avri.altman@sandisk.com>,
"Bart Van Assche" <bvanassche@acm.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Martin K. Petersen" <mkp@kernel.org>
Cc: "Anirudh Srinivasan" <asrinivasan@oss.tenstorrent.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jennifer Berringer" <jberring@redhat.com>,
<linux-scsi@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-riscv@lists.infradead.org>, <spacemit@lists.linux.dev>,
<linux-kernel@vger.kernel.org>,
"Troy Mitchell" <troy.mitchell@linux.spacemit.com>
Subject: Re: [PATCH v6 2/2] scsi: ufs: spacemit: k3: Add UFS Host Controller driver
Date: Tue, 22 Sep 2026 17:25:03 +0800 [thread overview]
Message-ID: <DLLQJDEA91FU.18Q1TSX09AUR3@linux.spacemit.com> (raw)
In-Reply-To: <20260921-08-k3-ufs-support-v6-2-3479768a2299@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]
On Mon Sep 21, 2026 at 8:36 PM +08, Yixun Lan wrote:
> [...]
>
> +static int ufs_spacemit_link_startup_pre_change(struct ufs_hba *hba)
> +{
> + u32 value, sys1clk_1us;
> + int err;
> +
> + err = ufs_spacemit_mphy_init(hba);
> + if (err < 0)
> + return err;
> +
> + err = ufs_spacemit_uniprov1p6_init(hba);
> + if (err < 0)
> + return err;
> +
Should this be `if (err)`? The call chain is:
ufs_spacemit_uniprov1p6_init()
-> ufs_spacemit_dme_set()
-> ufshcd_dme_set()
-> ufshcd_dme_set_attr()
ufshcd_dme_set_attr() returns 0 on success and non-zero on failure,
including positive UIC error codes. The current check misses those.
Also, ufshcd_link_startup() ignores the PRE_CHANGE return value in this
series' base, so returning an error here alone will not abort startup.
> [...]
>
> +static int ufs_spacemit_apply_dev_quirks(struct ufs_hba *hba)
> +{
> [...]
> + err = ufs_spacemit_dme_set(hba, setup_attrs, ARRAY_SIZE(setup_attrs));
> + if (err < 0)
> + return err;
The same `if (err)` check is needed here for positive DME errors.
> +
> + return ufs_spacemit_wait_mphy_pll_lock(hba);
> +}
> +
> [...]
>
> +static int ufs_spacemit_init(struct ufs_hba *hba)
> +{
> [...]
> + hba->caps |= UFSHCD_CAP_RPM_AUTOSUSPEND;
> +
> + return 0;
> +}
> +
--
Troy Mitchell
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 248 bytes --]
next prev parent reply other threads:[~2026-09-22 9:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 12:36 [PATCH v6 0/2] Add UFS Host driver support for SpacemiT K3 SoC Yixun Lan
2026-09-21 12:36 ` Yixun Lan
2026-09-21 12:36 ` [PATCH v6 1/2] scsi: ufs: spacemit: dt-bindings: Add UFS controller for " Yixun Lan
2026-09-21 12:36 ` Yixun Lan
2026-09-21 12:36 ` [PATCH v6 2/2] scsi: ufs: spacemit: k3: Add UFS Host Controller driver Yixun Lan
2026-09-21 12:36 ` Yixun Lan
2026-09-21 12:46 ` sashiko-bot
2026-10-02 3:06 ` Yixun Lan
2026-09-22 9:25 ` Troy Mitchell [this message]
2026-09-22 9:25 ` Troy Mitchell
2026-10-02 2:59 ` Yixun Lan
2026-10-02 2:59 ` Yixun Lan
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=DLLQJDEA91FU.18Q1TSX09AUR3@linux.spacemit.com \
--to=troy.mitchell@linux.spacemit.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alex@ghiti.fr \
--cc=alim.akhtar@samsung.com \
--cc=aou@eecs.berkeley.edu \
--cc=asrinivasan@oss.tenstorrent.com \
--cc=aurelien@aurel32.net \
--cc=avri.altman@sandisk.com \
--cc=bvanassche@acm.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlan@kernel.org \
--cc=jberring@redhat.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=spacemit@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.