clk: mediatek: pll: Split definitions into separate header file
authorChen-Yu Tsai <wenst@chromium.org>
Tue, 8 Feb 2022 12:40:15 +0000 (20:40 +0800)
committerStephen Boyd <sboyd@kernel.org>
Thu, 17 Feb 2022 20:12:23 +0000 (12:12 -0800)
When the PLL type clk was implemented in the MediaTek clk driver
library, the data structure definitions and function declaration
were put in the common header file.

Since it is its own type of clk, and not all platform clk drivers
utilize it, having the definitions in the common header results
in wasted cycles during compilation.

Split out the related definitions and declarations into its own
header file, and include that only in the platform clk drivers that
need it.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Miles Chen <miles.chen@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220208124034.414635-13-wenst@chromium.org
Reviewed-by: Chun-Jie Chen <chun-jie.chen@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
19 files changed:
drivers/clk/mediatek/clk-mt2701.c
drivers/clk/mediatek/clk-mt2712.c
drivers/clk/mediatek/clk-mt6765.c
drivers/clk/mediatek/clk-mt6779.c
drivers/clk/mediatek/clk-mt6797.c
drivers/clk/mediatek/clk-mt7622.c
drivers/clk/mediatek/clk-mt7629.c
drivers/clk/mediatek/clk-mt7986-apmixed.c
drivers/clk/mediatek/clk-mt8135.c
drivers/clk/mediatek/clk-mt8167.c
drivers/clk/mediatek/clk-mt8173.c
drivers/clk/mediatek/clk-mt8183.c
drivers/clk/mediatek/clk-mt8192.c
drivers/clk/mediatek/clk-mt8195-apmixedsys.c
drivers/clk/mediatek/clk-mt8195-apusys_pll.c
drivers/clk/mediatek/clk-mt8516.c
drivers/clk/mediatek/clk-mtk.h
drivers/clk/mediatek/clk-pll.c
drivers/clk/mediatek/clk-pll.h [new file with mode: 0644]

index 695be0f77427014af8ac40f78dfd39b952fde68a..1eb3e4563c3fb09010cbc5b76eb21ec651e1f9a3 100644 (file)
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 
-#include "clk-mtk.h"
-#include "clk-gate.h"
 #include "clk-cpumux.h"
+#include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt2701-clk.h>
 
index a3bd9a107209a73d21623a556f1b3e46099b327f..ff72b9ab945bd1577b9a08a90801cbbc5f8e6f8d 100644 (file)
@@ -13,8 +13,9 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
-#include "clk-mtk.h"
 #include "clk-gate.h"
+#include "clk-pll.h"
+#include "clk-mtk.h"
 
 #include <dt-bindings/clock/mt2712-clk.h>
 
index d77ea5aff292092c65568bf24981ae5c4a0d0643..24829ca3bd1f648ee57e09cb8e20aedd0c03ccea 100644 (file)
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 
-#include "clk-mtk.h"
 #include "clk-gate.h"
+#include "clk-mtk.h"
 #include "clk-mux.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt6765-clk.h>
 
index 9825385c9f9441040f2e56115085b24dcac3a616..7b61664da18f1b981130d1d69c31f66158f162a6 100644 (file)
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 
+#include "clk-gate.h"
 #include "clk-mtk.h"
 #include "clk-mux.h"
-#include "clk-gate.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt6779-clk.h>
 
index 428eb24ffec556b2e7b4230b3f22d67cb00f36ad..02259e81625a0b4144f8f055c88f56a7d7d85655 100644 (file)
@@ -9,8 +9,9 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 
-#include "clk-mtk.h"
 #include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt6797-clk.h>
 
index ef5947e15c7527ce912ed833bc05fe073b806556..0e1fb30a1e98b611bd9511e2021ada1818e03eda 100644 (file)
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 
-#include "clk-mtk.h"
-#include "clk-gate.h"
 #include "clk-cpumux.h"
+#include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt7622-clk.h>
 #include <linux/clk.h> /* for consumer */
index a0ee079670c7e8c12b1e86fc121e921f3ba12886..c0e023bf31eb5e85eec9502068cf49f5fe6a5ea8 100644 (file)
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 
-#include "clk-mtk.h"
-#include "clk-gate.h"
 #include "clk-cpumux.h"
+#include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt7629-clk.h>
 
index 98ec3887585fca4f7e13de32e3f090e892bc87bf..21d4c82e782ab73067d38d740cd123151f3fdd38 100644 (file)
 #include <linux/of_address.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
-#include "clk-mtk.h"
+
 #include "clk-gate.h"
+#include "clk-mtk.h"
 #include "clk-mux.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt7986-clk.h>
 #include <linux/clk.h>
index 9b4b645aea9931f33e4c08981646db7f2c772551..09ad272d51f113a0cd768d561a90cbd6bed6af88 100644 (file)
@@ -11,8 +11,9 @@
 #include <linux/mfd/syscon.h>
 #include <dt-bindings/clock/mt8135-clk.h>
 
-#include "clk-mtk.h"
 #include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
 
 static DEFINE_SPINLOCK(mt8135_clk_lock);
 
index e5ea10e31799af35305ba79cfe1572fac17c42b6..812b33a57530c84e6dbc03eaeca726b20125df3e 100644 (file)
@@ -12,8 +12,9 @@
 #include <linux/slab.h>
 #include <linux/mfd/syscon.h>
 
-#include "clk-mtk.h"
 #include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt8167-clk.h>
 
index 8f898ac476c019b2cb70defafabcbfb839b20398..46b7655feeaa169e4bdb43ff98ac6b801dbea07c 100644 (file)
@@ -8,9 +8,10 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 
-#include "clk-mtk.h"
-#include "clk-gate.h"
 #include "clk-cpumux.h"
+#include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt8173-clk.h>
 
index 5046852eb0fdf844c7fc7d9f6e6f489f31674a22..68496554dd3dbefdccbf3dfffb7e0edf42f44d64 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include "clk-gate.h"
 #include "clk-mtk.h"
 #include "clk-mux.h"
-#include "clk-gate.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt8183-clk.h>
 
index 79ddb3cc0b98a5125b9214843b14d52dd4c792b8..ab27cd66b866919e319ca0d97c27895b25877620 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
+#include "clk-gate.h"
 #include "clk-mtk.h"
 #include "clk-mux.h"
-#include "clk-gate.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt8192-clk.h>
 
index 6156ceeed71e6e9938ffb8f2d96d73629f55a1fd..5b1b7dc447eb83e6086bca5a108d7aab928803aa 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "clk-gate.h"
 #include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt8195-clk.h>
 #include <linux/of_device.h>
index f1c84186346e5c18ad81bdf6bc9692e14d02125c..db449ff877d779de47b3041a9afe054f32962aa8 100644 (file)
@@ -4,6 +4,7 @@
 // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com>
 
 #include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt8195-clk.h>
 #include <linux/clk-provider.h>
index 9d4261ecc7607eb7ff0f9f7d93be3c8cc6f69e3b..a37143f920cebf89e93634e7ee4d596e6190a94a 100644 (file)
@@ -11,8 +11,9 @@
 #include <linux/slab.h>
 #include <linux/mfd/syscon.h>
 
-#include "clk-mtk.h"
 #include "clk-gate.h"
+#include "clk-mtk.h"
+#include "clk-pll.h"
 
 #include <dt-bindings/clock/mt8516-clk.h>
 
index bdec7dc5e07a38ebf3d728b9aa30cee6e0d22b4c..168220f85489b9940b0d5f633f79bb1d938d5e10 100644 (file)
@@ -179,45 +179,6 @@ void mtk_clk_register_dividers(const struct mtk_clk_divider *mcds,
 struct clk_onecell_data *mtk_alloc_clk_data(unsigned int clk_num);
 void mtk_free_clk_data(struct clk_onecell_data *clk_data);
 
-#define HAVE_RST_BAR   BIT(0)
-#define PLL_AO         BIT(1)
-
-struct mtk_pll_div_table {
-       u32 div;
-       unsigned long freq;
-};
-
-struct mtk_pll_data {
-       int id;
-       const char *name;
-       u32 reg;
-       u32 pwr_reg;
-       u32 en_mask;
-       u32 pd_reg;
-       u32 tuner_reg;
-       u32 tuner_en_reg;
-       u8 tuner_en_bit;
-       int pd_shift;
-       unsigned int flags;
-       const struct clk_ops *ops;
-       u32 rst_bar_mask;
-       unsigned long fmin;
-       unsigned long fmax;
-       int pcwbits;
-       int pcwibits;
-       u32 pcw_reg;
-       int pcw_shift;
-       u32 pcw_chg_reg;
-       const struct mtk_pll_div_table *div_table;
-       const char *parent_name;
-       u32 en_reg;
-       u8 pll_en_bit; /* Assume 0, indicates BIT(0) by default */
-};
-
-void mtk_clk_register_plls(struct device_node *node,
-               const struct mtk_pll_data *plls, int num_plls,
-               struct clk_onecell_data *clk_data);
-
 struct clk *mtk_clk_register_ref2usb_tx(const char *name,
                        const char *parent_name, void __iomem *reg);
 
index f04f724e12e595ac7f4813200eb7d8699ccfd8d1..64f59554bc9bd03f82dee58f07cc95f0a3b4c502 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/delay.h>
 
 #include "clk-mtk.h"
+#include "clk-pll.h"
 
 #define REG_CON0               0
 #define REG_CON1               4
diff --git a/drivers/clk/mediatek/clk-pll.h b/drivers/clk/mediatek/clk-pll.h
new file mode 100644 (file)
index 0000000..d01b0c3
--- /dev/null
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ * Author: James Liao <jamesjj.liao@mediatek.com>
+ */
+
+#ifndef __DRV_CLK_MTK_PLL_H
+#define __DRV_CLK_MTK_PLL_H
+
+#include <linux/types.h>
+
+struct clk_ops;
+struct clk_onecell_data;
+struct device_node;
+
+struct mtk_pll_div_table {
+       u32 div;
+       unsigned long freq;
+};
+
+#define HAVE_RST_BAR   BIT(0)
+#define PLL_AO         BIT(1)
+
+struct mtk_pll_data {
+       int id;
+       const char *name;
+       u32 reg;
+       u32 pwr_reg;
+       u32 en_mask;
+       u32 pd_reg;
+       u32 tuner_reg;
+       u32 tuner_en_reg;
+       u8 tuner_en_bit;
+       int pd_shift;
+       unsigned int flags;
+       const struct clk_ops *ops;
+       u32 rst_bar_mask;
+       unsigned long fmin;
+       unsigned long fmax;
+       int pcwbits;
+       int pcwibits;
+       u32 pcw_reg;
+       int pcw_shift;
+       u32 pcw_chg_reg;
+       const struct mtk_pll_div_table *div_table;
+       const char *parent_name;
+       u32 en_reg;
+       u8 pll_en_bit; /* Assume 0, indicates BIT(0) by default */
+};
+
+void mtk_clk_register_plls(struct device_node *node,
+                          const struct mtk_pll_data *plls, int num_plls,
+                          struct clk_onecell_data *clk_data);
+
+#endif /* __DRV_CLK_MTK_PLL_H */