Skip to content

Commit 2acdaf5

Browse files
committed
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk driver fixes from Stephen Boyd: - Fix qcom mux logic to look at the proper parent table member. Luckily this clk type isn't very common. - Don't kill clks on qcom systems that use Trion PLLs that are enabled out of the bootloader. We will simply skip programming the PLL rate if it's already done. - Use the proper clk_ops for the qcom sm6125 ICE clks. - Use module_platform_driver() in i.MX as it can be a module. - Fix a UAF in the versatile clk driver on an error path. * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: versatile: clk-icst: use after free on error path clk: qcom: sm6125-gcc: Swap ops of ice and apps on sdcc1 clk: imx: use module_platform_driver clk: qcom: clk-alpha-pll: Don't reconfigure running Trion clk: qcom: regmap-mux: fix parent clock lookup
2 parents a84e0b3 + 2d4fcc5 commit 2acdaf5

File tree

8 files changed

+29
-6
lines changed

8 files changed

+29
-6
lines changed

drivers/clk/imx/clk-imx8qxp-lpcg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = {
370370
.probe = imx8qxp_lpcg_clk_probe,
371371
};
372372

373-
builtin_platform_driver(imx8qxp_lpcg_clk_driver);
373+
module_platform_driver(imx8qxp_lpcg_clk_driver);
374374

375375
MODULE_AUTHOR("Aisheng Dong <[email protected]>");
376376
MODULE_DESCRIPTION("NXP i.MX8QXP LPCG clock driver");

drivers/clk/imx/clk-imx8qxp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static struct platform_driver imx8qxp_clk_driver = {
308308
},
309309
.probe = imx8qxp_clk_probe,
310310
};
311-
builtin_platform_driver(imx8qxp_clk_driver);
311+
module_platform_driver(imx8qxp_clk_driver);
312312

313313
MODULE_AUTHOR("Aisheng Dong <[email protected]>");
314314
MODULE_DESCRIPTION("NXP i.MX8QXP clock driver");

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,15 @@ EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_fabia_ops);
14291429
void clk_trion_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
14301430
const struct alpha_pll_config *config)
14311431
{
1432+
/*
1433+
* If the bootloader left the PLL enabled it's likely that there are
1434+
* RCGs that will lock up if we disable the PLL below.
1435+
*/
1436+
if (trion_pll_is_enabled(pll, regmap)) {
1437+
pr_debug("Trion PLL is already enabled, skipping configuration\n");
1438+
return;
1439+
}
1440+
14321441
clk_alpha_pll_write_config(regmap, PLL_L_VAL(pll), config->l);
14331442
regmap_write(regmap, PLL_CAL_L_VAL(pll), TRION_PLL_CAL_VAL);
14341443
clk_alpha_pll_write_config(regmap, PLL_ALPHA_VAL(pll), config->alpha);

drivers/clk/qcom/clk-regmap-mux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static u8 mux_get_parent(struct clk_hw *hw)
2828
val &= mask;
2929

3030
if (mux->parent_map)
31-
return qcom_find_src_index(hw, mux->parent_map, val);
31+
return qcom_find_cfg_index(hw, mux->parent_map, val);
3232

3333
return val;
3434
}

drivers/clk/qcom/common.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, u8 src)
6969
}
7070
EXPORT_SYMBOL_GPL(qcom_find_src_index);
7171

72+
int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, u8 cfg)
73+
{
74+
int i, num_parents = clk_hw_get_num_parents(hw);
75+
76+
for (i = 0; i < num_parents; i++)
77+
if (cfg == map[i].cfg)
78+
return i;
79+
80+
return -ENOENT;
81+
}
82+
EXPORT_SYMBOL_GPL(qcom_find_cfg_index);
83+
7284
struct regmap *
7385
qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc)
7486
{

drivers/clk/qcom/common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ extern void
4949
qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count);
5050
extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map,
5151
u8 src);
52+
extern int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map,
53+
u8 cfg);
5254

5355
extern int qcom_cc_register_board_clk(struct device *dev, const char *path,
5456
const char *name, unsigned long rate);

drivers/clk/qcom/gcc-sm6125.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ static struct clk_rcg2 gcc_sdcc1_apps_clk_src = {
11211121
.name = "gcc_sdcc1_apps_clk_src",
11221122
.parent_data = gcc_parent_data_1,
11231123
.num_parents = ARRAY_SIZE(gcc_parent_data_1),
1124-
.ops = &clk_rcg2_ops,
1124+
.ops = &clk_rcg2_floor_ops,
11251125
},
11261126
};
11271127

@@ -1143,7 +1143,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = {
11431143
.name = "gcc_sdcc1_ice_core_clk_src",
11441144
.parent_data = gcc_parent_data_0,
11451145
.num_parents = ARRAY_SIZE(gcc_parent_data_0),
1146-
.ops = &clk_rcg2_floor_ops,
1146+
.ops = &clk_rcg2_ops,
11471147
},
11481148
};
11491149

drivers/clk/versatile/clk-icst.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ static void __init of_syscon_icst_setup(struct device_node *np)
543543

544544
regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype);
545545
if (IS_ERR(regclk)) {
546-
kfree(name);
547546
pr_err("error setting up syscon ICST clock %s\n", name);
547+
kfree(name);
548548
return;
549549
}
550550
of_clk_add_provider(np, of_clk_src_simple_get, regclk);

0 commit comments

Comments
 (0)