git: 5c25d7b78da0 - main - aw_ccu: h6: Fix the P factor of the CPUX PLL
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 09:51:33 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=5c25d7b78da04dd1f78e889d616abc425062320a
commit 5c25d7b78da04dd1f78e889d616abc425062320a
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-10 16:09:59 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-12 09:47:30 +0000
aw_ccu: h6: Fix the P factor of the CPUX PLL
The P factor of the CPUX PLL was defined on the bits 1:0, which are the
M factor that is only used for testing, instead of bits 17:16. It was
also defined as one to four when it is a divider of 1, 2 or 4, as the H6
manual says.
Read it from the correct bits as a power of two. It should only be used
for frequencies lower than 288MHz, which the minimum of N does not
allow, so always search the rate with it at 1 as Linux does.
Tested on: H6
---
sys/dev/clk/allwinner/ccu_h6.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sys/dev/clk/allwinner/ccu_h6.c b/sys/dev/clk/allwinner/ccu_h6.c
index 9ff89d6dfdcd..5aa2cea62fbd 100644
--- a/sys/dev/clk/allwinner/ccu_h6.c
+++ b/sys/dev/clk/allwinner/ccu_h6.c
@@ -168,13 +168,20 @@ FIXED_CLK(osc12m_clk,
2, /* div */
0); /* flags */
+/*
+ * The P factor, bits 17:16, is /1, /2 or /4 and should only be used for
+ * frequencies lower than 288MHz, which the minimum of N does not allow. It
+ * is read but the rate is always searched with it at 1. The bits 1:0 are
+ * the M factor which is only used for testing, it is not used.
+ */
static const char *pll_cpux_parents[] = {"osc24M"};
NP_CLK(pll_cpux_clk,
CLK_PLL_CPUX, /* id */
"pll_cpux", pll_cpux_parents, /* name, parents */
0x00, /* offset */
8, 8, 0, AW_CLK_FACTOR_MIN_VALUE, 12, /* n factor */
- 0, 2, 0, 0, /* p factor */
+ 16, 2, 1, AW_CLK_FACTOR_POWER_OF_TWO |
+ AW_CLK_FACTOR_SEARCH_VALUE, /* p factor */
31, /* gate */
28, 1000, /* lock */
AW_CLK_HAS_GATE | AW_CLK_HAS_LOCK); /* flags */