|
15 | 15 | #define REG_MSSPLL_POSTDIV_CR 0x10u
|
16 | 16 | #define REG_MSSPLL_SSCG_2_CR 0x2Cu
|
17 | 17 | #define REG_CLOCK_CONFIG_CR 0x08u
|
| 18 | +#define REG_RTC_CLOCK_CR 0x0Cu |
18 | 19 | #define REG_SUBBLK_CLOCK_CR 0x84u
|
19 | 20 | #define REG_SUBBLK_RESET_CR 0x88u
|
20 | 21 |
|
@@ -96,6 +97,17 @@ static const struct clk_div_table mpfs_div_ahb_table[] = {
|
96 | 97 | { 0, 0 }
|
97 | 98 | };
|
98 | 99 |
|
| 100 | +/* |
| 101 | + * The only two supported reference clock frequencies for the PolarFire SoC are |
| 102 | + * 100 and 125 MHz, as the rtc reference is required to be 1 MHz. |
| 103 | + * It therefore only needs to have divider table entries corresponding to |
| 104 | + * divide by 100 and 125. |
| 105 | + */ |
| 106 | +static const struct clk_div_table mpfs_div_rtcref_table[] = { |
| 107 | + { 100, 100 }, { 125, 125 }, |
| 108 | + { 0, 0 } |
| 109 | +}; |
| 110 | + |
99 | 111 | static unsigned long mpfs_clk_msspll_recalc_rate(struct clk_hw *hw, unsigned long prate)
|
100 | 112 | {
|
101 | 113 | struct mpfs_msspll_hw_clock *msspll_hw = to_mpfs_msspll_clk(hw);
|
@@ -234,6 +246,16 @@ static struct mpfs_cfg_hw_clock mpfs_cfg_clks[] = {
|
234 | 246 | REG_CLOCK_CONFIG_CR),
|
235 | 247 | CLK_CFG(CLK_AHB, "clk_ahb", "clk_msspll", 4, 2, mpfs_div_ahb_table, 0,
|
236 | 248 | REG_CLOCK_CONFIG_CR),
|
| 249 | + { |
| 250 | + .cfg.id = CLK_RTCREF, |
| 251 | + .cfg.shift = 0, |
| 252 | + .cfg.width = 12, |
| 253 | + .cfg.table = mpfs_div_rtcref_table, |
| 254 | + .cfg.reg_offset = REG_RTC_CLOCK_CR, |
| 255 | + .cfg.flags = CLK_DIVIDER_ONE_BASED, |
| 256 | + .hw.init = |
| 257 | + CLK_HW_INIT_PARENTS_DATA("clk_rtcref", mpfs_ext_ref, &mpfs_clk_cfg_ops, 0), |
| 258 | + } |
237 | 259 | };
|
238 | 260 |
|
239 | 261 | static int mpfs_clk_register_cfg(struct device *dev, struct mpfs_cfg_hw_clock *cfg_hw,
|
@@ -359,7 +381,7 @@ static struct mpfs_periph_hw_clock mpfs_periph_clks[] = {
|
359 | 381 | CLK_PERIPH(CLK_MAC0, "clk_periph_mac0", PARENT_CLK(AHB), 1, 0),
|
360 | 382 | CLK_PERIPH(CLK_MAC1, "clk_periph_mac1", PARENT_CLK(AHB), 2, 0),
|
361 | 383 | CLK_PERIPH(CLK_MMC, "clk_periph_mmc", PARENT_CLK(AHB), 3, 0),
|
362 |
| - CLK_PERIPH(CLK_TIMER, "clk_periph_timer", PARENT_CLK(AHB), 4, 0), |
| 384 | + CLK_PERIPH(CLK_TIMER, "clk_periph_timer", PARENT_CLK(RTCREF), 4, 0), |
363 | 385 | CLK_PERIPH(CLK_MMUART0, "clk_periph_mmuart0", PARENT_CLK(AHB), 5, CLK_IS_CRITICAL),
|
364 | 386 | CLK_PERIPH(CLK_MMUART1, "clk_periph_mmuart1", PARENT_CLK(AHB), 6, 0),
|
365 | 387 | CLK_PERIPH(CLK_MMUART2, "clk_periph_mmuart2", PARENT_CLK(AHB), 7, 0),
|
|
0 commit comments