clk: clk-mux: Resolve parent clock by name

Use clock-names property which is accessible via parent clock OF node
to look up the parent clock by name instead of depending on unreliable
global clock name to perform look up.

Signed-off-by: Marek Vasut <marex@denx.de>
This commit is contained in:
Marek Vasut
2025-03-23 16:58:33 +01:00
committed by Fabio Estevam
parent 54a4c83b12
commit 3070d30df1

View File

@@ -113,6 +113,11 @@ int clk_mux_fetch_parent_index(struct clk *clk, struct clk *parent)
for (i = 0; i < mux->num_parents; i++) {
if (!strcmp(parent->dev->name, mux->parent_names[i]))
return i;
if (!strcmp(parent->dev->name,
clk_resolve_parent_clk(clk->dev,
mux->parent_names[i])))
return i;
}
return -EINVAL;
@@ -207,7 +212,8 @@ struct clk *clk_register_mux(struct udevice *dev, const char *name,
* for the corresponding clock (to do that define .set_parent() method).
*/
ret = clk_register(clk, UBOOT_DM_CLK_CCF_MUX, name,
parent_names[clk_mux_get_parent(clk)]);
clk_resolve_parent_clk(dev,
parent_names[clk_mux_get_parent(clk)]));
if (ret) {
kfree(mux);
return ERR_PTR(ret);