Commit 5a4bd506 authored by Linus Torvalds's avatar Linus Torvalds

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
parents c6653f49 10f84de2
...@@ -29,6 +29,7 @@ static const struct mtk_gate mfg_clks[] = { ...@@ -29,6 +29,7 @@ static const struct mtk_gate mfg_clks[] = {
static const struct mtk_clk_desc mfg_desc = { static const struct mtk_clk_desc mfg_desc = {
.clks = mfg_clks, .clks = mfg_clks,
.num_clks = ARRAY_SIZE(mfg_clks), .num_clks = ARRAY_SIZE(mfg_clks),
.need_runtime_pm = true,
}; };
static const struct of_device_id of_match_clk_mt8183_mfg[] = { static const struct of_device_id of_match_clk_mt8183_mfg[] = {
......
...@@ -496,14 +496,16 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev, ...@@ -496,14 +496,16 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
} }
devm_pm_runtime_enable(&pdev->dev); if (mcd->need_runtime_pm) {
/* devm_pm_runtime_enable(&pdev->dev);
* Do a pm_runtime_resume_and_get() to workaround a possible /*
* deadlock between clk_register() and the genpd framework. * Do a pm_runtime_resume_and_get() to workaround a possible
*/ * deadlock between clk_register() and the genpd framework.
r = pm_runtime_resume_and_get(&pdev->dev); */
if (r) r = pm_runtime_resume_and_get(&pdev->dev);
return r; if (r)
return r;
}
/* Calculate how many clk_hw_onecell_data entries to allocate */ /* Calculate how many clk_hw_onecell_data entries to allocate */
num_clks = mcd->num_clks + mcd->num_composite_clks; num_clks = mcd->num_clks + mcd->num_composite_clks;
...@@ -585,7 +587,8 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev, ...@@ -585,7 +587,8 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
goto unregister_clks; goto unregister_clks;
} }
pm_runtime_put(&pdev->dev); if (mcd->need_runtime_pm)
pm_runtime_put(&pdev->dev);
return r; return r;
...@@ -618,7 +621,8 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev, ...@@ -618,7 +621,8 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
if (mcd->shared_io && base) if (mcd->shared_io && base)
iounmap(base); iounmap(base);
pm_runtime_put(&pdev->dev); if (mcd->need_runtime_pm)
pm_runtime_put(&pdev->dev);
return r; return r;
} }
......
...@@ -237,6 +237,8 @@ struct mtk_clk_desc { ...@@ -237,6 +237,8 @@ struct mtk_clk_desc {
int (*clk_notifier_func)(struct device *dev, struct clk *clk); int (*clk_notifier_func)(struct device *dev, struct clk *clk);
unsigned int mfg_clk_idx; unsigned int mfg_clk_idx;
bool need_runtime_pm;
}; };
int mtk_clk_pdev_probe(struct platform_device *pdev); int mtk_clk_pdev_probe(struct platform_device *pdev);
......
...@@ -70,7 +70,6 @@ static struct clk_alpha_pll ipq_pll_stromer_plus = { ...@@ -70,7 +70,6 @@ static struct clk_alpha_pll ipq_pll_stromer_plus = {
static const struct alpha_pll_config ipq5018_pll_config = { static const struct alpha_pll_config ipq5018_pll_config = {
.l = 0x2a, .l = 0x2a,
.config_ctl_val = 0x4001075b, .config_ctl_val = 0x4001075b,
.config_ctl_hi_val = 0x304,
.main_output_mask = BIT(0), .main_output_mask = BIT(0),
.aux_output_mask = BIT(1), .aux_output_mask = BIT(1),
.early_output_mask = BIT(3), .early_output_mask = BIT(3),
...@@ -84,7 +83,6 @@ static const struct alpha_pll_config ipq5018_pll_config = { ...@@ -84,7 +83,6 @@ static const struct alpha_pll_config ipq5018_pll_config = {
static const struct alpha_pll_config ipq5332_pll_config = { static const struct alpha_pll_config ipq5332_pll_config = {
.l = 0x2d, .l = 0x2d,
.config_ctl_val = 0x4001075b, .config_ctl_val = 0x4001075b,
.config_ctl_hi_val = 0x304,
.main_output_mask = BIT(0), .main_output_mask = BIT(0),
.aux_output_mask = BIT(1), .aux_output_mask = BIT(1),
.early_output_mask = BIT(3), .early_output_mask = BIT(3),
......
...@@ -2574,6 +2574,9 @@ static int clk_alpha_pll_stromer_plus_set_rate(struct clk_hw *hw, ...@@ -2574,6 +2574,9 @@ static int clk_alpha_pll_stromer_plus_set_rate(struct clk_hw *hw,
regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL_U(pll), regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL_U(pll),
a >> ALPHA_BITWIDTH); a >> ALPHA_BITWIDTH);
regmap_update_bits(pll->clkr.regmap, PLL_USER_CTL(pll),
PLL_ALPHA_EN, PLL_ALPHA_EN);
regmap_write(pll->clkr.regmap, PLL_MODE(pll), PLL_BYPASSNL); regmap_write(pll->clkr.regmap, PLL_MODE(pll), PLL_BYPASSNL);
/* Wait five micro seconds or more */ /* Wait five micro seconds or more */
......
...@@ -2140,9 +2140,10 @@ static struct clk_rcg2 pcnoc_bfdcd_clk_src = { ...@@ -2140,9 +2140,10 @@ static struct clk_rcg2 pcnoc_bfdcd_clk_src = {
static struct clk_branch gcc_crypto_axi_clk = { static struct clk_branch gcc_crypto_axi_clk = {
.halt_reg = 0x16010, .halt_reg = 0x16010,
.halt_check = BRANCH_HALT_VOTED,
.clkr = { .clkr = {
.enable_reg = 0x16010, .enable_reg = 0xb004,
.enable_mask = BIT(0), .enable_mask = BIT(15),
.hw.init = &(const struct clk_init_data) { .hw.init = &(const struct clk_init_data) {
.name = "gcc_crypto_axi_clk", .name = "gcc_crypto_axi_clk",
.parent_hws = (const struct clk_hw *[]) { .parent_hws = (const struct clk_hw *[]) {
...@@ -2156,9 +2157,10 @@ static struct clk_branch gcc_crypto_axi_clk = { ...@@ -2156,9 +2157,10 @@ static struct clk_branch gcc_crypto_axi_clk = {
static struct clk_branch gcc_crypto_ahb_clk = { static struct clk_branch gcc_crypto_ahb_clk = {
.halt_reg = 0x16014, .halt_reg = 0x16014,
.halt_check = BRANCH_HALT_VOTED,
.clkr = { .clkr = {
.enable_reg = 0x16014, .enable_reg = 0xb004,
.enable_mask = BIT(0), .enable_mask = BIT(16),
.hw.init = &(const struct clk_init_data) { .hw.init = &(const struct clk_init_data) {
.name = "gcc_crypto_ahb_clk", .name = "gcc_crypto_ahb_clk",
.parent_hws = (const struct clk_hw *[]) { .parent_hws = (const struct clk_hw *[]) {
......
...@@ -100,8 +100,8 @@ static struct clk_alpha_pll gpll6 = { ...@@ -100,8 +100,8 @@ static struct clk_alpha_pll gpll6 = {
.enable_mask = BIT(6), .enable_mask = BIT(6),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gpll6", .name = "gpll6",
.parent_hws = (const struct clk_hw*[]){ .parent_data = &(const struct clk_parent_data){
&gpll0.clkr.hw, .fw_name = "bi_tcxo",
}, },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_fixed_fabia_ops, .ops = &clk_alpha_pll_fixed_fabia_ops,
...@@ -124,7 +124,7 @@ static struct clk_alpha_pll_postdiv gpll6_out_even = { ...@@ -124,7 +124,7 @@ static struct clk_alpha_pll_postdiv gpll6_out_even = {
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll6_out_even", .name = "gpll6_out_even",
.parent_hws = (const struct clk_hw*[]){ .parent_hws = (const struct clk_hw*[]){
&gpll0.clkr.hw, &gpll6.clkr.hw,
}, },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_postdiv_fabia_ops, .ops = &clk_alpha_pll_postdiv_fabia_ops,
...@@ -139,8 +139,8 @@ static struct clk_alpha_pll gpll7 = { ...@@ -139,8 +139,8 @@ static struct clk_alpha_pll gpll7 = {
.enable_mask = BIT(7), .enable_mask = BIT(7),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gpll7", .name = "gpll7",
.parent_hws = (const struct clk_hw*[]){ .parent_data = &(const struct clk_parent_data){
&gpll0.clkr.hw, .fw_name = "bi_tcxo",
}, },
.num_parents = 1, .num_parents = 1,
.ops = &clk_alpha_pll_fixed_fabia_ops, .ops = &clk_alpha_pll_fixed_fabia_ops,
......
...@@ -132,7 +132,6 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, ...@@ -132,7 +132,6 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev,
for (i = 0; i < desc->hw_clks->num ; i++) { for (i = 0; i < desc->hw_clks->num ; i++) {
struct clk_hw *hw = desc->hw_clks->hws[i]; struct clk_hw *hw = desc->hw_clks->hws[i];
struct ccu_common *common = hw_to_ccu_common(hw);
const char *name; const char *name;
if (!hw) if (!hw)
...@@ -147,14 +146,21 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev, ...@@ -147,14 +146,21 @@ static int sunxi_ccu_probe(struct sunxi_ccu *ccu, struct device *dev,
pr_err("Couldn't register clock %d - %s\n", i, name); pr_err("Couldn't register clock %d - %s\n", i, name);
goto err_clk_unreg; goto err_clk_unreg;
} }
}
for (i = 0; i < desc->num_ccu_clks; i++) {
struct ccu_common *cclk = desc->ccu_clks[i];
if (!cclk)
continue;
if (common->max_rate) if (cclk->max_rate)
clk_hw_set_rate_range(hw, common->min_rate, clk_hw_set_rate_range(&cclk->hw, cclk->min_rate,
common->max_rate); cclk->max_rate);
else else
WARN(common->min_rate, WARN(cclk->min_rate,
"No max_rate, ignoring min_rate of clock %d - %s\n", "No max_rate, ignoring min_rate of clock %d - %s\n",
i, name); i, clk_hw_get_name(&cclk->hw));
} }
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment