xref: /linux/drivers/clk/starfive/clk-starfive-jh7100.c (revision 06d07429858317ded2db7986113a9e0129cd599b)
14210be66SGeert Uytterhoeven // SPDX-License-Identifier: GPL-2.0
24210be66SGeert Uytterhoeven /*
34210be66SGeert Uytterhoeven  * StarFive JH7100 Clock Generator Driver
44210be66SGeert Uytterhoeven  *
54210be66SGeert Uytterhoeven  * Copyright 2021 Ahmad Fatoum, Pengutronix
64210be66SGeert Uytterhoeven  * Copyright (C) 2021 Glider bv
74210be66SGeert Uytterhoeven  * Copyright (C) 2021 Emil Renner Berthing <kernel@esmil.dk>
84210be66SGeert Uytterhoeven  */
94210be66SGeert Uytterhoeven 
104210be66SGeert Uytterhoeven #include <linux/clk-provider.h>
114210be66SGeert Uytterhoeven #include <linux/device.h>
124210be66SGeert Uytterhoeven #include <linux/init.h>
134210be66SGeert Uytterhoeven #include <linux/mod_devicetable.h>
144210be66SGeert Uytterhoeven #include <linux/platform_device.h>
154210be66SGeert Uytterhoeven 
164210be66SGeert Uytterhoeven #include <dt-bindings/clock/starfive-jh7100.h>
174210be66SGeert Uytterhoeven 
18e19aa786SEmil Renner Berthing #include "clk-starfive-jh71x0.h"
1926ad971fSEmil Renner Berthing 
204210be66SGeert Uytterhoeven /* external clocks */
214210be66SGeert Uytterhoeven #define JH7100_CLK_OSC_SYS		(JH7100_CLK_END + 0)
224210be66SGeert Uytterhoeven #define JH7100_CLK_OSC_AUD		(JH7100_CLK_END + 1)
234210be66SGeert Uytterhoeven #define JH7100_CLK_GMAC_RMII_REF	(JH7100_CLK_END + 2)
244210be66SGeert Uytterhoeven #define JH7100_CLK_GMAC_GR_MII_RX	(JH7100_CLK_END + 3)
254210be66SGeert Uytterhoeven 
26147455edSEmil Renner Berthing static const struct jh71x0_clk_data jh7100_clk_data[] __initconst = {
27a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_CPUNDBUS_ROOT, "cpundbus_root", 0, 4,
284210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
294210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL0_OUT,
304210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL1_OUT,
314210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
32a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_DLA_ROOT, "dla_root", 0, 3,
334210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
344210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL1_OUT,
354210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
36a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_DSP_ROOT, "dsp_root", 0, 4,
374210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
384210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL0_OUT,
394210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL1_OUT,
404210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
41a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_GMACUSB_ROOT, "gmacusb_root", 0, 3,
424210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
434210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL0_OUT,
444210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
45a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_PERH0_ROOT, "perh0_root", 0, 2,
464210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
474210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL0_OUT),
48a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_PERH1_ROOT, "perh1_root", 0, 2,
494210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
504210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
51a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_VIN_ROOT, "vin_root", 0, 3,
524210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
534210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL1_OUT,
544210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
55a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_VOUT_ROOT, "vout_root", 0, 3,
564210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_AUD,
574210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL0_OUT,
584210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
59147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_AUDIO_ROOT, "audio_root", 0, 8, JH7100_CLK_PLL0_OUT),
60a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_CDECHIFI4_ROOT, "cdechifi4_root", 0, 3,
614210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
624210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL1_OUT,
634210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
64a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_CDEC_ROOT, "cdec_root", 0, 3,
654210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
664210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL0_OUT,
674210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL1_OUT),
68a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_VOUTBUS_ROOT, "voutbus_root", 0, 3,
694210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_AUD,
704210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL0_OUT,
714210be66SGeert Uytterhoeven 		    JH7100_CLK_PLL2_OUT),
72147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_CPUNBUS_ROOT_DIV, "cpunbus_root_div", 2, JH7100_CLK_CPUNDBUS_ROOT),
73147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_DSP_ROOT_DIV, "dsp_root_div", 4, JH7100_CLK_DSP_ROOT),
74147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_PERH0_SRC, "perh0_src", 4, JH7100_CLK_PERH0_ROOT),
75147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_PERH1_SRC, "perh1_src", 4, JH7100_CLK_PERH1_ROOT),
76147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_PLL0_TESTOUT, "pll0_testout", 0, 31, JH7100_CLK_PERH0_SRC),
77147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_PLL1_TESTOUT, "pll1_testout", 0, 31, JH7100_CLK_DLA_ROOT),
78147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_PLL2_TESTOUT, "pll2_testout", 0, 31, JH7100_CLK_PERH1_SRC),
79a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_PLL2_REF, "pll2_refclk", 0, 2,
804210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
814210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_AUD),
82147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_CPU_CORE, "cpu_core", 8, JH7100_CLK_CPUNBUS_ROOT_DIV),
83147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_CPU_AXI, "cpu_axi", 8, JH7100_CLK_CPU_CORE),
84147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_AHB_BUS, "ahb_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV),
85147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_APB1_BUS, "apb1_bus", 8, JH7100_CLK_AHB_BUS),
86147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_APB2_BUS, "apb2_bus", 8, JH7100_CLK_AHB_BUS),
87147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DOM3AHB_BUS, "dom3ahb_bus", CLK_IS_CRITICAL, JH7100_CLK_AHB_BUS),
88147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DOM7AHB_BUS, "dom7ahb_bus", CLK_IS_CRITICAL, JH7100_CLK_AHB_BUS),
89147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_U74_CORE0, "u74_core0", CLK_IS_CRITICAL, JH7100_CLK_CPU_CORE),
90147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_U74_CORE1, "u74_core1", CLK_IS_CRITICAL, 8, JH7100_CLK_CPU_CORE),
91147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_U74_AXI, "u74_axi", CLK_IS_CRITICAL, JH7100_CLK_CPU_AXI),
92147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_U74RTC_TOGGLE, "u74rtc_toggle", CLK_IS_CRITICAL, JH7100_CLK_OSC_SYS),
93147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SGDMA2P_AXI, "sgdma2p_axi", 0, JH7100_CLK_CPU_AXI),
94147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DMA2PNOC_AXI, "dma2pnoc_axi", 0, JH7100_CLK_CPU_AXI),
95147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SGDMA2P_AHB, "sgdma2p_ahb", 0, JH7100_CLK_AHB_BUS),
96147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_DLA_BUS, "dla_bus", 4, JH7100_CLK_DLA_ROOT),
97147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DLA_AXI, "dla_axi", 0, JH7100_CLK_DLA_BUS),
98147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DLANOC_AXI, "dlanoc_axi", 0, JH7100_CLK_DLA_BUS),
99147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DLA_APB, "dla_apb", 0, JH7100_CLK_APB1_BUS),
100147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_VP6_CORE, "vp6_core", 0, 4, JH7100_CLK_DSP_ROOT_DIV),
101147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_VP6BUS_SRC, "vp6bus_src", 4, JH7100_CLK_DSP_ROOT),
102147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_VP6_AXI, "vp6_axi", 0, 4, JH7100_CLK_VP6BUS_SRC),
103147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_VCDECBUS_SRC, "vcdecbus_src", 4, JH7100_CLK_CDECHIFI4_ROOT),
104147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_VDEC_BUS, "vdec_bus", 8, JH7100_CLK_VCDECBUS_SRC),
105147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VDEC_AXI, "vdec_axi", 0, JH7100_CLK_VDEC_BUS),
106147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VDECBRG_MAIN, "vdecbrg_mainclk", 0, JH7100_CLK_VDEC_BUS),
107147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_VDEC_BCLK, "vdec_bclk", 0, 8, JH7100_CLK_VCDECBUS_SRC),
108147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_VDEC_CCLK, "vdec_cclk", 0, 8, JH7100_CLK_CDEC_ROOT),
109147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VDEC_APB, "vdec_apb", 0, JH7100_CLK_APB1_BUS),
110147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_JPEG_AXI, "jpeg_axi", 0, 8, JH7100_CLK_CPUNBUS_ROOT_DIV),
111147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_JPEG_CCLK, "jpeg_cclk", 0, 8, JH7100_CLK_CPUNBUS_ROOT_DIV),
112147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_JPEG_APB, "jpeg_apb", 0, JH7100_CLK_APB1_BUS),
113147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_GC300_2X, "gc300_2x", 0, 8, JH7100_CLK_CDECHIFI4_ROOT),
114147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_GC300_AHB, "gc300_ahb", 0, JH7100_CLK_AHB_BUS),
115147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_JPCGC300_AXIBUS, "jpcgc300_axibus", 8, JH7100_CLK_VCDECBUS_SRC),
116147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_GC300_AXI, "gc300_axi", 0, JH7100_CLK_JPCGC300_AXIBUS),
117147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_JPCGC300_MAIN, "jpcgc300_mainclk", 0, JH7100_CLK_JPCGC300_AXIBUS),
118147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_VENC_BUS, "venc_bus", 8, JH7100_CLK_VCDECBUS_SRC),
119147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VENC_AXI, "venc_axi", 0, JH7100_CLK_VENC_BUS),
120147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VENCBRG_MAIN, "vencbrg_mainclk", 0, JH7100_CLK_VENC_BUS),
121147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_VENC_BCLK, "venc_bclk", 0, 8, JH7100_CLK_VCDECBUS_SRC),
122147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_VENC_CCLK, "venc_cclk", 0, 8, JH7100_CLK_CDEC_ROOT),
123147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VENC_APB, "venc_apb", 0, JH7100_CLK_APB1_BUS),
124147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_DDRPLL_DIV2, "ddrpll_div2", CLK_IS_CRITICAL, 2, JH7100_CLK_PLL1_OUT),
125147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_DDRPLL_DIV4, "ddrpll_div4", CLK_IS_CRITICAL, 2,
126147455edSEmil Renner Berthing 		    JH7100_CLK_DDRPLL_DIV2),
127147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_DDRPLL_DIV8, "ddrpll_div8", CLK_IS_CRITICAL, 2,
128147455edSEmil Renner Berthing 		    JH7100_CLK_DDRPLL_DIV4),
129147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_DDROSC_DIV2, "ddrosc_div2", CLK_IS_CRITICAL, 2, JH7100_CLK_OSC_SYS),
130147455edSEmil Renner Berthing 	JH71X0_GMUX(JH7100_CLK_DDRC0, "ddrc0", CLK_IS_CRITICAL, 4,
1314210be66SGeert Uytterhoeven 		    JH7100_CLK_DDROSC_DIV2,
1324210be66SGeert Uytterhoeven 		    JH7100_CLK_DDRPLL_DIV2,
1334210be66SGeert Uytterhoeven 		    JH7100_CLK_DDRPLL_DIV4,
1344210be66SGeert Uytterhoeven 		    JH7100_CLK_DDRPLL_DIV8),
135147455edSEmil Renner Berthing 	JH71X0_GMUX(JH7100_CLK_DDRC1, "ddrc1", CLK_IS_CRITICAL, 4,
1364210be66SGeert Uytterhoeven 		    JH7100_CLK_DDROSC_DIV2,
1374210be66SGeert Uytterhoeven 		    JH7100_CLK_DDRPLL_DIV2,
1384210be66SGeert Uytterhoeven 		    JH7100_CLK_DDRPLL_DIV4,
1394210be66SGeert Uytterhoeven 		    JH7100_CLK_DDRPLL_DIV8),
140147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DDRPHY_APB, "ddrphy_apb", 0, JH7100_CLK_APB1_BUS),
141147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_NOC_ROB, "noc_rob", 8, JH7100_CLK_CPUNBUS_ROOT_DIV),
142147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_NOC_COG, "noc_cog", 8, JH7100_CLK_DLA_ROOT),
143147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_NNE_AHB, "nne_ahb", 0, JH7100_CLK_AHB_BUS),
144147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_NNEBUS_SRC1, "nnebus_src1", 4, JH7100_CLK_DSP_ROOT),
145a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_NNE_BUS, "nne_bus", 0, 2,
1464210be66SGeert Uytterhoeven 		    JH7100_CLK_CPU_AXI,
1474210be66SGeert Uytterhoeven 		    JH7100_CLK_NNEBUS_SRC1),
148147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_NNE_AXI, "nne_axi", 0, JH7100_CLK_NNE_BUS),
149147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_NNENOC_AXI, "nnenoc_axi", 0, JH7100_CLK_NNE_BUS),
150147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DLASLV_AXI, "dlaslv_axi", 0, JH7100_CLK_NNE_BUS),
151147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DSPX2C_AXI, "dspx2c_axi", CLK_IS_CRITICAL, JH7100_CLK_NNE_BUS),
152147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_HIFI4_SRC, "hifi4_src", 4, JH7100_CLK_CDECHIFI4_ROOT),
153147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_HIFI4_COREFREE, "hifi4_corefree", 8, JH7100_CLK_HIFI4_SRC),
154147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_HIFI4_CORE, "hifi4_core", 0, JH7100_CLK_HIFI4_COREFREE),
155147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_HIFI4_BUS, "hifi4_bus", 8, JH7100_CLK_HIFI4_COREFREE),
156147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_HIFI4_AXI, "hifi4_axi", 0, JH7100_CLK_HIFI4_BUS),
157147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_HIFI4NOC_AXI, "hifi4noc_axi", 0, JH7100_CLK_HIFI4_BUS),
158147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_SGDMA1P_BUS, "sgdma1p_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV),
159147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SGDMA1P_AXI, "sgdma1p_axi", 0, JH7100_CLK_SGDMA1P_BUS),
160147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DMA1P_AXI, "dma1p_axi", 0, JH7100_CLK_SGDMA1P_BUS),
161147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_X2C_AXI, "x2c_axi", CLK_IS_CRITICAL, 8, JH7100_CLK_CPUNBUS_ROOT_DIV),
162147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_USB_BUS, "usb_bus", 8, JH7100_CLK_CPUNBUS_ROOT_DIV),
163147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_USB_AXI, "usb_axi", 0, JH7100_CLK_USB_BUS),
164147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_USBNOC_AXI, "usbnoc_axi", 0, JH7100_CLK_USB_BUS),
165147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_USBPHY_ROOTDIV, "usbphy_rootdiv", 4, JH7100_CLK_GMACUSB_ROOT),
166147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_USBPHY_125M, "usbphy_125m", 0, 8, JH7100_CLK_USBPHY_ROOTDIV),
167147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_USBPHY_PLLDIV25M, "usbphy_plldiv25m", 0, 32,
168147455edSEmil Renner Berthing 		    JH7100_CLK_USBPHY_ROOTDIV),
169a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_USBPHY_25M, "usbphy_25m", 0, 2,
1704210be66SGeert Uytterhoeven 		    JH7100_CLK_OSC_SYS,
1714210be66SGeert Uytterhoeven 		    JH7100_CLK_USBPHY_PLLDIV25M),
172147455edSEmil Renner Berthing 	JH71X0_FDIV(JH7100_CLK_AUDIO_DIV, "audio_div", JH7100_CLK_AUDIO_ROOT),
173147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_AUDIO_SRC, "audio_src", 0, JH7100_CLK_AUDIO_DIV),
174147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_AUDIO_12288, "audio_12288", 0, JH7100_CLK_OSC_AUD),
175147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_VIN_SRC, "vin_src", 0, 4, JH7100_CLK_VIN_ROOT),
176147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_ISP0_BUS, "isp0_bus", 8, JH7100_CLK_VIN_SRC),
177147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_ISP0_AXI, "isp0_axi", 0, JH7100_CLK_ISP0_BUS),
178147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_ISP0NOC_AXI, "isp0noc_axi", 0, JH7100_CLK_ISP0_BUS),
179147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_ISPSLV_AXI, "ispslv_axi", 0, JH7100_CLK_ISP0_BUS),
180147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_ISP1_BUS, "isp1_bus", 8, JH7100_CLK_VIN_SRC),
181147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_ISP1_AXI, "isp1_axi", 0, JH7100_CLK_ISP1_BUS),
182147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_ISP1NOC_AXI, "isp1noc_axi", 0, JH7100_CLK_ISP1_BUS),
183147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_VIN_BUS, "vin_bus", 8, JH7100_CLK_VIN_SRC),
184147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VIN_AXI, "vin_axi", 0, JH7100_CLK_VIN_BUS),
185147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VINNOC_AXI, "vinnoc_axi", 0, JH7100_CLK_VIN_BUS),
186147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_VOUT_SRC, "vout_src", 0, 4, JH7100_CLK_VOUT_ROOT),
187147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_DISPBUS_SRC, "dispbus_src", 4, JH7100_CLK_VOUTBUS_ROOT),
188147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_DISP_BUS, "disp_bus", 4, JH7100_CLK_DISPBUS_SRC),
189147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DISP_AXI, "disp_axi", 0, JH7100_CLK_DISP_BUS),
190147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_DISPNOC_AXI, "dispnoc_axi", 0, JH7100_CLK_DISP_BUS),
191147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SDIO0_AHB, "sdio0_ahb", 0, JH7100_CLK_AHB_BUS),
192147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_SDIO0_CCLKINT, "sdio0_cclkint", 0, 24, JH7100_CLK_PERH0_SRC),
193147455edSEmil Renner Berthing 	JH71X0__INV(JH7100_CLK_SDIO0_CCLKINT_INV, "sdio0_cclkint_inv", JH7100_CLK_SDIO0_CCLKINT),
194147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SDIO1_AHB, "sdio1_ahb", 0, JH7100_CLK_AHB_BUS),
195147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_SDIO1_CCLKINT, "sdio1_cclkint", 0, 24, JH7100_CLK_PERH1_SRC),
196147455edSEmil Renner Berthing 	JH71X0__INV(JH7100_CLK_SDIO1_CCLKINT_INV, "sdio1_cclkint_inv", JH7100_CLK_SDIO1_CCLKINT),
197147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_GMAC_AHB, "gmac_ahb", 0, JH7100_CLK_AHB_BUS),
198147455edSEmil Renner Berthing 	JH71X0__DIV(JH7100_CLK_GMAC_ROOT_DIV, "gmac_root_div", 8, JH7100_CLK_GMACUSB_ROOT),
199147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_GMAC_PTP_REF, "gmac_ptp_refclk", 0, 31, JH7100_CLK_GMAC_ROOT_DIV),
200147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_GMAC_GTX, "gmac_gtxclk", 0, 255, JH7100_CLK_GMAC_ROOT_DIV),
201147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_GMAC_RMII_TX, "gmac_rmii_txclk", 0, 8, JH7100_CLK_GMAC_RMII_REF),
202147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_GMAC_RMII_RX, "gmac_rmii_rxclk", 0, 8, JH7100_CLK_GMAC_RMII_REF),
203*4287cd62SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_GMAC_TX, "gmac_tx", CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, 3,
2044210be66SGeert Uytterhoeven 		    JH7100_CLK_GMAC_GTX,
2054210be66SGeert Uytterhoeven 		    JH7100_CLK_GMAC_TX_INV,
2064210be66SGeert Uytterhoeven 		    JH7100_CLK_GMAC_RMII_TX),
207147455edSEmil Renner Berthing 	JH71X0__INV(JH7100_CLK_GMAC_TX_INV, "gmac_tx_inv", JH7100_CLK_GMAC_TX),
208a242b205SEmil Renner Berthing 	JH71X0__MUX(JH7100_CLK_GMAC_RX_PRE, "gmac_rx_pre", 0, 2,
2094210be66SGeert Uytterhoeven 		    JH7100_CLK_GMAC_GR_MII_RX,
2104210be66SGeert Uytterhoeven 		    JH7100_CLK_GMAC_RMII_RX),
211147455edSEmil Renner Berthing 	JH71X0__INV(JH7100_CLK_GMAC_RX_INV, "gmac_rx_inv", JH7100_CLK_GMAC_RX_PRE),
212147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_GMAC_RMII, "gmac_rmii", 0, JH7100_CLK_GMAC_RMII_REF),
213147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_GMAC_TOPHYREF, "gmac_tophyref", 0, 127, JH7100_CLK_GMAC_ROOT_DIV),
214147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SPI2AHB_AHB, "spi2ahb_ahb", 0, JH7100_CLK_AHB_BUS),
215147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_SPI2AHB_CORE, "spi2ahb_core", 0, 31, JH7100_CLK_PERH0_SRC),
216147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_EZMASTER_AHB, "ezmaster_ahb", 0, JH7100_CLK_AHB_BUS),
217147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_E24_AHB, "e24_ahb", 0, JH7100_CLK_AHB_BUS),
218147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_E24RTC_TOGGLE, "e24rtc_toggle", 0, JH7100_CLK_OSC_SYS),
219147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_QSPI_AHB, "qspi_ahb", 0, JH7100_CLK_AHB_BUS),
220147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_QSPI_APB, "qspi_apb", 0, JH7100_CLK_APB1_BUS),
221147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_QSPI_REF, "qspi_refclk", 0, 31, JH7100_CLK_PERH0_SRC),
222147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SEC_AHB, "sec_ahb", 0, JH7100_CLK_AHB_BUS),
223147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_AES, "aes_clk", 0, JH7100_CLK_SEC_AHB),
224147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SHA, "sha_clk", 0, JH7100_CLK_SEC_AHB),
225147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_PKA, "pka_clk", 0, JH7100_CLK_SEC_AHB),
226147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_TRNG_APB, "trng_apb", 0, JH7100_CLK_APB1_BUS),
227147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_OTP_APB, "otp_apb", 0, JH7100_CLK_APB1_BUS),
228147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_UART0_APB, "uart0_apb", 0, JH7100_CLK_APB1_BUS),
229147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_UART0_CORE, "uart0_core", 0, 63, JH7100_CLK_PERH1_SRC),
230147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_UART1_APB, "uart1_apb", 0, JH7100_CLK_APB1_BUS),
231147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_UART1_CORE, "uart1_core", 0, 63, JH7100_CLK_PERH1_SRC),
232147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SPI0_APB, "spi0_apb", 0, JH7100_CLK_APB1_BUS),
233147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_SPI0_CORE, "spi0_core", 0, 63, JH7100_CLK_PERH1_SRC),
234147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SPI1_APB, "spi1_apb", 0, JH7100_CLK_APB1_BUS),
235147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_SPI1_CORE, "spi1_core", 0, 63, JH7100_CLK_PERH1_SRC),
236147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_I2C0_APB, "i2c0_apb", 0, JH7100_CLK_APB1_BUS),
237147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_I2C0_CORE, "i2c0_core", 0, 63, JH7100_CLK_PERH1_SRC),
238147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_I2C1_APB, "i2c1_apb", 0, JH7100_CLK_APB1_BUS),
239147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_I2C1_CORE, "i2c1_core", 0, 63, JH7100_CLK_PERH1_SRC),
240147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_GPIO_APB, "gpio_apb", 0, JH7100_CLK_APB1_BUS),
241147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_UART2_APB, "uart2_apb", 0, JH7100_CLK_APB2_BUS),
242147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_UART2_CORE, "uart2_core", 0, 63, JH7100_CLK_PERH0_SRC),
243147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_UART3_APB, "uart3_apb", 0, JH7100_CLK_APB2_BUS),
244147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_UART3_CORE, "uart3_core", 0, 63, JH7100_CLK_PERH0_SRC),
245147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SPI2_APB, "spi2_apb", 0, JH7100_CLK_APB2_BUS),
246147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_SPI2_CORE, "spi2_core", 0, 63, JH7100_CLK_PERH0_SRC),
247147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SPI3_APB, "spi3_apb", 0, JH7100_CLK_APB2_BUS),
248147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_SPI3_CORE, "spi3_core", 0, 63, JH7100_CLK_PERH0_SRC),
249147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_I2C2_APB, "i2c2_apb", 0, JH7100_CLK_APB2_BUS),
250147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_I2C2_CORE, "i2c2_core", 0, 63, JH7100_CLK_PERH0_SRC),
251147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_I2C3_APB, "i2c3_apb", 0, JH7100_CLK_APB2_BUS),
252147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_I2C3_CORE, "i2c3_core", 0, 63, JH7100_CLK_PERH0_SRC),
253147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_WDTIMER_APB, "wdtimer_apb", 0, JH7100_CLK_APB2_BUS),
254147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_WDT_CORE, "wdt_coreclk", 0, 63, JH7100_CLK_PERH0_SRC),
255147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_TIMER0_CORE, "timer0_coreclk", 0, 63, JH7100_CLK_PERH0_SRC),
256147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_TIMER1_CORE, "timer1_coreclk", 0, 63, JH7100_CLK_PERH0_SRC),
257147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_TIMER2_CORE, "timer2_coreclk", 0, 63, JH7100_CLK_PERH0_SRC),
258147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_TIMER3_CORE, "timer3_coreclk", 0, 63, JH7100_CLK_PERH0_SRC),
259147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_TIMER4_CORE, "timer4_coreclk", 0, 63, JH7100_CLK_PERH0_SRC),
260147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_TIMER5_CORE, "timer5_coreclk", 0, 63, JH7100_CLK_PERH0_SRC),
261147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_TIMER6_CORE, "timer6_coreclk", 0, 63, JH7100_CLK_PERH0_SRC),
262147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_VP6INTC_APB, "vp6intc_apb", 0, JH7100_CLK_APB2_BUS),
263147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_PWM_APB, "pwm_apb", 0, JH7100_CLK_APB2_BUS),
264147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_MSI_APB, "msi_apb", 0, JH7100_CLK_APB2_BUS),
265147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_TEMP_APB, "temp_apb", 0, JH7100_CLK_APB2_BUS),
266147455edSEmil Renner Berthing 	JH71X0_GDIV(JH7100_CLK_TEMP_SENSE, "temp_sense", 0, 31, JH7100_CLK_OSC_SYS),
267147455edSEmil Renner Berthing 	JH71X0_GATE(JH7100_CLK_SYSERR_APB, "syserr_apb", 0, JH7100_CLK_APB2_BUS),
2684210be66SGeert Uytterhoeven };
2694210be66SGeert Uytterhoeven 
jh7100_clk_get(struct of_phandle_args * clkspec,void * data)2704210be66SGeert Uytterhoeven static struct clk_hw *jh7100_clk_get(struct of_phandle_args *clkspec, void *data)
2714210be66SGeert Uytterhoeven {
272147455edSEmil Renner Berthing 	struct jh71x0_clk_priv *priv = data;
2734210be66SGeert Uytterhoeven 	unsigned int idx = clkspec->args[0];
2744210be66SGeert Uytterhoeven 
2754210be66SGeert Uytterhoeven 	if (idx < JH7100_CLK_PLL0_OUT)
2764210be66SGeert Uytterhoeven 		return &priv->reg[idx].hw;
2774210be66SGeert Uytterhoeven 
2784210be66SGeert Uytterhoeven 	if (idx < JH7100_CLK_END)
2794210be66SGeert Uytterhoeven 		return priv->pll[idx - JH7100_CLK_PLL0_OUT];
2804210be66SGeert Uytterhoeven 
2814210be66SGeert Uytterhoeven 	return ERR_PTR(-EINVAL);
2824210be66SGeert Uytterhoeven }
2834210be66SGeert Uytterhoeven 
clk_starfive_jh7100_probe(struct platform_device * pdev)2844210be66SGeert Uytterhoeven static int __init clk_starfive_jh7100_probe(struct platform_device *pdev)
2854210be66SGeert Uytterhoeven {
286147455edSEmil Renner Berthing 	struct jh71x0_clk_priv *priv;
2874210be66SGeert Uytterhoeven 	unsigned int idx;
2884210be66SGeert Uytterhoeven 	int ret;
2894210be66SGeert Uytterhoeven 
29026ad971fSEmil Renner Berthing 	priv = devm_kzalloc(&pdev->dev, struct_size(priv, reg, JH7100_CLK_PLL0_OUT), GFP_KERNEL);
2914210be66SGeert Uytterhoeven 	if (!priv)
2924210be66SGeert Uytterhoeven 		return -ENOMEM;
2934210be66SGeert Uytterhoeven 
2944210be66SGeert Uytterhoeven 	spin_lock_init(&priv->rmw_lock);
2954210be66SGeert Uytterhoeven 	priv->dev = &pdev->dev;
2964210be66SGeert Uytterhoeven 	priv->base = devm_platform_ioremap_resource(pdev, 0);
2974210be66SGeert Uytterhoeven 	if (IS_ERR(priv->base))
2984210be66SGeert Uytterhoeven 		return PTR_ERR(priv->base);
2994210be66SGeert Uytterhoeven 
3004210be66SGeert Uytterhoeven 	priv->pll[0] = devm_clk_hw_register_fixed_factor(priv->dev, "pll0_out",
3014210be66SGeert Uytterhoeven 							 "osc_sys", 0, 40, 1);
3024210be66SGeert Uytterhoeven 	if (IS_ERR(priv->pll[0]))
3034210be66SGeert Uytterhoeven 		return PTR_ERR(priv->pll[0]);
3044210be66SGeert Uytterhoeven 
3054210be66SGeert Uytterhoeven 	priv->pll[1] = devm_clk_hw_register_fixed_factor(priv->dev, "pll1_out",
3064210be66SGeert Uytterhoeven 							 "osc_sys", 0, 64, 1);
3074210be66SGeert Uytterhoeven 	if (IS_ERR(priv->pll[1]))
3084210be66SGeert Uytterhoeven 		return PTR_ERR(priv->pll[1]);
3094210be66SGeert Uytterhoeven 
3104210be66SGeert Uytterhoeven 	priv->pll[2] = devm_clk_hw_register_fixed_factor(priv->dev, "pll2_out",
3114210be66SGeert Uytterhoeven 							 "pll2_refclk", 0, 55, 1);
3124210be66SGeert Uytterhoeven 	if (IS_ERR(priv->pll[2]))
3134210be66SGeert Uytterhoeven 		return PTR_ERR(priv->pll[2]);
3144210be66SGeert Uytterhoeven 
3154210be66SGeert Uytterhoeven 	for (idx = 0; idx < JH7100_CLK_PLL0_OUT; idx++) {
3164210be66SGeert Uytterhoeven 		u32 max = jh7100_clk_data[idx].max;
3174210be66SGeert Uytterhoeven 		struct clk_parent_data parents[4] = {};
3184210be66SGeert Uytterhoeven 		struct clk_init_data init = {
3194210be66SGeert Uytterhoeven 			.name = jh7100_clk_data[idx].name,
320147455edSEmil Renner Berthing 			.ops = starfive_jh71x0_clk_ops(max),
3214210be66SGeert Uytterhoeven 			.parent_data = parents,
322147455edSEmil Renner Berthing 			.num_parents = ((max & JH71X0_CLK_MUX_MASK) >> JH71X0_CLK_MUX_SHIFT) + 1,
3234210be66SGeert Uytterhoeven 			.flags = jh7100_clk_data[idx].flags,
3244210be66SGeert Uytterhoeven 		};
325147455edSEmil Renner Berthing 		struct jh71x0_clk *clk = &priv->reg[idx];
3264210be66SGeert Uytterhoeven 		unsigned int i;
3274210be66SGeert Uytterhoeven 
3284210be66SGeert Uytterhoeven 		for (i = 0; i < init.num_parents; i++) {
3294210be66SGeert Uytterhoeven 			unsigned int pidx = jh7100_clk_data[idx].parents[i];
3304210be66SGeert Uytterhoeven 
3314210be66SGeert Uytterhoeven 			if (pidx < JH7100_CLK_PLL0_OUT)
3324210be66SGeert Uytterhoeven 				parents[i].hw = &priv->reg[pidx].hw;
3334210be66SGeert Uytterhoeven 			else if (pidx < JH7100_CLK_END)
3344210be66SGeert Uytterhoeven 				parents[i].hw = priv->pll[pidx - JH7100_CLK_PLL0_OUT];
3354210be66SGeert Uytterhoeven 			else if (pidx == JH7100_CLK_OSC_SYS)
3364210be66SGeert Uytterhoeven 				parents[i].fw_name = "osc_sys";
3374210be66SGeert Uytterhoeven 			else if (pidx == JH7100_CLK_OSC_AUD)
3384210be66SGeert Uytterhoeven 				parents[i].fw_name = "osc_aud";
3394210be66SGeert Uytterhoeven 			else if (pidx == JH7100_CLK_GMAC_RMII_REF)
3404210be66SGeert Uytterhoeven 				parents[i].fw_name = "gmac_rmii_ref";
3414210be66SGeert Uytterhoeven 			else if (pidx == JH7100_CLK_GMAC_GR_MII_RX)
3424210be66SGeert Uytterhoeven 				parents[i].fw_name = "gmac_gr_mii_rxclk";
3434210be66SGeert Uytterhoeven 		}
3444210be66SGeert Uytterhoeven 
3454210be66SGeert Uytterhoeven 		clk->hw.init = &init;
3464210be66SGeert Uytterhoeven 		clk->idx = idx;
347147455edSEmil Renner Berthing 		clk->max_div = max & JH71X0_CLK_DIV_MASK;
3484210be66SGeert Uytterhoeven 
3494210be66SGeert Uytterhoeven 		ret = devm_clk_hw_register(priv->dev, &clk->hw);
3504210be66SGeert Uytterhoeven 		if (ret)
3514210be66SGeert Uytterhoeven 			return ret;
3524210be66SGeert Uytterhoeven 	}
3534210be66SGeert Uytterhoeven 
3544210be66SGeert Uytterhoeven 	return devm_of_clk_add_hw_provider(priv->dev, jh7100_clk_get, priv);
3554210be66SGeert Uytterhoeven }
3564210be66SGeert Uytterhoeven 
3574210be66SGeert Uytterhoeven static const struct of_device_id clk_starfive_jh7100_match[] = {
3584210be66SGeert Uytterhoeven 	{ .compatible = "starfive,jh7100-clkgen" },
3594210be66SGeert Uytterhoeven 	{ /* sentinel */ }
3604210be66SGeert Uytterhoeven };
3614210be66SGeert Uytterhoeven 
3624210be66SGeert Uytterhoeven static struct platform_driver clk_starfive_jh7100_driver = {
3634210be66SGeert Uytterhoeven 	.driver = {
3644210be66SGeert Uytterhoeven 		.name = "clk-starfive-jh7100",
3654210be66SGeert Uytterhoeven 		.of_match_table = clk_starfive_jh7100_match,
3664210be66SGeert Uytterhoeven 		.suppress_bind_attrs = true,
3674210be66SGeert Uytterhoeven 	},
3684210be66SGeert Uytterhoeven };
3694210be66SGeert Uytterhoeven builtin_platform_driver_probe(clk_starfive_jh7100_driver, clk_starfive_jh7100_probe);
370