xref: /openbmc/linux/drivers/clk/imx/clk-imx8qxp.c (revision babfaa9556d7a9df2784bfcddafdeba29d24c8fd)
1c2cccb6dSAisheng Dong // SPDX-License-Identifier: GPL-2.0+
2c2cccb6dSAisheng Dong /*
35964012cSDong Aisheng  * Copyright 2018-2021 NXP
4c2cccb6dSAisheng Dong  *	Dong Aisheng <aisheng.dong@nxp.com>
5c2cccb6dSAisheng Dong  */
6c2cccb6dSAisheng Dong 
7c2cccb6dSAisheng Dong #include <linux/clk-provider.h>
8c2cccb6dSAisheng Dong #include <linux/err.h>
9c2cccb6dSAisheng Dong #include <linux/io.h>
10c2cccb6dSAisheng Dong #include <linux/module.h>
11c2cccb6dSAisheng Dong #include <linux/of.h>
125964012cSDong Aisheng #include <linux/of_device.h>
13c2cccb6dSAisheng Dong #include <linux/platform_device.h>
14c2cccb6dSAisheng Dong #include <linux/slab.h>
15c2cccb6dSAisheng Dong 
16c2cccb6dSAisheng Dong #include "clk-scu.h"
17c2cccb6dSAisheng Dong 
18c2cccb6dSAisheng Dong #include <dt-bindings/firmware/imx/rsrc.h>
19c2cccb6dSAisheng Dong 
20e4c0ca78SLiu Ying static const char *dc0_sels[] = {
21e4c0ca78SLiu Ying 	"clk_dummy",
22e4c0ca78SLiu Ying 	"clk_dummy",
23e4c0ca78SLiu Ying 	"dc0_pll0_clk",
24e4c0ca78SLiu Ying 	"dc0_pll1_clk",
25e4c0ca78SLiu Ying 	"dc0_bypass0_clk",
26e4c0ca78SLiu Ying };
27e4c0ca78SLiu Ying 
28*babfaa95SDong Aisheng static const char * const dc1_sels[] = {
29*babfaa95SDong Aisheng 	"clk_dummy",
30*babfaa95SDong Aisheng 	"clk_dummy",
31*babfaa95SDong Aisheng 	"dc1_pll0_clk",
32*babfaa95SDong Aisheng 	"dc1_pll1_clk",
33*babfaa95SDong Aisheng 	"dc1_bypass0_clk",
34*babfaa95SDong Aisheng };
35*babfaa95SDong Aisheng 
362924b0b0SDong Aisheng static const char * const enet0_rgmii_txc_sels[] = {
372924b0b0SDong Aisheng 	"enet0_ref_div",
382924b0b0SDong Aisheng 	"clk_dummy",
392924b0b0SDong Aisheng };
402924b0b0SDong Aisheng 
412924b0b0SDong Aisheng static const char * const enet1_rgmii_txc_sels[] = {
422924b0b0SDong Aisheng 	"enet1_ref_div",
432924b0b0SDong Aisheng 	"clk_dummy",
442924b0b0SDong Aisheng };
452924b0b0SDong Aisheng 
46*babfaa95SDong Aisheng static const char * const hdmi_sels[] = {
47*babfaa95SDong Aisheng 	"clk_dummy",
48*babfaa95SDong Aisheng 	"hdmi_dig_pll_clk",
49*babfaa95SDong Aisheng 	"clk_dummy",
50*babfaa95SDong Aisheng 	"clk_dummy",
51*babfaa95SDong Aisheng 	"hdmi_av_pll_clk",
52*babfaa95SDong Aisheng };
53*babfaa95SDong Aisheng 
54*babfaa95SDong Aisheng static const char * const hdmi_rx_sels[] = {
55*babfaa95SDong Aisheng 	"clk_dummy",
56*babfaa95SDong Aisheng 	"hdmi_rx_dig_pll_clk",
57*babfaa95SDong Aisheng 	"clk_dummy",
58*babfaa95SDong Aisheng 	"clk_dummy",
59*babfaa95SDong Aisheng 	"hdmi_rx_bypass_clk",
60*babfaa95SDong Aisheng };
61*babfaa95SDong Aisheng 
62*babfaa95SDong Aisheng static const char * const lcd_pxl_sels[] = {
63*babfaa95SDong Aisheng 	"clk_dummy",
64*babfaa95SDong Aisheng 	"clk_dummy",
65*babfaa95SDong Aisheng 	"clk_dummy",
66*babfaa95SDong Aisheng 	"clk_dummy",
67*babfaa95SDong Aisheng 	"lcd_pxl_bypass_div_clk",
68*babfaa95SDong Aisheng };
69*babfaa95SDong Aisheng 
70*babfaa95SDong Aisheng static const char * const mipi_sels[] = {
71*babfaa95SDong Aisheng 	"clk_dummy",
72*babfaa95SDong Aisheng 	"clk_dummy",
73*babfaa95SDong Aisheng 	"mipi_pll_div2_clk",
74*babfaa95SDong Aisheng 	"clk_dummy",
75*babfaa95SDong Aisheng 	"clk_dummy",
76*babfaa95SDong Aisheng };
77*babfaa95SDong Aisheng 
78*babfaa95SDong Aisheng static const char * const lcd_sels[] = {
79*babfaa95SDong Aisheng 	"clk_dummy",
80*babfaa95SDong Aisheng 	"clk_dummy",
81*babfaa95SDong Aisheng 	"clk_dummy",
82*babfaa95SDong Aisheng 	"clk_dummy",
83*babfaa95SDong Aisheng 	"elcdif_pll",
84*babfaa95SDong Aisheng };
85*babfaa95SDong Aisheng 
86*babfaa95SDong Aisheng static const char * const pi_pll0_sels[] = {
87*babfaa95SDong Aisheng 	"clk_dummy",
88*babfaa95SDong Aisheng 	"pi_dpll_clk",
89*babfaa95SDong Aisheng 	"clk_dummy",
90*babfaa95SDong Aisheng 	"clk_dummy",
91*babfaa95SDong Aisheng 	"clk_dummy",
92*babfaa95SDong Aisheng };
93*babfaa95SDong Aisheng 
94c2cccb6dSAisheng Dong static int imx8qxp_clk_probe(struct platform_device *pdev)
95c2cccb6dSAisheng Dong {
96c2cccb6dSAisheng Dong 	struct device_node *ccm_node = pdev->dev.of_node;
975964012cSDong Aisheng 	const struct imx_clk_scu_rsrc_table *rsrc_table;
9891e91677SDong Aisheng 	int ret;
99c2cccb6dSAisheng Dong 
1005964012cSDong Aisheng 	rsrc_table = of_device_get_match_data(&pdev->dev);
1015964012cSDong Aisheng 	ret = imx_clk_scu_init(ccm_node, rsrc_table);
102c2cccb6dSAisheng Dong 	if (ret)
103c2cccb6dSAisheng Dong 		return ret;
104c2cccb6dSAisheng Dong 
105c2cccb6dSAisheng Dong 	/* ARM core */
10691e91677SDong Aisheng 	imx_clk_scu("a35_clk", IMX_SC_R_A35, IMX_SC_PM_CLK_CPU);
107*babfaa95SDong Aisheng 	imx_clk_scu("a53_clk", IMX_SC_R_A53, IMX_SC_PM_CLK_CPU);
108*babfaa95SDong Aisheng 	imx_clk_scu("a72_clk", IMX_SC_R_A72, IMX_SC_PM_CLK_CPU);
109c2cccb6dSAisheng Dong 
110c2cccb6dSAisheng Dong 	/* LSIO SS */
11191e91677SDong Aisheng 	imx_clk_scu("pwm0_clk", IMX_SC_R_PWM_0, IMX_SC_PM_CLK_PER);
11291e91677SDong Aisheng 	imx_clk_scu("pwm1_clk", IMX_SC_R_PWM_1, IMX_SC_PM_CLK_PER);
11391e91677SDong Aisheng 	imx_clk_scu("pwm2_clk", IMX_SC_R_PWM_2, IMX_SC_PM_CLK_PER);
11491e91677SDong Aisheng 	imx_clk_scu("pwm3_clk", IMX_SC_R_PWM_3, IMX_SC_PM_CLK_PER);
11591e91677SDong Aisheng 	imx_clk_scu("pwm4_clk", IMX_SC_R_PWM_4, IMX_SC_PM_CLK_PER);
11691e91677SDong Aisheng 	imx_clk_scu("pwm5_clk", IMX_SC_R_PWM_5, IMX_SC_PM_CLK_PER);
11791e91677SDong Aisheng 	imx_clk_scu("pwm6_clk", IMX_SC_R_PWM_6, IMX_SC_PM_CLK_PER);
11891e91677SDong Aisheng 	imx_clk_scu("pwm7_clk", IMX_SC_R_PWM_7, IMX_SC_PM_CLK_PER);
11991e91677SDong Aisheng 	imx_clk_scu("gpt0_clk", IMX_SC_R_GPT_0, IMX_SC_PM_CLK_PER);
12091e91677SDong Aisheng 	imx_clk_scu("gpt1_clk", IMX_SC_R_GPT_1, IMX_SC_PM_CLK_PER);
12191e91677SDong Aisheng 	imx_clk_scu("gpt2_clk", IMX_SC_R_GPT_2, IMX_SC_PM_CLK_PER);
12291e91677SDong Aisheng 	imx_clk_scu("gpt3_clk", IMX_SC_R_GPT_3, IMX_SC_PM_CLK_PER);
12391e91677SDong Aisheng 	imx_clk_scu("gpt4_clk", IMX_SC_R_GPT_4, IMX_SC_PM_CLK_PER);
12491e91677SDong Aisheng 	imx_clk_scu("fspi0_clk", IMX_SC_R_FSPI_0, IMX_SC_PM_CLK_PER);
12591e91677SDong Aisheng 	imx_clk_scu("fspi1_clk", IMX_SC_R_FSPI_1, IMX_SC_PM_CLK_PER);
126c2cccb6dSAisheng Dong 
127*babfaa95SDong Aisheng 	/* DMA SS */
12891e91677SDong Aisheng 	imx_clk_scu("uart0_clk", IMX_SC_R_UART_0, IMX_SC_PM_CLK_PER);
12991e91677SDong Aisheng 	imx_clk_scu("uart1_clk", IMX_SC_R_UART_1, IMX_SC_PM_CLK_PER);
13091e91677SDong Aisheng 	imx_clk_scu("uart2_clk", IMX_SC_R_UART_2, IMX_SC_PM_CLK_PER);
13191e91677SDong Aisheng 	imx_clk_scu("uart3_clk", IMX_SC_R_UART_3, IMX_SC_PM_CLK_PER);
132*babfaa95SDong Aisheng 	imx_clk_scu("uart4_clk", IMX_SC_R_UART_4, IMX_SC_PM_CLK_PER);
133*babfaa95SDong Aisheng 	imx_clk_scu("sim0_clk",  IMX_SC_R_EMVSIM_0, IMX_SC_PM_CLK_PER);
13491e91677SDong Aisheng 	imx_clk_scu("spi0_clk",  IMX_SC_R_SPI_0, IMX_SC_PM_CLK_PER);
13591e91677SDong Aisheng 	imx_clk_scu("spi1_clk",  IMX_SC_R_SPI_1, IMX_SC_PM_CLK_PER);
13691e91677SDong Aisheng 	imx_clk_scu("spi2_clk",  IMX_SC_R_SPI_2, IMX_SC_PM_CLK_PER);
13791e91677SDong Aisheng 	imx_clk_scu("spi3_clk",  IMX_SC_R_SPI_3, IMX_SC_PM_CLK_PER);
13891e91677SDong Aisheng 	imx_clk_scu("can0_clk",  IMX_SC_R_CAN_0, IMX_SC_PM_CLK_PER);
139*babfaa95SDong Aisheng 	imx_clk_scu("can1_clk",  IMX_SC_R_CAN_1, IMX_SC_PM_CLK_PER);
140*babfaa95SDong Aisheng 	imx_clk_scu("can2_clk",  IMX_SC_R_CAN_2, IMX_SC_PM_CLK_PER);
14191e91677SDong Aisheng 	imx_clk_scu("i2c0_clk",  IMX_SC_R_I2C_0, IMX_SC_PM_CLK_PER);
14291e91677SDong Aisheng 	imx_clk_scu("i2c1_clk",  IMX_SC_R_I2C_1, IMX_SC_PM_CLK_PER);
14391e91677SDong Aisheng 	imx_clk_scu("i2c2_clk",  IMX_SC_R_I2C_2, IMX_SC_PM_CLK_PER);
14491e91677SDong Aisheng 	imx_clk_scu("i2c3_clk",  IMX_SC_R_I2C_3, IMX_SC_PM_CLK_PER);
145*babfaa95SDong Aisheng 	imx_clk_scu("i2c4_clk",  IMX_SC_R_I2C_4, IMX_SC_PM_CLK_PER);
14691e91677SDong Aisheng 	imx_clk_scu("ftm0_clk",  IMX_SC_R_FTM_0, IMX_SC_PM_CLK_PER);
14791e91677SDong Aisheng 	imx_clk_scu("ftm1_clk",  IMX_SC_R_FTM_1, IMX_SC_PM_CLK_PER);
14891e91677SDong Aisheng 	imx_clk_scu("adc0_clk",  IMX_SC_R_ADC_0, IMX_SC_PM_CLK_PER);
149*babfaa95SDong Aisheng 	imx_clk_scu("adc1_clk",  IMX_SC_R_ADC_1, IMX_SC_PM_CLK_PER);
15091e91677SDong Aisheng 	imx_clk_scu("pwm_clk",   IMX_SC_R_LCD_0_PWM_0, IMX_SC_PM_CLK_PER);
151*babfaa95SDong Aisheng 	imx_clk_scu2("lcd_clk", lcd_sels, ARRAY_SIZE(lcd_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_PER);
152*babfaa95SDong Aisheng 	imx_clk_scu2("lcd_pxl_clk", lcd_pxl_sels, ARRAY_SIZE(lcd_pxl_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_MISC0);
153*babfaa95SDong Aisheng 	imx_clk_scu("lcd_pxl_bypass_div_clk", IMX_SC_R_LCD_0, IMX_SC_PM_CLK_BYPASS);
154*babfaa95SDong Aisheng 	imx_clk_scu("elcdif_pll", IMX_SC_R_ELCDIF_PLL, IMX_SC_PM_CLK_PLL);
155*babfaa95SDong Aisheng 
156*babfaa95SDong Aisheng 	/* Audio SS */
157*babfaa95SDong Aisheng 	imx_clk_scu("audio_pll0_clk", IMX_SC_R_AUDIO_PLL_0, IMX_SC_PM_CLK_PLL);
158*babfaa95SDong Aisheng 	imx_clk_scu("audio_pll1_clk", IMX_SC_R_AUDIO_PLL_1, IMX_SC_PM_CLK_PLL);
159*babfaa95SDong Aisheng 	imx_clk_scu("audio_pll_div_clk0_clk", IMX_SC_R_AUDIO_PLL_0, IMX_SC_PM_CLK_MISC0);
160*babfaa95SDong Aisheng 	imx_clk_scu("audio_pll_div_clk1_clk", IMX_SC_R_AUDIO_PLL_1, IMX_SC_PM_CLK_MISC0);
161*babfaa95SDong Aisheng 	imx_clk_scu("audio_rec_clk0_clk", IMX_SC_R_AUDIO_PLL_0, IMX_SC_PM_CLK_MISC1);
162*babfaa95SDong Aisheng 	imx_clk_scu("audio_rec_clk1_clk", IMX_SC_R_AUDIO_PLL_1, IMX_SC_PM_CLK_MISC1);
163c2cccb6dSAisheng Dong 
164c2cccb6dSAisheng Dong 	/* Connectivity */
16591e91677SDong Aisheng 	imx_clk_scu("sdhc0_clk", IMX_SC_R_SDHC_0, IMX_SC_PM_CLK_PER);
16691e91677SDong Aisheng 	imx_clk_scu("sdhc1_clk", IMX_SC_R_SDHC_1, IMX_SC_PM_CLK_PER);
16791e91677SDong Aisheng 	imx_clk_scu("sdhc2_clk", IMX_SC_R_SDHC_2, IMX_SC_PM_CLK_PER);
1682924b0b0SDong Aisheng 	imx_clk_scu("enet0_root_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_PER);
1692924b0b0SDong Aisheng 	imx_clk_divider_gpr_scu("enet0_ref_div", "enet0_root_clk", IMX_SC_R_ENET_0, IMX_SC_C_CLKDIV);
1702924b0b0SDong Aisheng 	imx_clk_mux_gpr_scu("enet0_rgmii_txc_sel", enet0_rgmii_txc_sels, ARRAY_SIZE(enet0_rgmii_txc_sels), IMX_SC_R_ENET_0, IMX_SC_C_TXCLK);
17191e91677SDong Aisheng 	imx_clk_scu("enet0_bypass_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_BYPASS);
172*babfaa95SDong Aisheng 	imx_clk_gate_gpr_scu("enet0_ref_50_clk", "clk_dummy", IMX_SC_R_ENET_0, IMX_SC_C_DISABLE_50, true);
1732924b0b0SDong Aisheng 	imx_clk_scu("enet0_rgmii_rx_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_MISC0);
1742924b0b0SDong Aisheng 	imx_clk_scu("enet1_root_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_PER);
1752924b0b0SDong Aisheng 	imx_clk_divider_gpr_scu("enet1_ref_div", "enet1_root_clk", IMX_SC_R_ENET_1, IMX_SC_C_CLKDIV);
1762924b0b0SDong Aisheng 	imx_clk_mux_gpr_scu("enet1_rgmii_txc_sel", enet1_rgmii_txc_sels, ARRAY_SIZE(enet1_rgmii_txc_sels), IMX_SC_R_ENET_1, IMX_SC_C_TXCLK);
17791e91677SDong Aisheng 	imx_clk_scu("enet1_bypass_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_BYPASS);
178*babfaa95SDong Aisheng 	imx_clk_gate_gpr_scu("enet1_ref_50_clk", "clk_dummy", IMX_SC_R_ENET_1, IMX_SC_C_DISABLE_50, true);
1792924b0b0SDong Aisheng 	imx_clk_scu("enet1_rgmii_rx_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_MISC0);
18091e91677SDong Aisheng 	imx_clk_scu("gpmi_io_clk", IMX_SC_R_NAND, IMX_SC_PM_CLK_MST_BUS);
18191e91677SDong Aisheng 	imx_clk_scu("gpmi_bch_clk", IMX_SC_R_NAND, IMX_SC_PM_CLK_PER);
18291e91677SDong Aisheng 	imx_clk_scu("usb3_aclk_div", IMX_SC_R_USB_2, IMX_SC_PM_CLK_PER);
18391e91677SDong Aisheng 	imx_clk_scu("usb3_bus_div", IMX_SC_R_USB_2, IMX_SC_PM_CLK_MST_BUS);
18491e91677SDong Aisheng 	imx_clk_scu("usb3_lpm_div", IMX_SC_R_USB_2, IMX_SC_PM_CLK_MISC);
185c2cccb6dSAisheng Dong 
186c2cccb6dSAisheng Dong 	/* Display controller SS */
18791e91677SDong Aisheng 	imx_clk_scu2("dc0_disp0_clk", dc0_sels, ARRAY_SIZE(dc0_sels), IMX_SC_R_DC_0, IMX_SC_PM_CLK_MISC0);
18891e91677SDong Aisheng 	imx_clk_scu2("dc0_disp1_clk", dc0_sels, ARRAY_SIZE(dc0_sels), IMX_SC_R_DC_0, IMX_SC_PM_CLK_MISC1);
18991e91677SDong Aisheng 	imx_clk_scu("dc0_pll0_clk", IMX_SC_R_DC_0_PLL_0, IMX_SC_PM_CLK_PLL);
19091e91677SDong Aisheng 	imx_clk_scu("dc0_pll1_clk", IMX_SC_R_DC_0_PLL_1, IMX_SC_PM_CLK_PLL);
19191e91677SDong Aisheng 	imx_clk_scu("dc0_bypass0_clk", IMX_SC_R_DC_0_VIDEO0, IMX_SC_PM_CLK_BYPASS);
19291e91677SDong Aisheng 	imx_clk_scu("dc0_bypass1_clk", IMX_SC_R_DC_0_VIDEO1, IMX_SC_PM_CLK_BYPASS);
193c2cccb6dSAisheng Dong 
194*babfaa95SDong Aisheng 	imx_clk_scu2("dc1_disp0_clk", dc1_sels, ARRAY_SIZE(dc1_sels), IMX_SC_R_DC_1, IMX_SC_PM_CLK_MISC0);
195*babfaa95SDong Aisheng 	imx_clk_scu2("dc1_disp1_clk", dc1_sels, ARRAY_SIZE(dc1_sels), IMX_SC_R_DC_1, IMX_SC_PM_CLK_MISC1);
196*babfaa95SDong Aisheng 	imx_clk_scu("dc1_pll0_clk", IMX_SC_R_DC_1_PLL_0, IMX_SC_PM_CLK_PLL);
197*babfaa95SDong Aisheng 	imx_clk_scu("dc1_pll1_clk", IMX_SC_R_DC_1_PLL_1, IMX_SC_PM_CLK_PLL);
198*babfaa95SDong Aisheng 	imx_clk_scu("dc1_bypass0_clk", IMX_SC_R_DC_1_VIDEO0, IMX_SC_PM_CLK_BYPASS);
199*babfaa95SDong Aisheng 	imx_clk_scu("dc1_bypass1_clk", IMX_SC_R_DC_1_VIDEO1, IMX_SC_PM_CLK_BYPASS);
200*babfaa95SDong Aisheng 
201c2cccb6dSAisheng Dong 	/* MIPI-LVDS SS */
202*babfaa95SDong Aisheng 	imx_clk_scu("mipi0_bypass_clk", IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_BYPASS);
203*babfaa95SDong Aisheng 	imx_clk_scu("mipi0_pixel_clk", IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_PER);
20491e91677SDong Aisheng 	imx_clk_scu("mipi0_lvds_pixel_clk", IMX_SC_R_LVDS_0, IMX_SC_PM_CLK_MISC2);
20591e91677SDong Aisheng 	imx_clk_scu("mipi0_lvds_bypass_clk", IMX_SC_R_LVDS_0, IMX_SC_PM_CLK_BYPASS);
20691e91677SDong Aisheng 	imx_clk_scu("mipi0_lvds_phy_clk", IMX_SC_R_LVDS_0, IMX_SC_PM_CLK_MISC3);
207*babfaa95SDong Aisheng 	imx_clk_scu2("mipi0_dsi_tx_esc_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_MST_BUS);
208*babfaa95SDong Aisheng 	imx_clk_scu2("mipi0_dsi_rx_esc_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_SLV_BUS);
209*babfaa95SDong Aisheng 	imx_clk_scu2("mipi0_dsi_phy_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_0, IMX_SC_PM_CLK_PHY);
21091e91677SDong Aisheng 	imx_clk_scu("mipi0_i2c0_clk", IMX_SC_R_MIPI_0_I2C_0, IMX_SC_PM_CLK_MISC2);
21191e91677SDong Aisheng 	imx_clk_scu("mipi0_i2c1_clk", IMX_SC_R_MIPI_0_I2C_1, IMX_SC_PM_CLK_MISC2);
21291e91677SDong Aisheng 	imx_clk_scu("mipi0_pwm0_clk", IMX_SC_R_MIPI_0_PWM_0, IMX_SC_PM_CLK_PER);
213*babfaa95SDong Aisheng 
214*babfaa95SDong Aisheng 	imx_clk_scu("mipi1_bypass_clk", IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_BYPASS);
215*babfaa95SDong Aisheng 	imx_clk_scu("mipi1_pixel_clk", IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_PER);
21691e91677SDong Aisheng 	imx_clk_scu("mipi1_lvds_pixel_clk", IMX_SC_R_LVDS_1, IMX_SC_PM_CLK_MISC2);
21791e91677SDong Aisheng 	imx_clk_scu("mipi1_lvds_bypass_clk", IMX_SC_R_LVDS_1, IMX_SC_PM_CLK_BYPASS);
21891e91677SDong Aisheng 	imx_clk_scu("mipi1_lvds_phy_clk", IMX_SC_R_LVDS_1, IMX_SC_PM_CLK_MISC3);
219*babfaa95SDong Aisheng 
220*babfaa95SDong Aisheng 	imx_clk_scu2("mipi1_dsi_tx_esc_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_MST_BUS);
221*babfaa95SDong Aisheng 	imx_clk_scu2("mipi1_dsi_rx_esc_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_SLV_BUS);
222*babfaa95SDong Aisheng 	imx_clk_scu2("mipi1_dsi_phy_clk", mipi_sels, ARRAY_SIZE(mipi_sels), IMX_SC_R_MIPI_1, IMX_SC_PM_CLK_PHY);
22391e91677SDong Aisheng 	imx_clk_scu("mipi1_i2c0_clk", IMX_SC_R_MIPI_1_I2C_0, IMX_SC_PM_CLK_MISC2);
22491e91677SDong Aisheng 	imx_clk_scu("mipi1_i2c1_clk", IMX_SC_R_MIPI_1_I2C_1, IMX_SC_PM_CLK_MISC2);
22591e91677SDong Aisheng 	imx_clk_scu("mipi1_pwm0_clk", IMX_SC_R_MIPI_1_PWM_0, IMX_SC_PM_CLK_PER);
226c2cccb6dSAisheng Dong 
227*babfaa95SDong Aisheng 	imx_clk_scu("lvds0_i2c0_clk", IMX_SC_R_LVDS_0_I2C_0, IMX_SC_PM_CLK_PER);
228*babfaa95SDong Aisheng 	imx_clk_scu("lvds0_i2c1_clk", IMX_SC_R_LVDS_0_I2C_1, IMX_SC_PM_CLK_PER);
229*babfaa95SDong Aisheng 	imx_clk_scu("lvds0_pwm0_clk", IMX_SC_R_LVDS_0_PWM_0, IMX_SC_PM_CLK_PER);
230*babfaa95SDong Aisheng 
231*babfaa95SDong Aisheng 	imx_clk_scu("lvds1_i2c0_clk", IMX_SC_R_LVDS_1_I2C_0, IMX_SC_PM_CLK_PER);
232*babfaa95SDong Aisheng 	imx_clk_scu("lvds1_i2c1_clk", IMX_SC_R_LVDS_1_I2C_1, IMX_SC_PM_CLK_PER);
233*babfaa95SDong Aisheng 	imx_clk_scu("lvds1_pwm0_clk", IMX_SC_R_LVDS_1_PWM_0, IMX_SC_PM_CLK_PER);
234*babfaa95SDong Aisheng 
235c2cccb6dSAisheng Dong 	/* MIPI CSI SS */
23691e91677SDong Aisheng 	imx_clk_scu("mipi_csi0_core_clk", IMX_SC_R_CSI_0, IMX_SC_PM_CLK_PER);
23791e91677SDong Aisheng 	imx_clk_scu("mipi_csi0_esc_clk",  IMX_SC_R_CSI_0, IMX_SC_PM_CLK_MISC);
23891e91677SDong Aisheng 	imx_clk_scu("mipi_csi0_i2c0_clk", IMX_SC_R_CSI_0_I2C_0, IMX_SC_PM_CLK_PER);
23991e91677SDong Aisheng 	imx_clk_scu("mipi_csi0_pwm0_clk", IMX_SC_R_CSI_0_PWM_0, IMX_SC_PM_CLK_PER);
240*babfaa95SDong Aisheng 	imx_clk_scu("mipi_csi1_core_clk", IMX_SC_R_CSI_1, IMX_SC_PM_CLK_PER);
241*babfaa95SDong Aisheng 	imx_clk_scu("mipi_csi1_esc_clk",  IMX_SC_R_CSI_1, IMX_SC_PM_CLK_MISC);
242*babfaa95SDong Aisheng 	imx_clk_scu("mipi_csi1_i2c0_clk", IMX_SC_R_CSI_1_I2C_0, IMX_SC_PM_CLK_PER);
243*babfaa95SDong Aisheng 	imx_clk_scu("mipi_csi1_pwm0_clk", IMX_SC_R_CSI_1_PWM_0, IMX_SC_PM_CLK_PER);
244*babfaa95SDong Aisheng 
245*babfaa95SDong Aisheng 	/* Parallel Interface SS */
246*babfaa95SDong Aisheng 	imx_clk_scu("pi_dpll_clk", IMX_SC_R_PI_0_PLL, IMX_SC_PM_CLK_PLL);
247*babfaa95SDong Aisheng 	imx_clk_scu2("pi_per_div_clk", pi_pll0_sels, ARRAY_SIZE(pi_pll0_sels), IMX_SC_R_PI_0, IMX_SC_PM_CLK_PER);
248*babfaa95SDong Aisheng 	imx_clk_scu("pi_mclk_div_clk", IMX_SC_R_PI_0, IMX_SC_PM_CLK_MISC0);
249*babfaa95SDong Aisheng 	imx_clk_scu("pi_i2c0_div_clk", IMX_SC_R_PI_0_I2C_0, IMX_SC_PM_CLK_PER);
250c2cccb6dSAisheng Dong 
251c2cccb6dSAisheng Dong 	/* GPU SS */
25291e91677SDong Aisheng 	imx_clk_scu("gpu_core0_clk",	 IMX_SC_R_GPU_0_PID0, IMX_SC_PM_CLK_PER);
25391e91677SDong Aisheng 	imx_clk_scu("gpu_shader0_clk", IMX_SC_R_GPU_0_PID0, IMX_SC_PM_CLK_MISC);
254c2cccb6dSAisheng Dong 
255*babfaa95SDong Aisheng 	imx_clk_scu("gpu_core1_clk",	 IMX_SC_R_GPU_1_PID0, IMX_SC_PM_CLK_PER);
256*babfaa95SDong Aisheng 	imx_clk_scu("gpu_shader1_clk", IMX_SC_R_GPU_1_PID0, IMX_SC_PM_CLK_MISC);
257*babfaa95SDong Aisheng 
258*babfaa95SDong Aisheng 	 /* CM40 SS */
259*babfaa95SDong Aisheng 	imx_clk_scu("cm40_i2c_div", IMX_SC_R_M4_0_I2C, IMX_SC_PM_CLK_PER);
260*babfaa95SDong Aisheng 	imx_clk_scu("cm40_lpuart_div", IMX_SC_R_M4_0_UART, IMX_SC_PM_CLK_PER);
261*babfaa95SDong Aisheng 
262*babfaa95SDong Aisheng 	 /* CM41 SS */
263*babfaa95SDong Aisheng 	imx_clk_scu("cm41_i2c_div", IMX_SC_R_M4_1_I2C, IMX_SC_PM_CLK_PER);
264*babfaa95SDong Aisheng 
265*babfaa95SDong Aisheng 	/* HDMI TX SS */
266*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_dig_pll_clk",  IMX_SC_R_HDMI_PLL_0, IMX_SC_PM_CLK_PLL);
267*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_av_pll_clk", IMX_SC_R_HDMI_PLL_1, IMX_SC_PM_CLK_PLL);
268*babfaa95SDong Aisheng 	imx_clk_scu2("hdmi_pixel_mux_clk", hdmi_sels, ARRAY_SIZE(hdmi_sels), IMX_SC_R_HDMI, IMX_SC_PM_CLK_MISC0);
269*babfaa95SDong Aisheng 	imx_clk_scu2("hdmi_pixel_link_clk", hdmi_sels, ARRAY_SIZE(hdmi_sels), IMX_SC_R_HDMI, IMX_SC_PM_CLK_MISC1);
270*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_ipg_clk", IMX_SC_R_HDMI, IMX_SC_PM_CLK_MISC4);
271*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_i2c0_clk", IMX_SC_R_HDMI_I2C_0, IMX_SC_PM_CLK_MISC2);
272*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_hdp_core_clk", IMX_SC_R_HDMI, IMX_SC_PM_CLK_MISC2);
273*babfaa95SDong Aisheng 	imx_clk_scu2("hdmi_pxl_clk", hdmi_sels, ARRAY_SIZE(hdmi_sels), IMX_SC_R_HDMI, IMX_SC_PM_CLK_MISC3);
274*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_i2s_bypass_clk", IMX_SC_R_HDMI_I2S, IMX_SC_PM_CLK_BYPASS);
275*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_i2s_clk", IMX_SC_R_HDMI_I2S, IMX_SC_PM_CLK_MISC0);
276*babfaa95SDong Aisheng 
277*babfaa95SDong Aisheng 	/* HDMI RX SS */
278*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_rx_i2s_bypass_clk", IMX_SC_R_HDMI_RX_BYPASS, IMX_SC_PM_CLK_MISC0);
279*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_rx_spdif_bypass_clk", IMX_SC_R_HDMI_RX_BYPASS, IMX_SC_PM_CLK_MISC1);
280*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_rx_bypass_clk", IMX_SC_R_HDMI_RX_BYPASS, IMX_SC_PM_CLK_MISC2);
281*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_rx_i2c0_clk", IMX_SC_R_HDMI_RX_I2C_0, IMX_SC_PM_CLK_MISC2);
282*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_rx_pwm_clk", IMX_SC_R_HDMI_RX_PWM_0, IMX_SC_PM_CLK_MISC2);
283*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_rx_spdif_clk", IMX_SC_R_HDMI_RX, IMX_SC_PM_CLK_MISC0);
284*babfaa95SDong Aisheng 	imx_clk_scu2("hdmi_rx_hd_ref_clk", hdmi_rx_sels, ARRAY_SIZE(hdmi_rx_sels), IMX_SC_R_HDMI_RX, IMX_SC_PM_CLK_MISC1);
285*babfaa95SDong Aisheng 	imx_clk_scu2("hdmi_rx_hd_core_clk", hdmi_rx_sels, ARRAY_SIZE(hdmi_rx_sels), IMX_SC_R_HDMI_RX, IMX_SC_PM_CLK_MISC2);
286*babfaa95SDong Aisheng 	imx_clk_scu2("hdmi_rx_pxl_clk", hdmi_rx_sels, ARRAY_SIZE(hdmi_rx_sels), IMX_SC_R_HDMI_RX, IMX_SC_PM_CLK_MISC3);
287*babfaa95SDong Aisheng 	imx_clk_scu("hdmi_rx_i2s_clk", IMX_SC_R_HDMI_RX, IMX_SC_PM_CLK_MISC4);
288*babfaa95SDong Aisheng 
28977d8f306SDong Aisheng 	ret = of_clk_add_hw_provider(ccm_node, imx_scu_of_clk_src_get, imx_scu_clks);
29077d8f306SDong Aisheng 	if (ret)
29177d8f306SDong Aisheng 		imx_clk_scu_unregister();
29277d8f306SDong Aisheng 
29377d8f306SDong Aisheng 	return ret;
294c2cccb6dSAisheng Dong }
295c2cccb6dSAisheng Dong 
296c2cccb6dSAisheng Dong static const struct of_device_id imx8qxp_match[] = {
297cd67d327SAisheng Dong 	{ .compatible = "fsl,scu-clk", },
2985964012cSDong Aisheng 	{ .compatible = "fsl,imx8qxp-clk", &imx_clk_scu_rsrc_imx8qxp, },
299afd0406bSDong Aisheng 	{ .compatible = "fsl,imx8qm-clk", &imx_clk_scu_rsrc_imx8qm, },
300c2cccb6dSAisheng Dong 	{ /* sentinel */ }
301c2cccb6dSAisheng Dong };
302c2cccb6dSAisheng Dong 
303c2cccb6dSAisheng Dong static struct platform_driver imx8qxp_clk_driver = {
304c2cccb6dSAisheng Dong 	.driver = {
305c2cccb6dSAisheng Dong 		.name = "imx8qxp-clk",
306c2cccb6dSAisheng Dong 		.of_match_table = imx8qxp_match,
307c2cccb6dSAisheng Dong 		.suppress_bind_attrs = true,
308c2cccb6dSAisheng Dong 	},
309c2cccb6dSAisheng Dong 	.probe = imx8qxp_clk_probe,
310c2cccb6dSAisheng Dong };
311c2cccb6dSAisheng Dong builtin_platform_driver(imx8qxp_clk_driver);
312e0d0d4d8SAnson Huang 
313e0d0d4d8SAnson Huang MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>");
314e0d0d4d8SAnson Huang MODULE_DESCRIPTION("NXP i.MX8QXP clock driver");
315e0d0d4d8SAnson Huang MODULE_LICENSE("GPL v2");
316