diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-04-10 06:00:36 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-04-10 06:00:36 -0400 |
| commit | 38fc7839bae2db7a1321d9f6bfc7b5b3ccb59d2a (patch) | |
| tree | 743a51d973ed74fdc83053210b7ca3174fb339c4 /drivers/cpufreq | |
| parent | e5e02de0665ef2477e7a018193051387c6fe0fbc (diff) | |
| parent | 5acb972fed8bcfe6c38a4bdef4e74148eaad04b2 (diff) | |
Merge back earlier cpufreq material for v4.1.
Diffstat (limited to 'drivers/cpufreq')
| -rw-r--r-- | drivers/cpufreq/Kconfig | 8 | ||||
| -rw-r--r-- | drivers/cpufreq/Kconfig.arm | 9 | ||||
| -rw-r--r-- | drivers/cpufreq/Kconfig.powerpc | 9 | ||||
| -rw-r--r-- | drivers/cpufreq/Makefile | 3 | ||||
| -rw-r--r-- | drivers/cpufreq/hisi-acpu-cpufreq.c | 42 | ||||
| -rw-r--r-- | drivers/cpufreq/powernv-cpufreq.c | 47 | ||||
| -rw-r--r-- | drivers/cpufreq/qoriq-cpufreq.c (renamed from drivers/cpufreq/ppc-corenet-cpufreq.c) | 161 |
7 files changed, 206 insertions, 73 deletions
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index a171fef2c2b6..659879a56dba 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
| @@ -293,5 +293,13 @@ config SH_CPU_FREQ | |||
| 293 | If unsure, say N. | 293 | If unsure, say N. |
| 294 | endif | 294 | endif |
| 295 | 295 | ||
| 296 | config QORIQ_CPUFREQ | ||
| 297 | tristate "CPU frequency scaling driver for Freescale QorIQ SoCs" | ||
| 298 | depends on OF && COMMON_CLK && (PPC_E500MC || ARM) | ||
| 299 | select CLK_QORIQ | ||
| 300 | help | ||
| 301 | This adds the CPUFreq driver support for Freescale QorIQ SoCs | ||
| 302 | which are capable of changing the CPU's frequency dynamically. | ||
| 303 | |||
| 296 | endif | 304 | endif |
| 297 | endmenu | 305 | endmenu |
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 1b06fc4640e2..4f3dbc8cf729 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
| @@ -108,6 +108,15 @@ config ARM_HIGHBANK_CPUFREQ | |||
| 108 | 108 | ||
| 109 | If in doubt, say N. | 109 | If in doubt, say N. |
| 110 | 110 | ||
| 111 | config ARM_HISI_ACPU_CPUFREQ | ||
| 112 | tristate "Hisilicon ACPU CPUfreq driver" | ||
| 113 | depends on ARCH_HISI && CPUFREQ_DT | ||
| 114 | select PM_OPP | ||
| 115 | help | ||
| 116 | This enables the hisilicon ACPU CPUfreq driver. | ||
| 117 | |||
| 118 | If in doubt, say N. | ||
| 119 | |||
| 111 | config ARM_IMX6Q_CPUFREQ | 120 | config ARM_IMX6Q_CPUFREQ |
| 112 | tristate "Freescale i.MX6 cpufreq support" | 121 | tristate "Freescale i.MX6 cpufreq support" |
| 113 | depends on ARCH_MXC | 122 | depends on ARCH_MXC |
diff --git a/drivers/cpufreq/Kconfig.powerpc b/drivers/cpufreq/Kconfig.powerpc index 7ea24413cee6..3a0595b41eab 100644 --- a/drivers/cpufreq/Kconfig.powerpc +++ b/drivers/cpufreq/Kconfig.powerpc | |||
| @@ -23,15 +23,6 @@ config CPU_FREQ_MAPLE | |||
| 23 | This adds support for frequency switching on Maple 970FX | 23 | This adds support for frequency switching on Maple 970FX |
| 24 | Evaluation Board and compatible boards (IBM JS2x blades). | 24 | Evaluation Board and compatible boards (IBM JS2x blades). |
| 25 | 25 | ||
| 26 | config PPC_CORENET_CPUFREQ | ||
| 27 | tristate "CPU frequency scaling driver for Freescale E500MC SoCs" | ||
| 28 | depends on PPC_E500MC && OF && COMMON_CLK | ||
| 29 | select CLK_QORIQ | ||
| 30 | help | ||
| 31 | This adds the CPUFreq driver support for Freescale e500mc, | ||
| 32 | e5500 and e6500 series SoCs which are capable of changing | ||
| 33 | the CPU's frequency dynamically. | ||
| 34 | |||
| 35 | config CPU_FREQ_PMAC | 26 | config CPU_FREQ_PMAC |
| 36 | bool "Support for Apple PowerBooks" | 27 | bool "Support for Apple PowerBooks" |
| 37 | depends on ADB_PMU && PPC32 | 28 | depends on ADB_PMU && PPC32 |
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 82a1821471fd..cdce92ae2e8b 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile | |||
| @@ -59,6 +59,7 @@ arm-exynos-cpufreq-$(CONFIG_ARM_EXYNOS4X12_CPUFREQ) += exynos4x12-cpufreq.o | |||
| 59 | arm-exynos-cpufreq-$(CONFIG_ARM_EXYNOS5250_CPUFREQ) += exynos5250-cpufreq.o | 59 | arm-exynos-cpufreq-$(CONFIG_ARM_EXYNOS5250_CPUFREQ) += exynos5250-cpufreq.o |
| 60 | obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ) += exynos5440-cpufreq.o | 60 | obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ) += exynos5440-cpufreq.o |
| 61 | obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ) += highbank-cpufreq.o | 61 | obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ) += highbank-cpufreq.o |
| 62 | obj-$(CONFIG_ARM_HISI_ACPU_CPUFREQ) += hisi-acpu-cpufreq.o | ||
| 62 | obj-$(CONFIG_ARM_IMX6Q_CPUFREQ) += imx6q-cpufreq.o | 63 | obj-$(CONFIG_ARM_IMX6Q_CPUFREQ) += imx6q-cpufreq.o |
| 63 | obj-$(CONFIG_ARM_INTEGRATOR) += integrator-cpufreq.o | 64 | obj-$(CONFIG_ARM_INTEGRATOR) += integrator-cpufreq.o |
| 64 | obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ) += kirkwood-cpufreq.o | 65 | obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ) += kirkwood-cpufreq.o |
| @@ -85,7 +86,7 @@ obj-$(CONFIG_CPU_FREQ_CBE) += ppc-cbe-cpufreq.o | |||
| 85 | ppc-cbe-cpufreq-y += ppc_cbe_cpufreq_pervasive.o ppc_cbe_cpufreq.o | 86 | ppc-cbe-cpufreq-y += ppc_cbe_cpufreq_pervasive.o ppc_cbe_cpufreq.o |
| 86 | obj-$(CONFIG_CPU_FREQ_CBE_PMI) += ppc_cbe_cpufreq_pmi.o | 87 | obj-$(CONFIG_CPU_FREQ_CBE_PMI) += ppc_cbe_cpufreq_pmi.o |
| 87 | obj-$(CONFIG_CPU_FREQ_MAPLE) += maple-cpufreq.o | 88 | obj-$(CONFIG_CPU_FREQ_MAPLE) += maple-cpufreq.o |
| 88 | obj-$(CONFIG_PPC_CORENET_CPUFREQ) += ppc-corenet-cpufreq.o | 89 | obj-$(CONFIG_QORIQ_CPUFREQ) += qoriq-cpufreq.o |
| 89 | obj-$(CONFIG_CPU_FREQ_PMAC) += pmac32-cpufreq.o | 90 | obj-$(CONFIG_CPU_FREQ_PMAC) += pmac32-cpufreq.o |
| 90 | obj-$(CONFIG_CPU_FREQ_PMAC64) += pmac64-cpufreq.o | 91 | obj-$(CONFIG_CPU_FREQ_PMAC64) += pmac64-cpufreq.o |
| 91 | obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += pasemi-cpufreq.o | 92 | obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += pasemi-cpufreq.o |
diff --git a/drivers/cpufreq/hisi-acpu-cpufreq.c b/drivers/cpufreq/hisi-acpu-cpufreq.c new file mode 100644 index 000000000000..026d5b2224de --- /dev/null +++ b/drivers/cpufreq/hisi-acpu-cpufreq.c | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * Hisilicon Platforms Using ACPU CPUFreq Support | ||
| 3 | * | ||
| 4 | * Copyright (c) 2015 Hisilicon Limited. | ||
| 5 | * Copyright (c) 2015 Linaro Limited. | ||
| 6 | * | ||
| 7 | * Leo Yan <leo.yan@linaro.org> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License version 2 as | ||
| 11 | * published by the Free Software Foundation. | ||
| 12 | * | ||
| 13 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
| 14 | * kind, whether express or implied; without even the implied warranty | ||
| 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 20 | |||
| 21 | #include <linux/err.h> | ||
| 22 | #include <linux/init.h> | ||
| 23 | #include <linux/kernel.h> | ||
| 24 | #include <linux/module.h> | ||
| 25 | #include <linux/of.h> | ||
| 26 | #include <linux/platform_device.h> | ||
| 27 | |||
| 28 | static int __init hisi_acpu_cpufreq_driver_init(void) | ||
| 29 | { | ||
| 30 | struct platform_device *pdev; | ||
| 31 | |||
| 32 | if (!of_machine_is_compatible("hisilicon,hi6220")) | ||
| 33 | return -ENODEV; | ||
| 34 | |||
| 35 | pdev = platform_device_register_simple("cpufreq-dt", -1, NULL, 0); | ||
| 36 | return PTR_ERR_OR_ZERO(pdev); | ||
| 37 | } | ||
| 38 | module_init(hisi_acpu_cpufreq_driver_init); | ||
| 39 | |||
| 40 | MODULE_AUTHOR("Leo Yan <leo.yan@linaro.org>"); | ||
| 41 | MODULE_DESCRIPTION("Hisilicon acpu cpufreq driver"); | ||
| 42 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index 2dfd4fdb5a52..ebef0d8279c7 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c | |||
| @@ -34,9 +34,13 @@ | |||
| 34 | #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */ | 34 | #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */ |
| 35 | 35 | ||
| 36 | #define POWERNV_MAX_PSTATES 256 | 36 | #define POWERNV_MAX_PSTATES 256 |
| 37 | #define PMSR_PSAFE_ENABLE (1UL << 30) | ||
| 38 | #define PMSR_SPR_EM_DISABLE (1UL << 31) | ||
| 39 | #define PMSR_MAX(x) ((x >> 32) & 0xFF) | ||
| 40 | #define PMSR_LP(x) ((x >> 48) & 0xFF) | ||
| 37 | 41 | ||
| 38 | static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1]; | 42 | static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1]; |
| 39 | static bool rebooting; | 43 | static bool rebooting, throttled; |
| 40 | 44 | ||
| 41 | /* | 45 | /* |
| 42 | * Note: The set of pstates consists of contiguous integers, the | 46 | * Note: The set of pstates consists of contiguous integers, the |
| @@ -294,6 +298,44 @@ static inline unsigned int get_nominal_index(void) | |||
| 294 | return powernv_pstate_info.max - powernv_pstate_info.nominal; | 298 | return powernv_pstate_info.max - powernv_pstate_info.nominal; |
| 295 | } | 299 | } |
| 296 | 300 | ||
| 301 | static void powernv_cpufreq_throttle_check(unsigned int cpu) | ||
| 302 | { | ||
| 303 | unsigned long pmsr; | ||
| 304 | int pmsr_pmax, pmsr_lp; | ||
| 305 | |||
| 306 | pmsr = get_pmspr(SPRN_PMSR); | ||
| 307 | |||
| 308 | /* Check for Pmax Capping */ | ||
| 309 | pmsr_pmax = (s8)PMSR_MAX(pmsr); | ||
| 310 | if (pmsr_pmax != powernv_pstate_info.max) { | ||
| 311 | throttled = true; | ||
| 312 | pr_info("CPU %d Pmax is reduced to %d\n", cpu, pmsr_pmax); | ||
| 313 | pr_info("Max allowed Pstate is capped\n"); | ||
| 314 | } | ||
| 315 | |||
| 316 | /* | ||
| 317 | * Check for Psafe by reading LocalPstate | ||
| 318 | * or check if Psafe_mode_active is set in PMSR. | ||
| 319 | */ | ||
| 320 | pmsr_lp = (s8)PMSR_LP(pmsr); | ||
| 321 | if ((pmsr_lp < powernv_pstate_info.min) || | ||
| 322 | (pmsr & PMSR_PSAFE_ENABLE)) { | ||
| 323 | throttled = true; | ||
| 324 | pr_info("Pstate set to safe frequency\n"); | ||
| 325 | } | ||
| 326 | |||
