Skip to content

Commit c7ef7fb

Browse files
Kathiravan Tandersson
authored andcommitted
clk: qcom: apss-ipq-pll: add support for IPQ5332
IPQ5332 APSS PLL is of type Stromer Plus. Add support for the same. To configure the stromer plus PLL separate API (clock_stromer_pll_configure) to be used. To achieve this, introduce the new member pll_type in device data structure and call the appropriate function based on this. Reviewed-by: Konrad Dybcio <[email protected]> Signed-off-by: Kathiravan T <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1022627 commit c7ef7fb

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

drivers/clk/qcom/apss-ipq-pll.c

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ static const u8 ipq_pll_offsets[][PLL_OFF_MAX_REGS] = {
2424
[PLL_OFF_TEST_CTL] = 0x30,
2525
[PLL_OFF_TEST_CTL_U] = 0x34,
2626
},
27+
[CLK_ALPHA_PLL_TYPE_STROMER_PLUS] = {
28+
[PLL_OFF_L_VAL] = 0x08,
29+
[PLL_OFF_ALPHA_VAL] = 0x10,
30+
[PLL_OFF_ALPHA_VAL_U] = 0x14,
31+
[PLL_OFF_USER_CTL] = 0x18,
32+
[PLL_OFF_USER_CTL_U] = 0x1c,
33+
[PLL_OFF_CONFIG_CTL] = 0x20,
34+
[PLL_OFF_STATUS] = 0x28,
35+
[PLL_OFF_TEST_CTL] = 0x30,
36+
[PLL_OFF_TEST_CTL_U] = 0x34,
37+
},
2738
};
2839

2940
static struct clk_alpha_pll ipq_pll_huayra = {
@@ -44,6 +55,38 @@ static struct clk_alpha_pll ipq_pll_huayra = {
4455
},
4556
};
4657

58+
static struct clk_alpha_pll ipq_pll_stromer_plus = {
59+
.offset = 0x0,
60+
.regs = ipq_pll_offsets[CLK_ALPHA_PLL_TYPE_STROMER_PLUS],
61+
.flags = SUPPORTS_DYNAMIC_UPDATE,
62+
.clkr = {
63+
.enable_reg = 0x0,
64+
.enable_mask = BIT(0),
65+
.hw.init = &(struct clk_init_data){
66+
.name = "a53pll",
67+
.parent_data = &(const struct clk_parent_data) {
68+
.fw_name = "xo",
69+
},
70+
.num_parents = 1,
71+
.ops = &clk_alpha_pll_stromer_ops,
72+
},
73+
},
74+
};
75+
76+
static const struct alpha_pll_config ipq5332_pll_config = {
77+
.l = 0x3e,
78+
.config_ctl_val = 0x4001075b,
79+
.config_ctl_hi_val = 0x304,
80+
.main_output_mask = BIT(0),
81+
.aux_output_mask = BIT(1),
82+
.early_output_mask = BIT(3),
83+
.alpha_en_mask = BIT(24),
84+
.status_val = 0x3,
85+
.status_mask = GENMASK(10, 8),
86+
.lock_det = BIT(2),
87+
.test_ctl_hi_val = 0x00400003,
88+
};
89+
4790
static const struct alpha_pll_config ipq6018_pll_config = {
4891
.l = 0x37,
4992
.config_ctl_val = 0x240d4828,
@@ -69,16 +112,25 @@ static const struct alpha_pll_config ipq8074_pll_config = {
69112
};
70113

71114
struct apss_pll_data {
115+
int pll_type;
72116
struct clk_alpha_pll *pll;
73117
const struct alpha_pll_config *pll_config;
74118
};
75119

120+
static struct apss_pll_data ipq5332_pll_data = {
121+
.pll_type = CLK_ALPHA_PLL_TYPE_STROMER_PLUS,
122+
.pll = &ipq_pll_stromer_plus,
123+
.pll_config = &ipq5332_pll_config,
124+
};
125+
76126
static struct apss_pll_data ipq8074_pll_data = {
127+
.pll_type = CLK_ALPHA_PLL_TYPE_HUAYRA,
77128
.pll = &ipq_pll_huayra,
78129
.pll_config = &ipq8074_pll_config,
79130
};
80131

81132
static struct apss_pll_data ipq6018_pll_data = {
133+
.pll_type = CLK_ALPHA_PLL_TYPE_HUAYRA,
82134
.pll = &ipq_pll_huayra,
83135
.pll_config = &ipq6018_pll_config,
84136
};
@@ -111,7 +163,10 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
111163
if (!data)
112164
return -ENODEV;
113165

114-
clk_alpha_pll_configure(data->pll, regmap, data->pll_config);
166+
if (data->pll_type == CLK_ALPHA_PLL_TYPE_HUAYRA)
167+
clk_alpha_pll_configure(data->pll, regmap, data->pll_config);
168+
else if (data->pll_type == CLK_ALPHA_PLL_TYPE_STROMER_PLUS)
169+
clk_stromer_pll_configure(data->pll, regmap, data->pll_config);
115170

116171
ret = devm_clk_register_regmap(dev, &data->pll->clkr);
117172
if (ret)
@@ -122,6 +177,7 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
122177
}
123178

124179
static const struct of_device_id apss_ipq_pll_match_table[] = {
180+
{ .compatible = "qcom,ipq5332-a53pll", .data = &ipq5332_pll_data },
125181
{ .compatible = "qcom,ipq6018-a53pll", .data = &ipq6018_pll_data },
126182
{ .compatible = "qcom,ipq8074-a53pll", .data = &ipq8074_pll_data },
127183
{ }

0 commit comments

Comments
 (0)