Skip to content

Commit 040e165

Browse files
xdarklightjbrun3t
authored andcommitted
clk: meson: meson8b: Initialize the HDMI PLL registers
Add the reg_sequence to initialize the HDMI PLL with the settings for a video mode that doesn't require PLL internal clock doubling. These settings are taken from the 3.10 vendor kernel's driver for the 2970MHz PLL setting used for the 1080P video mode. This puts the PLL into a defined state and the Linux kernel can take over. While not all bits for this PLL are implemented using these "defaults" and then applying M, N and FRAC seems to work fine. Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bb85573 commit 040e165

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

drivers/clk/meson/meson8b.c

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,35 @@ static struct clk_regmap meson8b_fixed_pll = {
118118
},
119119
};
120120

121+
static struct clk_fixed_factor hdmi_pll_dco_in = {
122+
.mult = 2,
123+
.div = 1,
124+
.hw.init = &(struct clk_init_data){
125+
.name = "hdmi_pll_dco_in",
126+
.ops = &clk_fixed_factor_ops,
127+
.parent_data = &(const struct clk_parent_data) {
128+
.fw_name = "xtal",
129+
.index = -1,
130+
},
131+
.num_parents = 1,
132+
},
133+
};
134+
135+
/*
136+
* Taken from the vendor driver for the 2970/2975MHz (both only differ in the
137+
* FRAC part in HHI_VID_PLL_CNTL2) where these values are identical for Meson8,
138+
* Meson8b and Meson8m2. This doubles the input (or output - it's not clear
139+
* which one but the result is the same) clock. The vendor driver additionally
140+
* has the following comment about: "optimise HPLL VCO 2.97GHz performance".
141+
*/
142+
static const struct reg_sequence meson8b_hdmi_pll_init_regs[] = {
143+
{ .reg = HHI_VID_PLL_CNTL2, .def = 0x69c84000 },
144+
{ .reg = HHI_VID_PLL_CNTL3, .def = 0x8a46c023 },
145+
{ .reg = HHI_VID_PLL_CNTL4, .def = 0x4123b100 },
146+
{ .reg = HHI_VID_PLL_CNTL5, .def = 0x00012385 },
147+
{ .reg = HHI_VID2_PLL_CNTL2, .def = 0x0430a800 },
148+
};
149+
121150
static const struct pll_params_table hdmi_pll_params_table[] = {
122151
PLL_PARAMS(40, 1),
123152
PLL_PARAMS(42, 1),
@@ -172,15 +201,15 @@ static struct clk_regmap meson8b_hdmi_pll_dco = {
172201
.width = 1,
173202
},
174203
.table = hdmi_pll_params_table,
204+
.init_regs = meson8b_hdmi_pll_init_regs,
205+
.init_count = ARRAY_SIZE(meson8b_hdmi_pll_init_regs),
175206
},
176207
.hw.init = &(struct clk_init_data){
177208
/* sometimes also called "HPLL" or "HPLL PLL" */
178209
.name = "hdmi_pll_dco",
179210
.ops = &meson_clk_pll_ro_ops,
180-
.parent_data = &(const struct clk_parent_data) {
181-
.fw_name = "xtal",
182-
.name = "xtal",
183-
.index = -1,
211+
.parent_hws = (const struct clk_hw *[]) {
212+
&hdmi_pll_dco_in.hw
184213
},
185214
.num_parents = 1,
186215
},
@@ -2945,6 +2974,7 @@ static struct clk_hw_onecell_data meson8_hw_onecell_data = {
29452974
[CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
29462975
[CLKID_CTS_I958] = &meson8b_cts_i958.hw,
29472976
[CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw,
2977+
[CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw,
29482978
[CLK_NR_CLKS] = NULL,
29492979
},
29502980
.num = CLK_NR_CLKS,
@@ -3163,6 +3193,7 @@ static struct clk_hw_onecell_data meson8b_hw_onecell_data = {
31633193
[CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
31643194
[CLKID_CTS_I958] = &meson8b_cts_i958.hw,
31653195
[CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw,
3196+
[CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw,
31663197
[CLK_NR_CLKS] = NULL,
31673198
},
31683199
.num = CLK_NR_CLKS,
@@ -3383,6 +3414,7 @@ static struct clk_hw_onecell_data meson8m2_hw_onecell_data = {
33833414
[CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw,
33843415
[CLKID_CTS_I958] = &meson8b_cts_i958.hw,
33853416
[CLKID_VID_PLL_LVDS_EN] = &meson8b_vid_pll_lvds_en.hw,
3417+
[CLKID_HDMI_PLL_DCO_IN] = &hdmi_pll_dco_in.hw,
33863418
[CLK_NR_CLKS] = NULL,
33873419
},
33883420
.num = CLK_NR_CLKS,

drivers/clk/meson/meson8b.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@
5151
#define HHI_SYS_PLL_CNTL 0x300 /* 0xc0 offset in data sheet */
5252
#define HHI_VID_PLL_CNTL 0x320 /* 0xc8 offset in data sheet */
5353
#define HHI_VID_PLL_CNTL2 0x324 /* 0xc9 offset in data sheet */
54+
#define HHI_VID_PLL_CNTL3 0x328 /* 0xca offset in data sheet */
55+
#define HHI_VID_PLL_CNTL4 0x32c /* 0xcb offset in data sheet */
56+
#define HHI_VID_PLL_CNTL5 0x330 /* 0xcc offset in data sheet */
57+
#define HHI_VID_PLL_CNTL6 0x334 /* 0xcd offset in data sheet */
58+
#define HHI_VID2_PLL_CNTL 0x380 /* 0xe0 offset in data sheet */
59+
#define HHI_VID2_PLL_CNTL2 0x384 /* 0xe1 offset in data sheet */
60+
#define HHI_VID2_PLL_CNTL3 0x388 /* 0xe2 offset in data sheet */
61+
#define HHI_VID2_PLL_CNTL4 0x38c /* 0xe3 offset in data sheet */
62+
#define HHI_VID2_PLL_CNTL5 0x390 /* 0xe4 offset in data sheet */
63+
#define HHI_VID2_PLL_CNTL6 0x394 /* 0xe5 offset in data sheet */
5464

5565
/*
5666
* MPLL register offeset taken from the S905 datasheet. Vendor kernel source
@@ -173,8 +183,9 @@
173183
#define CLKID_VCLK_EN 214
174184
#define CLKID_VCLK2_EN 215
175185
#define CLKID_VID_PLL_LVDS_EN 216
186+
#define CLKID_HDMI_PLL_DCO_IN 217
176187

177-
#define CLK_NR_CLKS 217
188+
#define CLK_NR_CLKS 218
178189

179190
/*
180191
* include the CLKID and RESETID that have

0 commit comments

Comments
 (0)