18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2014 MediaTek Inc.
48c2ecf20Sopenharmony_ci * Author: James Liao <jamesjj.liao@mediatek.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/clk.h>
88c2ecf20Sopenharmony_ci#include <linux/of.h>
98c2ecf20Sopenharmony_ci#include <linux/of_address.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include "clk-mtk.h"
128c2ecf20Sopenharmony_ci#include "clk-gate.h"
138c2ecf20Sopenharmony_ci#include "clk-cpumux.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <dt-bindings/clock/mt8173-clk.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/*
188c2ecf20Sopenharmony_ci * For some clocks, we don't care what their actual rates are. And these
198c2ecf20Sopenharmony_ci * clocks may change their rate on different products or different scenarios.
208c2ecf20Sopenharmony_ci * So we model these clocks' rate as 0, to denote it's not an actual rate.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci#define DUMMY_RATE		0
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistatic DEFINE_SPINLOCK(mt8173_clk_lock);
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistatic const struct mtk_fixed_clk fixed_clks[] __initconst = {
278c2ecf20Sopenharmony_ci	FIXED_CLK(CLK_TOP_CLKPH_MCK_O, "clkph_mck_o", "clk26m", DUMMY_RATE),
288c2ecf20Sopenharmony_ci	FIXED_CLK(CLK_TOP_USB_SYSPLL_125M, "usb_syspll_125m", "clk26m", 125 * MHZ),
298c2ecf20Sopenharmony_ci	FIXED_CLK(CLK_TOP_DSI0_DIG, "dsi0_dig", "clk26m", DUMMY_RATE),
308c2ecf20Sopenharmony_ci	FIXED_CLK(CLK_TOP_DSI1_DIG, "dsi1_dig", "clk26m", DUMMY_RATE),
318c2ecf20Sopenharmony_ci	FIXED_CLK(CLK_TOP_LVDS_PXL, "lvds_pxl", "lvdspll", DUMMY_RATE),
328c2ecf20Sopenharmony_ci	FIXED_CLK(CLK_TOP_LVDS_CTS, "lvds_cts", "lvdspll", DUMMY_RATE),
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_cistatic const struct mtk_fixed_factor top_divs[] __initconst = {
368c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_ARMCA7PLL_754M, "armca7pll_754m", "armca7pll", 1, 2),
378c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_ARMCA7PLL_502M, "armca7pll_502m", "armca7pll", 1, 3),
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MAIN_H546M, "main_h546m", "mainpll", 1, 2),
408c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MAIN_H364M, "main_h364m", "mainpll", 1, 3),
418c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MAIN_H218P4M, "main_h218p4m", "mainpll", 1, 5),
428c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MAIN_H156M, "main_h156m", "mainpll", 1, 7),
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_TVDPLL_445P5M, "tvdpll_445p5m", "tvdpll", 1, 4),
458c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_TVDPLL_594M, "tvdpll_594m", "tvdpll", 1, 3),
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIV_624M, "univ_624m", "univpll", 1, 2),
488c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIV_416M, "univ_416m", "univpll", 1, 3),
498c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIV_249P6M, "univ_249p6m", "univpll", 1, 5),
508c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIV_178P3M, "univ_178p3m", "univpll", 1, 7),
518c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIV_48M, "univ_48m", "univpll", 1, 26),
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_CLKRTC_EXT, "clkrtc_ext", "clk32k", 1, 1),
548c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_CLKRTC_INT, "clkrtc_int", "clk26m", 1, 793),
558c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_FPC, "fpc_ck", "clk26m", 1, 1),
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_HDMITXPLL_D2, "hdmitxpll_d2", "hdmitx_dig_cts", 1, 2),
588c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_HDMITXPLL_D3, "hdmitxpll_d3", "hdmitx_dig_cts", 1, 3),
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_ARMCA7PLL_D2, "armca7pll_d2", "armca7pll_754m", 1, 1),
618c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_ARMCA7PLL_D3, "armca7pll_d3", "armca7pll_502m", 1, 1),
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_APLL1, "apll1_ck", "apll1", 1, 1),
648c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_APLL2, "apll2_ck", "apll2", 1, 1),
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_DMPLL, "dmpll_ck", "clkph_mck_o", 1, 1),
678c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_DMPLL_D2, "dmpll_d2", "clkph_mck_o", 1, 2),
688c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_DMPLL_D4, "dmpll_d4", "clkph_mck_o", 1, 4),
698c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_DMPLL_D8, "dmpll_d8", "clkph_mck_o", 1, 8),
708c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_DMPLL_D16, "dmpll_d16", "clkph_mck_o", 1, 16),
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_LVDSPLL_D2, "lvdspll_d2", "lvdspll", 1, 2),
738c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_LVDSPLL_D4, "lvdspll_d4", "lvdspll", 1, 4),
748c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_LVDSPLL_D8, "lvdspll_d8", "lvdspll", 1, 8),
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MMPLL, "mmpll_ck", "mmpll", 1, 1),
778c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MMPLL_D2, "mmpll_d2", "mmpll", 1, 2),
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MSDCPLL, "msdcpll_ck", "msdcpll", 1, 1),
808c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MSDCPLL_D2, "msdcpll_d2", "msdcpll", 1, 2),
818c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MSDCPLL_D4, "msdcpll_d4", "msdcpll", 1, 4),
828c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MSDCPLL2, "msdcpll2_ck", "msdcpll2", 1, 1),
838c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MSDCPLL2_D2, "msdcpll2_d2", "msdcpll2", 1, 2),
848c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_MSDCPLL2_D4, "msdcpll2_d4", "msdcpll2", 1, 4),
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL_D2, "syspll_d2", "main_h546m", 1, 1),
878c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL1_D2, "syspll1_d2", "main_h546m", 1, 2),
888c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL1_D4, "syspll1_d4", "main_h546m", 1, 4),
898c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL1_D8, "syspll1_d8", "main_h546m", 1, 8),
908c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL1_D16, "syspll1_d16", "main_h546m", 1, 16),
918c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL_D3, "syspll_d3", "main_h364m", 1, 1),
928c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL2_D2, "syspll2_d2", "main_h364m", 1, 2),
938c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL2_D4, "syspll2_d4", "main_h364m", 1, 4),
948c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL_D5, "syspll_d5", "main_h218p4m", 1, 1),
958c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL3_D2, "syspll3_d2", "main_h218p4m", 1, 2),
968c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL3_D4, "syspll3_d4", "main_h218p4m", 1, 4),
978c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL_D7, "syspll_d7", "main_h156m", 1, 1),
988c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL4_D2, "syspll4_d2", "main_h156m", 1, 2),
998c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_SYSPLL4_D4, "syspll4_d4", "main_h156m", 1, 4),
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_TVDPLL, "tvdpll_ck", "tvdpll_594m", 1, 1),
1028c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_TVDPLL_D2, "tvdpll_d2", "tvdpll_594m", 1, 2),
1038c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_TVDPLL_D4, "tvdpll_d4", "tvdpll_594m", 1, 4),
1048c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_TVDPLL_D8, "tvdpll_d8", "tvdpll_594m", 1, 8),
1058c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_TVDPLL_D16, "tvdpll_d16", "tvdpll_594m", 1, 16),
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL_D2, "univpll_d2", "univ_624m", 1, 1),
1088c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL1_D2, "univpll1_d2", "univ_624m", 1, 2),
1098c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL1_D4, "univpll1_d4", "univ_624m", 1, 4),
1108c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL1_D8, "univpll1_d8", "univ_624m", 1, 8),
1118c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univ_416m", 1, 1),
1128c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL2_D2, "univpll2_d2", "univ_416m", 1, 2),
1138c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL2_D4, "univpll2_d4", "univ_416m", 1, 4),
1148c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL2_D8, "univpll2_d8", "univ_416m", 1, 8),
1158c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univ_249p6m", 1, 1),
1168c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL3_D2, "univpll3_d2", "univ_249p6m", 1, 2),
1178c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL3_D4, "univpll3_d4", "univ_249p6m", 1, 4),
1188c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL3_D8, "univpll3_d8", "univ_249p6m", 1, 8),
1198c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL_D7, "univpll_d7", "univ_178p3m", 1, 1),
1208c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL_D26, "univpll_d26", "univ_48m", 1, 1),
1218c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_UNIVPLL_D52, "univpll_d52", "univ_48m", 1, 2),
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_VCODECPLL, "vcodecpll_ck", "vcodecpll", 1, 3),
1248c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_VCODECPLL_370P5, "vcodecpll_370p5", "vcodecpll", 1, 4),
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_VENCPLL, "vencpll_ck", "vencpll", 1, 1),
1278c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_VENCPLL_D2, "vencpll_d2", "vencpll", 1, 2),
1288c2ecf20Sopenharmony_ci	FACTOR(CLK_TOP_VENCPLL_D4, "vencpll_d4", "vencpll", 1, 4),
1298c2ecf20Sopenharmony_ci};
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_cistatic const char * const axi_parents[] __initconst = {
1328c2ecf20Sopenharmony_ci	"clk26m",
1338c2ecf20Sopenharmony_ci	"syspll1_d2",
1348c2ecf20Sopenharmony_ci	"syspll_d5",
1358c2ecf20Sopenharmony_ci	"syspll1_d4",
1368c2ecf20Sopenharmony_ci	"univpll_d5",
1378c2ecf20Sopenharmony_ci	"univpll2_d2",
1388c2ecf20Sopenharmony_ci	"dmpll_d2",
1398c2ecf20Sopenharmony_ci	"dmpll_d4"
1408c2ecf20Sopenharmony_ci};
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_cistatic const char * const mem_parents[] __initconst = {
1438c2ecf20Sopenharmony_ci	"clk26m",
1448c2ecf20Sopenharmony_ci	"dmpll_ck"
1458c2ecf20Sopenharmony_ci};
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_cistatic const char * const ddrphycfg_parents[] __initconst = {
1488c2ecf20Sopenharmony_ci	"clk26m",
1498c2ecf20Sopenharmony_ci	"syspll1_d8"
1508c2ecf20Sopenharmony_ci};
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_cistatic const char * const mm_parents[] __initconst = {
1538c2ecf20Sopenharmony_ci	"clk26m",
1548c2ecf20Sopenharmony_ci	"vencpll_d2",
1558c2ecf20Sopenharmony_ci	"main_h364m",
1568c2ecf20Sopenharmony_ci	"syspll1_d2",
1578c2ecf20Sopenharmony_ci	"syspll_d5",
1588c2ecf20Sopenharmony_ci	"syspll1_d4",
1598c2ecf20Sopenharmony_ci	"univpll1_d2",
1608c2ecf20Sopenharmony_ci	"univpll2_d2",
1618c2ecf20Sopenharmony_ci	"dmpll_d2"
1628c2ecf20Sopenharmony_ci};
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_cistatic const char * const pwm_parents[] __initconst = {
1658c2ecf20Sopenharmony_ci	"clk26m",
1668c2ecf20Sopenharmony_ci	"univpll2_d4",
1678c2ecf20Sopenharmony_ci	"univpll3_d2",
1688c2ecf20Sopenharmony_ci	"univpll1_d4"
1698c2ecf20Sopenharmony_ci};
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_cistatic const char * const vdec_parents[] __initconst = {
1728c2ecf20Sopenharmony_ci	"clk26m",
1738c2ecf20Sopenharmony_ci	"vcodecpll_ck",
1748c2ecf20Sopenharmony_ci	"tvdpll_445p5m",
1758c2ecf20Sopenharmony_ci	"univpll_d3",
1768c2ecf20Sopenharmony_ci	"vencpll_d2",
1778c2ecf20Sopenharmony_ci	"syspll_d3",
1788c2ecf20Sopenharmony_ci	"univpll1_d2",
1798c2ecf20Sopenharmony_ci	"mmpll_d2",
1808c2ecf20Sopenharmony_ci	"dmpll_d2",
1818c2ecf20Sopenharmony_ci	"dmpll_d4"
1828c2ecf20Sopenharmony_ci};
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_cistatic const char * const venc_parents[] __initconst = {
1858c2ecf20Sopenharmony_ci	"clk26m",
1868c2ecf20Sopenharmony_ci	"vcodecpll_ck",
1878c2ecf20Sopenharmony_ci	"tvdpll_445p5m",
1888c2ecf20Sopenharmony_ci	"univpll_d3",
1898c2ecf20Sopenharmony_ci	"vencpll_d2",
1908c2ecf20Sopenharmony_ci	"syspll_d3",
1918c2ecf20Sopenharmony_ci	"univpll1_d2",
1928c2ecf20Sopenharmony_ci	"univpll2_d2",
1938c2ecf20Sopenharmony_ci	"dmpll_d2",
1948c2ecf20Sopenharmony_ci	"dmpll_d4"
1958c2ecf20Sopenharmony_ci};
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_cistatic const char * const mfg_parents[] __initconst = {
1988c2ecf20Sopenharmony_ci	"clk26m",
1998c2ecf20Sopenharmony_ci	"mmpll_ck",
2008c2ecf20Sopenharmony_ci	"dmpll_ck",
2018c2ecf20Sopenharmony_ci	"clk26m",
2028c2ecf20Sopenharmony_ci	"clk26m",
2038c2ecf20Sopenharmony_ci	"clk26m",
2048c2ecf20Sopenharmony_ci	"clk26m",
2058c2ecf20Sopenharmony_ci	"clk26m",
2068c2ecf20Sopenharmony_ci	"clk26m",
2078c2ecf20Sopenharmony_ci	"syspll_d3",
2088c2ecf20Sopenharmony_ci	"syspll1_d2",
2098c2ecf20Sopenharmony_ci	"syspll_d5",
2108c2ecf20Sopenharmony_ci	"univpll_d3",
2118c2ecf20Sopenharmony_ci	"univpll1_d2",
2128c2ecf20Sopenharmony_ci	"univpll_d5",
2138c2ecf20Sopenharmony_ci	"univpll2_d2"
2148c2ecf20Sopenharmony_ci};
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_cistatic const char * const camtg_parents[] __initconst = {
2178c2ecf20Sopenharmony_ci	"clk26m",
2188c2ecf20Sopenharmony_ci	"univpll_d26",
2198c2ecf20Sopenharmony_ci	"univpll2_d2",
2208c2ecf20Sopenharmony_ci	"syspll3_d2",
2218c2ecf20Sopenharmony_ci	"syspll3_d4",
2228c2ecf20Sopenharmony_ci	"univpll1_d4"
2238c2ecf20Sopenharmony_ci};
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_cistatic const char * const uart_parents[] __initconst = {
2268c2ecf20Sopenharmony_ci	"clk26m",
2278c2ecf20Sopenharmony_ci	"univpll2_d8"
2288c2ecf20Sopenharmony_ci};
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_cistatic const char * const spi_parents[] __initconst = {
2318c2ecf20Sopenharmony_ci	"clk26m",
2328c2ecf20Sopenharmony_ci	"syspll3_d2",
2338c2ecf20Sopenharmony_ci	"syspll1_d4",
2348c2ecf20Sopenharmony_ci	"syspll4_d2",
2358c2ecf20Sopenharmony_ci	"univpll3_d2",
2368c2ecf20Sopenharmony_ci	"univpll2_d4",
2378c2ecf20Sopenharmony_ci	"univpll1_d8"
2388c2ecf20Sopenharmony_ci};
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_cistatic const char * const usb20_parents[] __initconst = {
2418c2ecf20Sopenharmony_ci	"clk26m",
2428c2ecf20Sopenharmony_ci	"univpll1_d8",
2438c2ecf20Sopenharmony_ci	"univpll3_d4"
2448c2ecf20Sopenharmony_ci};
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_cistatic const char * const usb30_parents[] __initconst = {
2478c2ecf20Sopenharmony_ci	"clk26m",
2488c2ecf20Sopenharmony_ci	"univpll3_d2",
2498c2ecf20Sopenharmony_ci	"usb_syspll_125m",
2508c2ecf20Sopenharmony_ci	"univpll2_d4"
2518c2ecf20Sopenharmony_ci};
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_cistatic const char * const msdc50_0_h_parents[] __initconst = {
2548c2ecf20Sopenharmony_ci	"clk26m",
2558c2ecf20Sopenharmony_ci	"syspll1_d2",
2568c2ecf20Sopenharmony_ci	"syspll2_d2",
2578c2ecf20Sopenharmony_ci	"syspll4_d2",
2588c2ecf20Sopenharmony_ci	"univpll_d5",
2598c2ecf20Sopenharmony_ci	"univpll1_d4"
2608c2ecf20Sopenharmony_ci};
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_cistatic const char * const msdc50_0_parents[] __initconst = {
2638c2ecf20Sopenharmony_ci	"clk26m",
2648c2ecf20Sopenharmony_ci	"msdcpll_ck",
2658c2ecf20Sopenharmony_ci	"msdcpll_d2",
2668c2ecf20Sopenharmony_ci	"univpll1_d4",
2678c2ecf20Sopenharmony_ci	"syspll2_d2",
2688c2ecf20Sopenharmony_ci	"syspll_d7",
2698c2ecf20Sopenharmony_ci	"msdcpll_d4",
2708c2ecf20Sopenharmony_ci	"vencpll_d4",
2718c2ecf20Sopenharmony_ci	"tvdpll_ck",
2728c2ecf20Sopenharmony_ci	"univpll_d2",
2738c2ecf20Sopenharmony_ci	"univpll1_d2",
2748c2ecf20Sopenharmony_ci	"mmpll_ck",
2758c2ecf20Sopenharmony_ci	"msdcpll2_ck",
2768c2ecf20Sopenharmony_ci	"msdcpll2_d2",
2778c2ecf20Sopenharmony_ci	"msdcpll2_d4"
2788c2ecf20Sopenharmony_ci};
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_cistatic const char * const msdc30_1_parents[] __initconst = {
2818c2ecf20Sopenharmony_ci	"clk26m",
2828c2ecf20Sopenharmony_ci	"univpll2_d2",
2838c2ecf20Sopenharmony_ci	"msdcpll_d4",
2848c2ecf20Sopenharmony_ci	"univpll1_d4",
2858c2ecf20Sopenharmony_ci	"syspll2_d2",
2868c2ecf20Sopenharmony_ci	"syspll_d7",
2878c2ecf20Sopenharmony_ci	"univpll_d7",
2888c2ecf20Sopenharmony_ci	"vencpll_d4"
2898c2ecf20Sopenharmony_ci};
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_cistatic const char * const msdc30_2_parents[] __initconst = {
2928c2ecf20Sopenharmony_ci	"clk26m",
2938c2ecf20Sopenharmony_ci	"univpll2_d2",
2948c2ecf20Sopenharmony_ci	"msdcpll_d4",
2958c2ecf20Sopenharmony_ci	"univpll1_d4",
2968c2ecf20Sopenharmony_ci	"syspll2_d2",
2978c2ecf20Sopenharmony_ci	"syspll_d7",
2988c2ecf20Sopenharmony_ci	"univpll_d7",
2998c2ecf20Sopenharmony_ci	"vencpll_d2"
3008c2ecf20Sopenharmony_ci};
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_cistatic const char * const msdc30_3_parents[] __initconst = {
3038c2ecf20Sopenharmony_ci	"clk26m",
3048c2ecf20Sopenharmony_ci	"msdcpll2_ck",
3058c2ecf20Sopenharmony_ci	"msdcpll2_d2",
3068c2ecf20Sopenharmony_ci	"univpll2_d2",
3078c2ecf20Sopenharmony_ci	"msdcpll2_d4",
3088c2ecf20Sopenharmony_ci	"msdcpll_d4",
3098c2ecf20Sopenharmony_ci	"univpll1_d4",
3108c2ecf20Sopenharmony_ci	"syspll2_d2",
3118c2ecf20Sopenharmony_ci	"syspll_d7",
3128c2ecf20Sopenharmony_ci	"univpll_d7",
3138c2ecf20Sopenharmony_ci	"vencpll_d4",
3148c2ecf20Sopenharmony_ci	"msdcpll_ck",
3158c2ecf20Sopenharmony_ci	"msdcpll_d2",
3168c2ecf20Sopenharmony_ci	"msdcpll_d4"
3178c2ecf20Sopenharmony_ci};
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_cistatic const char * const audio_parents[] __initconst = {
3208c2ecf20Sopenharmony_ci	"clk26m",
3218c2ecf20Sopenharmony_ci	"syspll3_d4",
3228c2ecf20Sopenharmony_ci	"syspll4_d4",
3238c2ecf20Sopenharmony_ci	"syspll1_d16"
3248c2ecf20Sopenharmony_ci};
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_cistatic const char * const aud_intbus_parents[] __initconst = {
3278c2ecf20Sopenharmony_ci	"clk26m",
3288c2ecf20Sopenharmony_ci	"syspll1_d4",
3298c2ecf20Sopenharmony_ci	"syspll4_d2",
3308c2ecf20Sopenharmony_ci	"univpll3_d2",
3318c2ecf20Sopenharmony_ci	"univpll2_d8",
3328c2ecf20Sopenharmony_ci	"dmpll_d4",
3338c2ecf20Sopenharmony_ci	"dmpll_d8"
3348c2ecf20Sopenharmony_ci};
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_cistatic const char * const pmicspi_parents[] __initconst = {
3378c2ecf20Sopenharmony_ci	"clk26m",
3388c2ecf20Sopenharmony_ci	"syspll1_d8",
3398c2ecf20Sopenharmony_ci	"syspll3_d4",
3408c2ecf20Sopenharmony_ci	"syspll1_d16",
3418c2ecf20Sopenharmony_ci	"univpll3_d4",
3428c2ecf20Sopenharmony_ci	"univpll_d26",
3438c2ecf20Sopenharmony_ci	"dmpll_d8",
3448c2ecf20Sopenharmony_ci	"dmpll_d16"
3458c2ecf20Sopenharmony_ci};
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_cistatic const char * const scp_parents[] __initconst = {
3488c2ecf20Sopenharmony_ci	"clk26m",
3498c2ecf20Sopenharmony_ci	"syspll1_d2",
3508c2ecf20Sopenharmony_ci	"univpll_d5",
3518c2ecf20Sopenharmony_ci	"syspll_d5",
3528c2ecf20Sopenharmony_ci	"dmpll_d2",
3538c2ecf20Sopenharmony_ci	"dmpll_d4"
3548c2ecf20Sopenharmony_ci};
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_cistatic const char * const atb_parents[] __initconst = {
3578c2ecf20Sopenharmony_ci	"clk26m",
3588c2ecf20Sopenharmony_ci	"syspll1_d2",
3598c2ecf20Sopenharmony_ci	"univpll_d5",
3608c2ecf20Sopenharmony_ci	"dmpll_d2"
3618c2ecf20Sopenharmony_ci};
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_cistatic const char * const venc_lt_parents[] __initconst = {
3648c2ecf20Sopenharmony_ci	"clk26m",
3658c2ecf20Sopenharmony_ci	"univpll_d3",
3668c2ecf20Sopenharmony_ci	"vcodecpll_ck",
3678c2ecf20Sopenharmony_ci	"tvdpll_445p5m",
3688c2ecf20Sopenharmony_ci	"vencpll_d2",
3698c2ecf20Sopenharmony_ci	"syspll_d3",
3708c2ecf20Sopenharmony_ci	"univpll1_d2",
3718c2ecf20Sopenharmony_ci	"univpll2_d2",
3728c2ecf20Sopenharmony_ci	"syspll1_d2",
3738c2ecf20Sopenharmony_ci	"univpll_d5",
3748c2ecf20Sopenharmony_ci	"vcodecpll_370p5",
3758c2ecf20Sopenharmony_ci	"dmpll_ck"
3768c2ecf20Sopenharmony_ci};
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_cistatic const char * const dpi0_parents[] __initconst = {
3798c2ecf20Sopenharmony_ci	"clk26m",
3808c2ecf20Sopenharmony_ci	"tvdpll_d2",
3818c2ecf20Sopenharmony_ci	"tvdpll_d4",
3828c2ecf20Sopenharmony_ci	"clk26m",
3838c2ecf20Sopenharmony_ci	"clk26m",
3848c2ecf20Sopenharmony_ci	"tvdpll_d8",
3858c2ecf20Sopenharmony_ci	"tvdpll_d16"
3868c2ecf20Sopenharmony_ci};
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_cistatic const char * const irda_parents[] __initconst = {
3898c2ecf20Sopenharmony_ci	"clk26m",
3908c2ecf20Sopenharmony_ci	"univpll2_d4",
3918c2ecf20Sopenharmony_ci	"syspll2_d4"
3928c2ecf20Sopenharmony_ci};
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_cistatic const char * const cci400_parents[] __initconst = {
3958c2ecf20Sopenharmony_ci	"clk26m",
3968c2ecf20Sopenharmony_ci	"vencpll_ck",
3978c2ecf20Sopenharmony_ci	"armca7pll_754m",
3988c2ecf20Sopenharmony_ci	"armca7pll_502m",
3998c2ecf20Sopenharmony_ci	"univpll_d2",
4008c2ecf20Sopenharmony_ci	"syspll_d2",
4018c2ecf20Sopenharmony_ci	"msdcpll_ck",
4028c2ecf20Sopenharmony_ci	"dmpll_ck"
4038c2ecf20Sopenharmony_ci};
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_cistatic const char * const aud_1_parents[] __initconst = {
4068c2ecf20Sopenharmony_ci	"clk26m",
4078c2ecf20Sopenharmony_ci	"apll1_ck",
4088c2ecf20Sopenharmony_ci	"univpll2_d4",
4098c2ecf20Sopenharmony_ci	"univpll2_d8"
4108c2ecf20Sopenharmony_ci};
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_cistatic const char * const aud_2_parents[] __initconst = {
4138c2ecf20Sopenharmony_ci	"clk26m",
4148c2ecf20Sopenharmony_ci	"apll2_ck",
4158c2ecf20Sopenharmony_ci	"univpll2_d4",
4168c2ecf20Sopenharmony_ci	"univpll2_d8"
4178c2ecf20Sopenharmony_ci};
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_cistatic const char * const mem_mfg_in_parents[] __initconst = {
4208c2ecf20Sopenharmony_ci	"clk26m",
4218c2ecf20Sopenharmony_ci	"mmpll_ck",
4228c2ecf20Sopenharmony_ci	"dmpll_ck",
4238c2ecf20Sopenharmony_ci	"clk26m"
4248c2ecf20Sopenharmony_ci};
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_cistatic const char * const axi_mfg_in_parents[] __initconst = {
4278c2ecf20Sopenharmony_ci	"clk26m",
4288c2ecf20Sopenharmony_ci	"axi_sel",
4298c2ecf20Sopenharmony_ci	"dmpll_d2"
4308c2ecf20Sopenharmony_ci};
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_cistatic const char * const scam_parents[] __initconst = {
4338c2ecf20Sopenharmony_ci	"clk26m",
4348c2ecf20Sopenharmony_ci	"syspll3_d2",
4358c2ecf20Sopenharmony_ci	"univpll2_d4",
4368c2ecf20Sopenharmony_ci	"dmpll_d4"
4378c2ecf20Sopenharmony_ci};
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_cistatic const char * const spinfi_ifr_parents[] __initconst = {
4408c2ecf20Sopenharmony_ci	"clk26m",
4418c2ecf20Sopenharmony_ci	"univpll2_d8",
4428c2ecf20Sopenharmony_ci	"univpll3_d4",
4438c2ecf20Sopenharmony_ci	"syspll4_d2",
4448c2ecf20Sopenharmony_ci	"univpll2_d4",
4458c2ecf20Sopenharmony_ci	"univpll3_d2",
4468c2ecf20Sopenharmony_ci	"syspll1_d4",
4478c2ecf20Sopenharmony_ci	"univpll1_d4"
4488c2ecf20Sopenharmony_ci};
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_cistatic const char * const hdmi_parents[] __initconst = {
4518c2ecf20Sopenharmony_ci	"clk26m",
4528c2ecf20Sopenharmony_ci	"hdmitx_dig_cts",
4538c2ecf20Sopenharmony_ci	"hdmitxpll_d2",
4548c2ecf20Sopenharmony_ci	"hdmitxpll_d3"
4558c2ecf20Sopenharmony_ci};
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_cistatic const char * const dpilvds_parents[] __initconst = {
4588c2ecf20Sopenharmony_ci	"clk26m",
4598c2ecf20Sopenharmony_ci	"lvdspll",
4608c2ecf20Sopenharmony_ci	"lvdspll_d2",
4618c2ecf20Sopenharmony_ci	"lvdspll_d4",
4628c2ecf20Sopenharmony_ci	"lvdspll_d8",
4638c2ecf20Sopenharmony_ci	"fpc_ck"
4648c2ecf20Sopenharmony_ci};
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_cistatic const char * const msdc50_2_h_parents[] __initconst = {
4678c2ecf20Sopenharmony_ci	"clk26m",
4688c2ecf20Sopenharmony_ci	"syspll1_d2",
4698c2ecf20Sopenharmony_ci	"syspll2_d2",
4708c2ecf20Sopenharmony_ci	"syspll4_d2",
4718c2ecf20Sopenharmony_ci	"univpll_d5",
4728c2ecf20Sopenharmony_ci	"univpll1_d4"
4738c2ecf20Sopenharmony_ci};
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_cistatic const char * const hdcp_parents[] __initconst = {
4768c2ecf20Sopenharmony_ci	"clk26m",
4778c2ecf20Sopenharmony_ci	"syspll4_d2",
4788c2ecf20Sopenharmony_ci	"syspll3_d4",
4798c2ecf20Sopenharmony_ci	"univpll2_d4"
4808c2ecf20Sopenharmony_ci};
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_cistatic const char * const hdcp_24m_parents[] __initconst = {
4838c2ecf20Sopenharmony_ci	"clk26m",
4848c2ecf20Sopenharmony_ci	"univpll_d26",
4858c2ecf20Sopenharmony_ci	"univpll_d52",
4868c2ecf20Sopenharmony_ci	"univpll2_d8"
4878c2ecf20Sopenharmony_ci};
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_cistatic const char * const rtc_parents[] __initconst = {
4908c2ecf20Sopenharmony_ci	"clkrtc_int",
4918c2ecf20Sopenharmony_ci	"clkrtc_ext",
4928c2ecf20Sopenharmony_ci	"clk26m",
4938c2ecf20Sopenharmony_ci	"univpll3_d8"
4948c2ecf20Sopenharmony_ci};
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_cistatic const char * const i2s0_m_ck_parents[] __initconst = {
4978c2ecf20Sopenharmony_ci	"apll1_div1",
4988c2ecf20Sopenharmony_ci	"apll2_div1"
4998c2ecf20Sopenharmony_ci};
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_cistatic const char * const i2s1_m_ck_parents[] __initconst = {
5028c2ecf20Sopenharmony_ci	"apll1_div2",
5038c2ecf20Sopenharmony_ci	"apll2_div2"
5048c2ecf20Sopenharmony_ci};
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_cistatic const char * const i2s2_m_ck_parents[] __initconst = {
5078c2ecf20Sopenharmony_ci	"apll1_div3",
5088c2ecf20Sopenharmony_ci	"apll2_div3"
5098c2ecf20Sopenharmony_ci};
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_cistatic const char * const i2s3_m_ck_parents[] __initconst = {
5128c2ecf20Sopenharmony_ci	"apll1_div4",
5138c2ecf20Sopenharmony_ci	"apll2_div4"
5148c2ecf20Sopenharmony_ci};
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_cistatic const char * const i2s3_b_ck_parents[] __initconst = {
5178c2ecf20Sopenharmony_ci	"apll1_div5",
5188c2ecf20Sopenharmony_ci	"apll2_div5"
5198c2ecf20Sopenharmony_ci};
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_cistatic const char * const ca53_parents[] __initconst = {
5228c2ecf20Sopenharmony_ci	"clk26m",
5238c2ecf20Sopenharmony_ci	"armca7pll",
5248c2ecf20Sopenharmony_ci	"mainpll",
5258c2ecf20Sopenharmony_ci	"univpll"
5268c2ecf20Sopenharmony_ci};
5278c2ecf20Sopenharmony_ci
5288c2ecf20Sopenharmony_cistatic const char * const ca72_parents[] __initconst = {
5298c2ecf20Sopenharmony_ci	"clk26m",
5308c2ecf20Sopenharmony_ci	"armca15pll",
5318c2ecf20Sopenharmony_ci	"mainpll",
5328c2ecf20Sopenharmony_ci	"univpll"
5338c2ecf20Sopenharmony_ci};
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_cistatic const struct mtk_composite cpu_muxes[] __initconst = {
5368c2ecf20Sopenharmony_ci	MUX(CLK_INFRA_CA53SEL, "infra_ca53_sel", ca53_parents, 0x0000, 0, 2),
5378c2ecf20Sopenharmony_ci	MUX(CLK_INFRA_CA72SEL, "infra_ca72_sel", ca72_parents, 0x0000, 2, 2),
5388c2ecf20Sopenharmony_ci};
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_cistatic const struct mtk_composite top_muxes[] __initconst = {
5418c2ecf20Sopenharmony_ci	/* CLK_CFG_0 */
5428c2ecf20Sopenharmony_ci	MUX(CLK_TOP_AXI_SEL, "axi_sel", axi_parents, 0x0040, 0, 3),
5438c2ecf20Sopenharmony_ci	MUX(CLK_TOP_MEM_SEL, "mem_sel", mem_parents, 0x0040, 8, 1),
5448c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_DDRPHYCFG_SEL, "ddrphycfg_sel", ddrphycfg_parents, 0x0040, 16, 1, 23),
5458c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MM_SEL, "mm_sel", mm_parents, 0x0040, 24, 4, 31),
5468c2ecf20Sopenharmony_ci	/* CLK_CFG_1 */
5478c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_PWM_SEL, "pwm_sel", pwm_parents, 0x0050, 0, 2, 7),
5488c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_VDEC_SEL, "vdec_sel", vdec_parents, 0x0050, 8, 4, 15),
5498c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_VENC_SEL, "venc_sel", venc_parents, 0x0050, 16, 4, 23),
5508c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MFG_SEL, "mfg_sel", mfg_parents, 0x0050, 24, 4, 31),
5518c2ecf20Sopenharmony_ci	/* CLK_CFG_2 */
5528c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_CAMTG_SEL, "camtg_sel", camtg_parents, 0x0060, 0, 3, 7),
5538c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_UART_SEL, "uart_sel", uart_parents, 0x0060, 8, 1, 15),
5548c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_SPI_SEL, "spi_sel", spi_parents, 0x0060, 16, 3, 23),
5558c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_USB20_SEL, "usb20_sel", usb20_parents, 0x0060, 24, 2, 31),
5568c2ecf20Sopenharmony_ci	/* CLK_CFG_3 */
5578c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_USB30_SEL, "usb30_sel", usb30_parents, 0x0070, 0, 2, 7),
5588c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MSDC50_0_H_SEL, "msdc50_0_h_sel", msdc50_0_h_parents, 0x0070, 8, 3, 15),
5598c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", msdc50_0_parents, 0x0070, 16, 4, 23),
5608c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", msdc30_1_parents, 0x0070, 24, 3, 31),
5618c2ecf20Sopenharmony_ci	/* CLK_CFG_4 */
5628c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel", msdc30_2_parents, 0x0080, 0, 3, 7),
5638c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MSDC30_3_SEL, "msdc30_3_sel", msdc30_3_parents, 0x0080, 8, 4, 15),
5648c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_AUDIO_SEL, "audio_sel", audio_parents, 0x0080, 16, 2, 23),
5658c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel", aud_intbus_parents, 0x0080, 24, 3, 31),
5668c2ecf20Sopenharmony_ci	/* CLK_CFG_5 */
5678c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_PMICSPI_SEL, "pmicspi_sel", pmicspi_parents, 0x0090, 0, 3, 7 /* 7:5 */),
5688c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_SCP_SEL, "scp_sel", scp_parents, 0x0090, 8, 3, 15),
5698c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_ATB_SEL, "atb_sel", atb_parents, 0x0090, 16, 2, 23),
5708c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_VENC_LT_SEL, "venclt_sel", venc_lt_parents, 0x0090, 24, 4, 31),
5718c2ecf20Sopenharmony_ci	/* CLK_CFG_6 */
5728c2ecf20Sopenharmony_ci	/*
5738c2ecf20Sopenharmony_ci	 * The dpi0_sel clock should not propagate rate changes to its parent
5748c2ecf20Sopenharmony_ci	 * clock so the dpi driver can have full control over PLL and divider.
5758c2ecf20Sopenharmony_ci	 */
5768c2ecf20Sopenharmony_ci	MUX_GATE_FLAGS(CLK_TOP_DPI0_SEL, "dpi0_sel", dpi0_parents, 0x00a0, 0, 3, 7, 0),
5778c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_IRDA_SEL, "irda_sel", irda_parents, 0x00a0, 8, 2, 15),
5788c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_CCI400_SEL, "cci400_sel", cci400_parents, 0x00a0, 16, 3, 23),
5798c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_AUD_1_SEL, "aud_1_sel", aud_1_parents, 0x00a0, 24, 2, 31),
5808c2ecf20Sopenharmony_ci	/* CLK_CFG_7 */
5818c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_AUD_2_SEL, "aud_2_sel", aud_2_parents, 0x00b0, 0, 2, 7),
5828c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MEM_MFG_IN_SEL, "mem_mfg_in_sel", mem_mfg_in_parents, 0x00b0, 8, 2, 15),
5838c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_AXI_MFG_IN_SEL, "axi_mfg_in_sel", axi_mfg_in_parents, 0x00b0, 16, 2, 23),
5848c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_SCAM_SEL, "scam_sel", scam_parents, 0x00b0, 24, 2, 31),
5858c2ecf20Sopenharmony_ci	/* CLK_CFG_12 */
5868c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_SPINFI_IFR_SEL, "spinfi_ifr_sel", spinfi_ifr_parents, 0x00c0, 0, 3, 7),
5878c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_HDMI_SEL, "hdmi_sel", hdmi_parents, 0x00c0, 8, 2, 15),
5888c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_DPILVDS_SEL, "dpilvds_sel", dpilvds_parents, 0x00c0, 24, 3, 31),
5898c2ecf20Sopenharmony_ci	/* CLK_CFG_13 */
5908c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_MSDC50_2_H_SEL, "msdc50_2_h_sel", msdc50_2_h_parents, 0x00d0, 0, 3, 7),
5918c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_HDCP_SEL, "hdcp_sel", hdcp_parents, 0x00d0, 8, 2, 15),
5928c2ecf20Sopenharmony_ci	MUX_GATE(CLK_TOP_HDCP_24M_SEL, "hdcp_24m_sel", hdcp_24m_parents, 0x00d0, 16, 2, 23),
5938c2ecf20Sopenharmony_ci	MUX(CLK_TOP_RTC_SEL, "rtc_sel", rtc_parents, 0x00d0, 24, 2),
5948c2ecf20Sopenharmony_ci
5958c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL1_DIV0, "apll1_div0", "aud_1_sel", 0x12c, 8, 0x120, 4, 24),
5968c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL1_DIV1, "apll1_div1", "aud_1_sel", 0x12c, 9, 0x124, 8, 0),
5978c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL1_DIV2, "apll1_div2", "aud_1_sel", 0x12c, 10, 0x124, 8, 8),
5988c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL1_DIV3, "apll1_div3", "aud_1_sel", 0x12c, 11, 0x124, 8, 16),
5998c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL1_DIV4, "apll1_div4", "aud_1_sel", 0x12c, 12, 0x124, 8, 24),
6008c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL1_DIV5, "apll1_div5", "apll1_div4", 0x12c, 13, 0x12c, 4, 0),
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL2_DIV0, "apll2_div0", "aud_2_sel", 0x12c, 16, 0x120, 4, 28),
6038c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL2_DIV1, "apll2_div1", "aud_2_sel", 0x12c, 17, 0x128, 8, 0),
6048c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL2_DIV2, "apll2_div2", "aud_2_sel", 0x12c, 18, 0x128, 8, 8),
6058c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL2_DIV3, "apll2_div3", "aud_2_sel", 0x12c, 19, 0x128, 8, 16),
6068c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL2_DIV4, "apll2_div4", "aud_2_sel", 0x12c, 20, 0x128, 8, 24),
6078c2ecf20Sopenharmony_ci	DIV_GATE(CLK_TOP_APLL2_DIV5, "apll2_div5", "apll2_div4", 0x12c, 21, 0x12c, 4, 4),
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci	MUX(CLK_TOP_I2S0_M_SEL, "i2s0_m_ck_sel", i2s0_m_ck_parents, 0x120, 4, 1),
6108c2ecf20Sopenharmony_ci	MUX(CLK_TOP_I2S1_M_SEL, "i2s1_m_ck_sel", i2s1_m_ck_parents, 0x120, 5, 1),
6118c2ecf20Sopenharmony_ci	MUX(CLK_TOP_I2S2_M_SEL, "i2s2_m_ck_sel", i2s2_m_ck_parents, 0x120, 6, 1),
6128c2ecf20Sopenharmony_ci	MUX(CLK_TOP_I2S3_M_SEL, "i2s3_m_ck_sel", i2s3_m_ck_parents, 0x120, 7, 1),
6138c2ecf20Sopenharmony_ci	MUX(CLK_TOP_I2S3_B_SEL, "i2s3_b_ck_sel", i2s3_b_ck_parents, 0x120, 8, 1),
6148c2ecf20Sopenharmony_ci};
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs infra_cg_regs __initconst = {
6178c2ecf20Sopenharmony_ci	.set_ofs = 0x0040,
6188c2ecf20Sopenharmony_ci	.clr_ofs = 0x0044,
6198c2ecf20Sopenharmony_ci	.sta_ofs = 0x0048,
6208c2ecf20Sopenharmony_ci};
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci#define GATE_ICG(_id, _name, _parent, _shift) {	\
6238c2ecf20Sopenharmony_ci		.id = _id,					\
6248c2ecf20Sopenharmony_ci		.name = _name,					\
6258c2ecf20Sopenharmony_ci		.parent_name = _parent,				\
6268c2ecf20Sopenharmony_ci		.regs = &infra_cg_regs,				\
6278c2ecf20Sopenharmony_ci		.shift = _shift,				\
6288c2ecf20Sopenharmony_ci		.ops = &mtk_clk_gate_ops_setclr,		\
6298c2ecf20Sopenharmony_ci	}
6308c2ecf20Sopenharmony_ci
6318c2ecf20Sopenharmony_cistatic const struct mtk_gate infra_clks[] __initconst = {
6328c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_DBGCLK, "infra_dbgclk", "axi_sel", 0),
6338c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_SMI, "infra_smi", "mm_sel", 1),
6348c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_AUDIO, "infra_audio", "aud_intbus_sel", 5),
6358c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_GCE, "infra_gce", "axi_sel", 6),
6368c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_L2C_SRAM, "infra_l2c_sram", "axi_sel", 7),
6378c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_M4U, "infra_m4u", "mem_sel", 8),
6388c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_CPUM, "infra_cpum", "cpum_ck", 15),
6398c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_KP, "infra_kp", "axi_sel", 16),
6408c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_CEC, "infra_cec", "clk26m", 18),
6418c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_PMICSPI, "infra_pmicspi", "pmicspi_sel", 22),
6428c2ecf20Sopenharmony_ci	GATE_ICG(CLK_INFRA_PMICWRAP, "infra_pmicwrap", "axi_sel", 23),
6438c2ecf20Sopenharmony_ci};
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_cistatic const struct mtk_fixed_factor infra_divs[] __initconst = {
6468c2ecf20Sopenharmony_ci	FACTOR(CLK_INFRA_CLK_13M, "clk13m", "clk26m", 1, 2),
6478c2ecf20Sopenharmony_ci};
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs peri0_cg_regs __initconst = {
6508c2ecf20Sopenharmony_ci	.set_ofs = 0x0008,
6518c2ecf20Sopenharmony_ci	.clr_ofs = 0x0010,
6528c2ecf20Sopenharmony_ci	.sta_ofs = 0x0018,
6538c2ecf20Sopenharmony_ci};
6548c2ecf20Sopenharmony_ci
6558c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs peri1_cg_regs __initconst = {
6568c2ecf20Sopenharmony_ci	.set_ofs = 0x000c,
6578c2ecf20Sopenharmony_ci	.clr_ofs = 0x0014,
6588c2ecf20Sopenharmony_ci	.sta_ofs = 0x001c,
6598c2ecf20Sopenharmony_ci};
6608c2ecf20Sopenharmony_ci
6618c2ecf20Sopenharmony_ci#define GATE_PERI0(_id, _name, _parent, _shift) {	\
6628c2ecf20Sopenharmony_ci		.id = _id,					\
6638c2ecf20Sopenharmony_ci		.name = _name,					\
6648c2ecf20Sopenharmony_ci		.parent_name = _parent,				\
6658c2ecf20Sopenharmony_ci		.regs = &peri0_cg_regs,				\
6668c2ecf20Sopenharmony_ci		.shift = _shift,				\
6678c2ecf20Sopenharmony_ci		.ops = &mtk_clk_gate_ops_setclr,		\
6688c2ecf20Sopenharmony_ci	}
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci#define GATE_PERI1(_id, _name, _parent, _shift) {	\
6718c2ecf20Sopenharmony_ci		.id = _id,					\
6728c2ecf20Sopenharmony_ci		.name = _name,					\
6738c2ecf20Sopenharmony_ci		.parent_name = _parent,				\
6748c2ecf20Sopenharmony_ci		.regs = &peri1_cg_regs,				\
6758c2ecf20Sopenharmony_ci		.shift = _shift,				\
6768c2ecf20Sopenharmony_ci		.ops = &mtk_clk_gate_ops_setclr,		\
6778c2ecf20Sopenharmony_ci	}
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_cistatic const struct mtk_gate peri_gates[] __initconst = {
6808c2ecf20Sopenharmony_ci	/* PERI0 */
6818c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_NFI, "peri_nfi", "axi_sel", 0),
6828c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_THERM, "peri_therm", "axi_sel", 1),
6838c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_PWM1, "peri_pwm1", "axi_sel", 2),
6848c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_PWM2, "peri_pwm2", "axi_sel", 3),
6858c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_PWM3, "peri_pwm3", "axi_sel", 4),
6868c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_PWM4, "peri_pwm4", "axi_sel", 5),
6878c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_PWM5, "peri_pwm5", "axi_sel", 6),
6888c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_PWM6, "peri_pwm6", "axi_sel", 7),
6898c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_PWM7, "peri_pwm7", "axi_sel", 8),
6908c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_PWM, "peri_pwm", "axi_sel", 9),
6918c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_USB0, "peri_usb0", "usb20_sel", 10),
6928c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_USB1, "peri_usb1", "usb20_sel", 11),
6938c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_AP_DMA, "peri_ap_dma", "axi_sel", 12),
6948c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_MSDC30_0, "peri_msdc30_0", "msdc50_0_sel", 13),
6958c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_MSDC30_1, "peri_msdc30_1", "msdc30_1_sel", 14),
6968c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_MSDC30_2, "peri_msdc30_2", "msdc30_2_sel", 15),
6978c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_MSDC30_3, "peri_msdc30_3", "msdc30_3_sel", 16),
6988c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_NLI_ARB, "peri_nli_arb", "axi_sel", 17),
6998c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_IRDA, "peri_irda", "irda_sel", 18),
7008c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_UART0, "peri_uart0", "axi_sel", 19),
7018c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_UART1, "peri_uart1", "axi_sel", 20),
7028c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_UART2, "peri_uart2", "axi_sel", 21),
7038c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_UART3, "peri_uart3", "axi_sel", 22),
7048c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_I2C0, "peri_i2c0", "axi_sel", 23),
7058c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_I2C1, "peri_i2c1", "axi_sel", 24),
7068c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_I2C2, "peri_i2c2", "axi_sel", 25),
7078c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_I2C3, "peri_i2c3", "axi_sel", 26),
7088c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_I2C4, "peri_i2c4", "axi_sel", 27),
7098c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_AUXADC, "peri_auxadc", "clk26m", 28),
7108c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_SPI0, "peri_spi0", "spi_sel", 29),
7118c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_I2C5, "peri_i2c5", "axi_sel", 30),
7128c2ecf20Sopenharmony_ci	GATE_PERI0(CLK_PERI_NFIECC, "peri_nfiecc", "axi_sel", 31),
7138c2ecf20Sopenharmony_ci	/* PERI1 */
7148c2ecf20Sopenharmony_ci	GATE_PERI1(CLK_PERI_SPI, "peri_spi", "spi_sel", 0),
7158c2ecf20Sopenharmony_ci	GATE_PERI1(CLK_PERI_IRRX, "peri_irrx", "spi_sel", 1),
7168c2ecf20Sopenharmony_ci	GATE_PERI1(CLK_PERI_I2C6, "peri_i2c6", "axi_sel", 2),
7178c2ecf20Sopenharmony_ci};
7188c2ecf20Sopenharmony_ci
7198c2ecf20Sopenharmony_cistatic const char * const uart_ck_sel_parents[] __initconst = {
7208c2ecf20Sopenharmony_ci	"clk26m",
7218c2ecf20Sopenharmony_ci	"uart_sel",
7228c2ecf20Sopenharmony_ci};
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_cistatic const struct mtk_composite peri_clks[] __initconst = {
7258c2ecf20Sopenharmony_ci	MUX(CLK_PERI_UART0_SEL, "uart0_ck_sel", uart_ck_sel_parents, 0x40c, 0, 1),
7268c2ecf20Sopenharmony_ci	MUX(CLK_PERI_UART1_SEL, "uart1_ck_sel", uart_ck_sel_parents, 0x40c, 1, 1),
7278c2ecf20Sopenharmony_ci	MUX(CLK_PERI_UART2_SEL, "uart2_ck_sel", uart_ck_sel_parents, 0x40c, 2, 1),
7288c2ecf20Sopenharmony_ci	MUX(CLK_PERI_UART3_SEL, "uart3_ck_sel", uart_ck_sel_parents, 0x40c, 3, 1),
7298c2ecf20Sopenharmony_ci};
7308c2ecf20Sopenharmony_ci
7318c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs cg_regs_4_8_0 __initconst = {
7328c2ecf20Sopenharmony_ci	.set_ofs = 0x0004,
7338c2ecf20Sopenharmony_ci	.clr_ofs = 0x0008,
7348c2ecf20Sopenharmony_ci	.sta_ofs = 0x0000,
7358c2ecf20Sopenharmony_ci};
7368c2ecf20Sopenharmony_ci
7378c2ecf20Sopenharmony_ci#define GATE_IMG(_id, _name, _parent, _shift) {			\
7388c2ecf20Sopenharmony_ci		.id = _id,					\
7398c2ecf20Sopenharmony_ci		.name = _name,					\
7408c2ecf20Sopenharmony_ci		.parent_name = _parent,				\
7418c2ecf20Sopenharmony_ci		.regs = &cg_regs_4_8_0,				\
7428c2ecf20Sopenharmony_ci		.shift = _shift,				\
7438c2ecf20Sopenharmony_ci		.ops = &mtk_clk_gate_ops_setclr,		\
7448c2ecf20Sopenharmony_ci	}
7458c2ecf20Sopenharmony_ci
7468c2ecf20Sopenharmony_cistatic const struct mtk_gate img_clks[] __initconst = {
7478c2ecf20Sopenharmony_ci	GATE_IMG(CLK_IMG_LARB2_SMI, "img_larb2_smi", "mm_sel", 0),
7488c2ecf20Sopenharmony_ci	GATE_IMG(CLK_IMG_CAM_SMI, "img_cam_smi", "mm_sel", 5),
7498c2ecf20Sopenharmony_ci	GATE_IMG(CLK_IMG_CAM_CAM, "img_cam_cam", "mm_sel", 6),
7508c2ecf20Sopenharmony_ci	GATE_IMG(CLK_IMG_SEN_TG, "img_sen_tg", "camtg_sel", 7),
7518c2ecf20Sopenharmony_ci	GATE_IMG(CLK_IMG_SEN_CAM, "img_sen_cam", "mm_sel", 8),
7528c2ecf20Sopenharmony_ci	GATE_IMG(CLK_IMG_CAM_SV, "img_cam_sv", "mm_sel", 9),
7538c2ecf20Sopenharmony_ci	GATE_IMG(CLK_IMG_FD, "img_fd", "mm_sel", 11),
7548c2ecf20Sopenharmony_ci};
7558c2ecf20Sopenharmony_ci
7568c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs vdec0_cg_regs __initconst = {
7578c2ecf20Sopenharmony_ci	.set_ofs = 0x0000,
7588c2ecf20Sopenharmony_ci	.clr_ofs = 0x0004,
7598c2ecf20Sopenharmony_ci	.sta_ofs = 0x0000,
7608c2ecf20Sopenharmony_ci};
7618c2ecf20Sopenharmony_ci
7628c2ecf20Sopenharmony_cistatic const struct mtk_gate_regs vdec1_cg_regs __initconst = {
7638c2ecf20Sopenharmony_ci	.set_ofs = 0x0008,
7648c2ecf20Sopenharmony_ci	.clr_ofs = 0x000c,
7658c2ecf20Sopenharmony_ci	.sta_ofs = 0x0008,
7668c2ecf20Sopenharmony_ci};
7678c2ecf20Sopenharmony_ci
7688c2ecf20Sopenharmony_ci#define GATE_VDEC0(_id, _name, _parent, _shift) {		\
7698c2ecf20Sopenharmony_ci		.id = _id,					\
7708c2ecf20Sopenharmony_ci		.name = _name,					\
7718c2ecf20Sopenharmony_ci		.parent_name = _parent,				\
7728c2ecf20Sopenharmony_ci		.regs = &vdec0_cg_regs,				\
7738c2ecf20Sopenharmony_ci		.shift = _shift,				\
7748c2ecf20Sopenharmony_ci		.ops = &mtk_clk_gate_ops_setclr_inv,		\
7758c2ecf20Sopenharmony_ci	}
7768c2ecf20Sopenharmony_ci
7778c2ecf20Sopenharmony_ci#define GATE_VDEC1(_id, _name, _parent, _shift) {		\
7788c2ecf20Sopenharmony_ci		.id = _id,					\
7798c2ecf20Sopenharmony_ci		.name = _name,					\
7808c2ecf20Sopenharmony_ci		.parent_name = _parent,				\
7818c2ecf20Sopenharmony_ci		.regs = &vdec1_cg_regs,				\
7828c2ecf20Sopenharmony_ci		.shift = _shift,				\
7838c2ecf20Sopenharmony_ci		.ops = &mtk_clk_gate_ops_setclr_inv,		\
7848c2ecf20Sopenharmony_ci	}
7858c2ecf20Sopenharmony_ci
7868c2ecf20Sopenharmony_cistatic const struct mtk_gate vdec_clks[] __initconst = {
7878c2ecf20Sopenharmony_ci	GATE_VDEC0(CLK_VDEC_CKEN, "vdec_cken", "vdec_sel", 0),
7888c2ecf20Sopenharmony_ci	GATE_VDEC1(CLK_VDEC_LARB_CKEN, "vdec_larb_cken", "mm_sel", 0),
7898c2ecf20Sopenharmony_ci};
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci#define GATE_VENC(_id, _name, _parent, _shift) {		\
7928c2ecf20Sopenharmony_ci		.id = _id,					\
7938c2ecf20Sopenharmony_ci		.name = _name,					\
7948c2ecf20Sopenharmony_ci		.parent_name = _parent,				\
7958c2ecf20Sopenharmony_ci		.regs = &cg_regs_4_8_0,				\
7968c2ecf20Sopenharmony_ci		.shift = _shift,				\
7978c2ecf20Sopenharmony_ci		.ops = &mtk_clk_gate_ops_setclr_inv,		\
7988c2ecf20Sopenharmony_ci	}
7998c2ecf20Sopenharmony_ci
8008c2ecf20Sopenharmony_cistatic const struct mtk_gate venc_clks[] __initconst = {
8018c2ecf20Sopenharmony_ci	GATE_VENC(CLK_VENC_CKE0, "venc_cke0", "mm_sel", 0),
8028c2ecf20Sopenharmony_ci	GATE_VENC(CLK_VENC_CKE1, "venc_cke1", "venc_sel", 4),
8038c2ecf20Sopenharmony_ci	GATE_VENC(CLK_VENC_CKE2, "venc_cke2", "venc_sel", 8),
8048c2ecf20Sopenharmony_ci	GATE_VENC(CLK_VENC_CKE3, "venc_cke3", "venc_sel", 12),
8058c2ecf20Sopenharmony_ci};
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci#define GATE_VENCLT(_id, _name, _parent, _shift) {		\
8088c2ecf20Sopenharmony_ci		.id = _id,					\
8098c2ecf20Sopenharmony_ci		.name = _name,					\
8108c2ecf20Sopenharmony_ci		.parent_name = _parent,				\
8118c2ecf20Sopenharmony_ci		.regs = &cg_regs_4_8_0,				\
8128c2ecf20Sopenharmony_ci		.shift = _shift,				\
8138c2ecf20Sopenharmony_ci		.ops = &mtk_clk_gate_ops_setclr_inv,		\
8148c2ecf20Sopenharmony_ci	}
8158c2ecf20Sopenharmony_ci
8168c2ecf20Sopenharmony_cistatic const struct mtk_gate venclt_clks[] __initconst = {
8178c2ecf20Sopenharmony_ci	GATE_VENCLT(CLK_VENCLT_CKE0, "venclt_cke0", "mm_sel", 0),
8188c2ecf20Sopenharmony_ci	GATE_VENCLT(CLK_VENCLT_CKE1, "venclt_cke1", "venclt_sel", 4),
8198c2ecf20Sopenharmony_ci};
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_cistatic struct clk_onecell_data *mt8173_top_clk_data __initdata;
8228c2ecf20Sopenharmony_cistatic struct clk_onecell_data *mt8173_pll_clk_data __initdata;
8238c2ecf20Sopenharmony_ci
8248c2ecf20Sopenharmony_cistatic void __init mtk_clk_enable_critical(void)
8258c2ecf20Sopenharmony_ci{
8268c2ecf20Sopenharmony_ci	if (!mt8173_top_clk_data || !mt8173_pll_clk_data)
8278c2ecf20Sopenharmony_ci		return;
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci	clk_prepare_enable(mt8173_pll_clk_data->clks[CLK_APMIXED_ARMCA15PLL]);
8308c2ecf20Sopenharmony_ci	clk_prepare_enable(mt8173_pll_clk_data->clks[CLK_APMIXED_ARMCA7PLL]);
8318c2ecf20Sopenharmony_ci	clk_prepare_enable(mt8173_top_clk_data->clks[CLK_TOP_MEM_SEL]);
8328c2ecf20Sopenharmony_ci	clk_prepare_enable(mt8173_top_clk_data->clks[CLK_TOP_DDRPHYCFG_SEL]);
8338c2ecf20Sopenharmony_ci	clk_prepare_enable(mt8173_top_clk_data->clks[CLK_TOP_CCI400_SEL]);
8348c2ecf20Sopenharmony_ci	clk_prepare_enable(mt8173_top_clk_data->clks[CLK_TOP_RTC_SEL]);
8358c2ecf20Sopenharmony_ci}
8368c2ecf20Sopenharmony_ci
8378c2ecf20Sopenharmony_cistatic void __init mtk_topckgen_init(struct device_node *node)
8388c2ecf20Sopenharmony_ci{
8398c2ecf20Sopenharmony_ci	struct clk_onecell_data *clk_data;
8408c2ecf20Sopenharmony_ci	void __iomem *base;
8418c2ecf20Sopenharmony_ci	int r;
8428c2ecf20Sopenharmony_ci
8438c2ecf20Sopenharmony_ci	base = of_iomap(node, 0);
8448c2ecf20Sopenharmony_ci	if (!base) {
8458c2ecf20Sopenharmony_ci		pr_err("%s(): ioremap failed\n", __func__);
8468c2ecf20Sopenharmony_ci		return;
8478c2ecf20Sopenharmony_ci	}
8488c2ecf20Sopenharmony_ci
8498c2ecf20Sopenharmony_ci	mt8173_top_clk_data = clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
8508c2ecf20Sopenharmony_ci
8518c2ecf20Sopenharmony_ci	mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks), clk_data);
8528c2ecf20Sopenharmony_ci	mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
8538c2ecf20Sopenharmony_ci	mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
8548c2ecf20Sopenharmony_ci			&mt8173_clk_lock, clk_data);
8558c2ecf20Sopenharmony_ci
8568c2ecf20Sopenharmony_ci	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
8578c2ecf20Sopenharmony_ci	if (r)
8588c2ecf20Sopenharmony_ci		pr_err("%s(): could not register clock provider: %d\n",
8598c2ecf20Sopenharmony_ci			__func__, r);
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci	mtk_clk_enable_critical();
8628c2ecf20Sopenharmony_ci}
8638c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8173-topckgen", mtk_topckgen_init);
8648c2ecf20Sopenharmony_ci
8658c2ecf20Sopenharmony_cistatic void __init mtk_infrasys_init(struct device_node *node)
8668c2ecf20Sopenharmony_ci{
8678c2ecf20Sopenharmony_ci	struct clk_onecell_data *clk_data;
8688c2ecf20Sopenharmony_ci	int r;
8698c2ecf20Sopenharmony_ci
8708c2ecf20Sopenharmony_ci	clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
8718c2ecf20Sopenharmony_ci
8728c2ecf20Sopenharmony_ci	mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
8738c2ecf20Sopenharmony_ci						clk_data);
8748c2ecf20Sopenharmony_ci	mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
8758c2ecf20Sopenharmony_ci
8768c2ecf20Sopenharmony_ci	mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
8778c2ecf20Sopenharmony_ci				  clk_data);
8788c2ecf20Sopenharmony_ci
8798c2ecf20Sopenharmony_ci	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
8808c2ecf20Sopenharmony_ci	if (r)
8818c2ecf20Sopenharmony_ci		pr_err("%s(): could not register clock provider: %d\n",
8828c2ecf20Sopenharmony_ci			__func__, r);
8838c2ecf20Sopenharmony_ci
8848c2ecf20Sopenharmony_ci	mtk_register_reset_controller(node, 2, 0x30);
8858c2ecf20Sopenharmony_ci}
8868c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_infrasys, "mediatek,mt8173-infracfg", mtk_infrasys_init);
8878c2ecf20Sopenharmony_ci
8888c2ecf20Sopenharmony_cistatic void __init mtk_pericfg_init(struct device_node *node)
8898c2ecf20Sopenharmony_ci{
8908c2ecf20Sopenharmony_ci	struct clk_onecell_data *clk_data;
8918c2ecf20Sopenharmony_ci	int r;
8928c2ecf20Sopenharmony_ci	void __iomem *base;
8938c2ecf20Sopenharmony_ci
8948c2ecf20Sopenharmony_ci	base = of_iomap(node, 0);
8958c2ecf20Sopenharmony_ci	if (!base) {
8968c2ecf20Sopenharmony_ci		pr_err("%s(): ioremap failed\n", __func__);
8978c2ecf20Sopenharmony_ci		return;
8988c2ecf20Sopenharmony_ci	}
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_ci	clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
9018c2ecf20Sopenharmony_ci
9028c2ecf20Sopenharmony_ci	mtk_clk_register_gates(node, peri_gates, ARRAY_SIZE(peri_gates),
9038c2ecf20Sopenharmony_ci						clk_data);
9048c2ecf20Sopenharmony_ci	mtk_clk_register_composites(peri_clks, ARRAY_SIZE(peri_clks), base,
9058c2ecf20Sopenharmony_ci			&mt8173_clk_lock, clk_data);
9068c2ecf20Sopenharmony_ci
9078c2ecf20Sopenharmony_ci	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
9088c2ecf20Sopenharmony_ci	if (r)
9098c2ecf20Sopenharmony_ci		pr_err("%s(): could not register clock provider: %d\n",
9108c2ecf20Sopenharmony_ci			__func__, r);
9118c2ecf20Sopenharmony_ci
9128c2ecf20Sopenharmony_ci	mtk_register_reset_controller(node, 2, 0);
9138c2ecf20Sopenharmony_ci}
9148c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_pericfg, "mediatek,mt8173-pericfg", mtk_pericfg_init);
9158c2ecf20Sopenharmony_ci
9168c2ecf20Sopenharmony_cistruct mtk_clk_usb {
9178c2ecf20Sopenharmony_ci	int id;
9188c2ecf20Sopenharmony_ci	const char *name;
9198c2ecf20Sopenharmony_ci	const char *parent;
9208c2ecf20Sopenharmony_ci	u32 reg_ofs;
9218c2ecf20Sopenharmony_ci};
9228c2ecf20Sopenharmony_ci
9238c2ecf20Sopenharmony_ci#define APMIXED_USB(_id, _name, _parent, _reg_ofs) {			\
9248c2ecf20Sopenharmony_ci		.id = _id,						\
9258c2ecf20Sopenharmony_ci		.name = _name,						\
9268c2ecf20Sopenharmony_ci		.parent = _parent,					\
9278c2ecf20Sopenharmony_ci		.reg_ofs = _reg_ofs,					\
9288c2ecf20Sopenharmony_ci	}
9298c2ecf20Sopenharmony_ci
9308c2ecf20Sopenharmony_cistatic const struct mtk_clk_usb apmixed_usb[] __initconst = {
9318c2ecf20Sopenharmony_ci	APMIXED_USB(CLK_APMIXED_REF2USB_TX, "ref2usb_tx", "clk26m", 0x8),
9328c2ecf20Sopenharmony_ci};
9338c2ecf20Sopenharmony_ci
9348c2ecf20Sopenharmony_ci#define MT8173_PLL_FMAX		(3000UL * MHZ)
9358c2ecf20Sopenharmony_ci
9368c2ecf20Sopenharmony_ci#define CON0_MT8173_RST_BAR	BIT(24)
9378c2ecf20Sopenharmony_ci
9388c2ecf20Sopenharmony_ci#define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits,	\
9398c2ecf20Sopenharmony_ci			_pd_reg, _pd_shift, _tuner_reg, _pcw_reg,	\
9408c2ecf20Sopenharmony_ci			_pcw_shift, _div_table) {			\
9418c2ecf20Sopenharmony_ci		.id = _id,						\
9428c2ecf20Sopenharmony_ci		.name = _name,						\
9438c2ecf20Sopenharmony_ci		.reg = _reg,						\
9448c2ecf20Sopenharmony_ci		.pwr_reg = _pwr_reg,					\
9458c2ecf20Sopenharmony_ci		.en_mask = _en_mask,					\
9468c2ecf20Sopenharmony_ci		.flags = _flags,					\
9478c2ecf20Sopenharmony_ci		.rst_bar_mask = CON0_MT8173_RST_BAR,			\
9488c2ecf20Sopenharmony_ci		.fmax = MT8173_PLL_FMAX,				\
9498c2ecf20Sopenharmony_ci		.pcwbits = _pcwbits,					\
9508c2ecf20Sopenharmony_ci		.pd_reg = _pd_reg,					\
9518c2ecf20Sopenharmony_ci		.pd_shift = _pd_shift,					\
9528c2ecf20Sopenharmony_ci		.tuner_reg = _tuner_reg,				\
9538c2ecf20Sopenharmony_ci		.pcw_reg = _pcw_reg,					\
9548c2ecf20Sopenharmony_ci		.pcw_shift = _pcw_shift,				\
9558c2ecf20Sopenharmony_ci		.div_table = _div_table,				\
9568c2ecf20Sopenharmony_ci	}
9578c2ecf20Sopenharmony_ci
9588c2ecf20Sopenharmony_ci#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits,	\
9598c2ecf20Sopenharmony_ci			_pd_reg, _pd_shift, _tuner_reg, _pcw_reg,	\
9608c2ecf20Sopenharmony_ci			_pcw_shift)					\
9618c2ecf20Sopenharmony_ci		PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
9628c2ecf20Sopenharmony_ci			_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift, \
9638c2ecf20Sopenharmony_ci			NULL)
9648c2ecf20Sopenharmony_ci
9658c2ecf20Sopenharmony_cistatic const struct mtk_pll_div_table mmpll_div_table[] = {
9668c2ecf20Sopenharmony_ci	{ .div = 0, .freq = MT8173_PLL_FMAX },
9678c2ecf20Sopenharmony_ci	{ .div = 1, .freq = 1000000000 },
9688c2ecf20Sopenharmony_ci	{ .div = 2, .freq = 702000000 },
9698c2ecf20Sopenharmony_ci	{ .div = 3, .freq = 253500000 },
9708c2ecf20Sopenharmony_ci	{ .div = 4, .freq = 126750000 },
9718c2ecf20Sopenharmony_ci	{ } /* sentinel */
9728c2ecf20Sopenharmony_ci};
9738c2ecf20Sopenharmony_ci
9748c2ecf20Sopenharmony_cistatic const struct mtk_pll_data plls[] = {
9758c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_ARMCA15PLL, "armca15pll", 0x200, 0x20c, 0x00000001, 0, 21, 0x204, 24, 0x0, 0x204, 0),
9768c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_ARMCA7PLL, "armca7pll", 0x210, 0x21c, 0x00000001, 0, 21, 0x214, 24, 0x0, 0x214, 0),
9778c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x220, 0x22c, 0xf0000101, HAVE_RST_BAR, 21, 0x220, 4, 0x0, 0x224, 0),
9788c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x230, 0x23c, 0xfe000001, HAVE_RST_BAR, 7, 0x230, 4, 0x0, 0x234, 14),
9798c2ecf20Sopenharmony_ci	PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x240, 0x24c, 0x00000001, 0, 21, 0x244, 24, 0x0, 0x244, 0, mmpll_div_table),
9808c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x250, 0x25c, 0x00000001, 0, 21, 0x250, 4, 0x0, 0x254, 0),
9818c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_VENCPLL, "vencpll", 0x260, 0x26c, 0x00000001, 0, 21, 0x260, 4, 0x0, 0x264, 0),
9828c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x270, 0x27c, 0x00000001, 0, 21, 0x270, 4, 0x0, 0x274, 0),
9838c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_MPLL, "mpll", 0x280, 0x28c, 0x00000001, 0, 21, 0x280, 4, 0x0, 0x284, 0),
9848c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_VCODECPLL, "vcodecpll", 0x290, 0x29c, 0x00000001, 0, 21, 0x290, 4, 0x0, 0x294, 0),
9858c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_APLL1, "apll1", 0x2a0, 0x2b0, 0x00000001, 0, 31, 0x2a0, 4, 0x2a4, 0x2a4, 0),
9868c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_APLL2, "apll2", 0x2b4, 0x2c4, 0x00000001, 0, 31, 0x2b4, 4, 0x2b8, 0x2b8, 0),
9878c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x2d0, 0x2dc, 0x00000001, 0, 21, 0x2d0, 4, 0x0, 0x2d4, 0),
9888c2ecf20Sopenharmony_ci	PLL(CLK_APMIXED_MSDCPLL2, "msdcpll2", 0x2f0, 0x2fc, 0x00000001, 0, 21, 0x2f0, 4, 0x0, 0x2f4, 0),
9898c2ecf20Sopenharmony_ci};
9908c2ecf20Sopenharmony_ci
9918c2ecf20Sopenharmony_cistatic void __init mtk_apmixedsys_init(struct device_node *node)
9928c2ecf20Sopenharmony_ci{
9938c2ecf20Sopenharmony_ci	struct clk_onecell_data *clk_data;
9948c2ecf20Sopenharmony_ci	void __iomem *base;
9958c2ecf20Sopenharmony_ci	struct clk *clk;
9968c2ecf20Sopenharmony_ci	int r, i;
9978c2ecf20Sopenharmony_ci
9988c2ecf20Sopenharmony_ci	base = of_iomap(node, 0);
9998c2ecf20Sopenharmony_ci	if (!base) {
10008c2ecf20Sopenharmony_ci		pr_err("%s(): ioremap failed\n", __func__);
10018c2ecf20Sopenharmony_ci		return;
10028c2ecf20Sopenharmony_ci	}
10038c2ecf20Sopenharmony_ci
10048c2ecf20Sopenharmony_ci	mt8173_pll_clk_data = clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
10058c2ecf20Sopenharmony_ci	if (!clk_data) {
10068c2ecf20Sopenharmony_ci		iounmap(base);
10078c2ecf20Sopenharmony_ci		return;
10088c2ecf20Sopenharmony_ci	}
10098c2ecf20Sopenharmony_ci
10108c2ecf20Sopenharmony_ci	mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
10118c2ecf20Sopenharmony_ci
10128c2ecf20Sopenharmony_ci	for (i = 0; i < ARRAY_SIZE(apmixed_usb); i++) {
10138c2ecf20Sopenharmony_ci		const struct mtk_clk_usb *cku = &apmixed_usb[i];
10148c2ecf20Sopenharmony_ci
10158c2ecf20Sopenharmony_ci		clk = mtk_clk_register_ref2usb_tx(cku->name, cku->parent,
10168c2ecf20Sopenharmony_ci					base + cku->reg_ofs);
10178c2ecf20Sopenharmony_ci
10188c2ecf20Sopenharmony_ci		if (IS_ERR(clk)) {
10198c2ecf20Sopenharmony_ci			pr_err("Failed to register clk %s: %ld\n", cku->name,
10208c2ecf20Sopenharmony_ci					PTR_ERR(clk));
10218c2ecf20Sopenharmony_ci			continue;
10228c2ecf20Sopenharmony_ci		}
10238c2ecf20Sopenharmony_ci
10248c2ecf20Sopenharmony_ci		clk_data->clks[cku->id] = clk;
10258c2ecf20Sopenharmony_ci	}
10268c2ecf20Sopenharmony_ci
10278c2ecf20Sopenharmony_ci	clk = clk_register_divider(NULL, "hdmi_ref", "tvdpll_594m", 0,
10288c2ecf20Sopenharmony_ci				   base + 0x40, 16, 3, CLK_DIVIDER_POWER_OF_TWO,
10298c2ecf20Sopenharmony_ci				   NULL);
10308c2ecf20Sopenharmony_ci	clk_data->clks[CLK_APMIXED_HDMI_REF] = clk;
10318c2ecf20Sopenharmony_ci
10328c2ecf20Sopenharmony_ci	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
10338c2ecf20Sopenharmony_ci	if (r)
10348c2ecf20Sopenharmony_ci		pr_err("%s(): could not register clock provider: %d\n",
10358c2ecf20Sopenharmony_ci			__func__, r);
10368c2ecf20Sopenharmony_ci
10378c2ecf20Sopenharmony_ci	mtk_clk_enable_critical();
10388c2ecf20Sopenharmony_ci}
10398c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8173-apmixedsys",
10408c2ecf20Sopenharmony_ci		mtk_apmixedsys_init);
10418c2ecf20Sopenharmony_ci
10428c2ecf20Sopenharmony_cistatic void __init mtk_imgsys_init(struct device_node *node)
10438c2ecf20Sopenharmony_ci{
10448c2ecf20Sopenharmony_ci	struct clk_onecell_data *clk_data;
10458c2ecf20Sopenharmony_ci	int r;
10468c2ecf20Sopenharmony_ci
10478c2ecf20Sopenharmony_ci	clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
10488c2ecf20Sopenharmony_ci
10498c2ecf20Sopenharmony_ci	mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
10508c2ecf20Sopenharmony_ci						clk_data);
10518c2ecf20Sopenharmony_ci
10528c2ecf20Sopenharmony_ci	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
10538c2ecf20Sopenharmony_ci
10548c2ecf20Sopenharmony_ci	if (r)
10558c2ecf20Sopenharmony_ci		pr_err("%s(): could not register clock provider: %d\n",
10568c2ecf20Sopenharmony_ci			__func__, r);
10578c2ecf20Sopenharmony_ci}
10588c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_imgsys, "mediatek,mt8173-imgsys", mtk_imgsys_init);
10598c2ecf20Sopenharmony_ci
10608c2ecf20Sopenharmony_cistatic void __init mtk_vdecsys_init(struct device_node *node)
10618c2ecf20Sopenharmony_ci{
10628c2ecf20Sopenharmony_ci	struct clk_onecell_data *clk_data;
10638c2ecf20Sopenharmony_ci	int r;
10648c2ecf20Sopenharmony_ci
10658c2ecf20Sopenharmony_ci	clk_data = mtk_alloc_clk_data(CLK_VDEC_NR_CLK);
10668c2ecf20Sopenharmony_ci
10678c2ecf20Sopenharmony_ci	mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
10688c2ecf20Sopenharmony_ci						clk_data);
10698c2ecf20Sopenharmony_ci
10708c2ecf20Sopenharmony_ci	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
10718c2ecf20Sopenharmony_ci	if (r)
10728c2ecf20Sopenharmony_ci		pr_err("%s(): could not register clock provider: %d\n",
10738c2ecf20Sopenharmony_ci			__func__, r);
10748c2ecf20Sopenharmony_ci}
10758c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_vdecsys, "mediatek,mt8173-vdecsys", mtk_vdecsys_init);
10768c2ecf20Sopenharmony_ci
10778c2ecf20Sopenharmony_cistatic void __init mtk_vencsys_init(struct device_node *node)
10788c2ecf20Sopenharmony_ci{
10798c2ecf20Sopenharmony_ci	struct clk_onecell_data *clk_data;
10808c2ecf20Sopenharmony_ci	int r;
10818c2ecf20Sopenharmony_ci
10828c2ecf20Sopenharmony_ci	clk_data = mtk_alloc_clk_data(CLK_VENC_NR_CLK);
10838c2ecf20Sopenharmony_ci
10848c2ecf20Sopenharmony_ci	mtk_clk_register_gates(node, venc_clks, ARRAY_SIZE(venc_clks),
10858c2ecf20Sopenharmony_ci						clk_data);
10868c2ecf20Sopenharmony_ci
10878c2ecf20Sopenharmony_ci	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
10888c2ecf20Sopenharmony_ci	if (r)
10898c2ecf20Sopenharmony_ci		pr_err("%s(): could not register clock provider: %d\n",
10908c2ecf20Sopenharmony_ci			__func__, r);
10918c2ecf20Sopenharmony_ci}
10928c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_vencsys, "mediatek,mt8173-vencsys", mtk_vencsys_init);
10938c2ecf20Sopenharmony_ci
10948c2ecf20Sopenharmony_cistatic void __init mtk_vencltsys_init(struct device_node *node)
10958c2ecf20Sopenharmony_ci{
10968c2ecf20Sopenharmony_ci	struct clk_onecell_data *clk_data;
10978c2ecf20Sopenharmony_ci	int r;
10988c2ecf20Sopenharmony_ci
10998c2ecf20Sopenharmony_ci	clk_data = mtk_alloc_clk_data(CLK_VENCLT_NR_CLK);
11008c2ecf20Sopenharmony_ci
11018c2ecf20Sopenharmony_ci	mtk_clk_register_gates(node, venclt_clks, ARRAY_SIZE(venclt_clks),
11028c2ecf20Sopenharmony_ci						clk_data);
11038c2ecf20Sopenharmony_ci
11048c2ecf20Sopenharmony_ci	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
11058c2ecf20Sopenharmony_ci	if (r)
11068c2ecf20Sopenharmony_ci		pr_err("%s(): could not register clock provider: %d\n",
11078c2ecf20Sopenharmony_ci			__func__, r);
11088c2ecf20Sopenharmony_ci}
11098c2ecf20Sopenharmony_ciCLK_OF_DECLARE(mtk_vencltsys, "mediatek,mt8173-vencltsys", mtk_vencltsys_init);
1110