Skip to content

Commit a29ae86

Browse files
xdarklightjbrun3t
authored andcommitted
clk: meson: meson8b: Don't rely on u-boot to init all GP_PLL registers
Not all u-boot versions initialize the HHI_GP_PLL_CNTL[2-5] registers. In that case all HHI_GPLL_PLL_CNTL[1-5] registers are 0x0 and when booting Linux the PLL fails to lock. The initialization sequence from u-boot is: - put the PLL into reset - write 0x59C88000 to HHI_GP_PLL_CNTL2 - write 0xCA463823 to HHI_GP_PLL_CNTL3 - write 0x0286A027 to HHI_GP_PLL_CNTL4 - write 0x00003000 to HHI_GP_PLL_CNTL5 - set M, N, OD and the enable bit - take the PLL out of reset - check if it has locked - disable the PLL In Linux we already initialize M, N, OD, the enable and the reset bits. Also the HHI_GP_PLL_CNTL[2-5] registers with these magic values (the exact meaning is unknown) so the PLL can lock when the vendor u-boot did not initialize these registers yet. Fixes: b882964 ("clk: meson: meson8b: add support for the GP_PLL clock on Meson8m2") Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 16afd70 commit a29ae86

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

drivers/clk/meson/meson8b.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,13 @@ static struct clk_regmap meson8b_mali = {
19181918
},
19191919
};
19201920

1921+
static const struct reg_sequence meson8m2_gp_pll_init_regs[] = {
1922+
{ .reg = HHI_GP_PLL_CNTL2, .def = 0x59c88000 },
1923+
{ .reg = HHI_GP_PLL_CNTL3, .def = 0xca463823 },
1924+
{ .reg = HHI_GP_PLL_CNTL4, .def = 0x0286a027 },
1925+
{ .reg = HHI_GP_PLL_CNTL5, .def = 0x00003000 },
1926+
};
1927+
19211928
static const struct pll_params_table meson8m2_gp_pll_params_table[] = {
19221929
PLL_PARAMS(182, 3),
19231930
{ /* sentinel */ },
@@ -1951,6 +1958,8 @@ static struct clk_regmap meson8m2_gp_pll_dco = {
19511958
.width = 1,
19521959
},
19531960
.table = meson8m2_gp_pll_params_table,
1961+
.init_regs = meson8m2_gp_pll_init_regs,
1962+
.init_count = ARRAY_SIZE(meson8m2_gp_pll_init_regs),
19541963
},
19551964
.hw.init = &(struct clk_init_data){
19561965
.name = "gp_pll_dco",

drivers/clk/meson/meson8b.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
* [0] http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf
2121
*/
2222
#define HHI_GP_PLL_CNTL 0x40 /* 0x10 offset in data sheet */
23+
#define HHI_GP_PLL_CNTL2 0x44 /* 0x11 offset in data sheet */
24+
#define HHI_GP_PLL_CNTL3 0x48 /* 0x12 offset in data sheet */
25+
#define HHI_GP_PLL_CNTL4 0x4C /* 0x13 offset in data sheet */
26+
#define HHI_GP_PLL_CNTL5 0x50 /* 0x14 offset in data sheet */
2327
#define HHI_VIID_CLK_DIV 0x128 /* 0x4a offset in data sheet */
2428
#define HHI_VIID_CLK_CNTL 0x12c /* 0x4b offset in data sheet */
2529
#define HHI_GCLK_MPEG0 0x140 /* 0x50 offset in data sheet */

0 commit comments

Comments
 (0)