From: Ilia Snezhkov <iasnezhkov@gmail.com>
To: Peter Wang <peter.wang@mediatek.com>
Cc: stanley.chu@mediatek.com, martin.petersen@oracle.com,
James.Bottomley@HansenPartnership.com, 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: Re: [PATCH v2 3/3] scsi: ufs: mediatek: round scalable clock bounds to clk_round_rate()
Date: Fri, 27 Nov 2026 09:14:28 +0800 [thread overview]
Message-ID: <179574206826.56397.7920531590189565888@gmail.com> (raw)
In-Reply-To: <00ba0aec941a72c8401eab7c3d4036caa2ae8aee.camel@mediatek.com>
Hi Peter,
It is not a missing hardware calibration — it comes directly from the
fractional-N PLL PCW quantization against the 26 MHz reference crystal
(clk26m).
On MT6789, msdcpll has pcwbits = 22 and pcwibits = 8 (14 fractional
bits, 2^14 = 16384), with VCO range 1500..3800 MHz, and ufs_sel_max_src
is msdcpll_d2 (msdcpll / 2). To target msdcpll = 384 MHz (msdcpll_d2 =
192 MHz) at postdiv = 4, VCO = 1536 MHz, so the required multiplier is:
1536 / 26 = 768 / 13 = 59 + 1/13
Because 1/13 is a non-terminating binary fraction, no integer PCW value
can represent 384 MHz exactly in 14 fractional bits:
pcw = 0xec4ec (967916) -> vco = 1535999512 Hz -> msdcpll = 383999878 Hz -> msdcpll_d2 = 191999939 Hz (-61 Hz)
pcw = 0xec4ed (967917) -> vco = 1536001099 Hz -> msdcpll = 384000275 Hz -> msdcpll_d2 = 192000137 Hz (+137 Hz)
(With postdiv = 8, VCO = 3072 MHz = 26 MHz * (118 + 2/13), the closest
PCW values give 191999939 Hz and 192000038 Hz — still never exactly
192000000 Hz.)
So the CCF __mtk_pll_recalc_rate() / clk_round_rate() result for
msdcpll_d2 is deterministically 191999939 Hz, which never matches a
nominal 192000000 Hz entry in freq-table-hz under ufshcd_devfreq_target()'s
exact `freq == clki->max_freq` check.
Best regards,
Ilia
next prev parent reply other threads:[~2026-11-27 1:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 3:10 [PATCH v2 0/3] scsi: ufs: mediatek: pre-UniPro-1.8 adapt and clock scaling fixes Ilia Snezhkov via B4 Relay
2026-11-26 3:10 ` [PATCH v2 1/3] scsi: ufs: mediatek: skip PA_TXHSADAPTTYPE on pre-UniPro-1.8 hosts Ilia Snezhkov via B4 Relay
2026-11-26 13:01 ` Peter Wang
2026-11-26 3:10 ` [PATCH v2 2/3] scsi: ufs: mediatek: allow clock scaling when ufs_fde is absent Ilia Snezhkov via B4 Relay
2026-11-26 13:03 ` Peter Wang
2026-11-27 1:10 ` Ilia Snezhkov
2026-11-27 6:44 ` Peter Wang
2026-11-26 3:10 ` [PATCH v2 3/3] scsi: ufs: mediatek: round scalable clock bounds to clk_round_rate() Ilia Snezhkov via B4 Relay
2026-11-26 13:04 ` Peter Wang
2026-11-27 1:14 ` Ilia Snezhkov [this message]
2026-11-27 7:11 ` Peter Wang
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=179574206826.56397.7920531590189565888@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®