]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
clk: mediatek: add CLK_XTAL support for clock driver
authorWeijie Gao <weijie.gao@mediatek.com>
Fri, 9 Sep 2022 12:00:07 +0000 (20:00 +0800)
committerTom Rini <trini@konsulko.com>
Fri, 23 Sep 2022 19:09:16 +0000 (15:09 -0400)
This adds the CLK_XTAL macro/flag to allow modeling clocks which are
directly connected to the xtal clock.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
drivers/clk/mediatek/clk-mtk.c
drivers/clk/mediatek/clk-mtk.h

index 207a4c6b11a6a4dfccc219ec11fec0c7f4940d7b..4303300d3a8d3729148757dfc3a96c37a95ad974 100644 (file)
@@ -296,6 +296,7 @@ static ulong mtk_topckgen_get_factor_rate(struct clk *clk, u32 off)
                rate = mtk_clk_find_parent_rate(clk, fdiv->parent, NULL);
                break;
 
+       case CLK_PARENT_XTAL:
        default:
                rate = priv->tree->xtal_rate;
        }
@@ -314,6 +315,9 @@ static ulong mtk_infrasys_get_factor_rate(struct clk *clk, u32 off)
                rate = mtk_clk_find_parent_rate(clk, fdiv->parent,
                                                priv->parent);
                break;
+       case CLK_PARENT_XTAL:
+               rate = priv->tree->xtal_rate;
+               break;
        default:
                rate = mtk_clk_find_parent_rate(clk, fdiv->parent, NULL);
        }
index e7c61ae483b2bb59e0ec385ec832f5805c14fb81..48ce16484ec2a414b111bd6acac03d8ad4cd32ef 100644 (file)
@@ -29,7 +29,8 @@
 #define CLK_PARENT_APMIXED             BIT(4)
 #define CLK_PARENT_TOPCKGEN            BIT(5)
 #define CLK_PARENT_INFRASYS            BIT(6)
-#define CLK_PARENT_MASK                        GENMASK(6, 4)
+#define CLK_PARENT_XTAL                        BIT(7)
+#define CLK_PARENT_MASK                        GENMASK(7, 4)
 
 #define ETHSYS_HIFSYS_RST_CTRL_OFS     0x34