1515
1616#include "clk.h"
1717
18- #define IMX93_CLK_END 202
18+ #define IMX93_CLK_END 207
19+
20+ #define PLAT_IMX93 BIT(0)
21+ #define PLAT_IMX91 BIT(1)
1922
2023enum clk_sel {
2124 LOW_SPEED_IO_SEL ,
@@ -55,6 +58,7 @@ static const struct imx93_clk_root {
5558 u32 off ;
5659 enum clk_sel sel ;
5760 unsigned long flags ;
61+ unsigned long plat ;
5862} root_array [] = {
5963 /* a55/m33/bus critical clk for system run */
6064 { IMX93_CLK_A55_PERIPH , "a55_periph_root" , 0x0000 , FAST_SEL , CLK_IS_CRITICAL },
@@ -65,7 +69,7 @@ static const struct imx93_clk_root {
6569 { IMX93_CLK_BUS_AON , "bus_aon_root" , 0x0300 , LOW_SPEED_IO_SEL , CLK_IS_CRITICAL },
6670 { IMX93_CLK_WAKEUP_AXI , "wakeup_axi_root" , 0x0380 , FAST_SEL , CLK_IS_CRITICAL },
6771 { IMX93_CLK_SWO_TRACE , "swo_trace_root" , 0x0400 , LOW_SPEED_IO_SEL , },
68- { IMX93_CLK_M33_SYSTICK , "m33_systick_root" , 0x0480 , LOW_SPEED_IO_SEL , },
72+ { IMX93_CLK_M33_SYSTICK , "m33_systick_root" , 0x0480 , LOW_SPEED_IO_SEL , 0 , PLAT_IMX93 , },
6973 { IMX93_CLK_FLEXIO1 , "flexio1_root" , 0x0500 , LOW_SPEED_IO_SEL , },
7074 { IMX93_CLK_FLEXIO2 , "flexio2_root" , 0x0580 , LOW_SPEED_IO_SEL , },
7175 { IMX93_CLK_LPTMR1 , "lptmr1_root" , 0x0700 , LOW_SPEED_IO_SEL , },
@@ -122,15 +126,15 @@ static const struct imx93_clk_root {
122126 { IMX93_CLK_HSIO_ACSCAN_80M , "hsio_acscan_80m_root" , 0x1f80 , LOW_SPEED_IO_SEL , },
123127 { IMX93_CLK_HSIO_ACSCAN_480M , "hsio_acscan_480m_root" , 0x2000 , MISC_SEL , },
124128 { IMX93_CLK_NIC_AXI , "nic_axi_root" , 0x2080 , FAST_SEL , CLK_IS_CRITICAL , },
125- { IMX93_CLK_ML_APB , "ml_apb_root" , 0x2180 , LOW_SPEED_IO_SEL , },
126- { IMX93_CLK_ML , "ml_root" , 0x2200 , FAST_SEL , },
129+ { IMX93_CLK_ML_APB , "ml_apb_root" , 0x2180 , LOW_SPEED_IO_SEL , 0 , PLAT_IMX93 , },
130+ { IMX93_CLK_ML , "ml_root" , 0x2200 , FAST_SEL , 0 , PLAT_IMX93 , },
127131 { IMX93_CLK_MEDIA_AXI , "media_axi_root" , 0x2280 , FAST_SEL , },
128132 { IMX93_CLK_MEDIA_APB , "media_apb_root" , 0x2300 , LOW_SPEED_IO_SEL , },
129- { IMX93_CLK_MEDIA_LDB , "media_ldb_root" , 0x2380 , VIDEO_SEL , },
133+ { IMX93_CLK_MEDIA_LDB , "media_ldb_root" , 0x2380 , VIDEO_SEL , 0 , PLAT_IMX93 , },
130134 { IMX93_CLK_MEDIA_DISP_PIX , "media_disp_pix_root" , 0x2400 , VIDEO_SEL , },
131135 { IMX93_CLK_CAM_PIX , "cam_pix_root" , 0x2480 , VIDEO_SEL , },
132- { IMX93_CLK_MIPI_TEST_BYTE , "mipi_test_byte_root" , 0x2500 , VIDEO_SEL , },
133- { IMX93_CLK_MIPI_PHY_CFG , "mipi_phy_cfg_root" , 0x2580 , VIDEO_SEL , },
136+ { IMX93_CLK_MIPI_TEST_BYTE , "mipi_test_byte_root" , 0x2500 , VIDEO_SEL , 0 , PLAT_IMX93 , },
137+ { IMX93_CLK_MIPI_PHY_CFG , "mipi_phy_cfg_root" , 0x2580 , VIDEO_SEL , 0 , PLAT_IMX93 , },
134138 { IMX93_CLK_ADC , "adc_root" , 0x2700 , LOW_SPEED_IO_SEL , },
135139 { IMX93_CLK_PDM , "pdm_root" , 0x2780 , AUDIO_SEL , },
136140 { IMX93_CLK_TSTMR1 , "tstmr1_root" , 0x2800 , LOW_SPEED_IO_SEL , },
@@ -139,13 +143,16 @@ static const struct imx93_clk_root {
139143 { IMX93_CLK_MQS2 , "mqs2_root" , 0x2980 , AUDIO_SEL , },
140144 { IMX93_CLK_AUDIO_XCVR , "audio_xcvr_root" , 0x2a00 , NON_IO_SEL , },
141145 { IMX93_CLK_SPDIF , "spdif_root" , 0x2a80 , AUDIO_SEL , },
142- { IMX93_CLK_ENET , "enet_root" , 0x2b00 , NON_IO_SEL , },
143- { IMX93_CLK_ENET_TIMER1 , "enet_timer1_root" , 0x2b80 , LOW_SPEED_IO_SEL , },
144- { IMX93_CLK_ENET_TIMER2 , "enet_timer2_root" , 0x2c00 , LOW_SPEED_IO_SEL , },
145- { IMX93_CLK_ENET_REF , "enet_ref_root" , 0x2c80 , NON_IO_SEL , },
146- { IMX93_CLK_ENET_REF_PHY , "enet_ref_phy_root" , 0x2d00 , LOW_SPEED_IO_SEL , },
147- { IMX93_CLK_I3C1_SLOW , "i3c1_slow_root" , 0x2d80 , LOW_SPEED_IO_SEL , },
148- { IMX93_CLK_I3C2_SLOW , "i3c2_slow_root" , 0x2e00 , LOW_SPEED_IO_SEL , },
146+ { IMX93_CLK_ENET , "enet_root" , 0x2b00 , NON_IO_SEL , 0 , PLAT_IMX93 , },
147+ { IMX93_CLK_ENET_TIMER1 , "enet_timer1_root" , 0x2b80 , LOW_SPEED_IO_SEL , 0 , PLAT_IMX93 , },
148+ { IMX93_CLK_ENET_TIMER2 , "enet_timer2_root" , 0x2c00 , LOW_SPEED_IO_SEL , 0 , PLAT_IMX93 , },
149+ { IMX93_CLK_ENET_REF , "enet_ref_root" , 0x2c80 , NON_IO_SEL , 0 , PLAT_IMX93 , },
150+ { IMX93_CLK_ENET_REF_PHY , "enet_ref_phy_root" , 0x2d00 , LOW_SPEED_IO_SEL , 0 , PLAT_IMX93 , },
151+ { IMX91_CLK_ENET1_QOS_TSN , "enet1_qos_tsn_root" , 0x2b00 , NON_IO_SEL , 0 , PLAT_IMX91 , },
152+ { IMX91_CLK_ENET_TIMER , "enet_timer_root" , 0x2b80 , LOW_SPEED_IO_SEL , 0 , PLAT_IMX91 , },
153+ { IMX91_CLK_ENET2_REGULAR , "enet2_regular_root" , 0x2c80 , NON_IO_SEL , 0 , PLAT_IMX91 , },
154+ { IMX93_CLK_I3C1_SLOW , "i3c1_slow_root" , 0x2d80 , LOW_SPEED_IO_SEL , 0 , PLAT_IMX93 , },
155+ { IMX93_CLK_I3C2_SLOW , "i3c2_slow_root" , 0x2e00 , LOW_SPEED_IO_SEL , 0 , PLAT_IMX93 , },
149156 { IMX93_CLK_USB_PHY_BURUNIN , "usb_phy_root" , 0x2e80 , LOW_SPEED_IO_SEL , },
150157 { IMX93_CLK_PAL_CAME_SCAN , "pal_came_scan_root" , 0x2f00 , MISC_SEL , }
151158};
@@ -157,6 +164,7 @@ static const struct imx93_clk_ccgr {
157164 u32 off ;
158165 unsigned long flags ;
159166 u32 * shared_count ;
167+ unsigned long plat ;
160168} ccgr_array [] = {
161169 { IMX93_CLK_A55_GATE , "a55_alt" , "a55_alt_root" , 0x8000 , },
162170 /* M33 critical clk for system run */
@@ -246,8 +254,10 @@ static const struct imx93_clk_ccgr {
246254 { IMX93_CLK_AUD_XCVR_GATE , "aud_xcvr" , "audio_xcvr_root" , 0x9b80 , },
247255 { IMX93_CLK_SPDIF_GATE , "spdif" , "spdif_root" , 0x9c00 , },
248256 { IMX93_CLK_HSIO_32K_GATE , "hsio_32k" , "osc_32k" , 0x9dc0 , },
249- { IMX93_CLK_ENET1_GATE , "enet1" , "wakeup_axi_root" , 0x9e00 , },
250- { IMX93_CLK_ENET_QOS_GATE , "enet_qos" , "wakeup_axi_root" , 0x9e40 , },
257+ { IMX93_CLK_ENET1_GATE , "enet1" , "wakeup_axi_root" , 0x9e00 , 0 , NULL , PLAT_IMX93 , },
258+ { IMX93_CLK_ENET_QOS_GATE , "enet_qos" , "wakeup_axi_root" , 0x9e40 , 0 , NULL , PLAT_IMX93 , },
259+ { IMX91_CLK_ENET2_REGULAR_GATE , "enet2_regular" , "wakeup_axi_root" , 0x9e00 , 0 , NULL , PLAT_IMX91 , },
260+ { IMX91_CLK_ENET1_QOS_TSN_GATE , "enet1_qos_tsn" , "wakeup_axi_root" , 0x9e40 , 0 , NULL , PLAT_IMX91 , },
251261 /* Critical because clk accessed during CPU idle */
252262 { IMX93_CLK_SYS_CNT_GATE , "sys_cnt" , "osc_24m" , 0x9e80 , CLK_IS_CRITICAL },
253263 { IMX93_CLK_TSTMR1_GATE , "tstmr1" , "bus_aon_root" , 0x9ec0 , },
@@ -267,6 +277,7 @@ static int imx93_clocks_probe(struct platform_device *pdev)
267277 const struct imx93_clk_ccgr * ccgr ;
268278 void __iomem * base , * anatop_base ;
269279 int i , ret ;
280+ const unsigned long plat = (unsigned long )device_get_match_data (& pdev -> dev );
270281
271282 clk_hw_data = devm_kzalloc (dev , struct_size (clk_hw_data , hws ,
272283 IMX93_CLK_END ), GFP_KERNEL );
@@ -316,17 +327,20 @@ static int imx93_clocks_probe(struct platform_device *pdev)
316327
317328 for (i = 0 ; i < ARRAY_SIZE (root_array ); i ++ ) {
318329 root = & root_array [i ];
319- clks [root -> clk ] = imx93_clk_composite_flags (root -> name ,
320- parent_names [root -> sel ],
321- 4 , base + root -> off , 3 ,
322- root -> flags );
330+ if (!root -> plat || root -> plat & plat )
331+ clks [root -> clk ] = imx93_clk_composite_flags (root -> name ,
332+ parent_names [root -> sel ],
333+ 4 , base + root -> off , 3 ,
334+ root -> flags );
323335 }
324336
325337 for (i = 0 ; i < ARRAY_SIZE (ccgr_array ); i ++ ) {
326338 ccgr = & ccgr_array [i ];
327- clks [ccgr -> clk ] = imx93_clk_gate (NULL , ccgr -> name , ccgr -> parent_name ,
328- ccgr -> flags , base + ccgr -> off , 0 , 1 , 1 , 3 ,
329- ccgr -> shared_count );
339+ if (!ccgr -> plat || ccgr -> plat & plat )
340+ clks [ccgr -> clk ] = imx93_clk_gate (NULL ,
341+ ccgr -> name , ccgr -> parent_name ,
342+ ccgr -> flags , base + ccgr -> off , 0 , 1 , 1 , 3 ,
343+ ccgr -> shared_count );
330344 }
331345
332346 clks [IMX93_CLK_A55_SEL ] = imx_clk_hw_mux2 ("a55_sel" , base + 0x4820 , 0 , 1 , a55_core_sels ,
@@ -356,7 +370,8 @@ static int imx93_clocks_probe(struct platform_device *pdev)
356370}
357371
358372static const struct of_device_id imx93_clk_of_match [] = {
359- { .compatible = "fsl,imx93-ccm" },
373+ { .compatible = "fsl,imx93-ccm" , .data = (void * )PLAT_IMX93 },
374+ { .compatible = "fsl,imx91-ccm" , .data = (void * )PLAT_IMX91 },
360375 { /* Sentinel */ },
361376};
362377MODULE_DEVICE_TABLE (of , imx93_clk_of_match );
0 commit comments