From: Sam Shih Date: Thu, 16 Apr 2026 08:23:10 +0000 (+0800) Subject: clk: mediatek: fix parent rate lookup for fixed PLL clocks X-Git-Tag: v2026.07-rc1~36^2~20 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=ad3ea453d8eddd09d924b7fb8ae054ff8f290abb;p=thirdparty%2Fu-boot.git clk: mediatek: fix parent rate lookup for fixed PLL clocks The refactoring in commit 00d0ff7f81bf ("clk: mediatek: refactor parent rate lookup functions") introduced a regression where fixed PLL clocks using mtk_clk_fixed_pll_ops are not properly recognized as valid parents in the CLK_PARENT_APMIXED case. Fixed PLL clocks are implemented using mtk_clk_fixed_pll_ops instead of mtk_clk_apmixedsys_ops, but they can also serve as parent clocks in the APMIXED domain. The parent lookup function needs to check for both driver ops to properly resolve the parent clock device. Add mtk_clk_fixed_pll_ops checks alongside mtk_clk_apmixedsys_ops checks in mtk_find_parent_rate() to restore support for fixed PLL parent clocks. Fixes: 00d0ff7f81bf ("clk: mediatek: refactor parent rate lookup functions") Signed-off-by: Sam Shih Signed-off-by: Weijie Gao Link: https://patch.msgid.link/923e50db696d910803828cd26b0ca0fbbfe11570.1776326933.git.weijie.gao@mediatek.com Signed-off-by: David Lechner --- diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 3557aeac3d5..d405eeab6f2 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -216,11 +216,14 @@ static ulong mtk_find_parent_rate(struct mtk_clk_priv *priv, struct clk *clk, switch (flags & CLK_PARENT_MASK) { case CLK_PARENT_APMIXED: /* APMIXEDSYS can be parent or grandparent. */ - if (dev_get_driver_ops(clk->dev) == &mtk_clk_apmixedsys_ops) + if (dev_get_driver_ops(clk->dev) == &mtk_clk_apmixedsys_ops || + dev_get_driver_ops(clk->dev) == &mtk_clk_fixed_pll_ops) parent_dev = clk->dev; - else if (dev_get_driver_ops(priv->parent) == &mtk_clk_apmixedsys_ops) + else if (dev_get_driver_ops(priv->parent) == &mtk_clk_apmixedsys_ops || + dev_get_driver_ops(priv->parent) == &mtk_clk_fixed_pll_ops) parent_dev = priv->parent; - else if (dev_get_driver_ops(dev_get_parent(priv->parent)) == &mtk_clk_apmixedsys_ops) + else if (dev_get_driver_ops(dev_get_parent(priv->parent)) == &mtk_clk_apmixedsys_ops || + dev_get_driver_ops(dev_get_parent(priv->parent)) == &mtk_clk_fixed_pll_ops) parent_dev = dev_get_parent(priv->parent); else return -EINVAL;