From: Ilia Snezhkov <iasnezhkov@gmail.com>
To: peter.wang@mediatek.com, stanley.chu@mediatek.com,
martin.petersen@oracle.com,
James.Bottomley@HansenPartnership.com
Cc: matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
louisalexis.eyraud@collabora.com, linux-scsi@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] scsi: ufs: mediatek: allow clock scaling when ufs_fde is absent
Date: Thu, 26 Nov 2026 00:53:31 +0000 [thread overview]
Message-ID: <20261126005329.72010-3-iasnezhkov@gmail.com> (raw)
In-Reply-To: <20261126005329.72010-1-iasnezhkov@gmail.com>
ufs_mtk_is_clk_scale_ready() enables UFSHCD_CAP_CLK_SCALING whenever
ufs_sel, ufs_sel_max_src, and ufs_sel_min_src are present, treating the
FDE (AES) clock as optional. However, _ufs_mtk_clk_scale() bails out
early on !fde_clki, so on SoCs without a ufs_fde clock (such as MT6789)
ufshcd believes scaling succeeded and updates clki->curr_freq while the
ufs_sel mux never switches parents.
Only require clki (ufs_sel) in _ufs_mtk_clk_scale(), and gate
clk_fde_scale on fde_clki being non-NULL alongside its min/max parents.
Found on hardware and drafted with an AI coding assistant.
Fixes: 5e5976f5242d ("scsi: ufs: host: mediatek: Support FDE (AES) clock scaling")
Signed-off-by: Ilia Snezhkov <iasnezhkov@gmail.com>
---
drivers/ufs/host/ufs-mediatek.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 38d05ac..09b7993 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -2059,7 +2059,7 @@ static void _ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up)
if (!hba->clk_scaling.is_initialized)
return;
- if (!clki || !fde_clki)
+ if (!clki)
return;
reg = host->mclk.reg_vcore;
@@ -2067,7 +2067,7 @@ static void _ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up)
if (reg && volt != 0)
clk_bind_vcore = true;
- if (mclk->ufs_fde_max_clki && mclk->ufs_fde_min_clki)
+ if (fde_clki && mclk->ufs_fde_max_clki && mclk->ufs_fde_min_clki)
clk_fde_scale = true;
ret = clk_prepare_enable(clki->clk);
--
2.54.0 (Apple Git-157)
WARNING: multiple messages have this Message-ID (diff)
From: Ilia Snezhkov via B4 Relay <devnull+iasnezhkov.gmail.com@kernel.org>
To: peter.wang@mediatek.com, stanley.chu@mediatek.com,
martin.petersen@oracle.com,
James.Bottomley@HansenPartnership.com
Cc: matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
louisalexis.eyraud@collabora.com, linux-scsi@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] scsi: ufs: mediatek: allow clock scaling when ufs_fde is absent
Date: Thu, 26 Nov 2026 00:53:31 +0000 [thread overview]
Message-ID: <20261126005329.72010-3-iasnezhkov@gmail.com> (raw)
In-Reply-To: <20261126005329.72010-1-iasnezhkov@gmail.com>
From: Ilia Snezhkov <iasnezhkov@gmail.com>
ufs_mtk_is_clk_scale_ready() enables UFSHCD_CAP_CLK_SCALING whenever
ufs_sel, ufs_sel_max_src, and ufs_sel_min_src are present, treating the
FDE (AES) clock as optional. However, _ufs_mtk_clk_scale() bails out
early on !fde_clki, so on SoCs without a ufs_fde clock (such as MT6789)
ufshcd believes scaling succeeded and updates clki->curr_freq while the
ufs_sel mux never switches parents.
Only require clki (ufs_sel) in _ufs_mtk_clk_scale(), and gate
clk_fde_scale on fde_clki being non-NULL alongside its min/max parents.
Found on hardware and drafted with an AI coding assistant.
Fixes: 5e5976f5242d ("scsi: ufs: host: mediatek: Support FDE (AES) clock scaling")
Signed-off-by: Ilia Snezhkov <iasnezhkov@gmail.com>
---
drivers/ufs/host/ufs-mediatek.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 38d05ac..09b7993 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -2059,7 +2059,7 @@ static void _ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up)
if (!hba->clk_scaling.is_initialized)
return;
- if (!clki || !fde_clki)
+ if (!clki)
return;
reg = host->mclk.reg_vcore;
@@ -2067,7 +2067,7 @@ static void _ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up)
if (reg && volt != 0)
clk_bind_vcore = true;
- if (mclk->ufs_fde_max_clki && mclk->ufs_fde_min_clki)
+ if (fde_clki && mclk->ufs_fde_max_clki && mclk->ufs_fde_min_clki)
clk_fde_scale = true;
ret = clk_prepare_enable(clki->clk);
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-11-26 0:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 0:53 [PATCH 0/3] scsi: ufs: mediatek: pre-UniPro-1.8 adapt and clock scaling fixes Ilia Snezhkov
2026-11-26 0:53 ` Ilia Snezhkov via B4 Relay
2026-11-26 0:53 ` [PATCH 1/3] scsi: ufs: mediatek: skip PA_TXHSADAPTTYPE on pre-UniPro-1.8 hosts Ilia Snezhkov
2026-11-26 0:53 ` Ilia Snezhkov via B4 Relay
2026-11-26 0:59 ` sashiko-bot
2026-11-26 0:53 ` Ilia Snezhkov [this message]
2026-11-26 0:53 ` [PATCH 2/3] scsi: ufs: mediatek: allow clock scaling when ufs_fde is absent Ilia Snezhkov via B4 Relay
2026-11-26 0:53 ` [PATCH 3/3] scsi: ufs: mediatek: round scalable clock bounds to clk_round_rate() Ilia Snezhkov
2026-11-26 0:53 ` Ilia Snezhkov via B4 Relay
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=20261126005329.72010-3-iasnezhkov@gmail.com \
--to=iasnezhkov@gmail.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=louisalexis.eyraud@collabora.com \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=peter.wang@mediatek.com \
--cc=stanley.chu@mediatek.com \
/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.