@@ -177,6 +177,8 @@ static const struct clk_parent_data emac_mux[] = {
177177 .name = "emaca_free_clk" , },
178178 { .fw_name = "emacb_free_clk" ,
179179 .name = "emacb_free_clk" , },
180+ { .fw_name = "boot_clk" ,
181+ .name = "boot_clk" , },
180182};
181183
182184static const struct clk_parent_data noc_mux [] = {
@@ -186,6 +188,41 @@ static const struct clk_parent_data noc_mux[] = {
186188 .name = "boot_clk" , },
187189};
188190
191+ static const struct clk_parent_data sdmmc_mux [] = {
192+ { .fw_name = "sdmmc_free_clk" ,
193+ .name = "sdmmc_free_clk" , },
194+ { .fw_name = "boot_clk" ,
195+ .name = "boot_clk" , },
196+ };
197+
198+ static const struct clk_parent_data s2f_user1_mux [] = {
199+ { .fw_name = "s2f_user1_free_clk" ,
200+ .name = "s2f_user1_free_clk" , },
201+ { .fw_name = "boot_clk" ,
202+ .name = "boot_clk" , },
203+ };
204+
205+ static const struct clk_parent_data psi_mux [] = {
206+ { .fw_name = "psi_ref_free_clk" ,
207+ .name = "psi_ref_free_clk" , },
208+ { .fw_name = "boot_clk" ,
209+ .name = "boot_clk" , },
210+ };
211+
212+ static const struct clk_parent_data gpio_db_mux [] = {
213+ { .fw_name = "gpio_db_free_clk" ,
214+ .name = "gpio_db_free_clk" , },
215+ { .fw_name = "boot_clk" ,
216+ .name = "boot_clk" , },
217+ };
218+
219+ static const struct clk_parent_data emac_ptp_mux [] = {
220+ { .fw_name = "emac_ptp_free_clk" ,
221+ .name = "emac_ptp_free_clk" , },
222+ { .fw_name = "boot_clk" ,
223+ .name = "boot_clk" , },
224+ };
225+
189226/* clocks in AO (always on) controller */
190227static const struct stratix10_pll_clock agilex_pll_clks [] = {
191228 { AGILEX_BOOT_CLK , "boot_clk" , boot_mux , ARRAY_SIZE (boot_mux ), 0 ,
@@ -222,11 +259,9 @@ static const struct stratix10_perip_cnt_clock agilex_main_perip_cnt_clks[] = {
222259 { AGILEX_MPU_FREE_CLK , "mpu_free_clk" , NULL , mpu_free_mux , ARRAY_SIZE (mpu_free_mux ),
223260 0 , 0x3C , 0 , 0 , 0 },
224261 { AGILEX_NOC_FREE_CLK , "noc_free_clk" , NULL , noc_free_mux , ARRAY_SIZE (noc_free_mux ),
225- 0 , 0x40 , 0 , 0 , 1 },
226- { AGILEX_L4_SYS_FREE_CLK , "l4_sys_free_clk" , "noc_free_clk" , NULL , 1 , 0 ,
227- 0 , 4 , 0 , 0 },
228- { AGILEX_NOC_CLK , "noc_clk" , NULL , noc_mux , ARRAY_SIZE (noc_mux ),
229- 0 , 0 , 0 , 0x30 , 1 },
262+ 0 , 0x40 , 0 , 0 , 0 },
263+ { AGILEX_L4_SYS_FREE_CLK , "l4_sys_free_clk" , NULL , noc_mux , ARRAY_SIZE (noc_mux ), 0 ,
264+ 0 , 4 , 0x30 , 1 },
230265 { AGILEX_EMAC_A_FREE_CLK , "emaca_free_clk" , NULL , emaca_free_mux , ARRAY_SIZE (emaca_free_mux ),
231266 0 , 0xD4 , 0 , 0x88 , 0 },
232267 { AGILEX_EMAC_B_FREE_CLK , "emacb_free_clk" , NULL , emacb_free_mux , ARRAY_SIZE (emacb_free_mux ),
@@ -236,7 +271,7 @@ static const struct stratix10_perip_cnt_clock agilex_main_perip_cnt_clks[] = {
236271 { AGILEX_GPIO_DB_FREE_CLK , "gpio_db_free_clk" , NULL , gpio_db_free_mux ,
237272 ARRAY_SIZE (gpio_db_free_mux ), 0 , 0xE0 , 0 , 0x88 , 3 },
238273 { AGILEX_SDMMC_FREE_CLK , "sdmmc_free_clk" , NULL , sdmmc_free_mux ,
239- ARRAY_SIZE (sdmmc_free_mux ), 0 , 0xE4 , 0 , 0x88 , 4 },
274+ ARRAY_SIZE (sdmmc_free_mux ), 0 , 0xE4 , 0 , 0 , 0 },
240275 { AGILEX_S2F_USER0_FREE_CLK , "s2f_user0_free_clk" , NULL , s2f_usr0_free_mux ,
241276 ARRAY_SIZE (s2f_usr0_free_mux ), 0 , 0xE8 , 0 , 0 , 0 },
242277 { AGILEX_S2F_USER1_FREE_CLK , "s2f_user1_free_clk" , NULL , s2f_usr1_free_mux ,
@@ -252,24 +287,24 @@ static const struct stratix10_gate_clock agilex_gate_clks[] = {
252287 0 , 0 , 0 , 0 , 0 , 0 , 4 },
253288 { AGILEX_MPU_CCU_CLK , "mpu_ccu_clk" , "mpu_clk" , NULL , 1 , 0 , 0x24 ,
254289 0 , 0 , 0 , 0 , 0 , 0 , 2 },
255- { AGILEX_L4_MAIN_CLK , "l4_main_clk" , "noc_clk" , NULL , 1 , 0 , 0x24 ,
256- 1 , 0x44 , 0 , 2 , 0 , 0 , 0 },
257- { AGILEX_L4_MP_CLK , "l4_mp_clk" , "noc_clk" , NULL , 1 , 0 , 0x24 ,
258- 2 , 0x44 , 8 , 2 , 0 , 0 , 0 },
290+ { AGILEX_L4_MAIN_CLK , "l4_main_clk" , NULL , noc_mux , ARRAY_SIZE ( noc_mux ) , 0 , 0x24 ,
291+ 1 , 0x44 , 0 , 2 , 0x30 , 1 , 0 },
292+ { AGILEX_L4_MP_CLK , "l4_mp_clk" , NULL , noc_mux , ARRAY_SIZE ( noc_mux ) , 0 , 0x24 ,
293+ 2 , 0x44 , 8 , 2 , 0x30 , 1 , 0 },
259294 /*
260295 * The l4_sp_clk feeds a 100 MHz clock to various peripherals, one of them
261296 * being the SP timers, thus cannot get gated.
262297 */
263- { AGILEX_L4_SP_CLK , "l4_sp_clk" , "noc_clk" , NULL , 1 , CLK_IS_CRITICAL , 0x24 ,
264- 3 , 0x44 , 16 , 2 , 0 , 0 , 0 },
265- { AGILEX_CS_AT_CLK , "cs_at_clk" , "noc_clk" , NULL , 1 , 0 , 0x24 ,
266- 4 , 0x44 , 24 , 2 , 0 , 0 , 0 },
267- { AGILEX_CS_TRACE_CLK , "cs_trace_clk" , "noc_clk" , NULL , 1 , 0 , 0x24 ,
268- 4 , 0x44 , 26 , 2 , 0 , 0 , 0 },
298+ { AGILEX_L4_SP_CLK , "l4_sp_clk" , NULL , noc_mux , ARRAY_SIZE ( noc_mux ) , CLK_IS_CRITICAL , 0x24 ,
299+ 3 , 0x44 , 16 , 2 , 0x30 , 1 , 0 },
300+ { AGILEX_CS_AT_CLK , "cs_at_clk" , NULL , noc_mux , ARRAY_SIZE ( noc_mux ) , 0 , 0x24 ,
301+ 4 , 0x44 , 24 , 2 , 0x30 , 1 , 0 },
302+ { AGILEX_CS_TRACE_CLK , "cs_trace_clk" , NULL , noc_mux , ARRAY_SIZE ( noc_mux ) , 0 , 0x24 ,
303+ 4 , 0x44 , 26 , 2 , 0x30 , 1 , 0 },
269304 { AGILEX_CS_PDBG_CLK , "cs_pdbg_clk" , "cs_at_clk" , NULL , 1 , 0 , 0x24 ,
270305 4 , 0x44 , 28 , 1 , 0 , 0 , 0 },
271- { AGILEX_CS_TIMER_CLK , "cs_timer_clk" , "noc_clk" , NULL , 1 , 0 , 0x24 ,
272- 5 , 0 , 0 , 0 , 0 , 0 , 0 },
306+ { AGILEX_CS_TIMER_CLK , "cs_timer_clk" , NULL , noc_mux , ARRAY_SIZE ( noc_mux ) , 0 , 0x24 ,
307+ 5 , 0 , 0 , 0 , 0x30 , 1 , 0 },
273308 { AGILEX_S2F_USER0_CLK , "s2f_user0_clk" , NULL , s2f_usr0_mux , ARRAY_SIZE (s2f_usr0_mux ), 0 , 0x24 ,
274309 6 , 0 , 0 , 0 , 0 , 0 , 0 },
275310 { AGILEX_EMAC0_CLK , "emac0_clk" , NULL , emac_mux , ARRAY_SIZE (emac_mux ), 0 , 0x7C ,
@@ -278,16 +313,16 @@ static const struct stratix10_gate_clock agilex_gate_clks[] = {
278313 1 , 0 , 0 , 0 , 0x94 , 27 , 0 },
279314 { AGILEX_EMAC2_CLK , "emac2_clk" , NULL , emac_mux , ARRAY_SIZE (emac_mux ), 0 , 0x7C ,
280315 2 , 0 , 0 , 0 , 0x94 , 28 , 0 },
281- { AGILEX_EMAC_PTP_CLK , "emac_ptp_clk" , "emac_ptp_free_clk" , NULL , 1 , 0 , 0x7C ,
282- 3 , 0 , 0 , 0 , 0 , 0 , 0 },
283- { AGILEX_GPIO_DB_CLK , "gpio_db_clk" , "gpio_db_free_clk" , NULL , 1 , 0 , 0x7C ,
284- 4 , 0x98 , 0 , 16 , 0 , 0 , 0 },
285- { AGILEX_SDMMC_CLK , "sdmmc_clk" , "sdmmc_free_clk" , NULL , 1 , 0 , 0x7C ,
286- 5 , 0 , 0 , 0 , 0 , 0 , 4 },
287- { AGILEX_S2F_USER1_CLK , "s2f_user1_clk" , "s2f_user1_free_clk" , NULL , 1 , 0 , 0x7C ,
288- 6 , 0 , 0 , 0 , 0 , 0 , 0 },
289- { AGILEX_PSI_REF_CLK , "psi_ref_clk" , "psi_ref_free_clk" , NULL , 1 , 0 , 0x7C ,
290- 7 , 0 , 0 , 0 , 0 , 0 , 0 },
316+ { AGILEX_EMAC_PTP_CLK , "emac_ptp_clk" , NULL , emac_ptp_mux , ARRAY_SIZE ( emac_ptp_mux ) , 0 , 0x7C ,
317+ 3 , 0 , 0 , 0 , 0x88 , 2 , 0 },
318+ { AGILEX_GPIO_DB_CLK , "gpio_db_clk" , NULL , gpio_db_mux , ARRAY_SIZE ( gpio_db_mux ) , 0 , 0x7C ,
319+ 4 , 0x98 , 0 , 16 , 0x88 , 3 , 0 },
320+ { AGILEX_SDMMC_CLK , "sdmmc_clk" , NULL , sdmmc_mux , ARRAY_SIZE ( sdmmc_mux ) , 0 , 0x7C ,
321+ 5 , 0 , 0 , 0 , 0x88 , 4 , 4 },
322+ { AGILEX_S2F_USER1_CLK , "s2f_user1_clk" , NULL , s2f_user1_mux , ARRAY_SIZE ( s2f_user1_mux ) , 0 , 0x7C ,
323+ 6 , 0 , 0 , 0 , 0x88 , 5 , 0 },
324+ { AGILEX_PSI_REF_CLK , "psi_ref_clk" , NULL , psi_mux , ARRAY_SIZE ( psi_mux ) , 0 , 0x7C ,
325+ 7 , 0 , 0 , 0 , 0x88 , 6 , 0 },
291326 { AGILEX_USB_CLK , "usb_clk" , "l4_mp_clk" , NULL , 1 , 0 , 0x7C ,
292327 8 , 0 , 0 , 0 , 0 , 0 , 0 },
293328 { AGILEX_SPI_M_CLK , "spi_m_clk" , "l4_mp_clk" , NULL , 1 , 0 , 0x7C ,
@@ -366,7 +401,7 @@ static int agilex_clk_register_gate(const struct stratix10_gate_clock *clks,
366401 int i ;
367402
368403 for (i = 0 ; i < nums ; i ++ ) {
369- hw_clk = s10_register_gate (& clks [i ], base );
404+ hw_clk = agilex_register_gate (& clks [i ], base );
370405 if (IS_ERR (hw_clk )) {
371406 pr_err ("%s: failed to register clock %s\n" ,
372407 __func__ , clks [i ].name );
0 commit comments