Skip to content

scsi: ufs: mediatek: pre-UniPro-1.8 adapt and clock scaling fixes

Ilia Snezhkov b4-sent linux-mediatek linux-scsi lkml 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v13 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- Patch 1: corrected Fixes tag to 7212d624f863 ("scsi: ufs: host:
mediatek: Fix PWM mode switch issue") and clarified mainline behavior after d3eba21c7170 vs older stable kernels.
- Patch 3: use IS_ERR_OR_NULL(clki->clk) and cast max_rounded to u64 before comparing with U32_MAX to avoid 32-bit -Wtype-limits warnings.
- Moved AI assistant disclosure out of commit logs (below --- and in this cover letter).

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3scsi: ufs: mediatek: skip PA_TXHSADAPTTYPE on pre-UniPro-1.8 hostsdrivers/ufs/host/ufs-mediatek.c+8 -111 reply
2/3scsi: ufs: mediatek: allow clock scaling when ufs_fde is absentdrivers/ufs/host/ufs-mediatek.c+2 -21 reply
3/3scsi: ufs: mediatek: round scalable clock bounds to clk_round_rate()drivers/ufs/host/ufs-mediatek.c+35 -01 reply

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchPeter Wang
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] scsi: ufs: mediatek: pre-UniPro-1.8 adapt and clock scaling fixes

This series fixes three bugs in the MediaTek UFS host driver observed on MT6789 (UFS 2.2, pre-UniPro-1.8, HS-G3 rate B, no ufs_fde clock):

1. Skip ufshcd_dme_configure_adapt() when host->hw_ver.major < 3 so pre-UniPro-1.8 hosts do not fail DME-SET on PA_TXHSADAPTTYPE (0x15d4) on every power-mode change.
2. Allow _ufs_mtk_clk_scale() to switch ufs_sel when the optional ufs_fde clock is absent, matching ufs_mtk_is_clk_scale_ready().
3. Round clki->max_freq and clki->min_freq with clk_round_rate() during ufs_mtk_init_clocks() so PLL-derived clocks whose rounded rate differs from the nominal DT frequency can scale back up in ufshcd_devfreq_target().

Changes since v1:
- Patch 1: corrected Fixes tag to 7212d624f863 ("scsi: ufs: host:
mediatek: Fix PWM mode switch issue") and clarified mainline behavior after d3eba21c7170 vs older stable kernels.
- Patch 3: use IS_ERR_OR_NULL(clki->clk) and cast max_rounded to u64 before comparing with U32_MAX to avoid 32-bit -Wtype-limits warnings.
- Moved AI assistant disclosure out of commit logs (below --- and in this cover letter).

Found on hardware and drafted with an AI coding assistant.

Ilia Snezhkov (3):
scsi: ufs: mediatek: skip PA_TXHSADAPTTYPE on pre-UniPro-1.8 hosts
scsi: ufs: mediatek: allow clock scaling when ufs_fde is absent
scsi: ufs: mediatek: round scalable clock bounds to clk_round_rate()

 drivers/ufs/host/ufs-mediatek.c | 58 +++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 13 deletions(-)
Signature · 1 line
2.54.0 (Apple Git-157)