git: 6f35f21323c1 - main - aw_ccu: h6: Add the DRAM clock
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 09:51:40 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=6f35f21323c1cfcfc137087af0cd5d8f4a995c46
commit 6f35f21323c1cfcfc137087af0cd5d8f4a995c46
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-10 17:07:12 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-12 09:47:31 +0000
aw_ccu: h6: Add the DRAM clock
Add the DRAM clock, which is PLL_DDR0 divided by 1 to 4, and the bus
gate and the reset of the DRAM. The firmware sets up the DRAM, they are
not meant to be changed.
Tested on: H6
---
sys/dev/clk/allwinner/ccu_h6.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/sys/dev/clk/allwinner/ccu_h6.c b/sys/dev/clk/allwinner/ccu_h6.c
index 5251ae5f3aa5..a1848d5e820d 100644
--- a/sys/dev/clk/allwinner/ccu_h6.c
+++ b/sys/dev/clk/allwinner/ccu_h6.c
@@ -71,6 +71,8 @@
#define CLK_AHB3 25
#define CLK_APB2 27
#define CLK_MBUS 28
+#define CLK_DRAM 52
+#define CLK_BUS_DRAM 60
static struct aw_ccung_reset h6_ccu_resets[] = {
/* MBUS_CFG_REG */
@@ -104,6 +106,9 @@ static struct aw_ccung_reset h6_ccu_resets[] = {
*/
CCU_RESET(RST_BUS_IOMMU, 0x7bc, 16)
+ /* DRAM_BGR_REG */
+ CCU_RESET(RST_BUS_DRAM, 0x80c, 16)
+
/* SMHC_BGR_REG */
CCU_RESET(RST_BUS_MMC0, 0x84c, 16)
CCU_RESET(RST_BUS_MMC1, 0x84c, 17)
@@ -183,6 +188,9 @@ static struct aw_ccung_gate h6_ccu_gates[] = {
CCU_GATE(CLK_MBUS_CSI, "mbus-csi", "mbus", 0x804, 8)
CCU_GATE(CLK_MBUS_DEINTERLACE, "mbus-deinterlace", "mbus", 0x804, 11)
+ /* DRAM_BGR_REG */
+ CCU_GATE(CLK_BUS_DRAM, "bus-dram", "psi_ahb1_ahb2", 0x80c, 0)
+
/* SMHC_BGR_REG */
CCU_GATE(CLK_BUS_MMC0, "bus-mmc0", "ahb3", 0x84c, 0)
CCU_GATE(CLK_BUS_MMC1, "bus-mmc1", "ahb3", 0x84c, 1)
@@ -535,6 +543,16 @@ M_CLK(mbus_clk,
31, /* gate */
AW_CLK_HAS_MUX | AW_CLK_HAS_GATE); /* flags */
+/* The DRAM is set up by the firmware, its rate should not be changed */
+static const char *dram_parents[] = {"pll_ddr0"};
+M_CLK(dram_clk,
+ CLK_DRAM, "dram", dram_parents, /* id, name, parents */
+ 0x800, /* offset */
+ 0, 2, 0, 0, /* m factor */
+ 24, 2, /* mux */
+ 0, /* gate */
+ AW_CLK_HAS_MUX); /* flags */
+
static struct aw_ccung_clk h6_ccu_clks[] = {
{ .type = AW_CLK_NP, .clk.np = &pll_cpux_clk},
{ .type = AW_CLK_NMM, .clk.nmm = &pll_ddr0_clk},
@@ -556,6 +574,7 @@ static struct aw_ccung_clk h6_ccu_clks[] = {
{ .type = AW_CLK_NM, .clk.nm = &apb1_clk},
{ .type = AW_CLK_NM, .clk.nm = &apb2_clk},
{ .type = AW_CLK_M, .clk.m = &mbus_clk},
+ { .type = AW_CLK_M, .clk.m = &dram_clk},
{ .type = AW_CLK_NM, .clk.nm = &mmc0_clk},
{ .type = AW_CLK_NM, .clk.nm = &mmc1_clk},