18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2001-2021, Huawei Tech. Co., Ltd. 48c2ecf20Sopenharmony_ci * Author: chenjun <chenjun14@huawei.com> 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (c) 2018, Linaro Ltd. 78c2ecf20Sopenharmony_ci * Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <dt-bindings/clock/hi3670-clock.h> 118c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 128c2ecf20Sopenharmony_ci#include <linux/of_device.h> 138c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 148c2ecf20Sopenharmony_ci#include "clk.h" 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cistatic const struct hisi_fixed_rate_clock hi3670_fixed_rate_clks[] = { 178c2ecf20Sopenharmony_ci { HI3670_CLKIN_SYS, "clkin_sys", NULL, 0, 19200000, }, 188c2ecf20Sopenharmony_ci { HI3670_CLKIN_REF, "clkin_ref", NULL, 0, 32764, }, 198c2ecf20Sopenharmony_ci { HI3670_CLK_FLL_SRC, "clk_fll_src", NULL, 0, 134400000, }, 208c2ecf20Sopenharmony_ci { HI3670_CLK_PPLL0, "clk_ppll0", NULL, 0, 1660000000, }, 218c2ecf20Sopenharmony_ci { HI3670_CLK_PPLL1, "clk_ppll1", NULL, 0, 1866000000, }, 228c2ecf20Sopenharmony_ci { HI3670_CLK_PPLL2, "clk_ppll2", NULL, 0, 1920000000, }, 238c2ecf20Sopenharmony_ci { HI3670_CLK_PPLL3, "clk_ppll3", NULL, 0, 1200000000, }, 248c2ecf20Sopenharmony_ci { HI3670_CLK_PPLL4, "clk_ppll4", NULL, 0, 900000000, }, 258c2ecf20Sopenharmony_ci { HI3670_CLK_PPLL6, "clk_ppll6", NULL, 0, 393216000, }, 268c2ecf20Sopenharmony_ci { HI3670_CLK_PPLL7, "clk_ppll7", NULL, 0, 1008000000, }, 278c2ecf20Sopenharmony_ci { HI3670_CLK_PPLL_PCIE, "clk_ppll_pcie", NULL, 0, 100000000, }, 288c2ecf20Sopenharmony_ci { HI3670_CLK_PCIEPLL_REV, "clk_pciepll_rev", NULL, 0, 100000000, }, 298c2ecf20Sopenharmony_ci { HI3670_CLK_SCPLL, "clk_scpll", NULL, 0, 245760000, }, 308c2ecf20Sopenharmony_ci { HI3670_PCLK, "pclk", NULL, 0, 20000000, }, 318c2ecf20Sopenharmony_ci { HI3670_CLK_UART0_DBG, "clk_uart0_dbg", NULL, 0, 19200000, }, 328c2ecf20Sopenharmony_ci { HI3670_CLK_UART6, "clk_uart6", NULL, 0, 19200000, }, 338c2ecf20Sopenharmony_ci { HI3670_OSC32K, "osc32k", NULL, 0, 32764, }, 348c2ecf20Sopenharmony_ci { HI3670_OSC19M, "osc19m", NULL, 0, 19200000, }, 358c2ecf20Sopenharmony_ci { HI3670_CLK_480M, "clk_480m", NULL, 0, 480000000, }, 368c2ecf20Sopenharmony_ci { HI3670_CLK_INVALID, "clk_invalid", NULL, 0, 10000000, }, 378c2ecf20Sopenharmony_ci}; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/* crgctrl */ 408c2ecf20Sopenharmony_cistatic const struct hisi_fixed_factor_clock hi3670_crg_fixed_factor_clks[] = { 418c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_SYSBUS, "clk_div_sysbus", "clk_mux_sysbus", 428c2ecf20Sopenharmony_ci 1, 7, 0, }, 438c2ecf20Sopenharmony_ci { HI3670_CLK_FACTOR_MMC, "clk_factor_mmc", "clkin_sys", 448c2ecf20Sopenharmony_ci 1, 6, 0, }, 458c2ecf20Sopenharmony_ci { HI3670_CLK_SD_SYS, "clk_sd_sys", "clk_sd_sys_gt", 468c2ecf20Sopenharmony_ci 1, 6, 0, }, 478c2ecf20Sopenharmony_ci { HI3670_CLK_SDIO_SYS, "clk_sdio_sys", "clk_sdio_sys_gt", 488c2ecf20Sopenharmony_ci 1, 6, 0, }, 498c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_A53HPM, "clk_div_a53hpm", "clk_a53hpm_andgt", 508c2ecf20Sopenharmony_ci 1, 4, 0, }, 518c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_320M, "clk_div_320m", "clk_320m_pll_gt", 528c2ecf20Sopenharmony_ci 1, 5, 0, }, 538c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_UART0, "pclk_gate_uart0", "clk_mux_uartl", 548c2ecf20Sopenharmony_ci 1, 1, 0, }, 558c2ecf20Sopenharmony_ci { HI3670_CLK_FACTOR_UART0, "clk_factor_uart0", "clk_mux_uart0", 568c2ecf20Sopenharmony_ci 1, 1, 0, }, 578c2ecf20Sopenharmony_ci { HI3670_CLK_FACTOR_USB3PHY_PLL, "clk_factor_usb3phy_pll", "clk_ppll0", 588c2ecf20Sopenharmony_ci 1, 60, 0, }, 598c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ABB_USB, "clk_gate_abb_usb", "clk_gate_usb_tcxo_en", 608c2ecf20Sopenharmony_ci 1, 1, 0, }, 618c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UFSPHY_REF, "clk_gate_ufsphy_ref", "clkin_sys", 628c2ecf20Sopenharmony_ci 1, 1, 0, }, 638c2ecf20Sopenharmony_ci { HI3670_ICS_VOLT_HIGH, "ics_volt_high", "peri_volt_hold", 648c2ecf20Sopenharmony_ci 1, 1, 0, }, 658c2ecf20Sopenharmony_ci { HI3670_ICS_VOLT_MIDDLE, "ics_volt_middle", "peri_volt_middle", 668c2ecf20Sopenharmony_ci 1, 1, 0, }, 678c2ecf20Sopenharmony_ci { HI3670_VENC_VOLT_HOLD, "venc_volt_hold", "peri_volt_hold", 688c2ecf20Sopenharmony_ci 1, 1, 0, }, 698c2ecf20Sopenharmony_ci { HI3670_VDEC_VOLT_HOLD, "vdec_volt_hold", "peri_volt_hold", 708c2ecf20Sopenharmony_ci 1, 1, 0, }, 718c2ecf20Sopenharmony_ci { HI3670_EDC_VOLT_HOLD, "edc_volt_hold", "peri_volt_hold", 728c2ecf20Sopenharmony_ci 1, 1, 0, }, 738c2ecf20Sopenharmony_ci { HI3670_CLK_ISP_SNCLK_FAC, "clk_isp_snclk_fac", "clk_isp_snclk_angt", 748c2ecf20Sopenharmony_ci 1, 10, 0, }, 758c2ecf20Sopenharmony_ci { HI3670_CLK_FACTOR_RXDPHY, "clk_factor_rxdphy", "clk_andgt_rxdphy", 768c2ecf20Sopenharmony_ci 1, 6, 0, }, 778c2ecf20Sopenharmony_ci}; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_crgctrl_gate_sep_clks[] = { 808c2ecf20Sopenharmony_ci { HI3670_PPLL1_EN_ACPU, "ppll1_en_acpu", "clk_ppll1", 818c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0, 0, 0, }, 828c2ecf20Sopenharmony_ci { HI3670_PPLL2_EN_ACPU, "ppll2_en_acpu", "clk_ppll2", 838c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0, 3, 0, }, 848c2ecf20Sopenharmony_ci { HI3670_PPLL3_EN_ACPU, "ppll3_en_acpu", "clk_ppll3", 858c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0, 27, 0, }, 868c2ecf20Sopenharmony_ci { HI3670_PPLL1_GT_CPU, "ppll1_gt_cpu", "clk_ppll1", 878c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x460, 16, 0, }, 888c2ecf20Sopenharmony_ci { HI3670_PPLL2_GT_CPU, "ppll2_gt_cpu", "clk_ppll2", 898c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x460, 18, 0, }, 908c2ecf20Sopenharmony_ci { HI3670_PPLL3_GT_CPU, "ppll3_gt_cpu", "clk_ppll3", 918c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x460, 20, 0, }, 928c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PPLL2_MEDIA, "clk_gate_ppll2_media", "clk_ppll2", 938c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x410, 27, 0, }, 948c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PPLL3_MEDIA, "clk_gate_ppll3_media", "clk_ppll3", 958c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x410, 28, 0, }, 968c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PPLL4_MEDIA, "clk_gate_ppll4_media", "clk_ppll4", 978c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x410, 26, 0, }, 988c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PPLL6_MEDIA, "clk_gate_ppll6_media", "clk_ppll6", 998c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x410, 30, 0, }, 1008c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PPLL7_MEDIA, "clk_gate_ppll7_media", "clk_ppll7", 1018c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x410, 29, 0, }, 1028c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO0, "pclk_gpio0", "clk_div_cfgbus", 1038c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 0, 0, }, 1048c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO1, "pclk_gpio1", "clk_div_cfgbus", 1058c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 1, 0, }, 1068c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO2, "pclk_gpio2", "clk_div_cfgbus", 1078c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 2, 0, }, 1088c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO3, "pclk_gpio3", "clk_div_cfgbus", 1098c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 3, 0, }, 1108c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO4, "pclk_gpio4", "clk_div_cfgbus", 1118c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 4, 0, }, 1128c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO5, "pclk_gpio5", "clk_div_cfgbus", 1138c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 5, 0, }, 1148c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO6, "pclk_gpio6", "clk_div_cfgbus", 1158c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 6, 0, }, 1168c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO7, "pclk_gpio7", "clk_div_cfgbus", 1178c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 7, 0, }, 1188c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO8, "pclk_gpio8", "clk_div_cfgbus", 1198c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 8, 0, }, 1208c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO9, "pclk_gpio9", "clk_div_cfgbus", 1218c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 9, 0, }, 1228c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO10, "pclk_gpio10", "clk_div_cfgbus", 1238c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 10, 0, }, 1248c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO11, "pclk_gpio11", "clk_div_cfgbus", 1258c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 11, 0, }, 1268c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO12, "pclk_gpio12", "clk_div_cfgbus", 1278c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 12, 0, }, 1288c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO13, "pclk_gpio13", "clk_div_cfgbus", 1298c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 13, 0, }, 1308c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO14, "pclk_gpio14", "clk_div_cfgbus", 1318c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 14, 0, }, 1328c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO15, "pclk_gpio15", "clk_div_cfgbus", 1338c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 15, 0, }, 1348c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO16, "pclk_gpio16", "clk_div_cfgbus", 1358c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 16, 0, }, 1368c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO17, "pclk_gpio17", "clk_div_cfgbus", 1378c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 17, 0, }, 1388c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO20, "pclk_gpio20", "clk_div_cfgbus", 1398c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 20, 0, }, 1408c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO21, "pclk_gpio21", "clk_div_cfgbus", 1418c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 21, 0, }, 1428c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_DSI0, "pclk_gate_dsi0", "clk_div_cfgbus", 1438c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x50, 28, 0, }, 1448c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_DSI1, "pclk_gate_dsi1", "clk_div_cfgbus", 1458c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x50, 29, 0, }, 1468c2ecf20Sopenharmony_ci { HI3670_HCLK_GATE_USB3OTG, "hclk_gate_usb3otg", "clk_div_sysbus", 1478c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0, 25, 0, }, 1488c2ecf20Sopenharmony_ci { HI3670_ACLK_GATE_USB3DVFS, "aclk_gate_usb3dvfs", "autodiv_emmc0bus", 1498c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 1, 0, }, 1508c2ecf20Sopenharmony_ci { HI3670_HCLK_GATE_SDIO, "hclk_gate_sdio", "clk_div_sysbus", 1518c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0, 21, 0, }, 1528c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_PCIE_SYS, "pclk_gate_pcie_sys", "clk_div_mmc1bus", 1538c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x420, 7, 0, }, 1548c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_PCIE_PHY, "pclk_gate_pcie_phy", "pclk_gate_mmc1_pcie", 1558c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x420, 9, 0, }, 1568c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_MMC1_PCIE, "pclk_gate_mmc1_pcie", "pclk_div_mmc1_pcie", 1578c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x30, 12, 0, }, 1588c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_MMC0_IOC, "pclk_gate_mmc0_ioc", "clk_div_mmc0bus", 1598c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 13, 0, }, 1608c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_MMC1_IOC, "pclk_gate_mmc1_ioc", "clk_div_mmc1bus", 1618c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x420, 21, 0, }, 1628c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_DMAC, "clk_gate_dmac", "clk_div_sysbus", 1638c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x30, 1, 0, }, 1648c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_VCODECBUS2DDR, "clk_gate_vcodecbus2ddr", "clk_div_vcodecbus", 1658c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0, 5, 0, }, 1668c2ecf20Sopenharmony_ci { HI3670_CLK_CCI400_BYPASS, "clk_cci400_bypass", "clk_ddrc_freq", 1678c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x22C, 28, 0, }, 1688c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_CCI400, "clk_gate_cci400", "clk_ddrc_freq", 1698c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x50, 14, 0, }, 1708c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_SD, "clk_gate_sd", "clk_mux_sd_sys", 1718c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 17, 0, }, 1728c2ecf20Sopenharmony_ci { HI3670_HCLK_GATE_SD, "hclk_gate_sd", "clk_div_sysbus", 1738c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0, 30, 0, }, 1748c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_SDIO, "clk_gate_sdio", "clk_mux_sdio_sys", 1758c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 19, 0, }, 1768c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_A57HPM, "clk_gate_a57hpm", "clk_div_a53hpm", 1778c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x050, 9, 0, }, 1788c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_A53HPM, "clk_gate_a53hpm", "clk_div_a53hpm", 1798c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x050, 13, 0, }, 1808c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PA_A53, "clk_gate_pa_a53", "clk_div_a53hpm", 1818c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x480, 10, 0, }, 1828c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PA_A57, "clk_gate_pa_a57", "clk_div_a53hpm", 1838c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x480, 9, 0, }, 1848c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PA_G3D, "clk_gate_pa_g3d", "clk_div_a53hpm", 1858c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x480, 15, 0, }, 1868c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_GPUHPM, "clk_gate_gpuhpm", "clk_div_a53hpm", 1878c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x050, 15, 0, }, 1888c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PERIHPM, "clk_gate_perihpm", "clk_div_a53hpm", 1898c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x050, 12, 0, }, 1908c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_AOHPM, "clk_gate_aohpm", "clk_div_a53hpm", 1918c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x050, 11, 0, }, 1928c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UART1, "clk_gate_uart1", "clk_mux_uarth", 1938c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 11, 0, }, 1948c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UART4, "clk_gate_uart4", "clk_mux_uarth", 1958c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 14, 0, }, 1968c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_UART1, "pclk_gate_uart1", "clk_mux_uarth", 1978c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 11, 0, }, 1988c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_UART4, "pclk_gate_uart4", "clk_mux_uarth", 1998c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 14, 0, }, 2008c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UART2, "clk_gate_uart2", "clk_mux_uartl", 2018c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 12, 0, }, 2028c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UART5, "clk_gate_uart5", "clk_mux_uartl", 2038c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 15, 0, }, 2048c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_UART2, "pclk_gate_uart2", "clk_mux_uartl", 2058c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 12, 0, }, 2068c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_UART5, "pclk_gate_uart5", "clk_mux_uartl", 2078c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 15, 0, }, 2088c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UART0, "clk_gate_uart0", "clk_mux_uart0", 2098c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 10, 0, }, 2108c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_I2C3, "clk_gate_i2c3", "clk_mux_i2c", 2118c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 7, 0, }, 2128c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_I2C4, "clk_gate_i2c4", "clk_mux_i2c", 2138c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 27, 0, }, 2148c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_I2C7, "clk_gate_i2c7", "clk_mux_i2c", 2158c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 31, 0, }, 2168c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_I2C3, "pclk_gate_i2c3", "clk_mux_i2c", 2178c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 7, 0, }, 2188c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_I2C4, "pclk_gate_i2c4", "clk_mux_i2c", 2198c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 27, 0, }, 2208c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_I2C7, "pclk_gate_i2c7", "clk_mux_i2c", 2218c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 31, 0, }, 2228c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_SPI1, "clk_gate_spi1", "clk_mux_spi", 2238c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 9, 0, }, 2248c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_SPI4, "clk_gate_spi4", "clk_mux_spi", 2258c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 4, 0, }, 2268c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_SPI1, "pclk_gate_spi1", "clk_mux_spi", 2278c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 9, 0, }, 2288c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_SPI4, "pclk_gate_spi4", "clk_mux_spi", 2298c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 4, 0, }, 2308c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_USB3OTG_REF, "clk_gate_usb3otg_ref", "clkin_sys", 2318c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 0, 0, }, 2328c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_USB2PHY_REF, "clk_gate_usb2phy_ref", "clkin_sys", 2338c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x410, 19, 0, }, 2348c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PCIEAUX, "clk_gate_pcieaux", "clkin_sys", 2358c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x420, 8, 0, }, 2368c2ecf20Sopenharmony_ci { HI3670_ACLK_GATE_PCIE, "aclk_gate_pcie", "clk_gate_mmc1_pcieaxi", 2378c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x420, 5, 0, }, 2388c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_MMC1_PCIEAXI, "clk_gate_mmc1_pcieaxi", "clk_div_pcieaxi", 2398c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x050, 4, 0, }, 2408c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PCIEPHY_REF, "clk_gate_pciephy_ref", "clk_ppll_pcie", 2418c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x470, 14, 0, }, 2428c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PCIE_DEBOUNCE, "clk_gate_pcie_debounce", "clk_ppll_pcie", 2438c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x470, 12, 0, }, 2448c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PCIEIO, "clk_gate_pcieio", "clk_ppll_pcie", 2458c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x470, 13, 0, }, 2468c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PCIE_HP, "clk_gate_pcie_hp", "clk_ppll_pcie", 2478c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x470, 15, 0, }, 2488c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_AO_ASP, "clk_gate_ao_asp", "clk_div_ao_asp", 2498c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0, 26, 0, }, 2508c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_PCTRL, "pclk_gate_pctrl", "clk_div_ptp", 2518c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 31, 0, }, 2528c2ecf20Sopenharmony_ci { HI3670_CLK_CSI_TRANS_GT, "clk_csi_trans_gt", "clk_div_csi_trans", 2538c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x30, 24, 0, }, 2548c2ecf20Sopenharmony_ci { HI3670_CLK_DSI_TRANS_GT, "clk_dsi_trans_gt", "clk_div_dsi_trans", 2558c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x30, 25, 0, }, 2568c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PWM, "clk_gate_pwm", "clk_div_ptp", 2578c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 0, 0, }, 2588c2ecf20Sopenharmony_ci { HI3670_ABB_AUDIO_EN0, "abb_audio_en0", "clk_gate_abb_192", 2598c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x30, 8, 0, }, 2608c2ecf20Sopenharmony_ci { HI3670_ABB_AUDIO_EN1, "abb_audio_en1", "clk_gate_abb_192", 2618c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x30, 9, 0, }, 2628c2ecf20Sopenharmony_ci { HI3670_ABB_AUDIO_GT_EN0, "abb_audio_gt_en0", "abb_audio_en0", 2638c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x30, 19, 0, }, 2648c2ecf20Sopenharmony_ci { HI3670_ABB_AUDIO_GT_EN1, "abb_audio_gt_en1", "abb_audio_en1", 2658c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 20, 0, }, 2668c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_DP_AUDIO_PLL_AO, "clk_gate_dp_audio_pll_ao", "clkdiv_dp_audio_pll_ao", 2678c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 13, 0, }, 2688c2ecf20Sopenharmony_ci { HI3670_PERI_VOLT_HOLD, "peri_volt_hold", "clkin_sys", 2698c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0, 1, 0, }, 2708c2ecf20Sopenharmony_ci { HI3670_PERI_VOLT_MIDDLE, "peri_volt_middle", "clkin_sys", 2718c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0, 1, 0, }, 2728c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ISP_SNCLK0, "clk_gate_isp_snclk0", "clk_isp_snclk_mux0", 2738c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x50, 16, 0, }, 2748c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ISP_SNCLK1, "clk_gate_isp_snclk1", "clk_isp_snclk_mux1", 2758c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x50, 17, 0, }, 2768c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ISP_SNCLK2, "clk_gate_isp_snclk2", "clk_isp_snclk_mux2", 2778c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x50, 18, 0, }, 2788c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_RXDPHY0_CFG, "clk_gate_rxdphy0_cfg", "clk_mux_rxdphy_cfg", 2798c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x030, 20, 0, }, 2808c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_RXDPHY1_CFG, "clk_gate_rxdphy1_cfg", "clk_mux_rxdphy_cfg", 2818c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x030, 21, 0, }, 2828c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_RXDPHY2_CFG, "clk_gate_rxdphy2_cfg", "clk_mux_rxdphy_cfg", 2838c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x030, 22, 0, }, 2848c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_TXDPHY0_CFG, "clk_gate_txdphy0_cfg", "clkin_sys", 2858c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x030, 28, 0, }, 2868c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_TXDPHY0_REF, "clk_gate_txdphy0_ref", "clkin_sys", 2878c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x030, 29, 0, }, 2888c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_TXDPHY1_CFG, "clk_gate_txdphy1_cfg", "clkin_sys", 2898c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x030, 30, 0, }, 2908c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_TXDPHY1_REF, "clk_gate_txdphy1_ref", "clkin_sys", 2918c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x030, 31, 0, }, 2928c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_MEDIA_TCXO, "clk_gate_media_tcxo", "clkin_sys", 2938c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x40, 6, 0, }, 2948c2ecf20Sopenharmony_ci}; 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_crgctrl_gate_clks[] = { 2978c2ecf20Sopenharmony_ci { HI3670_AUTODIV_SYSBUS, "autodiv_sysbus", "clk_div_sysbus", 2988c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x404, 5, CLK_GATE_HIWORD_MASK, }, 2998c2ecf20Sopenharmony_ci { HI3670_AUTODIV_EMMC0BUS, "autodiv_emmc0bus", "autodiv_sysbus", 3008c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x404, 1, CLK_GATE_HIWORD_MASK, }, 3018c2ecf20Sopenharmony_ci { HI3670_PCLK_ANDGT_MMC1_PCIE, "pclk_andgt_mmc1_pcie", "clk_div_320m", 3028c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xf8, 13, CLK_GATE_HIWORD_MASK, }, 3038c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_VCODECBUS_GT, "clk_gate_vcodecbus_gt", "clk_mux_vcodecbus", 3048c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0F0, 8, CLK_GATE_HIWORD_MASK, }, 3058c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_SD, "clk_andgt_sd", "clk_mux_sd_pll", 3068c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 3, CLK_GATE_HIWORD_MASK, }, 3078c2ecf20Sopenharmony_ci { HI3670_CLK_SD_SYS_GT, "clk_sd_sys_gt", "clkin_sys", 3088c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 5, CLK_GATE_HIWORD_MASK, }, 3098c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_SDIO, "clk_andgt_sdio", "clk_mux_sdio_pll", 3108c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 8, CLK_GATE_HIWORD_MASK, }, 3118c2ecf20Sopenharmony_ci { HI3670_CLK_SDIO_SYS_GT, "clk_sdio_sys_gt", "clkin_sys", 3128c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 6, CLK_GATE_HIWORD_MASK, }, 3138c2ecf20Sopenharmony_ci { HI3670_CLK_A53HPM_ANDGT, "clk_a53hpm_andgt", "clk_mux_a53hpm", 3148c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0F4, 7, CLK_GATE_HIWORD_MASK, }, 3158c2ecf20Sopenharmony_ci { HI3670_CLK_320M_PLL_GT, "clk_320m_pll_gt", "clk_mux_320m", 3168c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF8, 10, CLK_GATE_HIWORD_MASK, }, 3178c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_UARTH, "clk_andgt_uarth", "clk_div_320m", 3188c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 11, CLK_GATE_HIWORD_MASK, }, 3198c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_UARTL, "clk_andgt_uartl", "clk_div_320m", 3208c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 10, CLK_GATE_HIWORD_MASK, }, 3218c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_UART0, "clk_andgt_uart0", "clk_div_320m", 3228c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 9, CLK_GATE_HIWORD_MASK, }, 3238c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_SPI, "clk_andgt_spi", "clk_div_320m", 3248c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 13, CLK_GATE_HIWORD_MASK, }, 3258c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_PCIEAXI, "clk_andgt_pcieaxi", "clk_mux_pcieaxi", 3268c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xfc, 15, CLK_GATE_HIWORD_MASK, }, 3278c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_AO_ASP_GT, "clk_div_ao_asp_gt", "clk_mux_ao_asp", 3288c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 4, CLK_GATE_HIWORD_MASK, }, 3298c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_CSI_TRANS, "clk_gate_csi_trans", "clk_ppll2", 3308c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 14, CLK_GATE_HIWORD_MASK, }, 3318c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_DSI_TRANS, "clk_gate_dsi_trans", "clk_ppll2", 3328c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF4, 1, CLK_GATE_HIWORD_MASK, }, 3338c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_PTP, "clk_andgt_ptp", "clk_div_320m", 3348c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF8, 5, CLK_GATE_HIWORD_MASK, }, 3358c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_OUT0, "clk_andgt_out0", "clk_ppll0", 3368c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF0, 10, CLK_GATE_HIWORD_MASK, }, 3378c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_OUT1, "clk_andgt_out1", "clk_ppll0", 3388c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF0, 11, CLK_GATE_HIWORD_MASK, }, 3398c2ecf20Sopenharmony_ci { HI3670_CLKGT_DP_AUDIO_PLL_AO, "clkgt_dp_audio_pll_ao", "clk_ppll6", 3408c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF8, 15, CLK_GATE_HIWORD_MASK, }, 3418c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_VDEC, "clk_andgt_vdec", "clk_mux_vdec", 3428c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF0, 13, CLK_GATE_HIWORD_MASK, }, 3438c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_VENC, "clk_andgt_venc", "clk_mux_venc", 3448c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xF0, 9, CLK_GATE_HIWORD_MASK, }, 3458c2ecf20Sopenharmony_ci { HI3670_CLK_ISP_SNCLK_ANGT, "clk_isp_snclk_angt", "clk_div_a53hpm", 3468c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x108, 2, CLK_GATE_HIWORD_MASK, }, 3478c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_RXDPHY, "clk_andgt_rxdphy", "clk_div_a53hpm", 3488c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0F0, 12, CLK_GATE_HIWORD_MASK, }, 3498c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_ICS, "clk_andgt_ics", "clk_mux_ics", 3508c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xf0, 14, CLK_GATE_HIWORD_MASK, }, 3518c2ecf20Sopenharmony_ci { HI3670_AUTODIV_DMABUS, "autodiv_dmabus", "autodiv_sysbus", 3528c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x404, 3, CLK_GATE_HIWORD_MASK, }, 3538c2ecf20Sopenharmony_ci}; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_cistatic const char *const 3568c2ecf20Sopenharmony_ciclk_mux_sysbus_p[] = { "clk_ppll1", "clk_ppll0", }; 3578c2ecf20Sopenharmony_cistatic const char *const 3588c2ecf20Sopenharmony_ciclk_mux_vcodecbus_p[] = { "clk_invalid", "clk_ppll4", "clk_ppll0", 3598c2ecf20Sopenharmony_ci "clk_invalid", "clk_ppll2", "clk_invalid", 3608c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_ppll3", 3618c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", 3628c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", 3638c2ecf20Sopenharmony_ci "clk_invalid", }; 3648c2ecf20Sopenharmony_cistatic const char *const 3658c2ecf20Sopenharmony_ciclk_mux_sd_sys_p[] = { "clk_sd_sys", "clk_div_sd", }; 3668c2ecf20Sopenharmony_cistatic const char *const 3678c2ecf20Sopenharmony_ciclk_mux_sd_pll_p[] = { "clk_ppll0", "clk_ppll3", "clk_ppll2", "clk_ppll2", }; 3688c2ecf20Sopenharmony_cistatic const char *const 3698c2ecf20Sopenharmony_ciclk_mux_sdio_sys_p[] = { "clk_sdio_sys", "clk_div_sdio", }; 3708c2ecf20Sopenharmony_cistatic const char *const 3718c2ecf20Sopenharmony_ciclk_mux_sdio_pll_p[] = { "clk_ppll0", "clk_ppll3", "clk_ppll2", "clk_ppll2", }; 3728c2ecf20Sopenharmony_cistatic const char *const 3738c2ecf20Sopenharmony_ciclk_mux_a53hpm_p[] = { "clk_ppll0", "clk_ppll2", }; 3748c2ecf20Sopenharmony_cistatic const char *const 3758c2ecf20Sopenharmony_ciclk_mux_320m_p[] = { "clk_ppll2", "clk_ppll0", }; 3768c2ecf20Sopenharmony_cistatic const char *const 3778c2ecf20Sopenharmony_ciclk_mux_uarth_p[] = { "clkin_sys", "clk_div_uarth", }; 3788c2ecf20Sopenharmony_cistatic const char *const 3798c2ecf20Sopenharmony_ciclk_mux_uartl_p[] = { "clkin_sys", "clk_div_uartl", }; 3808c2ecf20Sopenharmony_cistatic const char *const 3818c2ecf20Sopenharmony_ciclk_mux_uart0_p[] = { "clkin_sys", "clk_div_uart0", }; 3828c2ecf20Sopenharmony_cistatic const char *const 3838c2ecf20Sopenharmony_ciclk_mux_i2c_p[] = { "clkin_sys", "clk_div_i2c", }; 3848c2ecf20Sopenharmony_cistatic const char *const 3858c2ecf20Sopenharmony_ciclk_mux_spi_p[] = { "clkin_sys", "clk_div_spi", }; 3868c2ecf20Sopenharmony_cistatic const char *const 3878c2ecf20Sopenharmony_ciclk_mux_pcieaxi_p[] = { "clkin_sys", "clk_ppll0", }; 3888c2ecf20Sopenharmony_cistatic const char *const 3898c2ecf20Sopenharmony_ciclk_mux_ao_asp_p[] = { "clk_ppll2", "clk_ppll3", }; 3908c2ecf20Sopenharmony_cistatic const char *const 3918c2ecf20Sopenharmony_ciclk_mux_vdec_p[] = { "clk_invalid", "clk_ppll4", "clk_ppll0", "clk_invalid", 3928c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", "clk_invalid", 3938c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", "clk_invalid", 3948c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", 3958c2ecf20Sopenharmony_ci "clk_invalid", }; 3968c2ecf20Sopenharmony_cistatic const char *const 3978c2ecf20Sopenharmony_ciclk_mux_venc_p[] = { "clk_invalid", "clk_ppll4", "clk_ppll0", "clk_invalid", 3988c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", "clk_invalid", 3998c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", "clk_invalid", 4008c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", 4018c2ecf20Sopenharmony_ci "clk_invalid", }; 4028c2ecf20Sopenharmony_cistatic const char *const 4038c2ecf20Sopenharmony_ciclk_isp_snclk_mux0_p[] = { "clkin_sys", "clk_isp_snclk_div0", }; 4048c2ecf20Sopenharmony_cistatic const char *const 4058c2ecf20Sopenharmony_ciclk_isp_snclk_mux1_p[] = { "clkin_sys", "clk_isp_snclk_div1", }; 4068c2ecf20Sopenharmony_cistatic const char *const 4078c2ecf20Sopenharmony_ciclk_isp_snclk_mux2_p[] = { "clkin_sys", "clk_isp_snclk_div2", }; 4088c2ecf20Sopenharmony_cistatic const char *const 4098c2ecf20Sopenharmony_ciclk_mux_rxdphy_cfg_p[] = { "clk_factor_rxdphy", "clkin_sys", }; 4108c2ecf20Sopenharmony_cistatic const char *const 4118c2ecf20Sopenharmony_ciclk_mux_ics_p[] = { "clk_invalid", "clk_ppll4", "clk_ppll0", "clk_invalid", 4128c2ecf20Sopenharmony_ci "clk_ppll2", "clk_invalid", "clk_invalid", "clk_invalid", 4138c2ecf20Sopenharmony_ci "clk_ppll3", "clk_invalid", "clk_invalid", "clk_invalid", 4148c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", 4158c2ecf20Sopenharmony_ci "clk_invalid", }; 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_cistatic const struct hisi_mux_clock hi3670_crgctrl_mux_clks[] = { 4188c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_SYSBUS, "clk_mux_sysbus", clk_mux_sysbus_p, 4198c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_sysbus_p), CLK_SET_RATE_PARENT, 4208c2ecf20Sopenharmony_ci 0xAC, 0, 1, CLK_MUX_HIWORD_MASK, }, 4218c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_VCODECBUS, "clk_mux_vcodecbus", clk_mux_vcodecbus_p, 4228c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_vcodecbus_p), CLK_SET_RATE_PARENT, 4238c2ecf20Sopenharmony_ci 0x0C8, 0, 4, CLK_MUX_HIWORD_MASK, }, 4248c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_SD_SYS, "clk_mux_sd_sys", clk_mux_sd_sys_p, 4258c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_sd_sys_p), CLK_SET_RATE_PARENT, 4268c2ecf20Sopenharmony_ci 0x0B8, 6, 1, CLK_MUX_HIWORD_MASK, }, 4278c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_SD_PLL, "clk_mux_sd_pll", clk_mux_sd_pll_p, 4288c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_sd_pll_p), CLK_SET_RATE_PARENT, 4298c2ecf20Sopenharmony_ci 0x0B8, 4, 2, CLK_MUX_HIWORD_MASK, }, 4308c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_SDIO_SYS, "clk_mux_sdio_sys", clk_mux_sdio_sys_p, 4318c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_sdio_sys_p), CLK_SET_RATE_PARENT, 4328c2ecf20Sopenharmony_ci 0x0C0, 6, 1, CLK_MUX_HIWORD_MASK, }, 4338c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_SDIO_PLL, "clk_mux_sdio_pll", clk_mux_sdio_pll_p, 4348c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_sdio_pll_p), CLK_SET_RATE_PARENT, 4358c2ecf20Sopenharmony_ci 0x0C0, 4, 2, CLK_MUX_HIWORD_MASK, }, 4368c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_A53HPM, "clk_mux_a53hpm", clk_mux_a53hpm_p, 4378c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_a53hpm_p), CLK_SET_RATE_PARENT, 4388c2ecf20Sopenharmony_ci 0x0D4, 9, 1, CLK_MUX_HIWORD_MASK, }, 4398c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_320M, "clk_mux_320m", clk_mux_320m_p, 4408c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_320m_p), CLK_SET_RATE_PARENT, 4418c2ecf20Sopenharmony_ci 0x100, 0, 1, CLK_MUX_HIWORD_MASK, }, 4428c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_UARTH, "clk_mux_uarth", clk_mux_uarth_p, 4438c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_uarth_p), CLK_SET_RATE_PARENT, 4448c2ecf20Sopenharmony_ci 0xAC, 4, 1, CLK_MUX_HIWORD_MASK, }, 4458c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_UARTL, "clk_mux_uartl", clk_mux_uartl_p, 4468c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_uartl_p), CLK_SET_RATE_PARENT, 4478c2ecf20Sopenharmony_ci 0xAC, 3, 1, CLK_MUX_HIWORD_MASK, }, 4488c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_UART0, "clk_mux_uart0", clk_mux_uart0_p, 4498c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_uart0_p), CLK_SET_RATE_PARENT, 4508c2ecf20Sopenharmony_ci 0xAC, 2, 1, CLK_MUX_HIWORD_MASK, }, 4518c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_I2C, "clk_mux_i2c", clk_mux_i2c_p, 4528c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_i2c_p), CLK_SET_RATE_PARENT, 4538c2ecf20Sopenharmony_ci 0xAC, 13, 1, CLK_MUX_HIWORD_MASK, }, 4548c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_SPI, "clk_mux_spi", clk_mux_spi_p, 4558c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_spi_p), CLK_SET_RATE_PARENT, 4568c2ecf20Sopenharmony_ci 0xAC, 8, 1, CLK_MUX_HIWORD_MASK, }, 4578c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_PCIEAXI, "clk_mux_pcieaxi", clk_mux_pcieaxi_p, 4588c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_pcieaxi_p), CLK_SET_RATE_PARENT, 4598c2ecf20Sopenharmony_ci 0xb4, 5, 1, CLK_MUX_HIWORD_MASK, }, 4608c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_AO_ASP, "clk_mux_ao_asp", clk_mux_ao_asp_p, 4618c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_ao_asp_p), CLK_SET_RATE_PARENT, 4628c2ecf20Sopenharmony_ci 0x100, 6, 1, CLK_MUX_HIWORD_MASK, }, 4638c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_VDEC, "clk_mux_vdec", clk_mux_vdec_p, 4648c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_vdec_p), CLK_SET_RATE_PARENT, 4658c2ecf20Sopenharmony_ci 0xC8, 8, 4, CLK_MUX_HIWORD_MASK, }, 4668c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_VENC, "clk_mux_venc", clk_mux_venc_p, 4678c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_venc_p), CLK_SET_RATE_PARENT, 4688c2ecf20Sopenharmony_ci 0xC8, 4, 4, CLK_MUX_HIWORD_MASK, }, 4698c2ecf20Sopenharmony_ci { HI3670_CLK_ISP_SNCLK_MUX0, "clk_isp_snclk_mux0", clk_isp_snclk_mux0_p, 4708c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_isp_snclk_mux0_p), CLK_SET_RATE_PARENT, 4718c2ecf20Sopenharmony_ci 0x108, 3, 1, CLK_MUX_HIWORD_MASK, }, 4728c2ecf20Sopenharmony_ci { HI3670_CLK_ISP_SNCLK_MUX1, "clk_isp_snclk_mux1", clk_isp_snclk_mux1_p, 4738c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_isp_snclk_mux1_p), CLK_SET_RATE_PARENT, 4748c2ecf20Sopenharmony_ci 0x10C, 13, 1, CLK_MUX_HIWORD_MASK, }, 4758c2ecf20Sopenharmony_ci { HI3670_CLK_ISP_SNCLK_MUX2, "clk_isp_snclk_mux2", clk_isp_snclk_mux2_p, 4768c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_isp_snclk_mux2_p), CLK_SET_RATE_PARENT, 4778c2ecf20Sopenharmony_ci 0x10C, 10, 1, CLK_MUX_HIWORD_MASK, }, 4788c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_RXDPHY_CFG, "clk_mux_rxdphy_cfg", clk_mux_rxdphy_cfg_p, 4798c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_rxdphy_cfg_p), CLK_SET_RATE_PARENT, 4808c2ecf20Sopenharmony_ci 0x0C4, 8, 1, CLK_MUX_HIWORD_MASK, }, 4818c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_ICS, "clk_mux_ics", clk_mux_ics_p, 4828c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_ics_p), CLK_SET_RATE_PARENT, 4838c2ecf20Sopenharmony_ci 0xc8, 12, 4, CLK_MUX_HIWORD_MASK, }, 4848c2ecf20Sopenharmony_ci}; 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_cistatic const struct hisi_divider_clock hi3670_crgctrl_divider_clks[] = { 4878c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_CFGBUS, "clk_div_cfgbus", "clk_div_sysbus", 4888c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xEC, 0, 2, CLK_DIVIDER_HIWORD_MASK, }, 4898c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_MMC0BUS, "clk_div_mmc0bus", "autodiv_emmc0bus", 4908c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0EC, 2, 1, CLK_DIVIDER_HIWORD_MASK, }, 4918c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_MMC1BUS, "clk_div_mmc1bus", "clk_div_sysbus", 4928c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0EC, 3, 1, CLK_DIVIDER_HIWORD_MASK, }, 4938c2ecf20Sopenharmony_ci { HI3670_PCLK_DIV_MMC1_PCIE, "pclk_div_mmc1_pcie", "pclk_andgt_mmc1_pcie", 4948c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xb4, 6, 4, CLK_DIVIDER_HIWORD_MASK, }, 4958c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_VCODECBUS, "clk_div_vcodecbus", "clk_gate_vcodecbus_gt", 4968c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x0BC, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 4978c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_SD, "clk_div_sd", "clk_andgt_sd", 4988c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xB8, 0, 4, CLK_DIVIDER_HIWORD_MASK, }, 4998c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_SDIO, "clk_div_sdio", "clk_andgt_sdio", 5008c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xC0, 0, 4, CLK_DIVIDER_HIWORD_MASK, }, 5018c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_UARTH, "clk_div_uarth", "clk_andgt_uarth", 5028c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xB0, 12, 4, CLK_DIVIDER_HIWORD_MASK, }, 5038c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_UARTL, "clk_div_uartl", "clk_andgt_uartl", 5048c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xB0, 8, 4, CLK_DIVIDER_HIWORD_MASK, }, 5058c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_UART0, "clk_div_uart0", "clk_andgt_uart0", 5068c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xB0, 4, 4, CLK_DIVIDER_HIWORD_MASK, }, 5078c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_I2C, "clk_div_i2c", "clk_div_320m", 5088c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xE8, 4, 4, CLK_DIVIDER_HIWORD_MASK, }, 5098c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_SPI, "clk_div_spi", "clk_andgt_spi", 5108c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xC4, 12, 4, CLK_DIVIDER_HIWORD_MASK, }, 5118c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_PCIEAXI, "clk_div_pcieaxi", "clk_andgt_pcieaxi", 5128c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xb4, 0, 5, CLK_DIVIDER_HIWORD_MASK, }, 5138c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_AO_ASP, "clk_div_ao_asp", "clk_div_ao_asp_gt", 5148c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x108, 6, 4, CLK_DIVIDER_HIWORD_MASK, }, 5158c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_CSI_TRANS, "clk_div_csi_trans", "clk_gate_csi_trans", 5168c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xD4, 0, 5, CLK_DIVIDER_HIWORD_MASK, }, 5178c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_DSI_TRANS, "clk_div_dsi_trans", "clk_gate_dsi_trans", 5188c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xD4, 10, 5, CLK_DIVIDER_HIWORD_MASK, }, 5198c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_PTP, "clk_div_ptp", "clk_andgt_ptp", 5208c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xD8, 0, 4, CLK_DIVIDER_HIWORD_MASK, }, 5218c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_CLKOUT0_PLL, "clk_div_clkout0_pll", "clk_andgt_out0", 5228c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xe0, 4, 6, CLK_DIVIDER_HIWORD_MASK, }, 5238c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_CLKOUT1_PLL, "clk_div_clkout1_pll", "clk_andgt_out1", 5248c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xe0, 10, 6, CLK_DIVIDER_HIWORD_MASK, }, 5258c2ecf20Sopenharmony_ci { HI3670_CLKDIV_DP_AUDIO_PLL_AO, "clkdiv_dp_audio_pll_ao", "clkgt_dp_audio_pll_ao", 5268c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xBC, 11, 4, CLK_DIVIDER_HIWORD_MASK, }, 5278c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_VDEC, "clk_div_vdec", "clk_andgt_vdec", 5288c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xC4, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 5298c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_VENC, "clk_div_venc", "clk_andgt_venc", 5308c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xC0, 8, 6, CLK_DIVIDER_HIWORD_MASK, }, 5318c2ecf20Sopenharmony_ci { HI3670_CLK_ISP_SNCLK_DIV0, "clk_isp_snclk_div0", "clk_isp_snclk_fac", 5328c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x108, 0, 2, CLK_DIVIDER_HIWORD_MASK, }, 5338c2ecf20Sopenharmony_ci { HI3670_CLK_ISP_SNCLK_DIV1, "clk_isp_snclk_div1", "clk_isp_snclk_fac", 5348c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10C, 14, 2, CLK_DIVIDER_HIWORD_MASK, }, 5358c2ecf20Sopenharmony_ci { HI3670_CLK_ISP_SNCLK_DIV2, "clk_isp_snclk_div2", "clk_isp_snclk_fac", 5368c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10C, 11, 2, CLK_DIVIDER_HIWORD_MASK, }, 5378c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_ICS, "clk_div_ics", "clk_andgt_ics", 5388c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0xE4, 9, 6, CLK_DIVIDER_HIWORD_MASK, }, 5398c2ecf20Sopenharmony_ci}; 5408c2ecf20Sopenharmony_ci 5418c2ecf20Sopenharmony_ci/* clk_pmuctrl */ 5428c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_pmu_gate_clks[] = { 5438c2ecf20Sopenharmony_ci { HI3670_GATE_ABB_192, "clk_gate_abb_192", "clkin_sys", 5448c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, (0x037 << 2), 0, 0, }, 5458c2ecf20Sopenharmony_ci}; 5468c2ecf20Sopenharmony_ci 5478c2ecf20Sopenharmony_ci/* clk_pctrl */ 5488c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_pctrl_gate_clks[] = { 5498c2ecf20Sopenharmony_ci { HI3670_GATE_UFS_TCXO_EN, "clk_gate_ufs_tcxo_en", "clk_gate_abb_192", 5508c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 0, CLK_GATE_HIWORD_MASK, }, 5518c2ecf20Sopenharmony_ci { HI3670_GATE_USB_TCXO_EN, "clk_gate_usb_tcxo_en", "clk_gate_abb_192", 5528c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 1, CLK_GATE_HIWORD_MASK, }, 5538c2ecf20Sopenharmony_ci}; 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_ci/* clk_sctrl */ 5568c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_sctrl_gate_sep_clks[] = { 5578c2ecf20Sopenharmony_ci { HI3670_PPLL0_EN_ACPU, "ppll0_en_acpu", "clk_ppll0", 5588c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x190, 26, 0, }, 5598c2ecf20Sopenharmony_ci { HI3670_PPLL0_GT_CPU, "ppll0_gt_cpu", "clk_ppll0", 5608c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x190, 15, 0, }, 5618c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PPLL0_MEDIA, "clk_gate_ppll0_media", "clk_ppll0", 5628c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x1b0, 6, 0, }, 5638c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO18, "pclk_gpio18", "clk_div_aobus", 5648c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x1B0, 9, 0, }, 5658c2ecf20Sopenharmony_ci { HI3670_PCLK_GPIO19, "pclk_gpio19", "clk_div_aobus", 5668c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x1B0, 8, 0, }, 5678c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_SPI, "clk_gate_spi", "clk_div_ioperi", 5688c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x1B0, 10, 0, }, 5698c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_SPI, "pclk_gate_spi", "clk_div_ioperi", 5708c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x1B0, 10, 0, }, 5718c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UFS_SUBSYS, "clk_gate_ufs_subsys", "clk_div_ufs_subsys", 5728c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x1B0, 14, 0, }, 5738c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UFSIO_REF, "clk_gate_ufsio_ref", "clkin_sys", 5748c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x1b0, 12, 0, }, 5758c2ecf20Sopenharmony_ci { HI3670_PCLK_AO_GPIO0, "pclk_ao_gpio0", "clk_div_aobus", 5768c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 11, 0, }, 5778c2ecf20Sopenharmony_ci { HI3670_PCLK_AO_GPIO1, "pclk_ao_gpio1", "clk_div_aobus", 5788c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 12, 0, }, 5798c2ecf20Sopenharmony_ci { HI3670_PCLK_AO_GPIO2, "pclk_ao_gpio2", "clk_div_aobus", 5808c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 13, 0, }, 5818c2ecf20Sopenharmony_ci { HI3670_PCLK_AO_GPIO3, "pclk_ao_gpio3", "clk_div_aobus", 5828c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 14, 0, }, 5838c2ecf20Sopenharmony_ci { HI3670_PCLK_AO_GPIO4, "pclk_ao_gpio4", "clk_div_aobus", 5848c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 21, 0, }, 5858c2ecf20Sopenharmony_ci { HI3670_PCLK_AO_GPIO5, "pclk_ao_gpio5", "clk_div_aobus", 5868c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 22, 0, }, 5878c2ecf20Sopenharmony_ci { HI3670_PCLK_AO_GPIO6, "pclk_ao_gpio6", "clk_div_aobus", 5888c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 25, 0, }, 5898c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_OUT0, "clk_gate_out0", "clk_mux_clkout0", 5908c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 16, 0, }, 5918c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_OUT1, "clk_gate_out1", "clk_mux_clkout1", 5928c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 17, 0, }, 5938c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_SYSCNT, "pclk_gate_syscnt", "clk_div_aobus", 5948c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 19, 0, }, 5958c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_SYSCNT, "clk_gate_syscnt", "clkin_sys", 5968c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 20, 0, }, 5978c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ASP_SUBSYS_PERI, "clk_gate_asp_subsys_peri", 5988c2ecf20Sopenharmony_ci "clk_mux_asp_subsys_peri", 5998c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x170, 6, 0, }, 6008c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ASP_SUBSYS, "clk_gate_asp_subsys", "clk_mux_asp_pll", 6018c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x170, 4, 0, }, 6028c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ASP_TCXO, "clk_gate_asp_tcxo", "clkin_sys", 6038c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x160, 27, 0, }, 6048c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_DP_AUDIO_PLL, "clk_gate_dp_audio_pll", 6058c2ecf20Sopenharmony_ci "clk_gate_dp_audio_pll_ao", 6068c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x1B0, 7, 0, }, 6078c2ecf20Sopenharmony_ci}; 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_sctrl_gate_clks[] = { 6108c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_IOPERI, "clk_andgt_ioperi", "clk_ppll0", 6118c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x270, 6, CLK_GATE_HIWORD_MASK, }, 6128c2ecf20Sopenharmony_ci { HI3670_CLKANDGT_ASP_SUBSYS_PERI, "clkandgt_asp_subsys_peri", 6138c2ecf20Sopenharmony_ci "clk_ppll0", 6148c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x268, 3, CLK_GATE_HIWORD_MASK, }, 6158c2ecf20Sopenharmony_ci { HI3670_CLK_ANGT_ASP_SUBSYS, "clk_angt_asp_subsys", "clk_ppll0", 6168c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x258, 0, CLK_GATE_HIWORD_MASK, }, 6178c2ecf20Sopenharmony_ci}; 6188c2ecf20Sopenharmony_ci 6198c2ecf20Sopenharmony_cistatic const char *const 6208c2ecf20Sopenharmony_ciclk_mux_ufs_subsys_p[] = { "clkin_sys", "clk_ppll0", }; 6218c2ecf20Sopenharmony_cistatic const char *const 6228c2ecf20Sopenharmony_ciclk_mux_clkout0_p[] = { "clkin_ref", "clk_div_clkout0_tcxo", 6238c2ecf20Sopenharmony_ci "clk_div_clkout0_pll", "clk_div_clkout0_pll", }; 6248c2ecf20Sopenharmony_cistatic const char *const 6258c2ecf20Sopenharmony_ciclk_mux_clkout1_p[] = { "clkin_ref", "clk_div_clkout1_tcxo", 6268c2ecf20Sopenharmony_ci "clk_div_clkout1_pll", "clk_div_clkout1_pll", }; 6278c2ecf20Sopenharmony_cistatic const char *const 6288c2ecf20Sopenharmony_ciclk_mux_asp_subsys_peri_p[] = { "clk_ppll0", "clk_fll_src", }; 6298c2ecf20Sopenharmony_cistatic const char *const 6308c2ecf20Sopenharmony_ciclk_mux_asp_pll_p[] = { "clk_ppll0", "clk_fll_src", "clk_gate_ao_asp", 6318c2ecf20Sopenharmony_ci "clk_pciepll_rev", }; 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_cistatic const struct hisi_mux_clock hi3670_sctrl_mux_clks[] = { 6348c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_UFS_SUBSYS, "clk_mux_ufs_subsys", clk_mux_ufs_subsys_p, 6358c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_ufs_subsys_p), CLK_SET_RATE_PARENT, 6368c2ecf20Sopenharmony_ci 0x274, 8, 1, CLK_MUX_HIWORD_MASK, }, 6378c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_CLKOUT0, "clk_mux_clkout0", clk_mux_clkout0_p, 6388c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_clkout0_p), CLK_SET_RATE_PARENT, 6398c2ecf20Sopenharmony_ci 0x254, 12, 2, CLK_MUX_HIWORD_MASK, }, 6408c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_CLKOUT1, "clk_mux_clkout1", clk_mux_clkout1_p, 6418c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_clkout1_p), CLK_SET_RATE_PARENT, 6428c2ecf20Sopenharmony_ci 0x254, 14, 2, CLK_MUX_HIWORD_MASK, }, 6438c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_ASP_SUBSYS_PERI, "clk_mux_asp_subsys_peri", 6448c2ecf20Sopenharmony_ci clk_mux_asp_subsys_peri_p, ARRAY_SIZE(clk_mux_asp_subsys_peri_p), 6458c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x268, 8, 1, CLK_MUX_HIWORD_MASK, }, 6468c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_ASP_PLL, "clk_mux_asp_pll", clk_mux_asp_pll_p, 6478c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_asp_pll_p), CLK_SET_RATE_PARENT, 6488c2ecf20Sopenharmony_ci 0x268, 9, 2, CLK_MUX_HIWORD_MASK, }, 6498c2ecf20Sopenharmony_ci}; 6508c2ecf20Sopenharmony_ci 6518c2ecf20Sopenharmony_cistatic const struct hisi_divider_clock hi3670_sctrl_divider_clks[] = { 6528c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_AOBUS, "clk_div_aobus", "clk_ppll0", 6538c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x254, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 6548c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_UFS_SUBSYS, "clk_div_ufs_subsys", "clk_mux_ufs_subsys", 6558c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x274, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 6568c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_IOPERI, "clk_div_ioperi", "clk_andgt_ioperi", 6578c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x270, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 6588c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_CLKOUT0_TCXO, "clk_div_clkout0_tcxo", "clkin_sys", 6598c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x254, 6, 3, CLK_DIVIDER_HIWORD_MASK, }, 6608c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_CLKOUT1_TCXO, "clk_div_clkout1_tcxo", "clkin_sys", 6618c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x254, 9, 3, CLK_DIVIDER_HIWORD_MASK, }, 6628c2ecf20Sopenharmony_ci { HI3670_CLK_ASP_SUBSYS_PERI_DIV, "clk_asp_subsys_peri_div", "clkandgt_asp_subsys_peri", 6638c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x268, 0, 3, CLK_DIVIDER_HIWORD_MASK, }, 6648c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_ASP_SUBSYS, "clk_div_asp_subsys", "clk_angt_asp_subsys", 6658c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x250, 0, 3, CLK_DIVIDER_HIWORD_MASK, }, 6668c2ecf20Sopenharmony_ci}; 6678c2ecf20Sopenharmony_ci 6688c2ecf20Sopenharmony_ci/* clk_iomcu */ 6698c2ecf20Sopenharmony_cistatic const struct hisi_fixed_factor_clock hi3670_iomcu_fixed_factor_clks[] = { 6708c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_I2C0, "clk_gate_i2c0", "clk_i2c0_gate_iomcu", 1, 4, 0, }, 6718c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_I2C1, "clk_gate_i2c1", "clk_i2c1_gate_iomcu", 1, 4, 0, }, 6728c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_I2C2, "clk_gate_i2c2", "clk_i2c2_gate_iomcu", 1, 4, 0, }, 6738c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_SPI0, "clk_gate_spi0", "clk_spi0_gate_iomcu", 1, 1, 0, }, 6748c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_SPI2, "clk_gate_spi2", "clk_spi2_gate_iomcu", 1, 1, 0, }, 6758c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_UART3, "clk_gate_uart3", "clk_uart3_gate_iomcu", 1, 16, 0, }, 6768c2ecf20Sopenharmony_ci}; 6778c2ecf20Sopenharmony_ci 6788c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_iomcu_gate_sep_clks[] = { 6798c2ecf20Sopenharmony_ci { HI3670_CLK_I2C0_GATE_IOMCU, "clk_i2c0_gate_iomcu", "clk_fll_src", 6808c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 3, 0, }, 6818c2ecf20Sopenharmony_ci { HI3670_CLK_I2C1_GATE_IOMCU, "clk_i2c1_gate_iomcu", "clk_fll_src", 6828c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 4, 0, }, 6838c2ecf20Sopenharmony_ci { HI3670_CLK_I2C2_GATE_IOMCU, "clk_i2c2_gate_iomcu", "clk_fll_src", 6848c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 5, 0, }, 6858c2ecf20Sopenharmony_ci { HI3670_CLK_SPI0_GATE_IOMCU, "clk_spi0_gate_iomcu", "clk_fll_src", 6868c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 10, 0, }, 6878c2ecf20Sopenharmony_ci { HI3670_CLK_SPI2_GATE_IOMCU, "clk_spi2_gate_iomcu", "clk_fll_src", 6888c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 30, 0, }, 6898c2ecf20Sopenharmony_ci { HI3670_CLK_UART3_GATE_IOMCU, "clk_uart3_gate_iomcu", "clk_gate_iomcu_peri0", 6908c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 11, 0, }, 6918c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_PERI0_IOMCU, "clk_gate_iomcu_peri0", "clk_ppll0", 6928c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x90, 0, 0, }, 6938c2ecf20Sopenharmony_ci}; 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_ci/* clk_media1 */ 6968c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_media1_gate_sep_clks[] = { 6978c2ecf20Sopenharmony_ci { HI3670_ACLK_GATE_NOC_DSS, "aclk_gate_noc_dss", "aclk_gate_disp_noc_subsys", 6988c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 21, 0, }, 6998c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_NOC_DSS_CFG, "pclk_gate_noc_dss_cfg", "pclk_gate_disp_noc_subsys", 7008c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 22, 0, }, 7018c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_MMBUF_CFG, "pclk_gate_mmbuf_cfg", "pclk_gate_disp_noc_subsys", 7028c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 5, 0, }, 7038c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_DISP_NOC_SUBSYS, "pclk_gate_disp_noc_subsys", "clk_div_sysbus", 7048c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 18, 0, }, 7058c2ecf20Sopenharmony_ci { HI3670_ACLK_GATE_DISP_NOC_SUBSYS, "aclk_gate_disp_noc_subsys", "clk_gate_vivobusfreq", 7068c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x10, 17, 0, }, 7078c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_DSS, "pclk_gate_dss", "pclk_gate_disp_noc_subsys", 7088c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 14, 0, }, 7098c2ecf20Sopenharmony_ci { HI3670_ACLK_GATE_DSS, "aclk_gate_dss", "aclk_gate_disp_noc_subsys", 7108c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 19, 0, }, 7118c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_VIVOBUSFREQ, "clk_gate_vivobusfreq", "clk_div_vivobus", 7128c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 18, 0, }, 7138c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_EDC0, "clk_gate_edc0", "clk_div_edc0", 7148c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 15, 0, }, 7158c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_LDI0, "clk_gate_ldi0", "clk_div_ldi0", 7168c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 16, 0, }, 7178c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_LDI1FREQ, "clk_gate_ldi1freq", "clk_div_ldi1", 7188c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 17, 0, }, 7198c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_BRG, "clk_gate_brg", "clk_media_common_div", 7208c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 29, 0, }, 7218c2ecf20Sopenharmony_ci { HI3670_ACLK_GATE_ASC, "aclk_gate_asc", "clk_gate_mmbuf", 7228c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 3, 0, }, 7238c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_DSS_AXI_MM, "clk_gate_dss_axi_mm", "clk_gate_mmbuf", 7248c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 4, 0, }, 7258c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_MMBUF, "clk_gate_mmbuf", "aclk_div_mmbuf", 7268c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 0, 0, }, 7278c2ecf20Sopenharmony_ci { HI3670_PCLK_GATE_MMBUF, "pclk_gate_mmbuf", "pclk_div_mmbuf", 7288c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x20, 1, 0, }, 7298c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ATDIV_VIVO, "clk_gate_atdiv_vivo", "clk_div_vivobus", 7308c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x010, 1, 0, }, 7318c2ecf20Sopenharmony_ci}; 7328c2ecf20Sopenharmony_ci 7338c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_media1_gate_clks[] = { 7348c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_VIVOBUS_ANDGT, "clk_gate_vivobus_andgt", "clk_mux_vivobus", 7358c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x84, 3, CLK_GATE_HIWORD_MASK, }, 7368c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_EDC0, "clk_andgt_edc0", "clk_mux_edc0", 7378c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x84, 7, CLK_GATE_HIWORD_MASK, }, 7388c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_LDI0, "clk_andgt_ldi0", "clk_mux_ldi0", 7398c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x84, 9, CLK_GATE_HIWORD_MASK, }, 7408c2ecf20Sopenharmony_ci { HI3670_CLK_ANDGT_LDI1, "clk_andgt_ldi1", "clk_mux_ldi1", 7418c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x84, 8, CLK_GATE_HIWORD_MASK, }, 7428c2ecf20Sopenharmony_ci { HI3670_CLK_MMBUF_PLL_ANDGT, "clk_mmbuf_pll_andgt", "clk_sw_mmbuf", 7438c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x84, 14, CLK_GATE_HIWORD_MASK, }, 7448c2ecf20Sopenharmony_ci { HI3670_PCLK_MMBUF_ANDGT, "pclk_mmbuf_andgt", "aclk_div_mmbuf", 7458c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x84, 15, CLK_GATE_HIWORD_MASK, }, 7468c2ecf20Sopenharmony_ci}; 7478c2ecf20Sopenharmony_ci 7488c2ecf20Sopenharmony_cistatic const char *const 7498c2ecf20Sopenharmony_ciclk_mux_vivobus_p[] = { "clk_invalid", "clk_invalid", "clk_gate_ppll0_media", 7508c2ecf20Sopenharmony_ci "clk_invalid", "clk_gate_ppll2_media", "clk_invalid", 7518c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_gate_ppll3_media", 7528c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", 7538c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", 7548c2ecf20Sopenharmony_ci "clk_invalid", }; 7558c2ecf20Sopenharmony_cistatic const char *const 7568c2ecf20Sopenharmony_ciclk_mux_edc0_p[] = { "clk_invalid", "clk_invalid", "clk_gate_ppll0_media", 7578c2ecf20Sopenharmony_ci "clk_invalid", "clk_gate_ppll2_media", "clk_invalid", 7588c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_gate_ppll3_media", 7598c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", "clk_invalid", 7608c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", }; 7618c2ecf20Sopenharmony_cistatic const char *const 7628c2ecf20Sopenharmony_ciclk_mux_ldi0_p[] = { "clk_invalid", "clk_gate_ppll7_media", 7638c2ecf20Sopenharmony_ci "clk_gate_ppll0_media", "clk_invalid", 7648c2ecf20Sopenharmony_ci "clk_gate_ppll2_media", "clk_invalid", "clk_invalid", 7658c2ecf20Sopenharmony_ci "clk_invalid", "clk_gate_ppll3_media", "clk_invalid", 7668c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", "clk_invalid", 7678c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", }; 7688c2ecf20Sopenharmony_cistatic const char *const 7698c2ecf20Sopenharmony_ciclk_mux_ldi1_p[] = { "clk_invalid", "clk_gate_ppll7_media", 7708c2ecf20Sopenharmony_ci "clk_gate_ppll0_media", "clk_invalid", 7718c2ecf20Sopenharmony_ci "clk_gate_ppll2_media", "clk_invalid", "clk_invalid", 7728c2ecf20Sopenharmony_ci "clk_invalid", "clk_gate_ppll3_media", "clk_invalid", 7738c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", "clk_invalid", 7748c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", }; 7758c2ecf20Sopenharmony_cistatic const char *const 7768c2ecf20Sopenharmony_ciclk_sw_mmbuf_p[] = { "clk_invalid", "clk_invalid", "clk_gate_ppll0_media", 7778c2ecf20Sopenharmony_ci "clk_invalid", "clk_gate_ppll2_media", "clk_invalid", 7788c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_gate_ppll3_media", 7798c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", "clk_invalid", 7808c2ecf20Sopenharmony_ci "clk_invalid", "clk_invalid", "clk_invalid", }; 7818c2ecf20Sopenharmony_ci 7828c2ecf20Sopenharmony_cistatic const struct hisi_mux_clock hi3670_media1_mux_clks[] = { 7838c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_VIVOBUS, "clk_mux_vivobus", clk_mux_vivobus_p, 7848c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_vivobus_p), CLK_SET_RATE_PARENT, 7858c2ecf20Sopenharmony_ci 0x74, 6, 4, CLK_MUX_HIWORD_MASK, }, 7868c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_EDC0, "clk_mux_edc0", clk_mux_edc0_p, 7878c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_edc0_p), CLK_SET_RATE_PARENT, 7888c2ecf20Sopenharmony_ci 0x68, 6, 4, CLK_MUX_HIWORD_MASK, }, 7898c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_LDI0, "clk_mux_ldi0", clk_mux_ldi0_p, 7908c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_ldi0_p), CLK_SET_RATE_PARENT, 7918c2ecf20Sopenharmony_ci 0x60, 6, 4, CLK_MUX_HIWORD_MASK, }, 7928c2ecf20Sopenharmony_ci { HI3670_CLK_MUX_LDI1, "clk_mux_ldi1", clk_mux_ldi1_p, 7938c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_mux_ldi1_p), CLK_SET_RATE_PARENT, 7948c2ecf20Sopenharmony_ci 0x64, 6, 4, CLK_MUX_HIWORD_MASK, }, 7958c2ecf20Sopenharmony_ci { HI3670_CLK_SW_MMBUF, "clk_sw_mmbuf", clk_sw_mmbuf_p, 7968c2ecf20Sopenharmony_ci ARRAY_SIZE(clk_sw_mmbuf_p), CLK_SET_RATE_PARENT, 7978c2ecf20Sopenharmony_ci 0x88, 0, 4, CLK_MUX_HIWORD_MASK, }, 7988c2ecf20Sopenharmony_ci}; 7998c2ecf20Sopenharmony_ci 8008c2ecf20Sopenharmony_cistatic const struct hisi_divider_clock hi3670_media1_divider_clks[] = { 8018c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_VIVOBUS, "clk_div_vivobus", "clk_gate_vivobus_andgt", 8028c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x74, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 8038c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_EDC0, "clk_div_edc0", "clk_andgt_edc0", 8048c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x68, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 8058c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_LDI0, "clk_div_ldi0", "clk_andgt_ldi0", 8068c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x60, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 8078c2ecf20Sopenharmony_ci { HI3670_CLK_DIV_LDI1, "clk_div_ldi1", "clk_andgt_ldi1", 8088c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x64, 0, 6, CLK_DIVIDER_HIWORD_MASK, }, 8098c2ecf20Sopenharmony_ci { HI3670_ACLK_DIV_MMBUF, "aclk_div_mmbuf", "clk_mmbuf_pll_andgt", 8108c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x7C, 10, 6, CLK_DIVIDER_HIWORD_MASK, }, 8118c2ecf20Sopenharmony_ci { HI3670_PCLK_DIV_MMBUF, "pclk_div_mmbuf", "pclk_mmbuf_andgt", 8128c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x78, 0, 2, CLK_DIVIDER_HIWORD_MASK, }, 8138c2ecf20Sopenharmony_ci}; 8148c2ecf20Sopenharmony_ci 8158c2ecf20Sopenharmony_ci/* clk_media2 */ 8168c2ecf20Sopenharmony_cistatic const struct hisi_gate_clock hi3670_media2_gate_sep_clks[] = { 8178c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_VDECFREQ, "clk_gate_vdecfreq", "clk_div_vdec", 8188c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 8, 0, }, 8198c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_VENCFREQ, "clk_gate_vencfreq", "clk_div_venc", 8208c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 5, 0, }, 8218c2ecf20Sopenharmony_ci { HI3670_CLK_GATE_ICSFREQ, "clk_gate_icsfreq", "clk_div_ics", 8228c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT, 0x00, 2, 0, }, 8238c2ecf20Sopenharmony_ci}; 8248c2ecf20Sopenharmony_ci 8258c2ecf20Sopenharmony_cistatic void hi3670_clk_crgctrl_init(struct device_node *np) 8268c2ecf20Sopenharmony_ci{ 8278c2ecf20Sopenharmony_ci struct hisi_clock_data *clk_data; 8288c2ecf20Sopenharmony_ci 8298c2ecf20Sopenharmony_ci int nr = ARRAY_SIZE(hi3670_fixed_rate_clks) + 8308c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crgctrl_gate_sep_clks) + 8318c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crgctrl_gate_clks) + 8328c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crgctrl_mux_clks) + 8338c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crg_fixed_factor_clks) + 8348c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crgctrl_divider_clks); 8358c2ecf20Sopenharmony_ci 8368c2ecf20Sopenharmony_ci clk_data = hisi_clk_init(np, nr); 8378c2ecf20Sopenharmony_ci if (!clk_data) 8388c2ecf20Sopenharmony_ci return; 8398c2ecf20Sopenharmony_ci 8408c2ecf20Sopenharmony_ci hisi_clk_register_fixed_rate(hi3670_fixed_rate_clks, 8418c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_fixed_rate_clks), 8428c2ecf20Sopenharmony_ci clk_data); 8438c2ecf20Sopenharmony_ci hisi_clk_register_gate_sep(hi3670_crgctrl_gate_sep_clks, 8448c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crgctrl_gate_sep_clks), 8458c2ecf20Sopenharmony_ci clk_data); 8468c2ecf20Sopenharmony_ci hisi_clk_register_gate(hi3670_crgctrl_gate_clks, 8478c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crgctrl_gate_clks), 8488c2ecf20Sopenharmony_ci clk_data); 8498c2ecf20Sopenharmony_ci hisi_clk_register_mux(hi3670_crgctrl_mux_clks, 8508c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crgctrl_mux_clks), 8518c2ecf20Sopenharmony_ci clk_data); 8528c2ecf20Sopenharmony_ci hisi_clk_register_fixed_factor(hi3670_crg_fixed_factor_clks, 8538c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crg_fixed_factor_clks), 8548c2ecf20Sopenharmony_ci clk_data); 8558c2ecf20Sopenharmony_ci hisi_clk_register_divider(hi3670_crgctrl_divider_clks, 8568c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_crgctrl_divider_clks), 8578c2ecf20Sopenharmony_ci clk_data); 8588c2ecf20Sopenharmony_ci} 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_cistatic void hi3670_clk_pctrl_init(struct device_node *np) 8618c2ecf20Sopenharmony_ci{ 8628c2ecf20Sopenharmony_ci struct hisi_clock_data *clk_data; 8638c2ecf20Sopenharmony_ci int nr = ARRAY_SIZE(hi3670_pctrl_gate_clks); 8648c2ecf20Sopenharmony_ci 8658c2ecf20Sopenharmony_ci clk_data = hisi_clk_init(np, nr); 8668c2ecf20Sopenharmony_ci if (!clk_data) 8678c2ecf20Sopenharmony_ci return; 8688c2ecf20Sopenharmony_ci hisi_clk_register_gate(hi3670_pctrl_gate_clks, 8698c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_pctrl_gate_clks), clk_data); 8708c2ecf20Sopenharmony_ci} 8718c2ecf20Sopenharmony_ci 8728c2ecf20Sopenharmony_cistatic void hi3670_clk_pmuctrl_init(struct device_node *np) 8738c2ecf20Sopenharmony_ci{ 8748c2ecf20Sopenharmony_ci struct hisi_clock_data *clk_data; 8758c2ecf20Sopenharmony_ci int nr = ARRAY_SIZE(hi3670_pmu_gate_clks); 8768c2ecf20Sopenharmony_ci 8778c2ecf20Sopenharmony_ci clk_data = hisi_clk_init(np, nr); 8788c2ecf20Sopenharmony_ci if (!clk_data) 8798c2ecf20Sopenharmony_ci return; 8808c2ecf20Sopenharmony_ci 8818c2ecf20Sopenharmony_ci hisi_clk_register_gate(hi3670_pmu_gate_clks, 8828c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_pmu_gate_clks), clk_data); 8838c2ecf20Sopenharmony_ci} 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_cistatic void hi3670_clk_sctrl_init(struct device_node *np) 8868c2ecf20Sopenharmony_ci{ 8878c2ecf20Sopenharmony_ci struct hisi_clock_data *clk_data; 8888c2ecf20Sopenharmony_ci int nr = ARRAY_SIZE(hi3670_sctrl_gate_sep_clks) + 8898c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_sctrl_gate_clks) + 8908c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_sctrl_mux_clks) + 8918c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_sctrl_divider_clks); 8928c2ecf20Sopenharmony_ci 8938c2ecf20Sopenharmony_ci clk_data = hisi_clk_init(np, nr); 8948c2ecf20Sopenharmony_ci if (!clk_data) 8958c2ecf20Sopenharmony_ci return; 8968c2ecf20Sopenharmony_ci 8978c2ecf20Sopenharmony_ci hisi_clk_register_gate_sep(hi3670_sctrl_gate_sep_clks, 8988c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_sctrl_gate_sep_clks), 8998c2ecf20Sopenharmony_ci clk_data); 9008c2ecf20Sopenharmony_ci hisi_clk_register_gate(hi3670_sctrl_gate_clks, 9018c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_sctrl_gate_clks), 9028c2ecf20Sopenharmony_ci clk_data); 9038c2ecf20Sopenharmony_ci hisi_clk_register_mux(hi3670_sctrl_mux_clks, 9048c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_sctrl_mux_clks), 9058c2ecf20Sopenharmony_ci clk_data); 9068c2ecf20Sopenharmony_ci hisi_clk_register_divider(hi3670_sctrl_divider_clks, 9078c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_sctrl_divider_clks), 9088c2ecf20Sopenharmony_ci clk_data); 9098c2ecf20Sopenharmony_ci} 9108c2ecf20Sopenharmony_ci 9118c2ecf20Sopenharmony_cistatic void hi3670_clk_iomcu_init(struct device_node *np) 9128c2ecf20Sopenharmony_ci{ 9138c2ecf20Sopenharmony_ci struct hisi_clock_data *clk_data; 9148c2ecf20Sopenharmony_ci int nr = ARRAY_SIZE(hi3670_iomcu_gate_sep_clks) + 9158c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_iomcu_fixed_factor_clks); 9168c2ecf20Sopenharmony_ci 9178c2ecf20Sopenharmony_ci clk_data = hisi_clk_init(np, nr); 9188c2ecf20Sopenharmony_ci if (!clk_data) 9198c2ecf20Sopenharmony_ci return; 9208c2ecf20Sopenharmony_ci 9218c2ecf20Sopenharmony_ci hisi_clk_register_gate(hi3670_iomcu_gate_sep_clks, 9228c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_iomcu_gate_sep_clks), clk_data); 9238c2ecf20Sopenharmony_ci 9248c2ecf20Sopenharmony_ci hisi_clk_register_fixed_factor(hi3670_iomcu_fixed_factor_clks, 9258c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_iomcu_fixed_factor_clks), 9268c2ecf20Sopenharmony_ci clk_data); 9278c2ecf20Sopenharmony_ci} 9288c2ecf20Sopenharmony_ci 9298c2ecf20Sopenharmony_cistatic void hi3670_clk_media1_init(struct device_node *np) 9308c2ecf20Sopenharmony_ci{ 9318c2ecf20Sopenharmony_ci struct hisi_clock_data *clk_data; 9328c2ecf20Sopenharmony_ci 9338c2ecf20Sopenharmony_ci int nr = ARRAY_SIZE(hi3670_media1_gate_sep_clks) + 9348c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_media1_gate_clks) + 9358c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_media1_mux_clks) + 9368c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_media1_divider_clks); 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_ci clk_data = hisi_clk_init(np, nr); 9398c2ecf20Sopenharmony_ci if (!clk_data) 9408c2ecf20Sopenharmony_ci return; 9418c2ecf20Sopenharmony_ci 9428c2ecf20Sopenharmony_ci hisi_clk_register_gate_sep(hi3670_media1_gate_sep_clks, 9438c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_media1_gate_sep_clks), 9448c2ecf20Sopenharmony_ci clk_data); 9458c2ecf20Sopenharmony_ci hisi_clk_register_gate(hi3670_media1_gate_clks, 9468c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_media1_gate_clks), 9478c2ecf20Sopenharmony_ci clk_data); 9488c2ecf20Sopenharmony_ci hisi_clk_register_mux(hi3670_media1_mux_clks, 9498c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_media1_mux_clks), 9508c2ecf20Sopenharmony_ci clk_data); 9518c2ecf20Sopenharmony_ci hisi_clk_register_divider(hi3670_media1_divider_clks, 9528c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_media1_divider_clks), 9538c2ecf20Sopenharmony_ci clk_data); 9548c2ecf20Sopenharmony_ci} 9558c2ecf20Sopenharmony_ci 9568c2ecf20Sopenharmony_cistatic void hi3670_clk_media2_init(struct device_node *np) 9578c2ecf20Sopenharmony_ci{ 9588c2ecf20Sopenharmony_ci struct hisi_clock_data *clk_data; 9598c2ecf20Sopenharmony_ci 9608c2ecf20Sopenharmony_ci int nr = ARRAY_SIZE(hi3670_media2_gate_sep_clks); 9618c2ecf20Sopenharmony_ci 9628c2ecf20Sopenharmony_ci clk_data = hisi_clk_init(np, nr); 9638c2ecf20Sopenharmony_ci if (!clk_data) 9648c2ecf20Sopenharmony_ci return; 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_ci hisi_clk_register_gate_sep(hi3670_media2_gate_sep_clks, 9678c2ecf20Sopenharmony_ci ARRAY_SIZE(hi3670_media2_gate_sep_clks), 9688c2ecf20Sopenharmony_ci clk_data); 9698c2ecf20Sopenharmony_ci} 9708c2ecf20Sopenharmony_ci 9718c2ecf20Sopenharmony_cistatic const struct of_device_id hi3670_clk_match_table[] = { 9728c2ecf20Sopenharmony_ci { .compatible = "hisilicon,hi3670-crgctrl", 9738c2ecf20Sopenharmony_ci .data = hi3670_clk_crgctrl_init }, 9748c2ecf20Sopenharmony_ci { .compatible = "hisilicon,hi3670-pctrl", 9758c2ecf20Sopenharmony_ci .data = hi3670_clk_pctrl_init }, 9768c2ecf20Sopenharmony_ci { .compatible = "hisilicon,hi3670-pmuctrl", 9778c2ecf20Sopenharmony_ci .data = hi3670_clk_pmuctrl_init }, 9788c2ecf20Sopenharmony_ci { .compatible = "hisilicon,hi3670-sctrl", 9798c2ecf20Sopenharmony_ci .data = hi3670_clk_sctrl_init }, 9808c2ecf20Sopenharmony_ci { .compatible = "hisilicon,hi3670-iomcu", 9818c2ecf20Sopenharmony_ci .data = hi3670_clk_iomcu_init }, 9828c2ecf20Sopenharmony_ci { .compatible = "hisilicon,hi3670-media1-crg", 9838c2ecf20Sopenharmony_ci .data = hi3670_clk_media1_init }, 9848c2ecf20Sopenharmony_ci { .compatible = "hisilicon,hi3670-media2-crg", 9858c2ecf20Sopenharmony_ci .data = hi3670_clk_media2_init }, 9868c2ecf20Sopenharmony_ci { } 9878c2ecf20Sopenharmony_ci}; 9888c2ecf20Sopenharmony_ci 9898c2ecf20Sopenharmony_cistatic int hi3670_clk_probe(struct platform_device *pdev) 9908c2ecf20Sopenharmony_ci{ 9918c2ecf20Sopenharmony_ci struct device *dev = &pdev->dev; 9928c2ecf20Sopenharmony_ci struct device_node *np = pdev->dev.of_node; 9938c2ecf20Sopenharmony_ci void (*init_func)(struct device_node *np); 9948c2ecf20Sopenharmony_ci 9958c2ecf20Sopenharmony_ci init_func = of_device_get_match_data(dev); 9968c2ecf20Sopenharmony_ci if (!init_func) 9978c2ecf20Sopenharmony_ci return -ENODEV; 9988c2ecf20Sopenharmony_ci 9998c2ecf20Sopenharmony_ci init_func(np); 10008c2ecf20Sopenharmony_ci 10018c2ecf20Sopenharmony_ci return 0; 10028c2ecf20Sopenharmony_ci} 10038c2ecf20Sopenharmony_ci 10048c2ecf20Sopenharmony_cistatic struct platform_driver hi3670_clk_driver = { 10058c2ecf20Sopenharmony_ci .probe = hi3670_clk_probe, 10068c2ecf20Sopenharmony_ci .driver = { 10078c2ecf20Sopenharmony_ci .name = "hi3670-clk", 10088c2ecf20Sopenharmony_ci .of_match_table = hi3670_clk_match_table, 10098c2ecf20Sopenharmony_ci }, 10108c2ecf20Sopenharmony_ci}; 10118c2ecf20Sopenharmony_ci 10128c2ecf20Sopenharmony_cistatic int __init hi3670_clk_init(void) 10138c2ecf20Sopenharmony_ci{ 10148c2ecf20Sopenharmony_ci return platform_driver_register(&hi3670_clk_driver); 10158c2ecf20Sopenharmony_ci} 10168c2ecf20Sopenharmony_cicore_initcall(hi3670_clk_init); 1017