Skip to content

Commit 9ea9943

Browse files
njhollinghurstpelwell
authored andcommitted
clk: rp1: Bug fix! Set correct value for PLL_CS_REFDIV_MASK
In fact the register field has 6 bits, but we only ever set it to unity. Due to a typo we were setting it to BIT(1) == 2, causing PLLs to run at half the desired rate. Signed-off-by: Nick Hollinghurst <[email protected]>
1 parent dd4254b commit 9ea9943

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/clk/clk-rp1.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@
234234
#define PLL_SEC_DIV_MASK GENMASK(12, 8)
235235

236236
#define PLL_CS_LOCK BIT(31)
237-
#define PLL_CS_REFDIV_MASK BIT(1)
237+
#define PLL_CS_REFDIV_MASK GENMASK(5, 0)
238+
#define PLL_CS_REFDIV_UNITY FIELD_PREP(PLL_CS_REFDIV_MASK, 1)
238239

239240
#define PLL_PWR_PD BIT(0)
240241
#define PLL_PWR_DACPD BIT(1)
@@ -413,7 +414,7 @@ static int rp1_pll_core_on(struct clk_hw *hw)
413414
clockman_write(clockman, data->pwr_reg, PLL_PWR_MASK);
414415
clockman_write(clockman, data->fbdiv_int_reg, 20);
415416
clockman_write(clockman, data->fbdiv_frac_reg, 0);
416-
clockman_write(clockman, data->cs_reg, PLL_CS_REFDIV_MASK);
417+
clockman_write(clockman, data->cs_reg, PLL_CS_REFDIV_UNITY);
417418
}
418419

419420
/* Come out of reset. */
@@ -505,7 +506,7 @@ static int rp1_pll_core_set_rate(struct clk_hw *hw,
505506
/* Don't need to divide ref unless parent_rate > (output freq / 16) */
506507
clockman_write(clockman, data->cs_reg,
507508
clockman_read(clockman, data->cs_reg) |
508-
PLL_CS_REFDIV_MASK);
509+
PLL_CS_REFDIV_UNITY);
509510
spin_unlock(&clockman->regs_lock);
510511

511512
return 0;

0 commit comments

Comments
 (0)