|
@@ -1,7 +1,7 @@
|
|
|
-From 76e4e6ce9aaae897f80e375345bf0095e1b09ff2 Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
|
+From 82e703dd438b71432cc0ccbb90925d1e32dd014a Mon Sep 17 00:00:00 2001
|
|
|
From: Christian Marangi <[email protected]>
|
|
From: Christian Marangi <[email protected]>
|
|
|
-Date: Sat, 4 Jan 2025 19:03:09 +0100
|
|
|
|
|
-Subject: [PATCH v9 1/2] pmdomain: airoha: Add Airoha CPU PM Domain support
|
|
|
|
|
|
|
+Date: Thu, 9 Jan 2025 14:12:57 +0100
|
|
|
|
|
+Subject: [PATCH] pmdomain: airoha: Add Airoha CPU PM Domain support
|
|
|
|
|
|
|
|
Add Airoha CPU PM Domain support to control frequency and power of CPU
|
|
Add Airoha CPU PM Domain support to control frequency and power of CPU
|
|
|
present on Airoha EN7581 SoC.
|
|
present on Airoha EN7581 SoC.
|
|
@@ -11,25 +11,21 @@ passing the performance state. The driver also expose a read-only clock
|
|
|
that expose the current CPU frequency with SMC command.
|
|
that expose the current CPU frequency with SMC command.
|
|
|
|
|
|
|
|
Signed-off-by: Christian Marangi <[email protected]>
|
|
Signed-off-by: Christian Marangi <[email protected]>
|
|
|
|
|
+Link: https://lore.kernel.org/r/[email protected]
|
|
|
|
|
+Signed-off-by: Ulf Hansson <[email protected]>
|
|
|
---
|
|
---
|
|
|
-Changes v9:
|
|
|
|
|
-- Fix compile error targetting wrong branch (remove_new change)
|
|
|
|
|
-Changes v8:
|
|
|
|
|
-- Add this patch
|
|
|
|
|
-- Use SMC invoke instead of 1.2
|
|
|
|
|
-
|
|
|
|
|
- drivers/pmdomain/mediatek/Kconfig | 11 ++
|
|
|
|
|
|
|
+ drivers/pmdomain/mediatek/Kconfig | 12 ++
|
|
|
drivers/pmdomain/mediatek/Makefile | 1 +
|
|
drivers/pmdomain/mediatek/Makefile | 1 +
|
|
|
.../pmdomain/mediatek/airoha-cpu-pmdomain.c | 144 ++++++++++++++++++
|
|
.../pmdomain/mediatek/airoha-cpu-pmdomain.c | 144 ++++++++++++++++++
|
|
|
- 3 files changed, 156 insertions(+)
|
|
|
|
|
|
|
+ 3 files changed, 157 insertions(+)
|
|
|
create mode 100644 drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c
|
|
create mode 100644 drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c
|
|
|
|
|
|
|
|
--- a/drivers/soc/mediatek/Kconfig
|
|
--- a/drivers/soc/mediatek/Kconfig
|
|
|
+++ b/drivers/soc/mediatek/Kconfig
|
|
+++ b/drivers/soc/mediatek/Kconfig
|
|
|
-@@ -72,6 +72,17 @@ config MTK_SCPSYS_PM_DOMAINS
|
|
|
|
|
- Control Processor System (SCPSYS) has several power management related
|
|
|
|
|
- tasks in the system.
|
|
|
|
|
-
|
|
|
|
|
|
|
+@@ -2,6 +2,17 @@
|
|
|
|
|
+ #
|
|
|
|
|
+ # MediaTek SoC drivers
|
|
|
|
|
+ #
|
|
|
+config AIROHA_CPU_PM_DOMAIN
|
|
+config AIROHA_CPU_PM_DOMAIN
|
|
|
+ tristate "Airoha CPU power domain"
|
|
+ tristate "Airoha CPU power domain"
|
|
|
+ default ARCH_AIROHA
|
|
+ default ARCH_AIROHA
|
|
@@ -41,9 +37,9 @@ Changes v8:
|
|
|
+ CPU frequency and power is controlled by ATF with SMC command to
|
|
+ CPU frequency and power is controlled by ATF with SMC command to
|
|
|
+ set performance states.
|
|
+ set performance states.
|
|
|
+
|
|
+
|
|
|
- config MTK_MMSYS
|
|
|
|
|
- tristate "MediaTek MMSYS Support"
|
|
|
|
|
- default ARCH_MEDIATEK
|
|
|
|
|
|
|
+ menu "MediaTek SoC drivers"
|
|
|
|
|
+ depends on ARCH_MEDIATEK || COMPILE_TEST
|
|
|
|
|
+
|
|
|
--- a/drivers/pmdomain/mediatek/Makefile
|
|
--- a/drivers/pmdomain/mediatek/Makefile
|
|
|
+++ b/drivers/pmdomain/mediatek/Makefile
|
|
+++ b/drivers/pmdomain/mediatek/Makefile
|
|
|
@@ -1,3 +1,4 @@
|
|
@@ -1,3 +1,4 @@
|
|
@@ -53,7 +49,7 @@ Changes v8:
|
|
|
+obj-$(CONFIG_AIROHA_CPU_PM_DOMAIN) += airoha-cpu-pmdomain.o
|
|
+obj-$(CONFIG_AIROHA_CPU_PM_DOMAIN) += airoha-cpu-pmdomain.o
|
|
|
--- /dev/null
|
|
--- /dev/null
|
|
|
+++ b/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c
|
|
+++ b/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c
|
|
|
-@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
+@@ -0,0 +1,144 @@
|
|
|
+// SPDX-License-Identifier: GPL-2.0
|
|
+// SPDX-License-Identifier: GPL-2.0
|
|
|
+
|
|
+
|
|
|
+#include <linux/arm-smccc.h>
|
|
+#include <linux/arm-smccc.h>
|
|
@@ -123,9 +119,13 @@ Changes v8:
|
|
|
+{
|
|
+{
|
|
|
+ struct airoha_cpu_pmdomain_priv *priv;
|
|
+ struct airoha_cpu_pmdomain_priv *priv;
|
|
|
+ struct device *dev = &pdev->dev;
|
|
+ struct device *dev = &pdev->dev;
|
|
|
-+ struct clk_init_data init = { };
|
|
|
|
|
|
|
++ const struct clk_init_data init = {
|
|
|
|
|
++ .name = "cpu",
|
|
|
|
|
++ .ops = &airoha_cpu_pmdomain_clk_ops,
|
|
|
|
|
++ /* Clock with no set_rate, can't cache */
|
|
|
|
|
++ .flags = CLK_GET_RATE_NOCACHE,
|
|
|
|
|
++ };
|
|
|
+ struct generic_pm_domain *pd;
|
|
+ struct generic_pm_domain *pd;
|
|
|
-+ struct clk_hw *hw;
|
|
|
|
|
+ int ret;
|
|
+ int ret;
|
|
|
+
|
|
+
|
|
|
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
|
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
|
@@ -133,18 +133,13 @@ Changes v8:
|
|
|
+ return -ENOMEM;
|
|
+ return -ENOMEM;
|
|
|
+
|
|
+
|
|
|
+ /* Init and register a get-only clk for Cpufreq */
|
|
+ /* Init and register a get-only clk for Cpufreq */
|
|
|
-+ init.name = "cpu";
|
|
|
|
|
-+ init.ops = &airoha_cpu_pmdomain_clk_ops;
|
|
|
|
|
-+ /* Clock with no set_rate, can't cache */
|
|
|
|
|
-+ init.flags = CLK_GET_RATE_NOCACHE;
|
|
|
|
|
-+
|
|
|
|
|
-+ hw = &priv->hw;
|
|
|
|
|
-+ hw->init = &init;
|
|
|
|
|
-+ ret = devm_clk_hw_register(dev, hw);
|
|
|
|
|
|
|
++ priv->hw.init = &init;
|
|
|
|
|
++ ret = devm_clk_hw_register(dev, &priv->hw);
|
|
|
+ if (ret)
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
+ return ret;
|
|
|
+
|
|
+
|
|
|
-+ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw);
|
|
|
|
|
|
|
++ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get,
|
|
|
|
|
++ &priv->hw);
|
|
|
+ if (ret)
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
+ return ret;
|
|
|
+
|
|
+
|