* [PATCH v6 5/8] cpufreq: arm_big_little: add SCPI interface driver
2015-07-31 17:43 [PATCH v6 0/8] ARM64: juno: add SCPI mailbox protocol, clock and CPUFreq support Sudeep Holla
@ 2015-07-31 17:43 ` Sudeep Holla
2015-08-03 10:18 ` [PATCH v6 0/8] ARM64: juno: add SCPI mailbox protocol, clock and CPUFreq support Liviu Dudau
2015-08-05 9:59 ` Sudeep Holla
2 siblings, 0 replies; 6+ messages in thread
From: Sudeep Holla @ 2015-07-31 17:43 UTC (permalink / raw)
To: arm, linux-kernel, linux-arm-kernel, Olof Johansson, Kevin Hilman
Cc: Sudeep Holla, Liviu Dudau, Punit Agrawal, Jon Medhurst (Tixy),
Lorenzo Pieralisi, Arnd Bergmann, Viresh Kumar, Rafael J. Wysocki,
linux-pm
On some ARM based systems, a separate Cortex-M based System Control
Processor(SCP) provides the overall power, clock, reset and system
control including CPU DVFS. SCPI Message Protocol is used to
communicate with the SCPI.
This patch adds a interface driver for adding OPPs and registering
the arm_big_little cpufreq driver for such systems.
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-pm@vger.kernel.org
---
MAINTAINERS | 1 +
drivers/cpufreq/Kconfig.arm | 9 +++
drivers/cpufreq/Makefile | 1 +
drivers/cpufreq/scpi-cpufreq.c | 124 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 135 insertions(+)
create mode 100644 drivers/cpufreq/scpi-cpufreq.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 690122bb4426..d4b912664a93 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8966,6 +8966,7 @@ L: linux-arm-kernel@lists.infradead.org
S: Maintained
F: Documentation/devicetree/bindings/arm/arm,scpi.txt
F: drivers/clk/clk-scpi.c
+F: drivers/cpufreq/scpi-cpufreq.c
F: drivers/firmware/arm_scpi.c
F: include/linux/scpi_protocol.h
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index cc8a71c267b8..c46b495169af 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -24,6 +24,15 @@ config ARM_VEXPRESS_SPC_CPUFREQ
This add the CPUfreq driver support for Versatile Express
big.LITTLE platforms using SPC for power management.
+config ARM_SCPI_CPUFREQ
+ tristate "SCPI based CPUfreq driver"
+ depends on ARM_BIG_LITTLE_CPUFREQ && ARM_SCPI_PROTOCOL
+ help
+ This adds the CPUfreq driver support for ARM big.LITTLE platforms
+ using SCPI protocol for CPU power management.
+
+ This driver uses SCPI Message Protocol driver to interact with the
+ firmware providing the CPU DVFS functionality.
config ARM_EXYNOS_CPUFREQ
tristate "SAMSUNG EXYNOS CPUfreq Driver"
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 2169bf792db7..7e07f5535c3a 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -78,6 +78,7 @@ obj-$(CONFIG_ARM_SA1110_CPUFREQ) += sa1110-cpufreq.o
obj-$(CONFIG_ARM_SPEAR_CPUFREQ) += spear-cpufreq.o
obj-$(CONFIG_ARM_TEGRA_CPUFREQ) += tegra-cpufreq.o
obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o
+obj-$(CONFIG_ARM_SCPI_CPUFREQ) += scpi-cpufreq.o
##################################################################################
# PowerPC platform drivers
diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
new file mode 100644
index 000000000000..2c3b16fd3a01
--- /dev/null
+++ b/drivers/cpufreq/scpi-cpufreq.c
@@ -0,0 +1,124 @@
+/*
+ * System Control and Power Interface (SCPI) based CPUFreq Interface driver
+ *
+ * It provides necessary ops to arm_big_little cpufreq driver.
+ *
+ * Copyright (C) 2015 ARM Ltd.
+ * Sudeep Holla <sudeep.holla@arm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/cpufreq.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_opp.h>
+#include <linux/scpi_protocol.h>
+#include <linux/types.h>
+
+#include "arm_big_little.h"
+
+static struct scpi_ops *scpi_ops;
+
+static struct scpi_dvfs_info *scpi_get_dvfs_info(struct device *cpu_dev)
+{
+ u8 domain = topology_physical_package_id(cpu_dev->id);
+
+ if (domain < 0)
+ return ERR_PTR(-EINVAL);
+ return scpi_ops->dvfs_get_info(domain);
+}
+
+static int scpi_opp_table_ops(struct device *cpu_dev, bool remove)
+{
+ int idx, ret = 0;
+ struct scpi_opp *opp;
+ struct scpi_dvfs_info *info = scpi_get_dvfs_info(cpu_dev);
+
+ if (IS_ERR(info))
+ return PTR_ERR(info);
+
+ if (!info->opps)
+ return -EIO;
+
+ for (opp = info->opps, idx = 0; idx < info->count; idx++, opp++) {
+ if (remove)
+ dev_pm_opp_remove(cpu_dev, opp->freq);
+ else
+ ret = dev_pm_opp_add(cpu_dev, opp->freq,
+ opp->m_volt * 1000);
+ if (ret) {
+ dev_warn(cpu_dev, "failed to add opp %uHz %umV\n",
+ opp->freq, opp->m_volt);
+ while (idx-- > 0)
+ dev_pm_opp_remove(cpu_dev, (--opp)->freq);
+ return ret;
+ }
+ }
+ return ret;
+}
+
+static int scpi_get_transition_latency(struct device *cpu_dev)
+{
+ struct scpi_dvfs_info *info = scpi_get_dvfs_info(cpu_dev);
+
+ if (IS_ERR(info))
+ return PTR_ERR(info);
+ return info->latency;
+}
+
+static int scpi_init_opp_table(struct device *cpu_dev)
+{
+ return scpi_opp_table_ops(cpu_dev, false);
+}
+
+static void scpi_free_opp_table(struct device *cpu_dev)
+{
+ scpi_opp_table_ops(cpu_dev, true);
+}
+
+static struct cpufreq_arm_bL_ops scpi_cpufreq_ops = {
+ .name = "scpi",
+ .get_transition_latency = scpi_get_transition_latency,
+ .init_opp_table = scpi_init_opp_table,
+ .free_opp_table = scpi_free_opp_table,
+};
+
+static int scpi_cpufreq_probe(struct platform_device *pdev)
+{
+ scpi_ops = get_scpi_ops();
+ if (!scpi_ops)
+ return -EIO;
+
+ return bL_cpufreq_register(&scpi_cpufreq_ops);
+}
+
+static int scpi_cpufreq_remove(struct platform_device *pdev)
+{
+ bL_cpufreq_unregister(&scpi_cpufreq_ops);
+ scpi_ops = NULL;
+ return 0;
+}
+
+static struct platform_driver scpi_cpufreq_platdrv = {
+ .driver = {
+ .name = "scpi-cpufreq",
+ .owner = THIS_MODULE,
+ },
+ .probe = scpi_cpufreq_probe,
+ .remove = scpi_cpufreq_remove,
+};
+module_platform_driver(scpi_cpufreq_platdrv);
+
+MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>");
+MODULE_DESCRIPTION("ARM SCPI CPUFreq interface driver");
+MODULE_LICENSE("GPL v2");
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v6 0/8] ARM64: juno: add SCPI mailbox protocol, clock and CPUFreq support
2015-07-31 17:43 [PATCH v6 0/8] ARM64: juno: add SCPI mailbox protocol, clock and CPUFreq support Sudeep Holla
2015-07-31 17:43 ` [PATCH v6 5/8] cpufreq: arm_big_little: add SCPI interface driver Sudeep Holla
@ 2015-08-03 10:18 ` Liviu Dudau
2015-08-03 10:48 ` Sudeep Holla
2015-08-05 9:59 ` Sudeep Holla
2 siblings, 1 reply; 6+ messages in thread
From: Liviu Dudau @ 2015-08-03 10:18 UTC (permalink / raw)
To: Sudeep Holla
Cc: arm@kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Olof Johansson,
Kevin Hilman, Punit Agrawal, Jon Medhurst (Tixy),
Lorenzo Pieralisi, Arnd Bergmann, devicetree@vger.kernel.org,
linux-clk@vger.kernel.org, linux-pm@vger.kernel.org
On Fri, Jul 31, 2015 at 06:43:03PM +0100, Sudeep Holla wrote:
> Hi ARM-SoC guys,
>
> It has been on the list for a while and have got all the necessary ACKs.
> Can you please pull this series for v4.3 ?
>
> Regards,
> Sudeep
>
> This patch series adds support for:
> 1. SCPI(System Control and Power Interface) mailbox protocol driver.
> It uses ARM MHU mailbox controller driver on Juno but can work with
> any mailbox controllers using standard mailbox APIs
> 2. Add support for clocks provided by SCP firmware through the SCPI
> interface
> 3. Using the existing arm_big_little cpufreq driver and the newly
> added SCPI clock driver, it also adds support for CPU DVFS on
> ARM64 JUNO development platforms.
Hi Sudeep,
Is there a branch where I can pull this series from?
Best regards,
Liviu
>
> The SCPI protocol document is available @[1],[2]
>
> Changes v5->v6:
> - Minor review comments on clock bindings and clock driver
> - Added all the ACKs necessary
>
> Changes v4->v5:
> - Updated the SCPI clock bindings to correct the clock specifier
> usage and other minor updates as per review feedback
> - Updated clock driver to use SCPI specifier clock specifier
> decode function
> - Minor reshuffling in Juno DTS files, no functionality change
>
> Changes v3->v4:
> - Updated the SCPI binding based on MarkR's feedback
> - Updated SCPI clock driver to incorporate Stephen Boyd's review
> comments + used clk_set_rate_range to limit the clock range
> - Since no major changes are expected in SCPI DT, updated the
> Juno DTS to support SCPI and dependent device nodes.
>
> Changes v2->v3:
> - Minor fix in SCPI driver and added Tixy's reviewed-by tag
> - Updated scpi clock driver to incorporate all the comments from
> Stephen
> - Added Viresh's ack
>
> Changes v1->v2:
> - Updated the token handling in scpi driver as per Tixy's
> suggestion along with other review comments
> - Removed multiple drivers in scpi clock as Lorenzo suggested
> - Added free_opp_table in scpi-cpufreq as Viresh suggested
> - Separated the DT binding document
> - Moved SCPI protocol driver to drivers/firmware
>
> [1] http://community.arm.com/servlet/JiveServlet/download/8401-45-18326/DUI0922B_scp_message_interface.pdf
> [2] https://wiki.linaro.org/ARM/Juno?action=AttachFile&do=get&target=DUI0922B_scp_message_interface.pdf
> v1: https://lkml.org/lkml/2015/4/27/232
> v2: https://lkml.org/lkml/2015/5/14/470
> v3: https://lkml.org/lkml/2015/5/27/220
> v4: https://lkml.org/lkml/2015/6/8/178
> v5: https://lkml.org/lkml/2015/7/23/270
>
> Cc: devicetree@vger.kernel.org
> Cc: linux-clk@vger.kernel.org
> Cc: linux-pm@vger.kernel.org
>
> Sudeep Holla (8):
> Documentation: add DT binding for ARM System Control and Power
> Interface(SCPI) protocol
> firmware: add support for ARM System Control and Power Interface(SCPI)
> protocol
> clk: add support for clocks provided by SCP(System Control Processor)
> clk: scpi: add support for cpufreq virtual device
> cpufreq: arm_big_little: add SCPI interface driver
> arm64: dts: add SRAM, MHU mailbox and SCPI support on Juno
> arm64: dts: add CPU topology on Juno
> arm64: dts: add clock support for all the cpus
>
> Documentation/devicetree/bindings/arm/arm,scpi.txt | 150 +++++
> MAINTAINERS | 10 +
> arch/arm64/boot/dts/arm/juno-base.dtsi | 54 ++
> arch/arm64/boot/dts/arm/juno-r1.dts | 32 +
> arch/arm64/boot/dts/arm/juno.dts | 32 +
> drivers/clk/Kconfig | 10 +
> drivers/clk/Makefile | 1 +
> drivers/clk/clk-scpi.c | 325 ++++++++++
> drivers/cpufreq/Kconfig.arm | 9 +
> drivers/cpufreq/Makefile | 1 +
> drivers/cpufreq/scpi-cpufreq.c | 124 ++++
> drivers/firmware/Kconfig | 19 +
> drivers/firmware/Makefile | 1 +
> drivers/firmware/arm_scpi.c | 711 +++++++++++++++++++++
> include/linux/scpi_protocol.h | 61 ++
> 15 files changed, 1540 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/arm/arm,scpi.txt
> create mode 100644 drivers/clk/clk-scpi.c
> create mode 100644 drivers/cpufreq/scpi-cpufreq.c
> create mode 100644 drivers/firmware/arm_scpi.c
> create mode 100644 include/linux/scpi_protocol.h
>
> --
> 1.9.1
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v6 0/8] ARM64: juno: add SCPI mailbox protocol, clock and CPUFreq support
2015-07-31 17:43 [PATCH v6 0/8] ARM64: juno: add SCPI mailbox protocol, clock and CPUFreq support Sudeep Holla
2015-07-31 17:43 ` [PATCH v6 5/8] cpufreq: arm_big_little: add SCPI interface driver Sudeep Holla
2015-08-03 10:18 ` [PATCH v6 0/8] ARM64: juno: add SCPI mailbox protocol, clock and CPUFreq support Liviu Dudau
@ 2015-08-05 9:59 ` Sudeep Holla
2015-08-06 8:42 ` Sudeep Holla
2 siblings, 1 reply; 6+ messages in thread
From: Sudeep Holla @ 2015-08-05 9:59 UTC (permalink / raw)
To: arm@kernel.org, Olof Johansson
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Kevin Hilman, Sudeep Holla,
Liviu Dudau, Punit Agrawal, Jon Medhurst (Tixy),
Lorenzo Pieralisi, Arnd Bergmann, devicetree@vger.kernel.org,
linux-clk@vger.kernel.org, linux-pm@vger.kernel.org
Hi Olof,
On 31/07/15 18:43, Sudeep Holla wrote:
> Hi ARM-SoC guys,
>
> It has been on the list for a while and have got all the necessary
> ACKs. Can you please pull this series for v4.3 ?
>
Can you pull this patch series directly from the mail or do you prefer
pull-request ?
Regards,
Sudeep
^ permalink raw reply [flat|nested] 6+ messages in thread