Skip to contentSkip to conversation

dt-bindings: clock: add loongson-2 boot clock index

PATCH Applied Yinbo Zhu 2 participants 4 messages Mar 23, 2023 – Mar 27, 2023

Subsystems (3)
lore
Share & tools
lore

Yinbo Zhu

author maintainer
#0 lore raw

PATCH v16 1/2 dt-bindings: clock: add loongson-2 boot clock index

The Loongson-2 boot clock was used to spi and lio peripheral and this patch was to add boot clock index number.

---
Change in v16:
1. NO change, but other patch in this series of patches has changes.
Change in v15:
1. Add the acked-by for review information.
Change in v14:
1. Add the history changelog for this patch.
2. Move the boot clock index in ending.
Change in v13:
1. Add this patch as new patch and the clock driver patch need depend on this patch so add this patch as a series and set version number was v13.
Change in v2 to v12:
1. This patch doesn't exit, so no changelog.

 include/dt-bindings/clock/loongson,ls2k-clk.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/dt-bindings/clock/loongson,ls2k-clk.h +2 -1
index db1e27e792ff..3bc4dfc193c2 100644
@@ -24,6 +24,7 @@
 #define LOONGSON2_SATA_CLK				14
 #define LOONGSON2_PIX0_CLK				15
 #define LOONGSON2_PIX1_CLK				16
-#define LOONGSON2_CLK_END				17
+#define LOONGSON2_BOOT_CLK				17
+#define LOONGSON2_CLK_END				18
 
 #endif
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH v16 2/2 clk: clk-loongson2: add clock controller driver support

This driver provides support for clock controller on Loongson-2 SoC, the Loongson-2 SoC uses a 100MHz clock as the PLL reference clock, there are five independent PLLs inside, each of which PLL can provide up to three sets of frequency dependent clock outputs.

---
Change in v16:
1. Remove useless comment.
2. Return an error instead of be void on loongson2_check_clk_hws.
3. Replace clk_hw_register_divider with devm_clk_hw_register_divider.
4. Return an error code when call devm_of_clk_add_hw_provider.
5. Move the loongson2_clk_match_table above loongson2_clk_driver.
6. Use IS_ERR to judge loongson2_pll_base whether was a err pointer.
7. Get rid of the function loongson2_clocks_init() and move the code in that function into probe function.
Change in v15:
1. Remove the depends on COMMON_CLK && OF and add depend on LOONGARCH || COMPILE_TEST.
2. Remove some head file that include "linux/of.h", "linux/of_address.h" and "linux/clk.h".
3. Remove the initialization of .name in struct clk_parent_data.
4. Replace device node with struct device.
5. Replace of_clk_hw_register with devm_clk_hw_register.
6. Remove the initialized operaion in loongson2_calc_pll_rate.
7. Inline the function about loongson2_clocks_init.
8. Replace of_iomap with devm_platform_ioremap_resource.
9. Drop error messages when mapping.
10. Replace kzalloc with devm_kzalloc.
Change in v14:
1. For some board's config file doesn't enable CONFIG_64BIT and will report readq undefine error, and this version was to add include <linux/io-64-nonatomic-lo-hi.h> to fix this issue.
Change in v13:
1. Add the Loongson-2 boot clk support.
Change in v12:
1. Change driver register way that use platform driver register.
Change in v11:
1. Remove the repetitive COMMON_CLK config in loongarch Kconfig.
2. Fixup the help paragraph descprition in COMMON_CLK_LOONGSON2.
3. Drop the <linux/clkdev.h>.
4. Drop the cast in clock driver.
5. Use div_u64() replace do_div().
6. Inline this function for loongson2_check_clk_hws.
7. Fixup the comma deposition on the loongson2_check_clk_hws.
8. Drop the loongson2_obtain_fixed_clk_hw and rework this driver use clk_parent_data and the 'fw_name'.
Change in v10:
1. Detach of_clk_init to another patch.
Change in v9:
1. Add all history changelog information.
Change in v8:
1. Remove the flag "CLK_IS_BASIC".
Change in v7:
1. Adjust position alphabetically in Kconfig and Makefile.
2. Add static for loongson2_pll_base.
3. Move other file-scope variables in probe.
Change in v6:
1. NO change, but other patch in this series of patches has changes.
Change in v5:
1. Replace loongson2 with Loongson-2 in commit info.
2. Replace Loongson2 with Loongson-2 in binding and Kconfig file.
3. Replace soc with SoC.
Change in v4:
1. Fixup clock-names that replace "xxx-clk" with "xxx".
Change in v3:
1. NO change, but other patch in this series of patches has changes.
Change in v2:
1. Update the include filename.
2. Change string from refclk/REFCLK to ref/REF.

 MAINTAINERS                 |   1 +
 drivers/clk/Kconfig         |   9 +
 drivers/clk/Makefile        |   1 +
 drivers/clk/clk-loongson2.c | 341 ++++++++++++++++++++++++++++++++++++
 4 files changed, 352 insertions(+)
 create mode 100644 drivers/clk/clk-loongson2.c
MAINTAINERS +1 -0
index 25a0981c74b6..a6983bf85956 100644
@@ -12155,6 +12155,7 @@ M:	Yinbo Zhu <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/clock/loongson,ls2k-clk.yaml
+F:	drivers/clk/clk-loongson2.c
 F:	include/dt-bindings/clock/loongson,ls2k-clk.h
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
drivers/clk/Kconfig +9 -0
index 1eef05bb1f99..6da372fcc56a 100644
@@ -325,6 +325,15 @@ config COMMON_CLK_LOCHNAGAR
 	  This driver supports the clocking features of the Cirrus Logic
 	  Lochnagar audio development board.
 
+config COMMON_CLK_LOONGSON2
+	bool "Clock driver for Loongson-2 SoC"
+	depends on LOONGARCH || COMPILE_TEST
+	help
+          This driver provides support for clock controller on Loongson-2 SoC.
+          The clock controller can generates and supplies clock to various
+          peripherals within the SoC.
+          Say Y here to support Loongson-2 SoC clock driver.
+
 config COMMON_CLK_NXP
 	def_bool COMMON_CLK && (ARCH_LPC18XX || ARCH_LPC32XX)
 	select REGMAP_MMIO if ARCH_LPC32XX
drivers/clk/Makefile +1 -0
index e3ca0d058a25..b298c5dabc1a 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_COMMON_CLK_K210)		+= clk-k210.o
 obj-$(CONFIG_LMK04832)			+= clk-lmk04832.o
 obj-$(CONFIG_COMMON_CLK_LAN966X)	+= clk-lan966x.o
 obj-$(CONFIG_COMMON_CLK_LOCHNAGAR)	+= clk-lochnagar.o
+obj-$(CONFIG_COMMON_CLK_LOONGSON2)	+= clk-loongson2.o
 obj-$(CONFIG_COMMON_CLK_MAX77686)	+= clk-max77686.o
 obj-$(CONFIG_COMMON_CLK_MAX9485)	+= clk-max9485.o
 obj-$(CONFIG_ARCH_MILBEAUT_M10V)	+= clk-milbeaut.o
drivers/clk/clk-loongson2.c new file +341 -0

341 lines not on this page · raw message

Signature · 1 line
2.20.1
maintainer Applied
#2 lore raw

Re: [PATCH v16 2/2] clk: clk-loongson2: add clock controller driver support

Quoting Yinbo Zhu (2023-03-22 19:52:29)

Quoted 7 lines

This driver provides support for clock controller on Loongson-2 SoC, the Loongson-2 SoC uses a 100MHz clock as the PLL reference clock, there are five independent PLLs inside, each of which PLL can provide up to three sets of frequency dependent clock outputs.

---

Applied to clk-next