1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2017 MediaTek Inc.
8 #include <linux/delay.h>
9 #include <linux/mfd/syscon.h>
11 #include <linux/of_address.h>
12 #include <linux/of_device.h>
13 #include <linux/platform_device.h>
14 #include <linux/slab.h>
20 #include <dt-bindings/clock/mt2712-clk.h>
22 static DEFINE_SPINLOCK(mt2712_clk_lock);
24 static const struct mtk_fixed_clk top_fixed_clks[] = {
25 FIXED_CLK(CLK_TOP_VPLL3_DPIX, "vpll3_dpix", NULL, 200000000),
26 FIXED_CLK(CLK_TOP_VPLL_DPIX, "vpll_dpix", NULL, 200000000),
27 FIXED_CLK(CLK_TOP_LTEPLL_FS26M, "ltepll_fs26m", NULL, 26000000),
28 FIXED_CLK(CLK_TOP_DMPLL, "dmpll_ck", NULL, 350000000),
29 FIXED_CLK(CLK_TOP_DSI0_LNTC, "dsi0_lntc", NULL, 143000000),
30 FIXED_CLK(CLK_TOP_DSI1_LNTC, "dsi1_lntc", NULL, 143000000),
31 FIXED_CLK(CLK_TOP_LVDSTX3_CLKDIG_CTS, "lvdstx3", NULL, 140000000),
32 FIXED_CLK(CLK_TOP_LVDSTX_CLKDIG_CTS, "lvdstx", NULL, 140000000),
33 FIXED_CLK(CLK_TOP_CLKRTC_EXT, "clkrtc_ext", NULL, 32768),
34 FIXED_CLK(CLK_TOP_CLKRTC_INT, "clkrtc_int", NULL, 32747),
35 FIXED_CLK(CLK_TOP_CSI0, "csi0", NULL, 26000000),
36 FIXED_CLK(CLK_TOP_CVBSPLL, "cvbspll", NULL, 108000000),
39 static const struct mtk_fixed_factor top_early_divs[] = {
40 FACTOR(CLK_TOP_SYS_26M, "sys_26m", "clk26m", 1,
42 FACTOR(CLK_TOP_CLK26M_D2, "clk26m_d2", "sys_26m", 1,
46 static const struct mtk_fixed_factor top_divs[] = {
47 FACTOR(CLK_TOP_ARMCA35PLL, "armca35pll_ck", "armca35pll", 1,
49 FACTOR(CLK_TOP_ARMCA35PLL_600M, "armca35pll_600m", "armca35pll_ck", 1,
51 FACTOR(CLK_TOP_ARMCA35PLL_400M, "armca35pll_400m", "armca35pll_ck", 1,
53 FACTOR(CLK_TOP_ARMCA72PLL, "armca72pll_ck", "armca72pll", 1,
55 FACTOR(CLK_TOP_SYSPLL, "syspll_ck", "mainpll", 1,
57 FACTOR(CLK_TOP_SYSPLL_D2, "syspll_d2", "syspll_ck", 1,
59 FACTOR(CLK_TOP_SYSPLL1_D2, "syspll1_d2", "syspll_d2", 1,
61 FACTOR(CLK_TOP_SYSPLL1_D4, "syspll1_d4", "syspll_d2", 1,
63 FACTOR(CLK_TOP_SYSPLL1_D8, "syspll1_d8", "syspll_d2", 1,
65 FACTOR(CLK_TOP_SYSPLL1_D16, "syspll1_d16", "syspll_d2", 1,
67 FACTOR(CLK_TOP_SYSPLL_D3, "syspll_d3", "syspll_ck", 1,
69 FACTOR(CLK_TOP_SYSPLL2_D2, "syspll2_d2", "syspll_d3", 1,
71 FACTOR(CLK_TOP_SYSPLL2_D4, "syspll2_d4", "syspll_d3", 1,
73 FACTOR(CLK_TOP_SYSPLL_D5, "syspll_d5", "syspll_ck", 1,
75 FACTOR(CLK_TOP_SYSPLL3_D2, "syspll3_d2", "syspll_d5", 1,
77 FACTOR(CLK_TOP_SYSPLL3_D4, "syspll3_d4", "syspll_d5", 1,
79 FACTOR(CLK_TOP_SYSPLL_D7, "syspll_d7", "syspll_ck", 1,
81 FACTOR(CLK_TOP_SYSPLL4_D2, "syspll4_d2", "syspll_d7", 1,
83 FACTOR(CLK_TOP_SYSPLL4_D4, "syspll4_d4", "syspll_d7", 1,
85 FACTOR(CLK_TOP_UNIVPLL, "univpll_ck", "univpll", 1,
87 FACTOR(CLK_TOP_UNIVPLL_D7, "univpll_d7", "univpll_ck", 1,
89 FACTOR(CLK_TOP_UNIVPLL_D26, "univpll_d26", "univpll_ck", 1,
91 FACTOR(CLK_TOP_UNIVPLL_D52, "univpll_d52", "univpll_ck", 1,
93 FACTOR(CLK_TOP_UNIVPLL_D104, "univpll_d104", "univpll_ck", 1,
95 FACTOR(CLK_TOP_UNIVPLL_D208, "univpll_d208", "univpll_ck", 1,
97 FACTOR(CLK_TOP_UNIVPLL_D2, "univpll_d2", "univpll_ck", 1,
99 FACTOR(CLK_TOP_UNIVPLL1_D2, "univpll1_d2", "univpll_d2", 1,
101 FACTOR(CLK_TOP_UNIVPLL1_D4, "univpll1_d4", "univpll_d2", 1,
103 FACTOR(CLK_TOP_UNIVPLL1_D8, "univpll1_d8", "univpll_d2", 1,
105 FACTOR(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll_ck", 1,
107 FACTOR(CLK_TOP_UNIVPLL2_D2, "univpll2_d2", "univpll_d3", 1,
109 FACTOR(CLK_TOP_UNIVPLL2_D4, "univpll2_d4", "univpll_d3", 1,
111 FACTOR(CLK_TOP_UNIVPLL2_D8, "univpll2_d8", "univpll_d3", 1,
113 FACTOR(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll_ck", 1,
115 FACTOR(CLK_TOP_UNIVPLL3_D2, "univpll3_d2", "univpll_d5", 1,
117 FACTOR(CLK_TOP_UNIVPLL3_D4, "univpll3_d4", "univpll_d5", 1,
119 FACTOR(CLK_TOP_UNIVPLL3_D8, "univpll3_d8", "univpll_d5", 1,
121 FACTOR(CLK_TOP_F_MP0_PLL1, "f_mp0_pll1_ck", "univpll_d2", 1,
123 FACTOR(CLK_TOP_F_MP0_PLL2, "f_mp0_pll2_ck", "univpll1_d2", 1,
125 FACTOR(CLK_TOP_F_BIG_PLL1, "f_big_pll1_ck", "univpll_d2", 1,
127 FACTOR(CLK_TOP_F_BIG_PLL2, "f_big_pll2_ck", "univpll1_d2", 1,
129 FACTOR(CLK_TOP_F_BUS_PLL1, "f_bus_pll1_ck", "univpll_d2", 1,
131 FACTOR(CLK_TOP_F_BUS_PLL2, "f_bus_pll2_ck", "univpll1_d2", 1,
133 FACTOR(CLK_TOP_APLL1, "apll1_ck", "apll1", 1,
135 FACTOR(CLK_TOP_APLL1_D2, "apll1_d2", "apll1_ck", 1,
137 FACTOR(CLK_TOP_APLL1_D4, "apll1_d4", "apll1_ck", 1,
139 FACTOR(CLK_TOP_APLL1_D8, "apll1_d8", "apll1_ck", 1,
141 FACTOR(CLK_TOP_APLL1_D16, "apll1_d16", "apll1_ck", 1,
143 FACTOR(CLK_TOP_APLL2, "apll2_ck", "apll2", 1,
145 FACTOR(CLK_TOP_APLL2_D2, "apll2_d2", "apll2_ck", 1,
147 FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "apll2_ck", 1,
149 FACTOR(CLK_TOP_APLL2_D8, "apll2_d8", "apll2_ck", 1,
151 FACTOR(CLK_TOP_APLL2_D16, "apll2_d16", "apll2_ck", 1,
153 FACTOR(CLK_TOP_LVDSPLL, "lvdspll_ck", "lvdspll", 1,
155 FACTOR(CLK_TOP_LVDSPLL_D2, "lvdspll_d2", "lvdspll_ck", 1,
157 FACTOR(CLK_TOP_LVDSPLL_D4, "lvdspll_d4", "lvdspll_ck", 1,
159 FACTOR(CLK_TOP_LVDSPLL_D8, "lvdspll_d8", "lvdspll_ck", 1,
161 FACTOR(CLK_TOP_LVDSPLL2, "lvdspll2_ck", "lvdspll2", 1,
163 FACTOR(CLK_TOP_LVDSPLL2_D2, "lvdspll2_d2", "lvdspll2_ck", 1,
165 FACTOR(CLK_TOP_LVDSPLL2_D4, "lvdspll2_d4", "lvdspll2_ck", 1,
167 FACTOR(CLK_TOP_LVDSPLL2_D8, "lvdspll2_d8", "lvdspll2_ck", 1,
169 FACTOR(CLK_TOP_ETHERPLL_125M, "etherpll_125m", "etherpll", 1,
171 FACTOR(CLK_TOP_ETHERPLL_50M, "etherpll_50m", "etherpll", 1,
173 FACTOR(CLK_TOP_CVBS, "cvbs", "cvbspll", 1,
175 FACTOR(CLK_TOP_CVBS_D2, "cvbs_d2", "cvbs", 1,
177 FACTOR(CLK_TOP_MMPLL, "mmpll_ck", "mmpll", 1,
179 FACTOR(CLK_TOP_MMPLL_D2, "mmpll_d2", "mmpll_ck", 1,
181 FACTOR(CLK_TOP_VENCPLL, "vencpll_ck", "vencpll", 1,
183 FACTOR(CLK_TOP_VENCPLL_D2, "vencpll_d2", "vencpll_ck", 1,
185 FACTOR(CLK_TOP_VCODECPLL, "vcodecpll_ck", "vcodecpll", 1,
187 FACTOR(CLK_TOP_VCODECPLL_D2, "vcodecpll_d2", "vcodecpll_ck", 1,
189 FACTOR(CLK_TOP_TVDPLL, "tvdpll_ck", "tvdpll", 1,
191 FACTOR(CLK_TOP_TVDPLL_D2, "tvdpll_d2", "tvdpll_ck", 1,
193 FACTOR(CLK_TOP_TVDPLL_D4, "tvdpll_d4", "tvdpll_ck", 1,
195 FACTOR(CLK_TOP_TVDPLL_D8, "tvdpll_d8", "tvdpll_ck", 1,
197 FACTOR(CLK_TOP_TVDPLL_429M, "tvdpll_429m", "tvdpll", 1,
199 FACTOR(CLK_TOP_TVDPLL_429M_D2, "tvdpll_429m_d2", "tvdpll_429m", 1,
201 FACTOR(CLK_TOP_TVDPLL_429M_D4, "tvdpll_429m_d4", "tvdpll_429m", 1,
203 FACTOR(CLK_TOP_MSDCPLL, "msdcpll_ck", "msdcpll", 1,
205 FACTOR(CLK_TOP_MSDCPLL_D2, "msdcpll_d2", "msdcpll_ck", 1,
207 FACTOR(CLK_TOP_MSDCPLL_D4, "msdcpll_d4", "msdcpll_ck", 1,
209 FACTOR(CLK_TOP_MSDCPLL2, "msdcpll2_ck", "msdcpll2", 1,
211 FACTOR(CLK_TOP_MSDCPLL2_D2, "msdcpll2_d2", "msdcpll2_ck", 1,
213 FACTOR(CLK_TOP_MSDCPLL2_D4, "msdcpll2_d4", "msdcpll2_ck", 1,
215 FACTOR(CLK_TOP_D2A_ULCLK_6P5M, "d2a_ulclk_6p5m", "clk26m", 1,
217 FACTOR(CLK_TOP_APLL1_D3, "apll1_d3", "apll1_ck", 1,
219 FACTOR(CLK_TOP_APLL2_D3, "apll2_d3", "apll2_ck", 1,
223 static const char * const axi_parents[] = {
233 static const char * const mem_parents[] = {
238 static const char * const mm_parents[] = {
249 static const char * const pwm_parents[] = {
256 static const char * const vdec_parents[] = {
269 static const char * const venc_parents[] = {
281 static const char * const mfg_parents[] = {
300 static const char * const camtg_parents[] = {
314 static const char * const uart_parents[] = {
319 static const char * const spi_parents[] = {
328 static const char * const usb20_parents[] = {
334 static const char * const usb30_parents[] = {
341 static const char * const msdc50_0_h_parents[] = {
350 static const char * const msdc50_0_parents[] = {
364 static const char * const msdc30_1_parents[] = {
374 static const char * const msdc30_3_parents[] = {
390 static const char * const audio_parents[] = {
397 static const char * const aud_intbus_parents[] = {
407 static const char * const pmicspi_parents[] = {
417 static const char * const dpilvds1_parents[] = {
426 static const char * const atb_parents[] = {
433 static const char * const nr_parents[] = {
444 static const char * const nfi2x_parents[] = {
458 static const char * const irda_parents[] = {
465 static const char * const cci400_parents[] = {
476 static const char * const aud_1_parents[] = {
483 static const char * const aud_2_parents[] = {
490 static const char * const mem_mfg_parents[] = {
496 static const char * const axi_mfg_parents[] = {
502 static const char * const scam_parents[] = {
509 static const char * const nfiecc_parents[] = {
519 static const char * const pe2_mac_p0_parents[] = {
528 static const char * const dpilvds_parents[] = {
537 static const char * const hdcp_parents[] = {
544 static const char * const hdcp_24m_parents[] = {
551 static const char * const rtc_parents[] = {
558 static const char * const spinor_parents[] = {
571 static const char * const apll_parents[] = {
587 static const char * const a1sys_hp_parents[] = {
596 static const char * const a2sys_hp_parents[] = {
605 static const char * const asm_l_parents[] = {
612 static const char * const i2so1_parents[] = {
618 static const char * const ether_125m_parents[] = {
624 static const char * const ether_50m_parents[] = {
631 static const char * const jpgdec_parents[] = {
644 static const char * const spislv_parents[] = {
655 static const char * const ether_parents[] = {
661 static const char * const di_parents[] = {
672 static const char * const tvd_parents[] = {
678 static const char * const i2c_parents[] = {
686 static const char * const msdc0p_aes_parents[] = {
693 static const char * const cmsys_parents[] = {
701 static const char * const gcpu_parents[] = {
711 static const char * const aud_apll1_parents[] = {
716 static const char * const aud_apll2_parents[] = {
721 static const char * const apll1_ref_parents[] = {
732 static const char * const audull_vtx_parents[] = {
737 static struct mtk_composite top_muxes[] = {
739 MUX_GATE_FLAGS(CLK_TOP_AXI_SEL, "axi_sel", axi_parents, 0x040, 0, 3,
741 MUX_GATE_FLAGS(CLK_TOP_MEM_SEL, "mem_sel", mem_parents, 0x040, 8, 1,
742 15, CLK_IS_CRITICAL),
743 MUX_GATE(CLK_TOP_MM_SEL, "mm_sel",
744 mm_parents, 0x040, 24, 3, 31),
746 MUX_GATE(CLK_TOP_PWM_SEL, "pwm_sel",
747 pwm_parents, 0x050, 0, 2, 7),
748 MUX_GATE(CLK_TOP_VDEC_SEL, "vdec_sel",
749 vdec_parents, 0x050, 8, 4, 15),
750 MUX_GATE(CLK_TOP_VENC_SEL, "venc_sel",
751 venc_parents, 0x050, 16, 4, 23),
752 MUX_GATE(CLK_TOP_MFG_SEL, "mfg_sel",
753 mfg_parents, 0x050, 24, 4, 31),
755 MUX_GATE(CLK_TOP_CAMTG_SEL, "camtg_sel",
756 camtg_parents, 0x060, 0, 4, 7),
757 MUX_GATE(CLK_TOP_UART_SEL, "uart_sel",
758 uart_parents, 0x060, 8, 1, 15),
759 MUX_GATE(CLK_TOP_SPI_SEL, "spi_sel",
760 spi_parents, 0x060, 16, 3, 23),
761 MUX_GATE(CLK_TOP_USB20_SEL, "usb20_sel",
762 usb20_parents, 0x060, 24, 2, 31),
764 MUX_GATE(CLK_TOP_USB30_SEL, "usb30_sel",
765 usb30_parents, 0x070, 0, 2, 7),
766 MUX_GATE(CLK_TOP_MSDC50_0_HCLK_SEL, "msdc50_0_h_sel",
767 msdc50_0_h_parents, 0x070, 8, 3, 15),
768 MUX_GATE(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel",
769 msdc50_0_parents, 0x070, 16, 4, 23),
770 MUX_GATE(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel",
771 msdc30_1_parents, 0x070, 24, 3, 31),
773 MUX_GATE(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel",
774 msdc30_1_parents, 0x080, 0, 3, 7),
775 MUX_GATE(CLK_TOP_MSDC30_3_SEL, "msdc30_3_sel",
776 msdc30_3_parents, 0x080, 8, 4, 15),
777 MUX_GATE(CLK_TOP_AUDIO_SEL, "audio_sel",
778 audio_parents, 0x080, 16, 2, 23),
779 MUX_GATE(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel",
780 aud_intbus_parents, 0x080, 24, 3, 31),
782 MUX_GATE(CLK_TOP_PMICSPI_SEL, "pmicspi_sel",
783 pmicspi_parents, 0x090, 0, 3, 7),
784 MUX_GATE(CLK_TOP_DPILVDS1_SEL, "dpilvds1_sel",
785 dpilvds1_parents, 0x090, 8, 3, 15),
786 MUX_GATE(CLK_TOP_ATB_SEL, "atb_sel",
787 atb_parents, 0x090, 16, 2, 23),
788 MUX_GATE(CLK_TOP_NR_SEL, "nr_sel",
789 nr_parents, 0x090, 24, 3, 31),
791 MUX_GATE(CLK_TOP_NFI2X_SEL, "nfi2x_sel",
792 nfi2x_parents, 0x0a0, 0, 4, 7),
793 MUX_GATE(CLK_TOP_IRDA_SEL, "irda_sel",
794 irda_parents, 0x0a0, 8, 2, 15),
795 MUX_GATE(CLK_TOP_CCI400_SEL, "cci400_sel",
796 cci400_parents, 0x0a0, 16, 3, 23),
797 MUX_GATE(CLK_TOP_AUD_1_SEL, "aud_1_sel",
798 aud_1_parents, 0x0a0, 24, 2, 31),
800 MUX_GATE(CLK_TOP_AUD_2_SEL, "aud_2_sel",
801 aud_2_parents, 0x0b0, 0, 2, 7),
802 MUX_GATE(CLK_TOP_MEM_MFG_IN_AS_SEL, "mem_mfg_sel",
803 mem_mfg_parents, 0x0b0, 8, 2, 15),
804 MUX_GATE(CLK_TOP_AXI_MFG_IN_AS_SEL, "axi_mfg_sel",
805 axi_mfg_parents, 0x0b0, 16, 2, 23),
806 MUX_GATE(CLK_TOP_SCAM_SEL, "scam_sel",
807 scam_parents, 0x0b0, 24, 2, 31),
809 MUX_GATE(CLK_TOP_NFIECC_SEL, "nfiecc_sel",
810 nfiecc_parents, 0x0c0, 0, 3, 7),
811 MUX_GATE(CLK_TOP_PE2_MAC_P0_SEL, "pe2_mac_p0_sel",
812 pe2_mac_p0_parents, 0x0c0, 8, 3, 15),
813 MUX_GATE(CLK_TOP_PE2_MAC_P1_SEL, "pe2_mac_p1_sel",
814 pe2_mac_p0_parents, 0x0c0, 16, 3, 23),
815 MUX_GATE(CLK_TOP_DPILVDS_SEL, "dpilvds_sel",
816 dpilvds_parents, 0x0c0, 24, 3, 31),
818 MUX_GATE(CLK_TOP_MSDC50_3_HCLK_SEL, "msdc50_3_h_sel",
819 msdc50_0_h_parents, 0x0d0, 0, 3, 7),
820 MUX_GATE(CLK_TOP_HDCP_SEL, "hdcp_sel",
821 hdcp_parents, 0x0d0, 8, 2, 15),
822 MUX_GATE(CLK_TOP_HDCP_24M_SEL, "hdcp_24m_sel",
823 hdcp_24m_parents, 0x0d0, 16, 2, 23),
824 MUX_GATE_FLAGS(CLK_TOP_RTC_SEL, "rtc_sel", rtc_parents, 0x0d0, 24, 2,
825 31, CLK_IS_CRITICAL),
827 MUX_GATE(CLK_TOP_SPINOR_SEL, "spinor_sel",
828 spinor_parents, 0x500, 0, 4, 7),
829 MUX_GATE(CLK_TOP_APLL_SEL, "apll_sel",
830 apll_parents, 0x500, 8, 4, 15),
831 MUX_GATE(CLK_TOP_APLL2_SEL, "apll2_sel",
832 apll_parents, 0x500, 16, 4, 23),
833 MUX_GATE(CLK_TOP_A1SYS_HP_SEL, "a1sys_hp_sel",
834 a1sys_hp_parents, 0x500, 24, 3, 31),
836 MUX_GATE(CLK_TOP_A2SYS_HP_SEL, "a2sys_hp_sel",
837 a2sys_hp_parents, 0x510, 0, 3, 7),
838 MUX_GATE(CLK_TOP_ASM_L_SEL, "asm_l_sel",
839 asm_l_parents, 0x510, 8, 2, 15),
840 MUX_GATE(CLK_TOP_ASM_M_SEL, "asm_m_sel",
841 asm_l_parents, 0x510, 16, 2, 23),
842 MUX_GATE(CLK_TOP_ASM_H_SEL, "asm_h_sel",
843 asm_l_parents, 0x510, 24, 2, 31),
845 MUX_GATE(CLK_TOP_I2SO1_SEL, "i2so1_sel",
846 i2so1_parents, 0x520, 0, 2, 7),
847 MUX_GATE(CLK_TOP_I2SO2_SEL, "i2so2_sel",
848 i2so1_parents, 0x520, 8, 2, 15),
849 MUX_GATE(CLK_TOP_I2SO3_SEL, "i2so3_sel",
850 i2so1_parents, 0x520, 16, 2, 23),
851 MUX_GATE(CLK_TOP_TDMO0_SEL, "tdmo0_sel",
852 i2so1_parents, 0x520, 24, 2, 31),
854 MUX_GATE(CLK_TOP_TDMO1_SEL, "tdmo1_sel",
855 i2so1_parents, 0x530, 0, 2, 7),
856 MUX_GATE(CLK_TOP_I2SI1_SEL, "i2si1_sel",
857 i2so1_parents, 0x530, 8, 2, 15),
858 MUX_GATE(CLK_TOP_I2SI2_SEL, "i2si2_sel",
859 i2so1_parents, 0x530, 16, 2, 23),
860 MUX_GATE(CLK_TOP_I2SI3_SEL, "i2si3_sel",
861 i2so1_parents, 0x530, 24, 2, 31),
863 MUX_GATE(CLK_TOP_ETHER_125M_SEL, "ether_125m_sel",
864 ether_125m_parents, 0x540, 0, 2, 7),
865 MUX_GATE(CLK_TOP_ETHER_50M_SEL, "ether_50m_sel",
866 ether_50m_parents, 0x540, 8, 2, 15),
867 MUX_GATE(CLK_TOP_JPGDEC_SEL, "jpgdec_sel",
868 jpgdec_parents, 0x540, 16, 4, 23),
869 MUX_GATE(CLK_TOP_SPISLV_SEL, "spislv_sel",
870 spislv_parents, 0x540, 24, 3, 31),
872 MUX_GATE(CLK_TOP_ETHER_50M_RMII_SEL, "ether_sel",
873 ether_parents, 0x550, 0, 2, 7),
874 MUX_GATE(CLK_TOP_CAM2TG_SEL, "cam2tg_sel",
875 camtg_parents, 0x550, 8, 4, 15),
876 MUX_GATE(CLK_TOP_DI_SEL, "di_sel",
877 di_parents, 0x550, 16, 3, 23),
878 MUX_GATE(CLK_TOP_TVD_SEL, "tvd_sel",
879 tvd_parents, 0x550, 24, 2, 31),
881 MUX_GATE(CLK_TOP_I2C_SEL, "i2c_sel",
882 i2c_parents, 0x560, 0, 3, 7),
883 MUX_GATE(CLK_TOP_PWM_INFRA_SEL, "pwm_infra_sel",
884 pwm_parents, 0x560, 8, 2, 15),
885 MUX_GATE(CLK_TOP_MSDC0P_AES_SEL, "msdc0p_aes_sel",
886 msdc0p_aes_parents, 0x560, 16, 2, 23),
887 MUX_GATE(CLK_TOP_CMSYS_SEL, "cmsys_sel",
888 cmsys_parents, 0x560, 24, 3, 31),
890 MUX_GATE(CLK_TOP_GCPU_SEL, "gcpu_sel",
891 gcpu_parents, 0x570, 0, 3, 7),
893 MUX(CLK_TOP_AUD_APLL1_SEL, "aud_apll1_sel",
894 aud_apll1_parents, 0x134, 0, 1),
895 MUX(CLK_TOP_AUD_APLL2_SEL, "aud_apll2_sel",
896 aud_apll2_parents, 0x134, 1, 1),
897 MUX(CLK_TOP_DA_AUDULL_VTX_6P5M_SEL, "audull_vtx_sel",
898 audull_vtx_parents, 0x134, 31, 1),
899 MUX(CLK_TOP_APLL1_REF_SEL, "apll1_ref_sel",
900 apll1_ref_parents, 0x134, 4, 3),
901 MUX(CLK_TOP_APLL2_REF_SEL, "apll2_ref_sel",
902 apll1_ref_parents, 0x134, 7, 3),
905 static const char * const mcu_mp0_parents[] = {
912 static const char * const mcu_mp2_parents[] = {
919 static const char * const mcu_bus_parents[] = {
926 static struct mtk_composite mcu_muxes[] = {
927 /* mp0_pll_divider_cfg */
928 MUX_GATE_FLAGS(CLK_MCU_MP0_SEL, "mcu_mp0_sel", mcu_mp0_parents, 0x7A0,
929 9, 2, -1, CLK_IS_CRITICAL),
930 /* mp2_pll_divider_cfg */
931 MUX_GATE_FLAGS(CLK_MCU_MP2_SEL, "mcu_mp2_sel", mcu_mp2_parents, 0x7A8,
932 9, 2, -1, CLK_IS_CRITICAL),
933 /* bus_pll_divider_cfg */
934 MUX_GATE_FLAGS(CLK_MCU_BUS_SEL, "mcu_bus_sel", mcu_bus_parents, 0x7C0,
935 9, 2, -1, CLK_IS_CRITICAL),
938 static const struct mtk_clk_divider top_adj_divs[] = {
939 DIV_ADJ(CLK_TOP_APLL_DIV0, "apll_div0", "i2so1_sel", 0x124, 0, 8),
940 DIV_ADJ(CLK_TOP_APLL_DIV1, "apll_div1", "i2so2_sel", 0x124, 8, 8),
941 DIV_ADJ(CLK_TOP_APLL_DIV2, "apll_div2", "i2so3_sel", 0x124, 16, 8),
942 DIV_ADJ(CLK_TOP_APLL_DIV3, "apll_div3", "tdmo0_sel", 0x124, 24, 8),
943 DIV_ADJ(CLK_TOP_APLL_DIV4, "apll_div4", "tdmo1_sel", 0x128, 0, 8),
944 DIV_ADJ(CLK_TOP_APLL_DIV5, "apll_div5", "i2si1_sel", 0x128, 8, 8),
945 DIV_ADJ(CLK_TOP_APLL_DIV6, "apll_div6", "i2si2_sel", 0x128, 16, 8),
946 DIV_ADJ(CLK_TOP_APLL_DIV7, "apll_div7", "i2si3_sel", 0x128, 24, 8),
949 static const struct mtk_gate_regs top0_cg_regs = {
955 static const struct mtk_gate_regs top1_cg_regs = {
961 #define GATE_TOP0(_id, _name, _parent, _shift) { \
964 .parent_name = _parent, \
965 .regs = &top0_cg_regs, \
967 .ops = &mtk_clk_gate_ops_no_setclr, \
970 #define GATE_TOP1(_id, _name, _parent, _shift) { \
973 .parent_name = _parent, \
974 .regs = &top1_cg_regs, \
976 .ops = &mtk_clk_gate_ops_no_setclr_inv, \
979 static const struct mtk_gate top_clks[] = {
981 GATE_TOP0(CLK_TOP_APLL_DIV_PDN0, "apll_div_pdn0", "i2so1_sel", 0),
982 GATE_TOP0(CLK_TOP_APLL_DIV_PDN1, "apll_div_pdn1", "i2so2_sel", 1),
983 GATE_TOP0(CLK_TOP_APLL_DIV_PDN2, "apll_div_pdn2", "i2so3_sel", 2),
984 GATE_TOP0(CLK_TOP_APLL_DIV_PDN3, "apll_div_pdn3", "tdmo0_sel", 3),
985 GATE_TOP0(CLK_TOP_APLL_DIV_PDN4, "apll_div_pdn4", "tdmo1_sel", 4),
986 GATE_TOP0(CLK_TOP_APLL_DIV_PDN5, "apll_div_pdn5", "i2si1_sel", 5),
987 GATE_TOP0(CLK_TOP_APLL_DIV_PDN6, "apll_div_pdn6", "i2si2_sel", 6),
988 GATE_TOP0(CLK_TOP_APLL_DIV_PDN7, "apll_div_pdn7", "i2si3_sel", 7),
990 GATE_TOP1(CLK_TOP_NFI2X_EN, "nfi2x_en", "nfi2x_sel", 0),
991 GATE_TOP1(CLK_TOP_NFIECC_EN, "nfiecc_en", "nfiecc_sel", 1),
992 GATE_TOP1(CLK_TOP_NFI1X_CK_EN, "nfi1x_ck_en", "nfi2x_sel", 2),
995 static const struct mtk_gate_regs infra_cg_regs = {
1001 #define GATE_INFRA(_id, _name, _parent, _shift) { \
1004 .parent_name = _parent, \
1005 .regs = &infra_cg_regs, \
1007 .ops = &mtk_clk_gate_ops_setclr, \
1010 static const struct mtk_gate infra_clks[] = {
1011 GATE_INFRA(CLK_INFRA_DBGCLK, "infra_dbgclk", "axi_sel", 0),
1012 GATE_INFRA(CLK_INFRA_GCE, "infra_gce", "axi_sel", 6),
1013 GATE_INFRA(CLK_INFRA_M4U, "infra_m4u", "mem_sel", 8),
1014 GATE_INFRA(CLK_INFRA_KP, "infra_kp", "axi_sel", 16),
1015 GATE_INFRA(CLK_INFRA_AO_SPI0, "infra_ao_spi0", "spi_sel", 24),
1016 GATE_INFRA(CLK_INFRA_AO_SPI1, "infra_ao_spi1", "spislv_sel", 25),
1017 GATE_INFRA(CLK_INFRA_AO_UART5, "infra_ao_uart5", "axi_sel", 26),
1020 static const struct mtk_gate_regs peri0_cg_regs = {
1026 static const struct mtk_gate_regs peri1_cg_regs = {
1032 static const struct mtk_gate_regs peri2_cg_regs = {
1038 #define GATE_PERI0(_id, _name, _parent, _shift) { \
1041 .parent_name = _parent, \
1042 .regs = &peri0_cg_regs, \
1044 .ops = &mtk_clk_gate_ops_setclr, \
1047 #define GATE_PERI1(_id, _name, _parent, _shift) { \
1050 .parent_name = _parent, \
1051 .regs = &peri1_cg_regs, \
1053 .ops = &mtk_clk_gate_ops_setclr, \
1056 #define GATE_PERI2(_id, _name, _parent, _shift) { \
1059 .parent_name = _parent, \
1060 .regs = &peri2_cg_regs, \
1062 .ops = &mtk_clk_gate_ops_no_setclr_inv, \
1065 static const struct mtk_gate peri_clks[] = {
1067 GATE_PERI0(CLK_PERI_NFI, "per_nfi",
1069 GATE_PERI0(CLK_PERI_THERM, "per_therm",
1071 GATE_PERI0(CLK_PERI_PWM0, "per_pwm0",
1073 GATE_PERI0(CLK_PERI_PWM1, "per_pwm1",
1075 GATE_PERI0(CLK_PERI_PWM2, "per_pwm2",
1077 GATE_PERI0(CLK_PERI_PWM3, "per_pwm3",
1079 GATE_PERI0(CLK_PERI_PWM4, "per_pwm4",
1081 GATE_PERI0(CLK_PERI_PWM5, "per_pwm5",
1083 GATE_PERI0(CLK_PERI_PWM6, "per_pwm6",
1085 GATE_PERI0(CLK_PERI_PWM7, "per_pwm7",
1087 GATE_PERI0(CLK_PERI_PWM, "per_pwm",
1089 GATE_PERI0(CLK_PERI_AP_DMA, "per_ap_dma",
1091 GATE_PERI0(CLK_PERI_MSDC30_0, "per_msdc30_0",
1092 "msdc50_0_sel", 14),
1093 GATE_PERI0(CLK_PERI_MSDC30_1, "per_msdc30_1",
1094 "msdc30_1_sel", 15),
1095 GATE_PERI0(CLK_PERI_MSDC30_2, "per_msdc30_2",
1096 "msdc30_2_sel", 16),
1097 GATE_PERI0(CLK_PERI_MSDC30_3, "per_msdc30_3",
1098 "msdc30_3_sel", 17),
1099 GATE_PERI0(CLK_PERI_UART0, "per_uart0",
1101 GATE_PERI0(CLK_PERI_UART1, "per_uart1",
1103 GATE_PERI0(CLK_PERI_UART2, "per_uart2",
1105 GATE_PERI0(CLK_PERI_UART3, "per_uart3",
1107 GATE_PERI0(CLK_PERI_I2C0, "per_i2c0",
1109 GATE_PERI0(CLK_PERI_I2C1, "per_i2c1",
1111 GATE_PERI0(CLK_PERI_I2C2, "per_i2c2",
1113 GATE_PERI0(CLK_PERI_I2C3, "per_i2c3",
1115 GATE_PERI0(CLK_PERI_I2C4, "per_i2c4",
1117 GATE_PERI0(CLK_PERI_AUXADC, "per_auxadc",
1118 "ltepll_fs26m", 29),
1119 GATE_PERI0(CLK_PERI_SPI0, "per_spi0",
1122 GATE_PERI1(CLK_PERI_SPI, "per_spi",
1124 GATE_PERI1(CLK_PERI_I2C5, "per_i2c5",
1126 GATE_PERI1(CLK_PERI_SPI2, "per_spi2",
1128 GATE_PERI1(CLK_PERI_SPI3, "per_spi3",
1130 GATE_PERI1(CLK_PERI_SPI5, "per_spi5",
1132 GATE_PERI1(CLK_PERI_UART4, "per_uart4",
1134 GATE_PERI1(CLK_PERI_SFLASH, "per_sflash",
1136 GATE_PERI1(CLK_PERI_GMAC, "per_gmac",
1138 GATE_PERI1(CLK_PERI_PCIE0, "per_pcie0",
1140 GATE_PERI1(CLK_PERI_PCIE1, "per_pcie1",
1142 GATE_PERI1(CLK_PERI_GMAC_PCLK, "per_gmac_pclk",
1145 GATE_PERI2(CLK_PERI_MSDC50_0_EN, "per_msdc50_0_en",
1147 GATE_PERI2(CLK_PERI_MSDC30_1_EN, "per_msdc30_1_en",
1149 GATE_PERI2(CLK_PERI_MSDC30_2_EN, "per_msdc30_2_en",
1151 GATE_PERI2(CLK_PERI_MSDC30_3_EN, "per_msdc30_3_en",
1153 GATE_PERI2(CLK_PERI_MSDC50_0_HCLK_EN, "per_msdc50_0_h",
1154 "msdc50_0_h_sel", 4),
1155 GATE_PERI2(CLK_PERI_MSDC50_3_HCLK_EN, "per_msdc50_3_h",
1156 "msdc50_3_h_sel", 5),
1157 GATE_PERI2(CLK_PERI_MSDC30_0_QTR_EN, "per_msdc30_0_q",
1159 GATE_PERI2(CLK_PERI_MSDC30_3_QTR_EN, "per_msdc30_3_q",
1163 #define MT2712_PLL_FMAX (3000UL * MHZ)
1165 #define CON0_MT2712_RST_BAR BIT(24)
1167 #define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
1168 _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \
1169 _tuner_en_bit, _pcw_reg, _pcw_shift, \
1174 .pwr_reg = _pwr_reg, \
1175 .en_mask = _en_mask, \
1177 .rst_bar_mask = CON0_MT2712_RST_BAR, \
1178 .fmax = MT2712_PLL_FMAX, \
1179 .pcwbits = _pcwbits, \
1180 .pd_reg = _pd_reg, \
1181 .pd_shift = _pd_shift, \
1182 .tuner_reg = _tuner_reg, \
1183 .tuner_en_reg = _tuner_en_reg, \
1184 .tuner_en_bit = _tuner_en_bit, \
1185 .pcw_reg = _pcw_reg, \
1186 .pcw_shift = _pcw_shift, \
1187 .div_table = _div_table, \
1190 #define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
1191 _pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \
1192 _tuner_en_bit, _pcw_reg, _pcw_shift) \
1193 PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, \
1194 _pcwbits, _pd_reg, _pd_shift, _tuner_reg, \
1195 _tuner_en_reg, _tuner_en_bit, _pcw_reg, \
1198 static const struct mtk_pll_div_table armca35pll_div_table[] = {
1199 { .div = 0, .freq = MT2712_PLL_FMAX },
1200 { .div = 1, .freq = 1202500000 },
1201 { .div = 2, .freq = 500500000 },
1202 { .div = 3, .freq = 315250000 },
1203 { .div = 4, .freq = 157625000 },
1207 static const struct mtk_pll_div_table armca72pll_div_table[] = {
1208 { .div = 0, .freq = MT2712_PLL_FMAX },
1209 { .div = 1, .freq = 994500000 },
1210 { .div = 2, .freq = 520000000 },
1211 { .div = 3, .freq = 315250000 },
1212 { .div = 4, .freq = 157625000 },
1216 static const struct mtk_pll_div_table mmpll_div_table[] = {
1217 { .div = 0, .freq = MT2712_PLL_FMAX },
1218 { .div = 1, .freq = 1001000000 },
1219 { .div = 2, .freq = 601250000 },
1220 { .div = 3, .freq = 250250000 },
1221 { .div = 4, .freq = 125125000 },
1225 static const struct mtk_pll_data plls[] = {
1226 PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0230, 0x023C, 0xf0000100,
1227 HAVE_RST_BAR, 31, 0x0230, 4, 0, 0, 0, 0x0234, 0),
1228 PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0240, 0x024C, 0xfe000100,
1229 HAVE_RST_BAR, 31, 0x0240, 4, 0, 0, 0, 0x0244, 0),
1230 PLL(CLK_APMIXED_VCODECPLL, "vcodecpll", 0x0320, 0x032C, 0xc0000100,
1231 0, 31, 0x0320, 4, 0, 0, 0, 0x0324, 0),
1232 PLL(CLK_APMIXED_VENCPLL, "vencpll", 0x0280, 0x028C, 0x00000100,
1233 0, 31, 0x0280, 4, 0, 0, 0, 0x0284, 0),
1234 PLL(CLK_APMIXED_APLL1, "apll1", 0x0330, 0x0340, 0x00000100,
1235 0, 31, 0x0330, 4, 0x0338, 0x0014, 0, 0x0334, 0),
1236 PLL(CLK_APMIXED_APLL2, "apll2", 0x0350, 0x0360, 0x00000100,
1237 0, 31, 0x0350, 4, 0x0358, 0x0014, 1, 0x0354, 0),
1238 PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x0370, 0x037c, 0x00000100,
1239 0, 31, 0x0370, 4, 0, 0, 0, 0x0374, 0),
1240 PLL(CLK_APMIXED_LVDSPLL2, "lvdspll2", 0x0390, 0x039C, 0x00000100,
1241 0, 31, 0x0390, 4, 0, 0, 0, 0x0394, 0),
1242 PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x0270, 0x027C, 0x00000100,
1243 0, 31, 0x0270, 4, 0, 0, 0, 0x0274, 0),
1244 PLL(CLK_APMIXED_MSDCPLL2, "msdcpll2", 0x0410, 0x041C, 0x00000100,
1245 0, 31, 0x0410, 4, 0, 0, 0, 0x0414, 0),
1246 PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x0290, 0x029C, 0xc0000100,
1247 0, 31, 0x0290, 4, 0, 0, 0, 0x0294, 0),
1248 PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x0250, 0x0260, 0x00000100,
1249 0, 31, 0x0250, 4, 0, 0, 0, 0x0254, 0,
1251 PLL_B(CLK_APMIXED_ARMCA35PLL, "armca35pll", 0x0100, 0x0110, 0xf0000100,
1252 HAVE_RST_BAR, 31, 0x0100, 4, 0, 0, 0, 0x0104, 0,
1253 armca35pll_div_table),
1254 PLL_B(CLK_APMIXED_ARMCA72PLL, "armca72pll", 0x0210, 0x0220, 0x00000100,
1255 0, 31, 0x0210, 4, 0, 0, 0, 0x0214, 0,
1256 armca72pll_div_table),
1257 PLL(CLK_APMIXED_ETHERPLL, "etherpll", 0x0300, 0x030C, 0xc0000100,
1258 0, 31, 0x0300, 4, 0, 0, 0, 0x0304, 0),
1261 static u16 infrasys_rst_ofs[] = { 0x30, 0x34, };
1262 static u16 pericfg_rst_ofs[] = { 0x0, 0x4, };
1264 static const struct mtk_clk_rst_desc clk_rst_desc[] = {
1267 .version = MTK_RST_SIMPLE,
1268 .rst_bank_ofs = infrasys_rst_ofs,
1269 .rst_bank_nr = ARRAY_SIZE(infrasys_rst_ofs),
1273 .version = MTK_RST_SIMPLE,
1274 .rst_bank_ofs = pericfg_rst_ofs,
1275 .rst_bank_nr = ARRAY_SIZE(pericfg_rst_ofs),
1279 static int clk_mt2712_apmixed_probe(struct platform_device *pdev)
1281 struct clk_hw_onecell_data *clk_data;
1283 struct device_node *node = pdev->dev.of_node;
1285 clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
1287 mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
1289 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
1292 pr_err("%s(): could not register clock provider: %d\n",
1298 static struct clk_hw_onecell_data *top_clk_data;
1300 static void clk_mt2712_top_init_early(struct device_node *node)
1304 if (!top_clk_data) {
1305 top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
1307 for (i = 0; i < CLK_TOP_NR_CLK; i++)
1308 top_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER);
1311 mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs),
1314 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, top_clk_data);
1316 pr_err("%s(): could not register clock provider: %d\n",
1320 CLK_OF_DECLARE_DRIVER(mt2712_topckgen, "mediatek,mt2712-topckgen",
1321 clk_mt2712_top_init_early);
1323 static int clk_mt2712_top_probe(struct platform_device *pdev)
1326 struct device_node *node = pdev->dev.of_node;
1329 base = devm_platform_ioremap_resource(pdev, 0);
1331 pr_err("%s(): ioremap failed\n", __func__);
1332 return PTR_ERR(base);
1335 if (!top_clk_data) {
1336 top_clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
1338 for (i = 0; i < CLK_TOP_NR_CLK; i++) {
1339 if (top_clk_data->hws[i] == ERR_PTR(-EPROBE_DEFER))
1340 top_clk_data->hws[i] = ERR_PTR(-ENOENT);
1344 mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
1346 mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs),
1348 mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
1349 mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
1350 &mt2712_clk_lock, top_clk_data);
1351 mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs), base,
1352 &mt2712_clk_lock, top_clk_data);
1353 mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
1356 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, top_clk_data);
1359 pr_err("%s(): could not register clock provider: %d\n",
1365 static int clk_mt2712_infra_probe(struct platform_device *pdev)
1367 struct clk_hw_onecell_data *clk_data;
1369 struct device_node *node = pdev->dev.of_node;
1371 clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
1373 mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
1376 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
1379 pr_err("%s(): could not register clock provider: %d\n",
1382 mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc[0]);
1387 static int clk_mt2712_peri_probe(struct platform_device *pdev)
1389 struct clk_hw_onecell_data *clk_data;
1391 struct device_node *node = pdev->dev.of_node;
1393 clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
1395 mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
1398 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
1401 pr_err("%s(): could not register clock provider: %d\n",
1404 mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc[1]);
1409 static int clk_mt2712_mcu_probe(struct platform_device *pdev)
1411 struct clk_hw_onecell_data *clk_data;
1413 struct device_node *node = pdev->dev.of_node;
1416 base = devm_platform_ioremap_resource(pdev, 0);
1418 pr_err("%s(): ioremap failed\n", __func__);
1419 return PTR_ERR(base);
1422 clk_data = mtk_alloc_clk_data(CLK_MCU_NR_CLK);
1424 mtk_clk_register_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes), base,
1425 &mt2712_clk_lock, clk_data);
1427 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
1430 pr_err("%s(): could not register clock provider: %d\n",
1436 static const struct of_device_id of_match_clk_mt2712[] = {
1438 .compatible = "mediatek,mt2712-apmixedsys",
1439 .data = clk_mt2712_apmixed_probe,
1441 .compatible = "mediatek,mt2712-topckgen",
1442 .data = clk_mt2712_top_probe,
1444 .compatible = "mediatek,mt2712-infracfg",
1445 .data = clk_mt2712_infra_probe,
1447 .compatible = "mediatek,mt2712-pericfg",
1448 .data = clk_mt2712_peri_probe,
1450 .compatible = "mediatek,mt2712-mcucfg",
1451 .data = clk_mt2712_mcu_probe,
1457 static int clk_mt2712_probe(struct platform_device *pdev)
1459 int (*clk_probe)(struct platform_device *);
1462 clk_probe = of_device_get_match_data(&pdev->dev);
1466 r = clk_probe(pdev);
1469 "could not register clock provider: %s: %d\n",
1475 static struct platform_driver clk_mt2712_drv = {
1476 .probe = clk_mt2712_probe,
1478 .name = "clk-mt2712",
1479 .of_match_table = of_match_clk_mt2712,
1483 static int __init clk_mt2712_init(void)
1485 return platform_driver_register(&clk_mt2712_drv);
1488 arch_initcall(clk_mt2712_init);