Skip to content

Commit d4d74e4

Browse files
konradybcioandersson
authored andcommitted
clk: qcom: clk-alpha-pll: Add HUAYRA_2290 support
Commit 134b55b ("clk: qcom: support Huayra type Alpha PLL") introduced an entry to the alpha offsets array, but diving into QCM2290 downstream and some documentation, it turned out that the name Huayra apparently has been used quite liberally across many chips, even with noticeably different hardware. Introduce another set of offsets and a new configure function for the Huayra PLL found on QCM2290. This is required e.g. for the consumers of GPUCC_PLL0 to properly start. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20240606-topic-rb1_gpu-v4-2-4bc0c19da4af@linaro.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent ea5594a commit d4d74e4

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

drivers/clk/qcom/clk-alpha-pll.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = {
9393
[PLL_OFF_TEST_CTL] = 0x30,
9494
[PLL_OFF_TEST_CTL_U] = 0x34,
9595
},
96+
[CLK_ALPHA_PLL_TYPE_HUAYRA_2290] = {
97+
[PLL_OFF_L_VAL] = 0x04,
98+
[PLL_OFF_ALPHA_VAL] = 0x08,
99+
[PLL_OFF_USER_CTL] = 0x0c,
100+
[PLL_OFF_CONFIG_CTL] = 0x10,
101+
[PLL_OFF_CONFIG_CTL_U] = 0x14,
102+
[PLL_OFF_CONFIG_CTL_U1] = 0x18,
103+
[PLL_OFF_TEST_CTL] = 0x1c,
104+
[PLL_OFF_TEST_CTL_U] = 0x20,
105+
[PLL_OFF_TEST_CTL_U1] = 0x24,
106+
[PLL_OFF_OPMODE] = 0x28,
107+
[PLL_OFF_STATUS] = 0x38,
108+
},
96109
[CLK_ALPHA_PLL_TYPE_BRAMMO] = {
97110
[PLL_OFF_L_VAL] = 0x04,
98111
[PLL_OFF_ALPHA_VAL] = 0x08,
@@ -788,6 +801,40 @@ static long clk_alpha_pll_round_rate(struct clk_hw *hw, unsigned long rate,
788801
return clamp(rate, min_freq, max_freq);
789802
}
790803

804+
void clk_huayra_2290_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
805+
const struct alpha_pll_config *config)
806+
{
807+
u32 val;
808+
809+
clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL(pll), config->config_ctl_val);
810+
clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL_U(pll), config->config_ctl_hi_val);
811+
clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL_U1(pll), config->config_ctl_hi1_val);
812+
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL(pll), config->test_ctl_val);
813+
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL_U(pll), config->test_ctl_hi_val);
814+
clk_alpha_pll_write_config(regmap, PLL_TEST_CTL_U1(pll), config->test_ctl_hi1_val);
815+
clk_alpha_pll_write_config(regmap, PLL_L_VAL(pll), config->l);
816+
clk_alpha_pll_write_config(regmap, PLL_ALPHA_VAL(pll), config->alpha);
817+
clk_alpha_pll_write_config(regmap, PLL_USER_CTL(pll), config->user_ctl_val);
818+
819+
/* Set PLL_BYPASSNL */
820+
regmap_update_bits(regmap, PLL_MODE(pll), PLL_BYPASSNL, PLL_BYPASSNL);
821+
regmap_read(regmap, PLL_MODE(pll), &val);
822+
823+
/* Wait 5 us between setting BYPASS and deasserting reset */
824+
udelay(5);
825+
826+
/* Take PLL out from reset state */
827+
regmap_update_bits(regmap, PLL_MODE(pll), PLL_RESET_N, PLL_RESET_N);
828+
regmap_read(regmap, PLL_MODE(pll), &val);
829+
830+
/* Wait 50us for PLL_LOCK_DET bit to go high */
831+
usleep_range(50, 55);
832+
833+
/* Enable PLL output */
834+
regmap_update_bits(regmap, PLL_MODE(pll), PLL_OUTCTRL, PLL_OUTCTRL);
835+
}
836+
EXPORT_SYMBOL_GPL(clk_huayra_2290_pll_configure);
837+
791838
static unsigned long
792839
alpha_huayra_pll_calc_rate(u64 prate, u32 l, u32 a)
793840
{

drivers/clk/qcom/clk-alpha-pll.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum {
1616
CLK_ALPHA_PLL_TYPE_DEFAULT,
1717
CLK_ALPHA_PLL_TYPE_HUAYRA,
1818
CLK_ALPHA_PLL_TYPE_HUAYRA_APSS,
19+
CLK_ALPHA_PLL_TYPE_HUAYRA_2290,
1920
CLK_ALPHA_PLL_TYPE_BRAMMO,
2021
CLK_ALPHA_PLL_TYPE_FABIA,
2122
CLK_ALPHA_PLL_TYPE_TRION,
@@ -194,6 +195,8 @@ extern const struct clk_ops clk_alpha_pll_rivian_evo_ops;
194195

195196
void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
196197
const struct alpha_pll_config *config);
198+
void clk_huayra_2290_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
199+
const struct alpha_pll_config *config);
197200
void clk_fabia_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
198201
const struct alpha_pll_config *config);
199202
void clk_trion_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,

0 commit comments

Comments
 (0)