@@ -131,6 +131,18 @@ static const struct clk_div_table ast2600_eclk_div_table[] = {
131
131
{ 0 }
132
132
};
133
133
134
+ static const struct clk_div_table ast2600_emmc_extclk_div_table [] = {
135
+ { 0x0 , 2 },
136
+ { 0x1 , 4 },
137
+ { 0x2 , 6 },
138
+ { 0x3 , 8 },
139
+ { 0x4 , 10 },
140
+ { 0x5 , 12 },
141
+ { 0x6 , 14 },
142
+ { 0x7 , 16 },
143
+ { 0 }
144
+ };
145
+
134
146
static const struct clk_div_table ast2600_mac_div_table [] = {
135
147
{ 0x0 , 4 },
136
148
{ 0x1 , 4 },
@@ -390,6 +402,11 @@ static struct clk_hw *aspeed_g6_clk_hw_register_gate(struct device *dev,
390
402
return hw ;
391
403
}
392
404
405
+ static const char * const emmc_extclk_parent_names [] = {
406
+ "emmc_extclk_hpll_in" ,
407
+ "mpll" ,
408
+ };
409
+
393
410
static const char * const vclk_parent_names [] = {
394
411
"dpll" ,
395
412
"d1pll" ,
@@ -459,16 +476,32 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev)
459
476
return PTR_ERR (hw );
460
477
aspeed_g6_clk_data -> hws [ASPEED_CLK_UARTX ] = hw ;
461
478
462
- /* EMMC ext clock divider */
463
- hw = clk_hw_register_gate (dev , "emmc_extclk_gate" , "hpll" , 0 ,
464
- scu_g6_base + ASPEED_G6_CLK_SELECTION1 , 15 , 0 ,
465
- & aspeed_g6_clk_lock );
479
+ /* EMMC ext clock */
480
+ hw = clk_hw_register_fixed_factor (dev , "emmc_extclk_hpll_in" , "hpll" ,
481
+ 0 , 1 , 2 );
466
482
if (IS_ERR (hw ))
467
483
return PTR_ERR (hw );
468
- hw = clk_hw_register_divider_table (dev , "emmc_extclk" , "emmc_extclk_gate" , 0 ,
469
- scu_g6_base + ASPEED_G6_CLK_SELECTION1 , 12 , 3 , 0 ,
470
- ast2600_div_table ,
471
- & aspeed_g6_clk_lock );
484
+
485
+ hw = clk_hw_register_mux (dev , "emmc_extclk_mux" ,
486
+ emmc_extclk_parent_names ,
487
+ ARRAY_SIZE (emmc_extclk_parent_names ), 0 ,
488
+ scu_g6_base + ASPEED_G6_CLK_SELECTION1 , 11 , 1 ,
489
+ 0 , & aspeed_g6_clk_lock );
490
+ if (IS_ERR (hw ))
491
+ return PTR_ERR (hw );
492
+
493
+ hw = clk_hw_register_gate (dev , "emmc_extclk_gate" , "emmc_extclk_mux" ,
494
+ 0 , scu_g6_base + ASPEED_G6_CLK_SELECTION1 ,
495
+ 15 , 0 , & aspeed_g6_clk_lock );
496
+ if (IS_ERR (hw ))
497
+ return PTR_ERR (hw );
498
+
499
+ hw = clk_hw_register_divider_table (dev , "emmc_extclk" ,
500
+ "emmc_extclk_gate" , 0 ,
501
+ scu_g6_base +
502
+ ASPEED_G6_CLK_SELECTION1 , 12 ,
503
+ 3 , 0 , ast2600_emmc_extclk_div_table ,
504
+ & aspeed_g6_clk_lock );
472
505
if (IS_ERR (hw ))
473
506
return PTR_ERR (hw );
474
507
aspeed_g6_clk_data -> hws [ASPEED_CLK_EMMC ] = hw ;
0 commit comments