Skip to contentSkip to conversation

clk: Add Sunplus SP7021 clock driver

PATCH RESEND Applied Qin Jian 2 participants 2 messages Dec 19, 2022 – Mar 20, 2023

Subsystems (2)
lore
Share & tools
lore

Qin Jian

author maintainer
#0 lore raw

PATCH RESEND v2 1/1 clk: Add Sunplus SP7021 clock driver

Add clock driver for Sunplus SP7021 SoC.

---
Addressed Dan's comments: https://lore.kernel.org/lkml/[email protected]/

---
 MAINTAINERS                  |   1 +
 drivers/clk/Kconfig          |  10 +
 drivers/clk/Makefile         |   1 +
 drivers/clk/clk-sp7021.c     | 711 +++++++++++++++++++++++++++++++++++
 include/linux/clk-provider.h |  18 +
 5 files changed, 741 insertions(+)
 create mode 100644 drivers/clk/clk-sp7021.c
MAINTAINERS +1 -0
index 8a5012ba6..d7c875ac6 100644
@@ -2883,6 +2883,7 @@ F:	Documentation/devicetree/bindings/reset/sunplus,reset.yaml
 F:	arch/arm/boot/dts/sunplus-sp7021*.dts*
 F:	arch/arm/configs/sp7021_*defconfig
 F:	arch/arm/mach-sunplus/
+F:	drivers/clk/clk-sp7021.c
 F:	drivers/irqchip/irq-sp7021-intc.c
 F:	drivers/reset/reset-sunplus.c
 F:	include/dt-bindings/clock/sunplus,sp7021-clkc.h
drivers/clk/Kconfig +10 -0
index 48f8f4221..134919446 100644
@@ -428,6 +428,16 @@ config COMMON_CLK_K210
 	help
 	  Support for the Canaan Kendryte K210 RISC-V SoC clocks.
 
+config COMMON_CLK_SP7021
+	tristate "Clock driver for Sunplus SP7021 SoC"
+	depends on SOC_SP7021 || COMPILE_TEST
+	default SOC_SP7021
+	help
+	  This driver supports the Sunplus SP7021 SoC clocks.
+	  It implements SP7021 PLLs/gate.
+	  Not all features of the PLL are currently supported
+	  by the driver.
+
 source "drivers/clk/actions/Kconfig"
 source "drivers/clk/analogbits/Kconfig"
 source "drivers/clk/baikal-t1/Kconfig"
drivers/clk/Makefile +1 -0
index d5db170d3..2979675a5 100644
@@ -65,6 +65,7 @@ obj-$(CONFIG_COMMON_CLK_SI5351)		+= clk-si5351.o
 obj-$(CONFIG_COMMON_CLK_SI514)		+= clk-si514.o
 obj-$(CONFIG_COMMON_CLK_SI544)		+= clk-si544.o
 obj-$(CONFIG_COMMON_CLK_SI570)		+= clk-si570.o
+obj-$(CONFIG_COMMON_CLK_SP7021)		+= clk-sp7021.o
 obj-$(CONFIG_COMMON_CLK_STM32F)		+= clk-stm32f4.o
 obj-$(CONFIG_COMMON_CLK_STM32H7)	+= clk-stm32h7.o
 obj-$(CONFIG_COMMON_CLK_STM32MP157)	+= clk-stm32mp1.o
drivers/clk/clk-sp7021.c new file +711 -0

711 lines not on this page · raw message

include/linux/clk-provider.h +18 -0
index 1615010aa..672866c3e 100644
@@ -567,6 +567,24 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
 	__devm_clk_hw_register_gate((dev), NULL, (name), (parent_name), NULL, \
 			       NULL, (flags), (reg), (bit_idx),		      \
 			       (clk_gate_flags), (lock))
+/**
+ * devm_clk_hw_register_gate_parent_data - register a gate clock with the
+ * clock framework
+ * @dev: device that is registering this clock
+ * @name: name of this clock
+ * @parent_data: parent clk data
+ * @flags: framework-specific flags for this clock
+ * @reg: register address to control gating of this clock
+ * @bit_idx: which bit in the register controls gating of this clock
+ * @clk_gate_flags: gate-specific flags for this clock
+ * @lock: shared register lock for this clock
+ */
+#define devm_clk_hw_register_gate_parent_data(dev, name, parent_data, flags,  \
+					      reg, bit_idx, clk_gate_flags,   \
+					      lock)                           \
+	__devm_clk_hw_register_gate((dev), NULL, (name), NULL, NULL,	      \
+				    (parent_data), (flags), (reg), (bit_idx), \
+				    (clk_gate_flags), (lock))
 void clk_unregister_gate(struct clk *clk);
 void clk_hw_unregister_gate(struct clk_hw *hw);
 int clk_gate_is_enabled(struct clk_hw *hw);

base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868

Signature · 7 lines
2.33.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel