18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2016-2017 Linaro Ltd.
48c2ecf20Sopenharmony_ci * Copyright (c) 2016-2017 HiSilicon Technologies Co., Ltd.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <dt-bindings/clock/hi3660-clock.h>
88c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
98c2ecf20Sopenharmony_ci#include <linux/of_device.h>
108c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
118c2ecf20Sopenharmony_ci#include "clk.h"
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistatic const struct hisi_fixed_rate_clock hi3660_fixed_rate_clks[] = {
148c2ecf20Sopenharmony_ci	{ HI3660_CLKIN_SYS, "clkin_sys", NULL, 0, 19200000, },
158c2ecf20Sopenharmony_ci	{ HI3660_CLKIN_REF, "clkin_ref", NULL, 0, 32764, },
168c2ecf20Sopenharmony_ci	{ HI3660_CLK_FLL_SRC, "clk_fll_src", NULL, 0, 128000000, },
178c2ecf20Sopenharmony_ci	{ HI3660_CLK_PPLL0, "clk_ppll0", NULL, 0, 1600000000, },
188c2ecf20Sopenharmony_ci	{ HI3660_CLK_PPLL1, "clk_ppll1", NULL, 0, 1866000000, },
198c2ecf20Sopenharmony_ci	{ HI3660_CLK_PPLL2, "clk_ppll2", NULL, 0, 2880000000UL, },
208c2ecf20Sopenharmony_ci	{ HI3660_CLK_PPLL3, "clk_ppll3", NULL, 0, 1290000000, },
218c2ecf20Sopenharmony_ci	{ HI3660_CLK_SCPLL, "clk_scpll", NULL, 0, 245760000, },
228c2ecf20Sopenharmony_ci	{ HI3660_PCLK, "pclk", NULL, 0, 20000000, },
238c2ecf20Sopenharmony_ci	{ HI3660_CLK_UART0_DBG, "clk_uart0_dbg", NULL, 0, 19200000, },
248c2ecf20Sopenharmony_ci	{ HI3660_CLK_UART6, "clk_uart6", NULL, 0, 19200000, },
258c2ecf20Sopenharmony_ci	{ HI3660_OSC32K, "osc32k", NULL, 0, 32764, },
268c2ecf20Sopenharmony_ci	{ HI3660_OSC19M, "osc19m", NULL, 0, 19200000, },
278c2ecf20Sopenharmony_ci	{ HI3660_CLK_480M, "clk_480m", NULL, 0, 480000000, },
288c2ecf20Sopenharmony_ci	{ HI3660_CLK_INV, "clk_inv", NULL, 0, 10000000, },
298c2ecf20Sopenharmony_ci};
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* crgctrl */
328c2ecf20Sopenharmony_cistatic const struct hisi_fixed_factor_clock hi3660_crg_fixed_factor_clks[] = {
338c2ecf20Sopenharmony_ci	{ HI3660_FACTOR_UART3, "clk_factor_uart3", "iomcu_peri0", 1, 16, 0, },
348c2ecf20Sopenharmony_ci	{ HI3660_CLK_FACTOR_MMC, "clk_factor_mmc", "clkin_sys", 1, 6, 0, },
358c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_I2C0, "clk_gate_i2c0", "clk_i2c0_iomcu", 1, 4, 0, },
368c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_I2C1, "clk_gate_i2c1", "clk_i2c1_iomcu", 1, 4, 0, },
378c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_I2C2, "clk_gate_i2c2", "clk_i2c2_iomcu", 1, 4, 0, },
388c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_I2C6, "clk_gate_i2c6", "clk_i2c6_iomcu", 1, 4, 0, },
398c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_SYSBUS, "clk_div_sysbus", "clk_mux_sysbus", 1, 7, 0, },
408c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_320M, "clk_div_320m", "clk_320m_pll_gt", 1, 5, 0, },
418c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_A53, "clk_div_a53hpm", "clk_a53hpm_andgt", 1, 6, 0, },
428c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_SPI0, "clk_gate_spi0", "clk_ppll0", 1, 8, 0, },
438c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_SPI2, "clk_gate_spi2", "clk_ppll0", 1, 8, 0, },
448c2ecf20Sopenharmony_ci	{ HI3660_PCIEPHY_REF, "clk_pciephy_ref", "clk_div_pciephy", 1, 1, 0, },
458c2ecf20Sopenharmony_ci	{ HI3660_CLK_ABB_USB, "clk_abb_usb", "clk_gate_usb_tcxo_en", 1, 1, 0 },
468c2ecf20Sopenharmony_ci	{ HI3660_VENC_VOLT_HOLD, "venc_volt_hold", "peri_volt_hold", 1, 1, 0, },
478c2ecf20Sopenharmony_ci	{ HI3660_CLK_FAC_ISP_SNCLK, "clk_isp_snclk_fac", "clk_isp_snclk_angt",
488c2ecf20Sopenharmony_ci	  1, 10, 0, },
498c2ecf20Sopenharmony_ci};
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3660_crgctrl_gate_sep_clks[] = {
528c2ecf20Sopenharmony_ci	{ HI3660_PERI_VOLT_HOLD, "peri_volt_hold", "clkin_sys",
538c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x0, 0, 0, },
548c2ecf20Sopenharmony_ci	{ HI3660_HCLK_GATE_SDIO0, "hclk_gate_sdio0", "clk_div_sysbus",
558c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x0, 21, 0, },
568c2ecf20Sopenharmony_ci	{ HI3660_HCLK_GATE_SD, "hclk_gate_sd", "clk_div_sysbus",
578c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x0, 30, 0, },
588c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_AOMM, "clk_gate_aomm", "clk_div_aomm",
598c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x0, 31, 0, },
608c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO0, "pclk_gpio0", "clk_div_cfgbus",
618c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 0, 0, },
628c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO1, "pclk_gpio1", "clk_div_cfgbus",
638c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 1, 0, },
648c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO2, "pclk_gpio2", "clk_div_cfgbus",
658c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 2, 0, },
668c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO3, "pclk_gpio3", "clk_div_cfgbus",
678c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 3, 0, },
688c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO4, "pclk_gpio4", "clk_div_cfgbus",
698c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 4, 0, },
708c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO5, "pclk_gpio5", "clk_div_cfgbus",
718c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 5, 0, },
728c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO6, "pclk_gpio6", "clk_div_cfgbus",
738c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 6, 0, },
748c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO7, "pclk_gpio7", "clk_div_cfgbus",
758c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 7, 0, },
768c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO8, "pclk_gpio8", "clk_div_cfgbus",
778c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 8, 0, },
788c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO9, "pclk_gpio9", "clk_div_cfgbus",
798c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 9, 0, },
808c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO10, "pclk_gpio10", "clk_div_cfgbus",
818c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 10, 0, },
828c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO11, "pclk_gpio11", "clk_div_cfgbus",
838c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 11, 0, },
848c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO12, "pclk_gpio12", "clk_div_cfgbus",
858c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 12, 0, },
868c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO13, "pclk_gpio13", "clk_div_cfgbus",
878c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 13, 0, },
888c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO14, "pclk_gpio14", "clk_div_cfgbus",
898c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 14, 0, },
908c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO15, "pclk_gpio15", "clk_div_cfgbus",
918c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 15, 0, },
928c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO16, "pclk_gpio16", "clk_div_cfgbus",
938c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 16, 0, },
948c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO17, "pclk_gpio17", "clk_div_cfgbus",
958c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 17, 0, },
968c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO18, "pclk_gpio18", "clk_div_ioperi",
978c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 18, 0, },
988c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO19, "pclk_gpio19", "clk_div_ioperi",
998c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 19, 0, },
1008c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO20, "pclk_gpio20", "clk_div_cfgbus",
1018c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 20, 0, },
1028c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GPIO21, "pclk_gpio21", "clk_div_cfgbus",
1038c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 21, 0, },
1048c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_SPI3, "clk_gate_spi3", "clk_div_ioperi",
1058c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 30, 0, },
1068c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_I2C7, "clk_gate_i2c7", "clk_mux_i2c",
1078c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 31, 0, },
1088c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_I2C3, "clk_gate_i2c3", "clk_mux_i2c",
1098c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x20, 7, 0, },
1108c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_SPI1, "clk_gate_spi1", "clk_mux_spi",
1118c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x20, 9, 0, },
1128c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_UART1, "clk_gate_uart1", "clk_mux_uarth",
1138c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x20, 11, 0, },
1148c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_UART2, "clk_gate_uart2", "clk_mux_uart1",
1158c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x20, 12, 0, },
1168c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_UART4, "clk_gate_uart4", "clk_mux_uarth",
1178c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x20, 14, 0, },
1188c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_UART5, "clk_gate_uart5", "clk_mux_uart1",
1198c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x20, 15, 0, },
1208c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_I2C4, "clk_gate_i2c4", "clk_mux_i2c",
1218c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x20, 27, 0, },
1228c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_DMAC, "clk_gate_dmac", "clk_div_sysbus",
1238c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 1, 0, },
1248c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_VENC, "clk_gate_venc", "clk_div_venc",
1258c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 10, 0, },
1268c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_VDEC, "clk_gate_vdec", "clk_div_vdec",
1278c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 11, 0, },
1288c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GATE_DSS, "pclk_gate_dss", "clk_div_cfgbus",
1298c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 12, 0, },
1308c2ecf20Sopenharmony_ci	{ HI3660_ACLK_GATE_DSS, "aclk_gate_dss", "clk_gate_vivobus",
1318c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 13, 0, },
1328c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_LDI1, "clk_gate_ldi1", "clk_div_ldi1",
1338c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 14, 0, },
1348c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_LDI0, "clk_gate_ldi0", "clk_div_ldi0",
1358c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 15, 0, },
1368c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_VIVOBUS, "clk_gate_vivobus", "clk_div_vivobus",
1378c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 16, 0, },
1388c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_EDC0, "clk_gate_edc0", "clk_div_edc0",
1398c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 17, 0, },
1408c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_TXDPHY0_CFG, "clk_gate_txdphy0_cfg", "clkin_sys",
1418c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 28, 0, },
1428c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_TXDPHY0_REF, "clk_gate_txdphy0_ref", "clkin_sys",
1438c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 29, 0, },
1448c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_TXDPHY1_CFG, "clk_gate_txdphy1_cfg", "clkin_sys",
1458c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 30, 0, },
1468c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_TXDPHY1_REF, "clk_gate_txdphy1_ref", "clkin_sys",
1478c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x30, 31, 0, },
1488c2ecf20Sopenharmony_ci	{ HI3660_ACLK_GATE_USB3OTG, "aclk_gate_usb3otg", "clk_div_mmc0bus",
1498c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x40, 1, 0, },
1508c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_SPI4, "clk_gate_spi4", "clk_mux_spi",
1518c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x40, 4, 0, },
1528c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_SD, "clk_gate_sd", "clk_mux_sd_sys",
1538c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x40, 17, 0, },
1548c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_SDIO0, "clk_gate_sdio0", "clk_mux_sdio_sys",
1558c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x40, 19, 0, },
1568c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_ISP_SNCLK0, "clk_gate_isp_snclk0",
1578c2ecf20Sopenharmony_ci	  "clk_isp_snclk_mux", CLK_SET_RATE_PARENT, 0x50, 16, 0, },
1588c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_ISP_SNCLK1, "clk_gate_isp_snclk1",
1598c2ecf20Sopenharmony_ci	  "clk_isp_snclk_mux", CLK_SET_RATE_PARENT, 0x50, 17, 0, },
1608c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_ISP_SNCLK2, "clk_gate_isp_snclk2",
1618c2ecf20Sopenharmony_ci	  "clk_isp_snclk_mux", CLK_SET_RATE_PARENT, 0x50, 18, 0, },
1628c2ecf20Sopenharmony_ci	/*
1638c2ecf20Sopenharmony_ci	 * clk_gate_ufs_subsys is a system bus clock, mark it as critical
1648c2ecf20Sopenharmony_ci	 * clock and keep it on for system suspend and resume.
1658c2ecf20Sopenharmony_ci	 */
1668c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_UFS_SUBSYS, "clk_gate_ufs_subsys", "clk_div_sysbus",
1678c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, 0x50, 21, 0, },
1688c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GATE_DSI0, "pclk_gate_dsi0", "clk_div_cfgbus",
1698c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x50, 28, 0, },
1708c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GATE_DSI1, "pclk_gate_dsi1", "clk_div_cfgbus",
1718c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x50, 29, 0, },
1728c2ecf20Sopenharmony_ci	{ HI3660_ACLK_GATE_PCIE, "aclk_gate_pcie", "clk_div_mmc1bus",
1738c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x420, 5, 0, },
1748c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GATE_PCIE_SYS, "pclk_gate_pcie_sys", "clk_div_mmc1bus",
1758c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x420, 7, 0, },
1768c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_PCIEAUX, "clk_gate_pcieaux", "clkin_sys",
1778c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x420, 8, 0, },
1788c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GATE_PCIE_PHY, "pclk_gate_pcie_phy", "clk_div_mmc1bus",
1798c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x420, 9, 0, },
1808c2ecf20Sopenharmony_ci};
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3660_crgctrl_gate_clks[] = {
1838c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_LDI0, "clk_andgt_ldi0", "clk_mux_ldi0",
1848c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf0, 6, CLK_GATE_HIWORD_MASK, },
1858c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_LDI1, "clk_andgt_ldi1", "clk_mux_ldi1",
1868c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf0, 7, CLK_GATE_HIWORD_MASK, },
1878c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_EDC0, "clk_andgt_edc0", "clk_mux_edc0",
1888c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf0, 8, CLK_GATE_HIWORD_MASK, },
1898c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_VDEC, "clk_andgt_vdec", "clk_mux_vdec",
1908c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf0, 15, CLK_GATE_HIWORD_MASK, },
1918c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_VENC, "clk_andgt_venc", "clk_mux_venc",
1928c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 0, CLK_GATE_HIWORD_MASK, },
1938c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_UFSPHY_GT, "clk_gate_ufsphy_gt", "clk_div_ufsperi",
1948c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 1, CLK_GATE_HIWORD_MASK, },
1958c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_MMC, "clk_andgt_mmc", "clk_mux_mmc_pll",
1968c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 2, CLK_GATE_HIWORD_MASK, },
1978c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_SD, "clk_andgt_sd", "clk_mux_sd_pll",
1988c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 3, CLK_GATE_HIWORD_MASK, },
1998c2ecf20Sopenharmony_ci	{ HI3660_CLK_A53HPM_ANDGT, "clk_a53hpm_andgt", "clk_mux_a53hpm",
2008c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 7, CLK_GATE_HIWORD_MASK, },
2018c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_SDIO, "clk_andgt_sdio", "clk_mux_sdio_pll",
2028c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 8, CLK_GATE_HIWORD_MASK, },
2038c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_UART0, "clk_andgt_uart0", "clk_div_320m",
2048c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 9, CLK_GATE_HIWORD_MASK, },
2058c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_UART1, "clk_andgt_uart1", "clk_div_320m",
2068c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 10, CLK_GATE_HIWORD_MASK, },
2078c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_UARTH, "clk_andgt_uarth", "clk_div_320m",
2088c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 11, CLK_GATE_HIWORD_MASK, },
2098c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANDGT_SPI, "clk_andgt_spi", "clk_div_320m",
2108c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf4, 13, CLK_GATE_HIWORD_MASK, },
2118c2ecf20Sopenharmony_ci	{ HI3660_CLK_VIVOBUS_ANDGT, "clk_vivobus_andgt", "clk_mux_vivobus",
2128c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf8, 1, CLK_GATE_HIWORD_MASK, },
2138c2ecf20Sopenharmony_ci	{ HI3660_CLK_AOMM_ANDGT, "clk_aomm_andgt", "clk_ppll2",
2148c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf8, 3, CLK_GATE_HIWORD_MASK, },
2158c2ecf20Sopenharmony_ci	{ HI3660_CLK_320M_PLL_GT, "clk_320m_pll_gt", "clk_mux_320m",
2168c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xf8, 10, 0, },
2178c2ecf20Sopenharmony_ci	{ HI3660_CLK_ANGT_ISP_SNCLK, "clk_isp_snclk_angt", "clk_div_a53hpm",
2188c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x108, 2, CLK_GATE_HIWORD_MASK, },
2198c2ecf20Sopenharmony_ci	{ HI3660_AUTODIV_EMMC0BUS, "autodiv_emmc0bus", "autodiv_sysbus",
2208c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x404, 1, CLK_GATE_HIWORD_MASK, },
2218c2ecf20Sopenharmony_ci	{ HI3660_AUTODIV_SYSBUS, "autodiv_sysbus", "clk_div_sysbus",
2228c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x404, 5, CLK_GATE_HIWORD_MASK, },
2238c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_UFSPHY_CFG, "clk_gate_ufsphy_cfg",
2248c2ecf20Sopenharmony_ci	  "clk_div_ufsphy_cfg", CLK_SET_RATE_PARENT, 0x420, 12, 0, },
2258c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_UFSIO_REF, "clk_gate_ufsio_ref",
2268c2ecf20Sopenharmony_ci	  "clk_gate_ufs_tcxo_en", CLK_SET_RATE_PARENT, 0x420, 14, 0, },
2278c2ecf20Sopenharmony_ci};
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_cistatic const char *const
2308c2ecf20Sopenharmony_ciclk_mux_sysbus_p[] = {"clk_ppll1", "clk_ppll0"};
2318c2ecf20Sopenharmony_cistatic const char *const
2328c2ecf20Sopenharmony_ciclk_mux_sdio_sys_p[] = {"clk_factor_mmc", "clk_div_sdio",};
2338c2ecf20Sopenharmony_cistatic const char *const
2348c2ecf20Sopenharmony_ciclk_mux_sd_sys_p[] = {"clk_factor_mmc", "clk_div_sd",};
2358c2ecf20Sopenharmony_cistatic const char *const
2368c2ecf20Sopenharmony_ciclk_mux_pll_p[] = {"clk_ppll0", "clk_ppll1", "clk_ppll2", "clk_ppll2",};
2378c2ecf20Sopenharmony_cistatic const char *const
2388c2ecf20Sopenharmony_ciclk_mux_pll0123_p[] = {"clk_ppll0", "clk_ppll1", "clk_ppll2", "clk_ppll3",};
2398c2ecf20Sopenharmony_cistatic const char *const
2408c2ecf20Sopenharmony_ciclk_mux_edc0_p[] = {"clk_inv", "clk_ppll0", "clk_ppll1", "clk_inv",
2418c2ecf20Sopenharmony_ci		    "clk_ppll2", "clk_inv", "clk_inv", "clk_inv",
2428c2ecf20Sopenharmony_ci		    "clk_ppll3", "clk_inv", "clk_inv", "clk_inv",
2438c2ecf20Sopenharmony_ci		    "clk_inv", "clk_inv", "clk_inv", "clk_inv",};
2448c2ecf20Sopenharmony_cistatic const char *const
2458c2ecf20Sopenharmony_ciclk_mux_ldi0_p[] = {"clk_inv", "clk_ppll0", "clk_ppll2", "clk_inv",
2468c2ecf20Sopenharmony_ci		    "clk_ppll1", "clk_inv", "clk_inv", "clk_inv",
2478c2ecf20Sopenharmony_ci		    "clk_ppll3", "clk_inv", "clk_inv", "clk_inv",
2488c2ecf20Sopenharmony_ci		    "clk_inv", "clk_inv", "clk_inv", "clk_inv",};
2498c2ecf20Sopenharmony_cistatic const char *const
2508c2ecf20Sopenharmony_ciclk_mux_uart0_p[] = {"clkin_sys", "clk_div_uart0",};
2518c2ecf20Sopenharmony_cistatic const char *const
2528c2ecf20Sopenharmony_ciclk_mux_uart1_p[] = {"clkin_sys", "clk_div_uart1",};
2538c2ecf20Sopenharmony_cistatic const char *const
2548c2ecf20Sopenharmony_ciclk_mux_uarth_p[] = {"clkin_sys", "clk_div_uarth",};
2558c2ecf20Sopenharmony_cistatic const char *const
2568c2ecf20Sopenharmony_ciclk_mux_pll02p[] = {"clk_ppll0", "clk_ppll2",};
2578c2ecf20Sopenharmony_cistatic const char *const
2588c2ecf20Sopenharmony_ciclk_mux_ioperi_p[] = {"clk_div_320m", "clk_div_a53hpm",};
2598c2ecf20Sopenharmony_cistatic const char *const
2608c2ecf20Sopenharmony_ciclk_mux_spi_p[] = {"clkin_sys", "clk_div_spi",};
2618c2ecf20Sopenharmony_cistatic const char *const
2628c2ecf20Sopenharmony_ciclk_mux_i2c_p[] = {"clkin_sys", "clk_div_i2c",};
2638c2ecf20Sopenharmony_cistatic const char *const
2648c2ecf20Sopenharmony_ciclk_mux_venc_p[] = {"clk_ppll0", "clk_ppll1", "clk_ppll3", "clk_ppll3",};
2658c2ecf20Sopenharmony_cistatic const char *const
2668c2ecf20Sopenharmony_ciclk_mux_isp_snclk_p[] = {"clkin_sys", "clk_isp_snclk_div"};
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_cistatic const struct hisi_mux_clock hi3660_crgctrl_mux_clks[] = {
2698c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_SYSBUS, "clk_mux_sysbus", clk_mux_sysbus_p,
2708c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_sysbus_p), CLK_SET_RATE_PARENT, 0xac, 0, 1,
2718c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2728c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_UART0, "clk_mux_uart0", clk_mux_uart0_p,
2738c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_uart0_p), CLK_SET_RATE_PARENT, 0xac, 2, 1,
2748c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2758c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_UART1, "clk_mux_uart1", clk_mux_uart1_p,
2768c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_uart1_p), CLK_SET_RATE_PARENT, 0xac, 3, 1,
2778c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2788c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_UARTH, "clk_mux_uarth", clk_mux_uarth_p,
2798c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_uarth_p), CLK_SET_RATE_PARENT, 0xac, 4, 1,
2808c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2818c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_SPI, "clk_mux_spi", clk_mux_spi_p,
2828c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_spi_p), CLK_SET_RATE_PARENT, 0xac, 8, 1,
2838c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2848c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_I2C, "clk_mux_i2c", clk_mux_i2c_p,
2858c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_i2c_p), CLK_SET_RATE_PARENT, 0xac, 13, 1,
2868c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2878c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_MMC_PLL, "clk_mux_mmc_pll", clk_mux_pll02p,
2888c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_pll02p), CLK_SET_RATE_PARENT, 0xb4, 0, 1,
2898c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2908c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_LDI1, "clk_mux_ldi1", clk_mux_ldi0_p,
2918c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_ldi0_p), CLK_SET_RATE_PARENT, 0xb4, 8, 4,
2928c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2938c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_LDI0, "clk_mux_ldi0", clk_mux_ldi0_p,
2948c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_ldi0_p), CLK_SET_RATE_PARENT, 0xb4, 12, 4,
2958c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2968c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_SD_PLL, "clk_mux_sd_pll", clk_mux_pll_p,
2978c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_pll_p), CLK_SET_RATE_PARENT, 0xb8, 4, 2,
2988c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
2998c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_SD_SYS, "clk_mux_sd_sys", clk_mux_sd_sys_p,
3008c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_sd_sys_p), CLK_SET_RATE_PARENT, 0xb8, 6, 1,
3018c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3028c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_EDC0, "clk_mux_edc0", clk_mux_edc0_p,
3038c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_edc0_p), CLK_SET_RATE_PARENT, 0xbc, 6, 4,
3048c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3058c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_SDIO_SYS, "clk_mux_sdio_sys", clk_mux_sdio_sys_p,
3068c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_sdio_sys_p), CLK_SET_RATE_PARENT, 0xc0, 6, 1,
3078c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3088c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_SDIO_PLL, "clk_mux_sdio_pll", clk_mux_pll_p,
3098c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_pll_p), CLK_SET_RATE_PARENT, 0xc0, 4, 2,
3108c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3118c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_VENC, "clk_mux_venc", clk_mux_venc_p,
3128c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_venc_p), CLK_SET_RATE_PARENT, 0xc8, 11, 2,
3138c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3148c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_VDEC, "clk_mux_vdec", clk_mux_pll0123_p,
3158c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_pll0123_p), CLK_SET_RATE_PARENT, 0xcc, 5, 2,
3168c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3178c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_VIVOBUS, "clk_mux_vivobus", clk_mux_pll0123_p,
3188c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_pll0123_p), CLK_SET_RATE_PARENT, 0xd0, 12, 2,
3198c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3208c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_A53HPM, "clk_mux_a53hpm", clk_mux_pll02p,
3218c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_pll02p), CLK_SET_RATE_PARENT, 0xd4, 9, 1,
3228c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3238c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_320M, "clk_mux_320m", clk_mux_pll02p,
3248c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_pll02p), CLK_SET_RATE_PARENT, 0x100, 0, 1,
3258c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3268c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_ISP_SNCLK, "clk_isp_snclk_mux", clk_mux_isp_snclk_p,
3278c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_isp_snclk_p), CLK_SET_RATE_PARENT, 0x108, 3, 1,
3288c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3298c2ecf20Sopenharmony_ci	{ HI3660_CLK_MUX_IOPERI, "clk_mux_ioperi", clk_mux_ioperi_p,
3308c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_mux_ioperi_p), CLK_SET_RATE_PARENT, 0x108, 10, 1,
3318c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
3328c2ecf20Sopenharmony_ci};
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_cistatic const struct hisi_divider_clock hi3660_crgctrl_divider_clks[] = {
3358c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_UART0, "clk_div_uart0", "clk_andgt_uart0",
3368c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xb0, 4, 4, CLK_DIVIDER_HIWORD_MASK, },
3378c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_UART1, "clk_div_uart1", "clk_andgt_uart1",
3388c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xb0, 8, 4, CLK_DIVIDER_HIWORD_MASK, },
3398c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_UARTH, "clk_div_uarth", "clk_andgt_uarth",
3408c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xb0, 12, 4, CLK_DIVIDER_HIWORD_MASK, },
3418c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_MMC, "clk_div_mmc", "clk_andgt_mmc",
3428c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xb4, 3, 4, CLK_DIVIDER_HIWORD_MASK, },
3438c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_SD, "clk_div_sd", "clk_andgt_sd",
3448c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xb8, 0, 4, CLK_DIVIDER_HIWORD_MASK, },
3458c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_EDC0, "clk_div_edc0", "clk_andgt_edc0",
3468c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xbc, 0, 6, CLK_DIVIDER_HIWORD_MASK, },
3478c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_LDI0, "clk_div_ldi0", "clk_andgt_ldi0",
3488c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xbc, 10, 6, CLK_DIVIDER_HIWORD_MASK, },
3498c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_SDIO, "clk_div_sdio", "clk_andgt_sdio",
3508c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xc0, 0, 4, CLK_DIVIDER_HIWORD_MASK, },
3518c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_LDI1, "clk_div_ldi1", "clk_andgt_ldi1",
3528c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xc0, 8, 6, CLK_DIVIDER_HIWORD_MASK, },
3538c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_SPI, "clk_div_spi", "clk_andgt_spi",
3548c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xc4, 12, 4, CLK_DIVIDER_HIWORD_MASK, },
3558c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_VENC, "clk_div_venc", "clk_andgt_venc",
3568c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xc8, 6, 5, CLK_DIVIDER_HIWORD_MASK, },
3578c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_VDEC, "clk_div_vdec", "clk_andgt_vdec",
3588c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xcc, 0, 5, CLK_DIVIDER_HIWORD_MASK,  },
3598c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_VIVOBUS, "clk_div_vivobus", "clk_vivobus_andgt",
3608c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xd0, 7, 5, CLK_DIVIDER_HIWORD_MASK, },
3618c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_I2C, "clk_div_i2c", "clk_div_320m",
3628c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xe8, 4, 4, CLK_DIVIDER_HIWORD_MASK, },
3638c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_UFSPHY, "clk_div_ufsphy_cfg", "clk_gate_ufsphy_gt",
3648c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xe8, 9, 2, CLK_DIVIDER_HIWORD_MASK, },
3658c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_CFGBUS, "clk_div_cfgbus", "clk_div_sysbus",
3668c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xec, 0, 2, CLK_DIVIDER_HIWORD_MASK, },
3678c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_MMC0BUS, "clk_div_mmc0bus", "autodiv_emmc0bus",
3688c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xec, 2, 1, CLK_DIVIDER_HIWORD_MASK, },
3698c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_MMC1BUS, "clk_div_mmc1bus", "clk_div_sysbus",
3708c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xec, 3, 1, CLK_DIVIDER_HIWORD_MASK, },
3718c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_UFSPERI, "clk_div_ufsperi", "clk_gate_ufs_subsys",
3728c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0xec, 14, 1, CLK_DIVIDER_HIWORD_MASK, },
3738c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_AOMM, "clk_div_aomm", "clk_aomm_andgt",
3748c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x100, 7, 4, CLK_DIVIDER_HIWORD_MASK, },
3758c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_ISP_SNCLK, "clk_isp_snclk_div", "clk_isp_snclk_fac",
3768c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x108, 0, 2, CLK_DIVIDER_HIWORD_MASK, },
3778c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_IOPERI, "clk_div_ioperi", "clk_mux_ioperi",
3788c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x108, 11, 4, CLK_DIVIDER_HIWORD_MASK, },
3798c2ecf20Sopenharmony_ci};
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci/* clk_pmuctrl */
3828c2ecf20Sopenharmony_ci/* pmu register need shift 2 bits */
3838c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3660_pmu_gate_clks[] = {
3848c2ecf20Sopenharmony_ci	{ HI3660_GATE_ABB_192, "clk_gate_abb_192", "clkin_sys",
3858c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, (0x10a << 2), 3, 0, },
3868c2ecf20Sopenharmony_ci};
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/* clk_pctrl */
3898c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3660_pctrl_gate_clks[] = {
3908c2ecf20Sopenharmony_ci	{ HI3660_GATE_UFS_TCXO_EN, "clk_gate_ufs_tcxo_en",
3918c2ecf20Sopenharmony_ci	  "clk_gate_abb_192", CLK_SET_RATE_PARENT, 0x10, 0,
3928c2ecf20Sopenharmony_ci	  CLK_GATE_HIWORD_MASK, },
3938c2ecf20Sopenharmony_ci	{ HI3660_GATE_USB_TCXO_EN, "clk_gate_usb_tcxo_en", "clk_gate_abb_192",
3948c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 1, CLK_GATE_HIWORD_MASK, },
3958c2ecf20Sopenharmony_ci};
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci/* clk_sctrl */
3988c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3660_sctrl_gate_sep_clks[] = {
3998c2ecf20Sopenharmony_ci	{ HI3660_PCLK_AO_GPIO0, "pclk_ao_gpio0", "clk_div_aobus",
4008c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x160, 11, 0, },
4018c2ecf20Sopenharmony_ci	{ HI3660_PCLK_AO_GPIO1, "pclk_ao_gpio1", "clk_div_aobus",
4028c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x160, 12, 0, },
4038c2ecf20Sopenharmony_ci	{ HI3660_PCLK_AO_GPIO2, "pclk_ao_gpio2", "clk_div_aobus",
4048c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x160, 13, 0, },
4058c2ecf20Sopenharmony_ci	{ HI3660_PCLK_AO_GPIO3, "pclk_ao_gpio3", "clk_div_aobus",
4068c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x160, 14, 0, },
4078c2ecf20Sopenharmony_ci	{ HI3660_PCLK_AO_GPIO4, "pclk_ao_gpio4", "clk_div_aobus",
4088c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x160, 21, 0, },
4098c2ecf20Sopenharmony_ci	{ HI3660_PCLK_AO_GPIO5, "pclk_ao_gpio5", "clk_div_aobus",
4108c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x160, 22, 0, },
4118c2ecf20Sopenharmony_ci	{ HI3660_PCLK_AO_GPIO6, "pclk_ao_gpio6", "clk_div_aobus",
4128c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x160, 25, 0, },
4138c2ecf20Sopenharmony_ci	{ HI3660_PCLK_GATE_MMBUF, "pclk_gate_mmbuf", "pclk_div_mmbuf",
4148c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x170, 23, 0, },
4158c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_DSS_AXI_MM, "clk_gate_dss_axi_mm", "aclk_mux_mmbuf",
4168c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x170, 24, 0, },
4178c2ecf20Sopenharmony_ci};
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3660_sctrl_gate_clks[] = {
4208c2ecf20Sopenharmony_ci	{ HI3660_PCLK_MMBUF_ANDGT, "pclk_mmbuf_andgt", "clk_sw_mmbuf",
4218c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x258, 7, CLK_GATE_HIWORD_MASK, },
4228c2ecf20Sopenharmony_ci	{ HI3660_CLK_MMBUF_PLL_ANDGT, "clk_mmbuf_pll_andgt", "clk_ppll0",
4238c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x260, 11, CLK_DIVIDER_HIWORD_MASK, },
4248c2ecf20Sopenharmony_ci	{ HI3660_CLK_FLL_MMBUF_ANDGT, "clk_fll_mmbuf_andgt", "clk_fll_src",
4258c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x260, 12, CLK_DIVIDER_HIWORD_MASK, },
4268c2ecf20Sopenharmony_ci	{ HI3660_CLK_SYS_MMBUF_ANDGT, "clk_sys_mmbuf_andgt", "clkin_sys",
4278c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x260, 13, CLK_DIVIDER_HIWORD_MASK, },
4288c2ecf20Sopenharmony_ci	{ HI3660_CLK_GATE_PCIEPHY_GT, "clk_gate_pciephy_gt", "clk_ppll0",
4298c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x268, 11, CLK_DIVIDER_HIWORD_MASK, },
4308c2ecf20Sopenharmony_ci};
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_cistatic const char *const
4338c2ecf20Sopenharmony_ciaclk_mux_mmbuf_p[] = {"aclk_div_mmbuf", "clk_gate_aomm",};
4348c2ecf20Sopenharmony_cistatic const char *const
4358c2ecf20Sopenharmony_ciclk_sw_mmbuf_p[] = {"clk_sys_mmbuf_andgt", "clk_fll_mmbuf_andgt",
4368c2ecf20Sopenharmony_ci		    "aclk_mux_mmbuf", "aclk_mux_mmbuf"};
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_cistatic const struct hisi_mux_clock hi3660_sctrl_mux_clks[] = {
4398c2ecf20Sopenharmony_ci	{ HI3660_ACLK_MUX_MMBUF, "aclk_mux_mmbuf", aclk_mux_mmbuf_p,
4408c2ecf20Sopenharmony_ci	  ARRAY_SIZE(aclk_mux_mmbuf_p), CLK_SET_RATE_PARENT, 0x250, 12, 1,
4418c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
4428c2ecf20Sopenharmony_ci	{ HI3660_CLK_SW_MMBUF, "clk_sw_mmbuf", clk_sw_mmbuf_p,
4438c2ecf20Sopenharmony_ci	  ARRAY_SIZE(clk_sw_mmbuf_p), CLK_SET_RATE_PARENT, 0x258, 8, 2,
4448c2ecf20Sopenharmony_ci	  CLK_MUX_HIWORD_MASK, },
4458c2ecf20Sopenharmony_ci};
4468c2ecf20Sopenharmony_ci
4478c2ecf20Sopenharmony_cistatic const struct hisi_divider_clock hi3660_sctrl_divider_clks[] = {
4488c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_AOBUS, "clk_div_aobus", "clk_ppll0",
4498c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x254, 0, 6, CLK_DIVIDER_HIWORD_MASK, },
4508c2ecf20Sopenharmony_ci	{ HI3660_PCLK_DIV_MMBUF, "pclk_div_mmbuf", "pclk_mmbuf_andgt",
4518c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x258, 10, 2, CLK_DIVIDER_HIWORD_MASK, },
4528c2ecf20Sopenharmony_ci	{ HI3660_ACLK_DIV_MMBUF, "aclk_div_mmbuf", "clk_mmbuf_pll_andgt",
4538c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x258, 12, 4, CLK_DIVIDER_HIWORD_MASK, },
4548c2ecf20Sopenharmony_ci	{ HI3660_CLK_DIV_PCIEPHY, "clk_div_pciephy", "clk_gate_pciephy_gt",
4558c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x268, 12, 4, CLK_DIVIDER_HIWORD_MASK, },
4568c2ecf20Sopenharmony_ci};
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci/* clk_iomcu */
4598c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3660_iomcu_gate_sep_clks[] = {
4608c2ecf20Sopenharmony_ci	{ HI3660_CLK_I2C0_IOMCU, "clk_i2c0_iomcu", "clk_fll_src",
4618c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 3, 0, },
4628c2ecf20Sopenharmony_ci	{ HI3660_CLK_I2C1_IOMCU, "clk_i2c1_iomcu", "clk_fll_src",
4638c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 4, 0, },
4648c2ecf20Sopenharmony_ci	{ HI3660_CLK_I2C2_IOMCU, "clk_i2c2_iomcu", "clk_fll_src",
4658c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 5, 0, },
4668c2ecf20Sopenharmony_ci	{ HI3660_CLK_I2C6_IOMCU, "clk_i2c6_iomcu", "clk_fll_src",
4678c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x10, 27, 0, },
4688c2ecf20Sopenharmony_ci	{ HI3660_CLK_IOMCU_PERI0, "iomcu_peri0", "clk_ppll0",
4698c2ecf20Sopenharmony_ci	  CLK_SET_RATE_PARENT, 0x90, 0, 0, },
4708c2ecf20Sopenharmony_ci};
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_cistatic struct hisi_clock_data *clk_crgctrl_data;
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_cistatic void hi3660_clk_iomcu_init(struct device_node *np)
4758c2ecf20Sopenharmony_ci{
4768c2ecf20Sopenharmony_ci	struct hisi_clock_data *clk_data;
4778c2ecf20Sopenharmony_ci	int nr = ARRAY_SIZE(hi3660_iomcu_gate_sep_clks);
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci	clk_data = hisi_clk_init(np, nr);
4808c2ecf20Sopenharmony_ci	if (!clk_data)
4818c2ecf20Sopenharmony_ci		return;
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ci	hisi_clk_register_gate_sep(hi3660_iomcu_gate_sep_clks,
4848c2ecf20Sopenharmony_ci				   ARRAY_SIZE(hi3660_iomcu_gate_sep_clks),
4858c2ecf20Sopenharmony_ci				   clk_data);
4868c2ecf20Sopenharmony_ci}
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_cistatic void hi3660_clk_pmuctrl_init(struct device_node *np)
4898c2ecf20Sopenharmony_ci{
4908c2ecf20Sopenharmony_ci	struct hisi_clock_data *clk_data;
4918c2ecf20Sopenharmony_ci	int nr = ARRAY_SIZE(hi3660_pmu_gate_clks);
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci	clk_data = hisi_clk_init(np, nr);
4948c2ecf20Sopenharmony_ci	if (!clk_data)
4958c2ecf20Sopenharmony_ci		return;
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ci	hisi_clk_register_gate(hi3660_pmu_gate_clks,
4988c2ecf20Sopenharmony_ci			       ARRAY_SIZE(hi3660_pmu_gate_clks), clk_data);
4998c2ecf20Sopenharmony_ci}
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_cistatic void hi3660_clk_pctrl_init(struct device_node *np)
5028c2ecf20Sopenharmony_ci{
5038c2ecf20Sopenharmony_ci	struct hisi_clock_data *clk_data;
5048c2ecf20Sopenharmony_ci	int nr = ARRAY_SIZE(hi3660_pctrl_gate_clks);
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci	clk_data = hisi_clk_init(np, nr);
5078c2ecf20Sopenharmony_ci	if (!clk_data)
5088c2ecf20Sopenharmony_ci		return;
5098c2ecf20Sopenharmony_ci	hisi_clk_register_gate(hi3660_pctrl_gate_clks,
5108c2ecf20Sopenharmony_ci			       ARRAY_SIZE(hi3660_pctrl_gate_clks), clk_data);
5118c2ecf20Sopenharmony_ci}
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_cistatic void hi3660_clk_sctrl_init(struct device_node *np)
5148c2ecf20Sopenharmony_ci{
5158c2ecf20Sopenharmony_ci	struct hisi_clock_data *clk_data;
5168c2ecf20Sopenharmony_ci	int nr = ARRAY_SIZE(hi3660_sctrl_gate_clks) +
5178c2ecf20Sopenharmony_ci		 ARRAY_SIZE(hi3660_sctrl_gate_sep_clks) +
5188c2ecf20Sopenharmony_ci		 ARRAY_SIZE(hi3660_sctrl_mux_clks) +
5198c2ecf20Sopenharmony_ci		 ARRAY_SIZE(hi3660_sctrl_divider_clks);
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci	clk_data = hisi_clk_init(np, nr);
5228c2ecf20Sopenharmony_ci	if (!clk_data)
5238c2ecf20Sopenharmony_ci		return;
5248c2ecf20Sopenharmony_ci	hisi_clk_register_gate(hi3660_sctrl_gate_clks,
5258c2ecf20Sopenharmony_ci			       ARRAY_SIZE(hi3660_sctrl_gate_clks), clk_data);
5268c2ecf20Sopenharmony_ci	hisi_clk_register_gate_sep(hi3660_sctrl_gate_sep_clks,
5278c2ecf20Sopenharmony_ci				   ARRAY_SIZE(hi3660_sctrl_gate_sep_clks),
5288c2ecf20Sopenharmony_ci				   clk_data);
5298c2ecf20Sopenharmony_ci	hisi_clk_register_mux(hi3660_sctrl_mux_clks,
5308c2ecf20Sopenharmony_ci			      ARRAY_SIZE(hi3660_sctrl_mux_clks), clk_data);
5318c2ecf20Sopenharmony_ci	hisi_clk_register_divider(hi3660_sctrl_divider_clks,
5328c2ecf20Sopenharmony_ci				  ARRAY_SIZE(hi3660_sctrl_divider_clks),
5338c2ecf20Sopenharmony_ci				  clk_data);
5348c2ecf20Sopenharmony_ci}
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_cistatic void hi3660_clk_crgctrl_early_init(struct device_node *np)
5378c2ecf20Sopenharmony_ci{
5388c2ecf20Sopenharmony_ci	int nr = ARRAY_SIZE(hi3660_fixed_rate_clks) +
5398c2ecf20Sopenharmony_ci		 ARRAY_SIZE(hi3660_crgctrl_gate_sep_clks) +
5408c2ecf20Sopenharmony_ci		 ARRAY_SIZE(hi3660_crgctrl_gate_clks) +
5418c2ecf20Sopenharmony_ci		 ARRAY_SIZE(hi3660_crgctrl_mux_clks) +
5428c2ecf20Sopenharmony_ci		 ARRAY_SIZE(hi3660_crg_fixed_factor_clks) +
5438c2ecf20Sopenharmony_ci		 ARRAY_SIZE(hi3660_crgctrl_divider_clks);
5448c2ecf20Sopenharmony_ci	int i;
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ci	clk_crgctrl_data = hisi_clk_init(np, nr);
5478c2ecf20Sopenharmony_ci	if (!clk_crgctrl_data)
5488c2ecf20Sopenharmony_ci		return;
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_ci	for (i = 0; i < nr; i++)
5518c2ecf20Sopenharmony_ci		clk_crgctrl_data->clk_data.clks[i] = ERR_PTR(-EPROBE_DEFER);
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ci	hisi_clk_register_fixed_rate(hi3660_fixed_rate_clks,
5548c2ecf20Sopenharmony_ci				     ARRAY_SIZE(hi3660_fixed_rate_clks),
5558c2ecf20Sopenharmony_ci				     clk_crgctrl_data);
5568c2ecf20Sopenharmony_ci}
5578c2ecf20Sopenharmony_ciCLK_OF_DECLARE_DRIVER(hi3660_clk_crgctrl, "hisilicon,hi3660-crgctrl",
5588c2ecf20Sopenharmony_ci		      hi3660_clk_crgctrl_early_init);
5598c2ecf20Sopenharmony_ci
5608c2ecf20Sopenharmony_cistatic void hi3660_clk_crgctrl_init(struct device_node *np)
5618c2ecf20Sopenharmony_ci{
5628c2ecf20Sopenharmony_ci	struct clk **clks;
5638c2ecf20Sopenharmony_ci	int i;
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci	if (!clk_crgctrl_data)
5668c2ecf20Sopenharmony_ci		hi3660_clk_crgctrl_early_init(np);
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci	/* clk_crgctrl_data initialization failed */
5698c2ecf20Sopenharmony_ci	if (!clk_crgctrl_data)
5708c2ecf20Sopenharmony_ci		return;
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci	hisi_clk_register_gate_sep(hi3660_crgctrl_gate_sep_clks,
5738c2ecf20Sopenharmony_ci				   ARRAY_SIZE(hi3660_crgctrl_gate_sep_clks),
5748c2ecf20Sopenharmony_ci				   clk_crgctrl_data);
5758c2ecf20Sopenharmony_ci	hisi_clk_register_gate(hi3660_crgctrl_gate_clks,
5768c2ecf20Sopenharmony_ci			       ARRAY_SIZE(hi3660_crgctrl_gate_clks),
5778c2ecf20Sopenharmony_ci			       clk_crgctrl_data);
5788c2ecf20Sopenharmony_ci	hisi_clk_register_mux(hi3660_crgctrl_mux_clks,
5798c2ecf20Sopenharmony_ci			      ARRAY_SIZE(hi3660_crgctrl_mux_clks),
5808c2ecf20Sopenharmony_ci			      clk_crgctrl_data);
5818c2ecf20Sopenharmony_ci	hisi_clk_register_fixed_factor(hi3660_crg_fixed_factor_clks,
5828c2ecf20Sopenharmony_ci				       ARRAY_SIZE(hi3660_crg_fixed_factor_clks),
5838c2ecf20Sopenharmony_ci				       clk_crgctrl_data);
5848c2ecf20Sopenharmony_ci	hisi_clk_register_divider(hi3660_crgctrl_divider_clks,
5858c2ecf20Sopenharmony_ci				  ARRAY_SIZE(hi3660_crgctrl_divider_clks),
5868c2ecf20Sopenharmony_ci				  clk_crgctrl_data);
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci	clks = clk_crgctrl_data->clk_data.clks;
5898c2ecf20Sopenharmony_ci	for (i = 0; i < clk_crgctrl_data->clk_data.clk_num; i++) {
5908c2ecf20Sopenharmony_ci		if (IS_ERR(clks[i]) && PTR_ERR(clks[i]) != -EPROBE_DEFER)
5918c2ecf20Sopenharmony_ci			pr_err("Failed to register crgctrl clock[%d] err=%ld\n",
5928c2ecf20Sopenharmony_ci			       i, PTR_ERR(clks[i]));
5938c2ecf20Sopenharmony_ci	}
5948c2ecf20Sopenharmony_ci}
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_cistatic const struct of_device_id hi3660_clk_match_table[] = {
5978c2ecf20Sopenharmony_ci	{ .compatible = "hisilicon,hi3660-crgctrl",
5988c2ecf20Sopenharmony_ci	  .data = hi3660_clk_crgctrl_init },
5998c2ecf20Sopenharmony_ci	{ .compatible = "hisilicon,hi3660-pctrl",
6008c2ecf20Sopenharmony_ci	  .data = hi3660_clk_pctrl_init },
6018c2ecf20Sopenharmony_ci	{ .compatible = "hisilicon,hi3660-pmuctrl",
6028c2ecf20Sopenharmony_ci	  .data = hi3660_clk_pmuctrl_init },
6038c2ecf20Sopenharmony_ci	{ .compatible = "hisilicon,hi3660-sctrl",
6048c2ecf20Sopenharmony_ci	  .data = hi3660_clk_sctrl_init },
6058c2ecf20Sopenharmony_ci	{ .compatible = "hisilicon,hi3660-iomcu",
6068c2ecf20Sopenharmony_ci	  .data = hi3660_clk_iomcu_init },
6078c2ecf20Sopenharmony_ci	{ }
6088c2ecf20Sopenharmony_ci};
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_cistatic int hi3660_clk_probe(struct platform_device *pdev)
6118c2ecf20Sopenharmony_ci{
6128c2ecf20Sopenharmony_ci	struct device *dev = &pdev->dev;
6138c2ecf20Sopenharmony_ci	struct device_node *np = pdev->dev.of_node;
6148c2ecf20Sopenharmony_ci	void (*init_func)(struct device_node *np);
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci	init_func = of_device_get_match_data(dev);
6178c2ecf20Sopenharmony_ci	if (!init_func)
6188c2ecf20Sopenharmony_ci		return -ENODEV;
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci	init_func(np);
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci	return 0;
6238c2ecf20Sopenharmony_ci}
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_cistatic struct platform_driver hi3660_clk_driver = {
6268c2ecf20Sopenharmony_ci	.probe          = hi3660_clk_probe,
6278c2ecf20Sopenharmony_ci	.driver         = {
6288c2ecf20Sopenharmony_ci		.name   = "hi3660-clk",
6298c2ecf20Sopenharmony_ci		.of_match_table = hi3660_clk_match_table,
6308c2ecf20Sopenharmony_ci	},
6318c2ecf20Sopenharmony_ci};
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_cistatic int __init hi3660_clk_init(void)
6348c2ecf20Sopenharmony_ci{
6358c2ecf20Sopenharmony_ci	return platform_driver_register(&hi3660_clk_driver);
6368c2ecf20Sopenharmony_ci}
6378c2ecf20Sopenharmony_cicore_initcall(hi3660_clk_init);
638