[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211012103612.101859-2-AjitKumar.Pandey@amd.com>
Date: Tue, 12 Oct 2021 16:06:08 +0530
From: Ajit Kumar Pandey <AjitKumar.Pandey@....com>
To: <sboyd@...nel.org>, <linux-clk@...r.kernel.org>
CC: <Vijendar.Mukunda@....com>, <Basavaraj.Hiregoudar@....com>,
<Sunil-kumar.Dommati@....com>, <Alexander.Deucher@....com>,
Ajit Kumar Pandey <AjitKumar.Pandey@....com>,
Michael Turquette <mturquette@...libre.com>,
open list <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 1/5] x86: clk: Add config option to enable 48MHz fixed fch clk
At present 48MHz clk support is only enabled for RV architecture
using "is-rv" device property initialized from boot loader. This
limit 48MHz fixed clock gate support to RV platform unless we add
similar device property in boot loader for other architecture.
Add Kernel config option to enable 48MHz fixed clk gate registration
with clock framework. This enahanced flexibility to enable 48MHz fch
clock support on any platforms by simply enabling kernel config. Also
replace RV with FIXED as generic naming convention across platforms.
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@....com>
---
drivers/clk/x86/Kconfig | 5 +++++
drivers/clk/x86/clk-fch.c | 22 +++++++++++-----------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/clk/x86/Kconfig b/drivers/clk/x86/Kconfig
index 69642e15fcc1..c10081774cd6 100644
--- a/drivers/clk/x86/Kconfig
+++ b/drivers/clk/x86/Kconfig
@@ -6,3 +6,8 @@ config CLK_LGM_CGU
help
Clock Generation Unit(CGU) driver for Intel Lightning Mountain(LGM)
network processor SoC.
+
+config CLK_FIXED_FCH
+ bool "AMD FCH controller fixed 48MHz CLK support"
+ help
+ Enable this option for 48MHz fixed mclk support on AMD platforms.
diff --git a/drivers/clk/x86/clk-fch.c b/drivers/clk/x86/clk-fch.c
index 8f7c5142b0f0..72d2c7497234 100644
--- a/drivers/clk/x86/clk-fch.c
+++ b/drivers/clk/x86/clk-fch.c
@@ -26,9 +26,9 @@
#define ST_CLK_GATE 3
#define ST_MAX_CLKS 4
-#define RV_CLK_48M 0
-#define RV_CLK_GATE 1
-#define RV_MAX_CLKS 2
+#define CLK_48M_FIXED 0
+#define CLK_GATE_FIXED 1
+#define CLK_MAX_FIXED 2
static const char * const clk_oscout1_parents[] = { "clk48MHz", "clk25MHz" };
static struct clk_hw *hws[ST_MAX_CLKS];
@@ -41,7 +41,7 @@ static int fch_clk_probe(struct platform_device *pdev)
if (!fch_data || !fch_data->base)
return -EINVAL;
- if (!fch_data->is_rv) {
+ if (!IS_ENABLED(CONFIG_CLK_FIXED_FCH)) {
hws[ST_CLK_48M] = clk_hw_register_fixed_rate(NULL, "clk48MHz",
NULL, 0, 48000000);
hws[ST_CLK_25M] = clk_hw_register_fixed_rate(NULL, "clk25MHz",
@@ -61,14 +61,14 @@ static int fch_clk_probe(struct platform_device *pdev)
devm_clk_hw_register_clkdev(&pdev->dev, hws[ST_CLK_GATE],
"oscout1", NULL);
} else {
- hws[RV_CLK_48M] = clk_hw_register_fixed_rate(NULL, "clk48MHz",
+ hws[CLK_48M_FIXED] = clk_hw_register_fixed_rate(NULL, "clk48MHz",
NULL, 0, 48000000);
- hws[RV_CLK_GATE] = clk_hw_register_gate(NULL, "oscout1",
+ hws[CLK_GATE_FIXED] = clk_hw_register_gate(NULL, "oscout1",
"clk48MHz", 0, fch_data->base + MISCCLKCNTL1,
OSCCLKENB, CLK_GATE_SET_TO_DISABLE, NULL);
- devm_clk_hw_register_clkdev(&pdev->dev, hws[RV_CLK_GATE],
+ devm_clk_hw_register_clkdev(&pdev->dev, hws[CLK_GATE_FIXED],
"oscout1", NULL);
}
@@ -78,11 +78,11 @@ static int fch_clk_probe(struct platform_device *pdev)
static int fch_clk_remove(struct platform_device *pdev)
{
int i, clks;
- struct fch_clk_data *fch_data;
-
- fch_data = dev_get_platdata(&pdev->dev);
- clks = fch_data->is_rv ? RV_MAX_CLKS : ST_MAX_CLKS;
+ if (IS_ENABLED(CONFIG_CLK_FIXED_FCH))
+ clks = CLK_MAX_FIXED;
+ else
+ clks = ST_MAX_CLKS;
for (i = 0; i < clks; i++)
clk_hw_unregister(hws[i]);
--
2.25.1
Powered by blists - more mailing lists