* [PATCH 0/2] clk: mediatek: Fix FHCTL DDS mask widths for mt8173, mt6795
@ 2026-09-12 6:40 Ryan Brue
2026-09-12 6:40 ` [PATCH 1/2] clk: mediatek: mt8173: fix the FHCTL DDS mask width Ryan Brue
2026-09-12 6:40 ` [PATCH 2/2] clk: mediatek: mt6795: " Ryan Brue
0 siblings, 2 replies; 3+ messages in thread
From: Ryan Brue @ 2026-09-12 6:40 UTC (permalink / raw)
To: Stephen Boyd, Brian Masney, Jerome Brunet, Matthias Brugger,
AngeloGioacchino Del Regno, Chen-Yu Tsai
Cc: linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek,
Ryan Brue
Discovered this while working on bringup for the Amazon Fire HD 10 (2017).
In f222a1baec5f ("clk: mediatek: mt6795: Add support for frequency hopping
through FHCTL"), and 45a5cbe05d1f ("clk: mediatek: mt8173: Add support
for frequency hopping through FHCTL"), the DDS masks were set to the same
GENMASK(21, 0) as mt8186, mt8192, and mt8195, despite not having the same
pcwbits (21 as opposed to 22). These two patches correct that.
Tested on an Amazon Fire HD 10 (2017), an mt8173 tablet, across 6 MMPLL
rate changes. All of them timed out prior to this patchset, and all of
them succeed with the patchset. mt8173 currently doesn't use FHCTL, but
this will correct it for the future in case it does get used.
I do not have an mt6795 to test with, but mt6795-sony-xperia-m5.dts is an
actual consumer of the FHCTL node, and switches it on for mainpll, mpll
and msdcpll. If someone has that device to test the second patch, that
would be appreciated. I do believe this is the correct fix though
regardless.
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
---
Ryan Brue (2):
clk: mediatek: mt8173: fix the FHCTL DDS mask width
clk: mediatek: mt6795: fix the FHCTL DDS mask width
drivers/clk/mediatek/clk-mt6795-apmixedsys.c | 2 +-
drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260912-mt8173-fix-dds-mask-width-6cb71c6fe4d1
Best regards,
--
Ryan Brue <ryanbrue.dev@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] clk: mediatek: mt8173: fix the FHCTL DDS mask width
2026-09-12 6:40 [PATCH 0/2] clk: mediatek: Fix FHCTL DDS mask widths for mt8173, mt6795 Ryan Brue
@ 2026-09-12 6:40 ` Ryan Brue
2026-09-12 6:40 ` [PATCH 2/2] clk: mediatek: mt6795: " Ryan Brue
1 sibling, 0 replies; 3+ messages in thread
From: Ryan Brue @ 2026-09-12 6:40 UTC (permalink / raw)
To: Stephen Boyd, Brian Masney, Jerome Brunet, Matthias Brugger,
AngeloGioacchino Del Regno, Chen-Yu Tsai
Cc: linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek,
Ryan Brue
MT8173's hoppable PLLs have pcwbits = 21, so the FHCTL DDS field is bits
20:0, but FH() declares .dds_mask = GENMASK(21, 0). Bit 21 of FHCTL_MON is
a status bit that comes up once a hop has settled, and new_dds from
mtk_pll_calc_values() is always 21-bit, so the poll in hopping_hw_flow()
never matches and every hop runs to the 1000 us timeout. The PLL does reach
the requested rate and clk_change_rate() discards the error, so the cost is
1 ms of atomic polling plus a warning and a register dump on each rate
change.
Six MMPLL rate changes on an Amazon Fire HD 10 (2017) all time out with
GENMASK(21, 0), MON reading the requested DDS with bit 21 set, and all pass
with GENMASK(20, 0).
mt8186, mt8192 and mt8195 share the constant but are correct, as their
hoppable PLLs really are 22-bit. mt6795 is fixed in the next patch.
Fixes: 45a5cbe05d1f ("clk: mediatek: mt8173: Add support for frequency hopping through FHCTL")
Assisted-by: LLM
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
---
drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
index d7d416172ab3..327240cd34fb 100644
--- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
+++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
@@ -100,7 +100,7 @@ enum fh_pll_id {
.fh_id = _fhid, \
.fh_ver = FHCTL_PLLFH_V1, \
.fhx_offset = _offset, \
- .dds_mask = GENMASK(21, 0), \
+ .dds_mask = GENMASK(20, 0), \
.slope0_value = 0x6003c97, \
.slope1_value = 0x6003c97, \
.sfstrx_en = BIT(2), \
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] clk: mediatek: mt6795: fix the FHCTL DDS mask width
2026-09-12 6:40 [PATCH 0/2] clk: mediatek: Fix FHCTL DDS mask widths for mt8173, mt6795 Ryan Brue
2026-09-12 6:40 ` [PATCH 1/2] clk: mediatek: mt8173: fix the FHCTL DDS mask width Ryan Brue
@ 2026-09-12 6:40 ` Ryan Brue
1 sibling, 0 replies; 3+ messages in thread
From: Ryan Brue @ 2026-09-12 6:40 UTC (permalink / raw)
To: Stephen Boyd, Brian Masney, Jerome Brunet, Matthias Brugger,
AngeloGioacchino Del Regno, Chen-Yu Tsai
Cc: linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek,
Ryan Brue
All eight PLLs in mt6795's pllfhs[] have pcwbits = 21, so the FHCTL DDS
field is bits 20:0, but _FH() declares .dds_mask = GENMASK(21, 0). As on
MT8173, new_dds from mtk_pll_calc_values() is always 21-bit, so admitting
bit 21 of FHCTL_MON into the poll in hopping_hw_flow() can only make it
time out. The same mask feeds the CON1 write-back and fhctl_set_ssc_regs().
Unlike MT8173 this path has a user: mt6795-sony-xperia-m5.dts switches
FHCTL on for mainpll, mpll and msdcpll, with SSC.
Found by inspection while fixing MT8173. I have no MT6795 hardware, so
this one is untested.
Fixes: f222a1baec5f ("clk: mediatek: mt6795: Add support for frequency hopping through FHCTL")
Assisted-by: LLM
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
---
drivers/clk/mediatek/clk-mt6795-apmixedsys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/mediatek/clk-mt6795-apmixedsys.c b/drivers/clk/mediatek/clk-mt6795-apmixedsys.c
index 123d5d7fea85..ff01cfefc31f 100644
--- a/drivers/clk/mediatek/clk-mt6795-apmixedsys.c
+++ b/drivers/clk/mediatek/clk-mt6795-apmixedsys.c
@@ -79,7 +79,7 @@ enum fh_pll_id {
.fh_id = _fhid, \
.fh_ver = FHCTL_PLLFH_V1, \
.fhx_offset = _offset, \
- .dds_mask = GENMASK(21, 0), \
+ .dds_mask = GENMASK(20, 0), \
.slope0_value = _slope, \
.slope1_value = _slope, \
.sfstrx_en = BIT(2), \
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-12 6:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-12 6:40 [PATCH 0/2] clk: mediatek: Fix FHCTL DDS mask widths for mt8173, mt6795 Ryan Brue
2026-09-12 6:40 ` [PATCH 1/2] clk: mediatek: mt8173: fix the FHCTL DDS mask width Ryan Brue
2026-09-12 6:40 ` [PATCH 2/2] clk: mediatek: mt6795: " Ryan Brue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox