git: 433e4c0a6ea4 - main - aw_ccu: h6: Add the CPUX, AXI and CPUX_APB clocks

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 12 Nov 2026 09:51:35 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=433e4c0a6ea42b92894aebbd5bf3cf4712e39b6f

commit 433e4c0a6ea42b92894aebbd5bf3cf4712e39b6f
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-10 16:28:37 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-12 09:47:30 +0000

    aw_ccu: h6: Add the CPUX, AXI and CPUX_APB clocks
    
    Add the clocks of the CPU from the CPUX_AXI_CFG register: cpux, which
    selects between OSC24M, the 32kHz clock, the 16MHz RC oscillator and
    PLL_CPUX, and the AXI and APB clocks of the CPU, which are cpux divided
    by 1 to 4.  The cpu nodes of the device tree use CLK_CPUX.
    
    Tested on: H6
---
 sys/dev/clk/allwinner/ccu_h6.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/sys/dev/clk/allwinner/ccu_h6.c b/sys/dev/clk/allwinner/ccu_h6.c
index 61dca3c0eb37..a3c140f481e8 100644
--- a/sys/dev/clk/allwinner/ccu_h6.c
+++ b/sys/dev/clk/allwinner/ccu_h6.c
@@ -65,6 +65,8 @@
 #define	CLK_PLL_DE		14
 #define	CLK_PLL_HSIC		16
 
+#define	CLK_AXI			22
+#define	CLK_CPUX_APB		23
 #define	CLK_PSI_AHB1_AHB2	24
 #define	CLK_AHB3		25
 #define	CLK_APB2		27
@@ -360,7 +362,27 @@ NMM_CLK(pll_hsic_clk,
 
 /* PLL_AUDIO missing */
 
-/* CPUX_AXI missing */
+static const char *cpux_parents[] = {"osc24M", "osc32k", "iosc", "pll_cpux"};
+MUX_CLK(cpux_clk,
+    CLK_CPUX,			/* id */
+    "cpux", cpux_parents,	/* name, parents */
+    0x500, 24, 2);		/* offset, shift, width */
+
+static const char *axi_parents[] = {"cpux"};
+DIV_CLK(axi_clk,
+    CLK_AXI,			/* id */
+    "axi", axi_parents,		/* name, parents */
+    0x500,			/* offset */
+    0, 2,			/* shift, width */
+    0, NULL);			/* flags, div table */
+
+static const char *cpux_apb_parents[] = {"cpux"};
+DIV_CLK(cpux_apb_clk,
+    CLK_CPUX_APB,		/* id */
+    "cpux_apb", cpux_apb_parents,	/* name, parents */
+    0x500,			/* offset */
+    8, 2,			/* shift, width */
+    0, NULL);			/* flags, div table */
 
 static const char *psi_ahb1_ahb2_parents[] = {"osc24M", "osc32k", "iosc", "pll_periph0"};
 NM_CLK(psi_ahb1_ahb2_clk,
@@ -447,6 +469,10 @@ static struct aw_ccung_clk h6_ccu_clks[] = {
 	{ .type = AW_CLK_NMM, .clk.nmm = &pll_de_clk},
 	{ .type = AW_CLK_NMM, .clk.nmm = &pll_hsic_clk},
 
+	{ .type = AW_CLK_MUX, .clk.mux = &cpux_clk},
+	{ .type = AW_CLK_DIV, .clk.div = &axi_clk},
+	{ .type = AW_CLK_DIV, .clk.div = &cpux_apb_clk},
+
 	{ .type = AW_CLK_NM, .clk.nm = &psi_ahb1_ahb2_clk},
 	{ .type = AW_CLK_NM, .clk.nm = &ahb3_clk},
 	{ .type = AW_CLK_NM, .clk.nm = &apb1_clk},