Skip to contentSkip to conversation

clk: socfpga: agilex5: add clock driver for Agilex5

PATCH New Khairul Anuar Romli 1 participant 1 message Oct 13, 2025 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH v3 1/1 clk: socfpga: agilex5: add clock driver for Agilex5

In reply to a message not in the archive

Add the new Clock manager driver to support new Agilex5 platform. The new driver got rid of the clk_parent_data structures as there are no 'clock-names' property in the DT bindings and use parent_names internally. This is based on the previous feedback from the maintainer.

---
Changes in v3:
- Fix warning of commit message line more than 75 characters
- Align the code to match bracket.
Changes in v2:
- Add clk-agilex5 to Makefile
- Add Kconfig to include Agilex5 clock manager
- us of.h instead of of_device and of_address
- use devm_platform_ioremap_resource to simplify the get resource
- Fix bound-checking coverage struct clock_data
- Clean up harmless TODO comment

---
 drivers/clk/socfpga/Kconfig          |   2 +-
 drivers/clk/socfpga/Makefile         |   2 +-
 drivers/clk/socfpga/clk-agilex5.c    | 561 +++++++++++++++++++++++++++
 drivers/clk/socfpga/clk-gate-s10.c   |  53 +++
 drivers/clk/socfpga/clk-periph-s10.c |  41 ++
 drivers/clk/socfpga/clk-pll-s10.c    |  36 ++
 drivers/clk/socfpga/stratix10-clk.h  |  43 ++
 7 files changed, 736 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/socfpga/clk-agilex5.c
drivers/clk/socfpga/Kconfig +1 -1
index 0cf16b894efb..d88277e2a898 100644
@@ -13,7 +13,7 @@ config CLK_INTEL_SOCFPGA32
 	default ARM && ARCH_INTEL_SOCFPGA
 
 config CLK_INTEL_SOCFPGA64
-	bool "Intel Stratix / Agilex / N5X clock controller support" if COMPILE_TEST && (!ARM64 || !ARCH_INTEL_SOCFPGA)
+	bool "Intel Stratix / Agilex / N5X / Agilex5 clock controller support" if COMPILE_TEST && (!ARM64 || !ARCH_INTEL_SOCFPGA)
 	default ARM64 && ARCH_INTEL_SOCFPGA
 
 endif # CLK_INTEL_SOCFPGA
drivers/clk/socfpga/Makefile +1 -1
index e8dfce339c91..a1ea2b988eaf 100644
@@ -3,4 +3,4 @@ obj-$(CONFIG_CLK_INTEL_SOCFPGA32) += clk.o clk-gate.o clk-pll.o clk-periph.o \
 				     clk-pll-a10.o clk-periph-a10.o clk-gate-a10.o
 obj-$(CONFIG_CLK_INTEL_SOCFPGA64) += clk-s10.o \
 				     clk-pll-s10.o clk-periph-s10.o clk-gate-s10.o \
-				     clk-agilex.o
+				     clk-agilex.o clk-agilex5.o
drivers/clk/socfpga/clk-agilex5.c new file +561 -0

561 lines not on this page · raw message

drivers/clk/socfpga/clk-gate-s10.c +53 -0

56 lines not on this page · raw message

drivers/clk/socfpga/clk-periph-s10.c +41 -0

44 lines not on this page · raw message

drivers/clk/socfpga/clk-pll-s10.c +36 -0
index a88c212bda12..1be92827cd93 100644
@@ -304,3 +304,39 @@ struct clk_hw *n5x_register_pll(const struct stratix10_pll_clock *clks,
 	}
 	return hw_clk;
 }
+
+struct clk_hw *agilex5_register_pll(const struct agilex5_pll_clock *clks,
+				    void __iomem *reg)
+{
+	struct clk_hw *hw_clk;
+	struct socfpga_pll *pll_clk;
+	struct clk_init_data init;
+	const char *name = clks->name;
+	int ret;
+
+	pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL);
+	if (WARN_ON(!pll_clk))
+		return NULL;
+
+	pll_clk->hw.reg = reg + clks->offset;
+
+	if (streq(name, SOCFPGA_BOOT_CLK))
+		init.ops = &clk_boot_ops;
+	else
+		init.ops = &agilex_clk_pll_ops;
+
+	init.name = name;
+	init.flags = clks->flags;
+	init.num_parents = clks->num_parents;
+	init.parent_names = clks->parent_names;
+	pll_clk->hw.hw.init = &init;
+	pll_clk->hw.bit_idx = SOCFPGA_PLL_POWER;
+	hw_clk = &pll_clk->hw.hw;
+
+	ret = clk_hw_register(NULL, hw_clk);
+	if (ret) {
+		kfree(pll_clk);
+		return ERR_PTR(ret);
+	}
+	return hw_clk;
+}
drivers/clk/socfpga/stratix10-clk.h +43 -0

55 lines not on this page · raw message

Signature · 1 line
2.35.3