Skip to content

Commit 5a4bd50

Browse files
committed
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk fixes from Stephen Boyd: "A set of clk fixes for the Qualcomm, Mediatek, and Allwinner drivers: - Fix the Qualcomm Stromer Plus PLL set_rate() clk_op to explicitly set the alpha enable bit and not set bits that don't exist - Mark Qualcomm IPQ9574 crypto clks as voted to avoid stuck clk warnings - Fix the parent of some PLLs on Qualcomm sm6530 so their rate is correct - Fix the min/max rate clamping logic in the Allwinner driver that got broken in v6.9 - Limit runtime PM enabling in the Mediatek driver to only mt8183-mfgcfg so that system wide resume doesn't break on other Mediatek SoCs" * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: mediatek: mt8183: Only enable runtime PM on mt8183-mfgcfg clk: sunxi-ng: common: Don't call hw_to_ccu_common on hw without common clk: qcom: gcc-ipq9574: Add BRANCH_HALT_VOTED flag clk: qcom: apss-ipq-pll: remove 'config_ctl_hi_val' from Stromer pll configs clk: qcom: clk-alpha-pll: set ALPHA_EN bit for Stromer Plus PLLs clk: qcom: gcc-sm6350: Fix gpll6* & gpll7 parents
2 parents c6653f4 + 10f84de commit 5a4bd50

File tree

8 files changed

+43
-27
lines changed

8 files changed

+43
-27
lines changed

drivers/clk/mediatek/clk-mt8183-mfgcfg.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ static const struct mtk_gate mfg_clks[] = {
2929
static const struct mtk_clk_desc mfg_desc = {
3030
.clks = mfg_clks,
3131
.num_clks = ARRAY_SIZE(mfg_clks),
32+
.need_runtime_pm = true,
3233
};
3334

3435
static const struct of_device_id of_match_clk_mt8183_mfg[] = {

drivers/clk/mediatek/clk-mtk.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,16 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
496496
}
497497

498498

499-
devm_pm_runtime_enable(&pdev->dev);
500-
/*
501-
* Do a pm_runtime_resume_and_get() to workaround a possible
502-
* deadlock between clk_register() and the genpd framework.
503-
*/
504-
r = pm_runtime_resume_and_get(&pdev->dev);
505-
if (r)
506-
return r;
499+
if (mcd->need_runtime_pm) {
500+
devm_pm_runtime_enable(&pdev->dev);
501+
/*
502+
* Do a pm_runtime_resume_and_get() to workaround a possible
503+
* deadlock between clk_register() and the genpd framework.
504+
*/
505+
r = pm_runtime_resume_and_get(&pdev->dev);
506+
if (r)
507+
return r;
508+
}
507509

508510
/* Calculate how many clk_hw_onecell_data entries to allocate */
509511
num_clks = mcd->num_clks + mcd->num_composite_clks;
@@ -585,7 +587,8 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
585587
goto unregister_clks;
586588
}
587589

588-
pm_runtime_put(&pdev->dev);
590+
if (mcd->need_runtime_pm)
591+
pm_runtime_put(&pdev->dev);
589592

590593
return r;
591594

@@ -618,7 +621,8 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
618621
if (mcd->shared_io && base)
619622
iounmap(base);
620623

621-
pm_runtime_put(&pdev->dev);
624+
if (mcd->need_runtime_pm)
625+
pm_runtime_put(&pdev->dev);
622626
return r;
623627
}
624628

drivers/clk/mediatek/clk-mtk.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ struct mtk_clk_desc {
237237

238238
int (*clk_notifier_func)(struct device *dev, struct clk *clk);
239239
unsigned int mfg_clk_idx;
240+
241+
bool need_runtime_pm;
240242
};
241243

242244
int mtk_clk_pdev_probe(struct platform_device *pdev);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ static struct clk_alpha_pll ipq_pll_stromer_plus = {
7070
static const struct alpha_pll_config ipq5018_pll_config = {
7171
.l = 0x2a,
7272
.config_ctl_val = 0x4001075b,
73-
.config_ctl_hi_val = 0x304,
7473
.main_output_mask = BIT(0),
7574
.aux_output_mask = BIT(1),
7675
.early_output_mask = BIT(3),
@@ -84,7 +83,6 @@ static const struct alpha_pll_config ipq5018_pll_config = {
8483
static const struct alpha_pll_config ipq5332_pll_config = {
8584
.l = 0x2d,
8685
.config_ctl_val = 0x4001075b,
87-
.config_ctl_hi_val = 0x304,
8886
.main_output_mask = BIT(0),
8987
.aux_output_mask = BIT(1),
9088
.early_output_mask = BIT(3),

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,6 +2574,9 @@ static int clk_alpha_pll_stromer_plus_set_rate(struct clk_hw *hw,
25742574
regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL_U(pll),
25752575
a >> ALPHA_BITWIDTH);
25762576

2577+
regmap_update_bits(pll->clkr.regmap, PLL_USER_CTL(pll),
2578+
PLL_ALPHA_EN, PLL_ALPHA_EN);
2579+
25772580
regmap_write(pll->clkr.regmap, PLL_MODE(pll), PLL_BYPASSNL);
25782581

25792582
/* Wait five micro seconds or more */

drivers/clk/qcom/gcc-ipq9574.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,9 +2140,10 @@ static struct clk_rcg2 pcnoc_bfdcd_clk_src = {
21402140

21412141
static struct clk_branch gcc_crypto_axi_clk = {
21422142
.halt_reg = 0x16010,
2143+
.halt_check = BRANCH_HALT_VOTED,
21432144
.clkr = {
2144-
.enable_reg = 0x16010,
2145-
.enable_mask = BIT(0),
2145+
.enable_reg = 0xb004,
2146+
.enable_mask = BIT(15),
21462147
.hw.init = &(const struct clk_init_data) {
21472148
.name = "gcc_crypto_axi_clk",
21482149
.parent_hws = (const struct clk_hw *[]) {
@@ -2156,9 +2157,10 @@ static struct clk_branch gcc_crypto_axi_clk = {
21562157

21572158
static struct clk_branch gcc_crypto_ahb_clk = {
21582159
.halt_reg = 0x16014,
2160+
.halt_check = BRANCH_HALT_VOTED,
21592161
.clkr = {
2160-
.enable_reg = 0x16014,
2161-
.enable_mask = BIT(0),
2162+
.enable_reg = 0xb004,
2163+
.enable_mask = BIT(16),
21622164
.hw.init = &(const struct clk_init_data) {
21632165
.name = "gcc_crypto_ahb_clk",
21642166
.parent_hws = (const struct clk_hw *[]) {

drivers/clk/qcom/gcc-sm6350.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ static struct clk_alpha_pll gpll6 = {
100100
.enable_mask = BIT(6),
101101
.hw.init = &(struct clk_init_data){
102102
.name = "gpll6",
103-
.parent_hws = (const struct clk_hw*[]){
104-
&gpll0.clkr.hw,
103+
.parent_data = &(const struct clk_parent_data){
104+
.fw_name = "bi_tcxo",
105105
},
106106
.num_parents = 1,
107107
.ops = &clk_alpha_pll_fixed_fabia_ops,
@@ -124,7 +124,7 @@ static struct clk_alpha_pll_postdiv gpll6_out_even = {
124124
.clkr.hw.init = &(struct clk_init_data){
125125
.name = "gpll6_out_even",
126126
.parent_hws = (const struct clk_hw*[]){
127-
&gpll0.clkr.hw,
127+
&gpll6.clkr.hw,
128128
},
129129
.num_parents = 1,
130130
.ops = &clk_alpha_pll_postdiv_fabia_ops,
@@ -139,8 +139,8 @@ static struct clk_alpha_pll gpll7 = {
139139
.enable_mask = BIT(7),
140140
.hw.init = &(struct clk_init_data){
141141
.name = "gpll7",
142-
.parent_hws = (const struct clk_hw*[]){
143-
&gpll0.clkr.hw,
142+
.parent_data = &(const struct clk_parent_data){
143+
.fw_name = "bi_tcxo",
144144
},
145145
.num_parents = 1,
146146
.ops = &clk_alpha_pll_fixed_fabia_ops,

drivers/clk/sunxi-ng/ccu_common.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev,
132132

133133
for (i = 0; i < desc->hw_clks->num ; i++) {
134134
struct clk_hw *hw = desc->hw_clks->hws[i];
135-
struct ccu_common *common = hw_to_ccu_common(hw);
136135
const char *name;
137136

138137
if (!hw)
@@ -147,14 +146,21 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev,
147146
pr_err("Couldn't register clock %d - %s\n", i, name);
148147
goto err_clk_unreg;
149148
}
149+
}
150+
151+
for (i = 0; i < desc->num_ccu_clks; i++) {
152+
struct ccu_common *cclk = desc->ccu_clks[i];
153+
154+
if (!cclk)
155+
continue;
150156

151-
if (common->max_rate)
152-
clk_hw_set_rate_range(hw, common->min_rate,
153-
common->max_rate);
157+
if (cclk->max_rate)
158+
clk_hw_set_rate_range(&cclk->hw, cclk->min_rate,
159+
cclk->max_rate);
154160
else
155-
WARN(common->min_rate,
161+
WARN(cclk->min_rate,
156162
"No max_rate, ignoring min_rate of clock %d - %s\n",
157-
i, name);
163+
i, clk_hw_get_name(&cclk->hw));
158164
}
159165

160166
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,

0 commit comments

Comments
 (0)