Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6b342944
Commit
6b342944
authored
Dec 21, 2017
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge back cpufreq material for v4.16.
parents
56026645
9a835fa6
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
896 additions
and
84 deletions
+896
-84
Documentation/devicetree/bindings/arm/marvell/armada-37xx.txt
...mentation/devicetree/bindings/arm/marvell/armada-37xx.txt
+19
-0
Documentation/devicetree/bindings/opp/ti-omap5-opp-supply.txt
...mentation/devicetree/bindings/opp/ti-omap5-opp-supply.txt
+63
-0
MAINTAINERS
MAINTAINERS
+1
-0
drivers/cpufreq/Kconfig.arm
drivers/cpufreq/Kconfig.arm
+47
-41
drivers/cpufreq/Makefile
drivers/cpufreq/Makefile
+5
-4
drivers/cpufreq/armada-37xx-cpufreq.c
drivers/cpufreq/armada-37xx-cpufreq.c
+241
-0
drivers/cpufreq/cpufreq-dt-platdev.c
drivers/cpufreq/cpufreq-dt-platdev.c
+8
-0
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq.c
+30
-25
drivers/cpufreq/longhaul.c
drivers/cpufreq/longhaul.c
+1
-1
drivers/cpufreq/mediatek-cpufreq.c
drivers/cpufreq/mediatek-cpufreq.c
+1
-0
drivers/cpufreq/mvebu-cpufreq.c
drivers/cpufreq/mvebu-cpufreq.c
+9
-7
drivers/cpufreq/ti-cpufreq.c
drivers/cpufreq/ti-cpufreq.c
+45
-6
drivers/opp/Makefile
drivers/opp/Makefile
+1
-0
drivers/opp/ti-opp-supply.c
drivers/opp/ti-opp-supply.c
+425
-0
No files found.
Documentation/devicetree/bindings/arm/marvell/armada-37xx.txt
View file @
6b342944
...
...
@@ -14,3 +14,22 @@ following property before the previous one:
Example:
compatible = "marvell,armada-3720-db", "marvell,armada3720", "marvell,armada3710";
Power management
----------------
For power management (particularly DVFS and AVS), the North Bridge
Power Management component is needed:
Required properties:
- compatible : should contain "marvell,armada-3700-nb-pm", "syscon";
- reg : the register start and length for the North Bridge
Power Management
Example:
nb_pm: syscon@14000 {
compatible = "marvell,armada-3700-nb-pm", "syscon";
reg = <0x14000 0x60>;
}
Documentation/devicetree/bindings/opp/ti-omap5-opp-supply.txt
0 → 100644
View file @
6b342944
Texas Instruments OMAP compatible OPP supply description
OMAP5, DRA7, and AM57 family of SoCs have Class0 AVS eFuse registers which
contain data that can be used to adjust voltages programmed for some of their
supplies for more efficient operation. This binding provides the information
needed to read these values and use them to program the main regulator during
an OPP transitions.
Also, some supplies may have an associated vbb-supply which is an Adaptive Body
Bias regulator which much be transitioned in a specific sequence with regards
to the vdd-supply and clk when making an OPP transition. By supplying two
regulators to the device that will undergo OPP transitions we can make use
of the multi regulator binding that is part of the OPP core described here [1]
to describe both regulators needed by the platform.
[1] Documentation/devicetree/bindings/opp/opp.txt
Required Properties for Device Node:
- vdd-supply: phandle to regulator controlling VDD supply
- vbb-supply: phandle to regulator controlling Body Bias supply
(Usually Adaptive Body Bias regulator)
Required Properties for opp-supply node:
- compatible: Should be one of:
"ti,omap-opp-supply" - basic OPP supply controlling VDD and VBB
"ti,omap5-opp-supply" - OMAP5+ optimized voltages in efuse(class0)VDD
along with VBB
"ti,omap5-core-opp-supply" - OMAP5+ optimized voltages in efuse(class0) VDD
but no VBB.
- reg: Address and length of the efuse register set for the device (mandatory
only for "ti,omap5-opp-supply")
- ti,efuse-settings: An array of u32 tuple items providing information about
optimized efuse configuration. Each item consists of the following:
volt: voltage in uV - reference voltage (OPP voltage)
efuse_offseet: efuse offset from reg where the optimized voltage is stored.
- ti,absolute-max-voltage-uv: absolute maximum voltage for the OPP supply.
Example:
/* Device Node (CPU) */
cpus {
cpu0: cpu@0 {
device_type = "cpu";
...
vdd-supply = <&vcc>;
vbb-supply = <&abb_mpu>;
};
};
/* OMAP OPP Supply with Class0 registers */
opp_supply_mpu: opp_supply@4a003b20 {
compatible = "ti,omap5-opp-supply";
reg = <0x4a003b20 0x8>;
ti,efuse-settings = <
/* uV offset */
1060000 0x0
1160000 0x4
1210000 0x8
>;
ti,absolute-max-voltage-uv = <1500000>;
};
MAINTAINERS
View file @
6b342944
...
...
@@ -1583,6 +1583,7 @@ F: arch/arm/boot/dts/kirkwood*
F: arch/arm/configs/mvebu_*_defconfig
F: arch/arm/mach-mvebu/
F: arch/arm64/boot/dts/marvell/armada*
F: drivers/cpufreq/armada-37xx-cpufreq.c
F: drivers/cpufreq/mvebu-cpufreq.c
F: drivers/irqchip/irq-armada-370-xp.c
F: drivers/irqchip/irq-mvebu-*
...
...
drivers/cpufreq/Kconfig.arm
View file @
6b342944
...
...
@@ -2,6 +2,29 @@
# ARM CPU Frequency scaling drivers
#
config ACPI_CPPC_CPUFREQ
tristate "CPUFreq driver based on the ACPI CPPC spec"
depends on ACPI_PROCESSOR
select ACPI_CPPC_LIB
help
This adds a CPUFreq driver which uses CPPC methods
as described in the ACPIv5.1 spec. CPPC stands for
Collaborative Processor Performance Controls. It
is based on an abstract continuous scale of CPU
performance values which allows the remote power
processor to flexibly optimize for power and
performance. CPPC relies on power management firmware
support for its operation.
If in doubt, say N.
config ARM_ARMADA_37XX_CPUFREQ
tristate "Armada 37xx CPUFreq support"
depends on ARCH_MVEBU
help
This adds the CPUFreq driver support for Marvell Armada 37xx SoCs.
The Armada 37xx PMU supports 4 frequency and VDD levels.
# big LITTLE core layer and glue drivers
config ARM_BIG_LITTLE_CPUFREQ
tristate "Generic ARM big LITTLE CPUfreq driver"
...
...
@@ -12,6 +35,30 @@ config ARM_BIG_LITTLE_CPUFREQ
help
This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.
config ARM_DT_BL_CPUFREQ
tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver"
depends on ARM_BIG_LITTLE_CPUFREQ && OF
help
This enables probing via DT for Generic CPUfreq driver for ARM
big.LITTLE platform. This gets frequency tables from DT.
config ARM_SCPI_CPUFREQ
tristate "SCPI based CPUfreq driver"
depends on ARM_BIG_LITTLE_CPUFREQ && ARM_SCPI_PROTOCOL && COMMON_CLK_SCPI
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_VEXPRESS_SPC_CPUFREQ
tristate "Versatile Express SPC based CPUfreq driver"
depends on ARM_BIG_LITTLE_CPUFREQ && ARCH_VEXPRESS_SPC
help
This add the CPUfreq driver support for Versatile Express
big.LITTLE platforms using SPC for power management.
config ARM_BRCMSTB_AVS_CPUFREQ
tristate "Broadcom STB AVS CPUfreq driver"
depends on ARCH_BRCMSTB || COMPILE_TEST
...
...
@@ -33,20 +80,6 @@ config ARM_BRCMSTB_AVS_CPUFREQ_DEBUG
If in doubt, say N.
config ARM_DT_BL_CPUFREQ
tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver"
depends on ARM_BIG_LITTLE_CPUFREQ && OF
help
This enables probing via DT for Generic CPUfreq driver for ARM
big.LITTLE platform. This gets frequency tables from DT.
config ARM_VEXPRESS_SPC_CPUFREQ
tristate "Versatile Express SPC based CPUfreq driver"
depends on ARM_BIG_LITTLE_CPUFREQ && ARCH_VEXPRESS_SPC
help
This add the CPUfreq driver support for Versatile Express
big.LITTLE platforms using SPC for power management.
config ARM_EXYNOS5440_CPUFREQ
tristate "SAMSUNG EXYNOS5440"
depends on SOC_EXYNOS5440
...
...
@@ -205,16 +238,6 @@ config ARM_SA1100_CPUFREQ
config ARM_SA1110_CPUFREQ
bool
config ARM_SCPI_CPUFREQ
tristate "SCPI based CPUfreq driver"
depends on ARM_BIG_LITTLE_CPUFREQ && ARM_SCPI_PROTOCOL && COMMON_CLK_SCPI
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_SPEAR_CPUFREQ
bool "SPEAr CPUFreq support"
depends on PLAT_SPEAR
...
...
@@ -275,20 +298,3 @@ config ARM_PXA2xx_CPUFREQ
This add the CPUFreq driver support for Intel PXA2xx SOCs.
If in doubt, say N.
config ACPI_CPPC_CPUFREQ
tristate "CPUFreq driver based on the ACPI CPPC spec"
depends on ACPI_PROCESSOR
select ACPI_CPPC_LIB
default n
help
This adds a CPUFreq driver which uses CPPC methods
as described in the ACPIv5.1 spec. CPPC stands for
Collaborative Processor Performance Controls. It
is based on an abstract continuous scale of CPU
performance values which allows the remote power
processor to flexibly optimize for power and
performance. CPPC relies on power management firmware
support for its operation.
If in doubt, say N.
drivers/cpufreq/Makefile
View file @
6b342944
...
...
@@ -52,23 +52,26 @@ obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ) += arm_big_little.o
# LITTLE drivers, so that it is probed last.
obj-$(CONFIG_ARM_DT_BL_CPUFREQ)
+=
arm_big_little_dt.o
obj-$(CONFIG_ARM_ARMADA_37XX_CPUFREQ)
+=
armada-37xx-cpufreq.o
obj-$(CONFIG_ARM_BRCMSTB_AVS_CPUFREQ)
+=
brcmstb-avs-cpufreq.o
obj-$(CONFIG_ACPI_CPPC_CPUFREQ)
+=
cppc_cpufreq.o
obj-$(CONFIG_ARCH_DAVINCI)
+=
davinci-cpufreq.o
obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ)
+=
exynos5440-cpufreq.o
obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ)
+=
highbank-cpufreq.o
obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)
+=
imx6q-cpufreq.o
obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ)
+=
kirkwood-cpufreq.o
obj-$(CONFIG_ARM_MEDIATEK_CPUFREQ)
+=
mediatek-cpufreq.o
obj-$(CONFIG_MACH_MVEBU_V7)
+=
mvebu-cpufreq.o
obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)
+=
omap-cpufreq.o
obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)
+=
pxa2xx-cpufreq.o
obj-$(CONFIG_PXA3xx)
+=
pxa3xx-cpufreq.o
obj-$(CONFIG_ARM_S3C24XX_CPUFREQ)
+=
s3c24xx-cpufreq.o
obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS)
+=
s3c24xx-cpufreq-debugfs.o
obj-$(CONFIG_ARM_S3C2410_CPUFREQ)
+=
s3c2410-cpufreq.o
obj-$(CONFIG_ARM_S3C2412_CPUFREQ)
+=
s3c2412-cpufreq.o
obj-$(CONFIG_ARM_S3C2416_CPUFREQ)
+=
s3c2416-cpufreq.o
obj-$(CONFIG_ARM_S3C2440_CPUFREQ)
+=
s3c2440-cpufreq.o
obj-$(CONFIG_ARM_S3C64XX_CPUFREQ)
+=
s3c64xx-cpufreq.o
obj-$(CONFIG_ARM_S3C24XX_CPUFREQ)
+=
s3c24xx-cpufreq.o
obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS)
+=
s3c24xx-cpufreq-debugfs.o
obj-$(CONFIG_ARM_S5PV210_CPUFREQ)
+=
s5pv210-cpufreq.o
obj-$(CONFIG_ARM_SA1100_CPUFREQ)
+=
sa1100-cpufreq.o
obj-$(CONFIG_ARM_SA1110_CPUFREQ)
+=
sa1110-cpufreq.o
...
...
@@ -81,8 +84,6 @@ obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o
obj-$(CONFIG_ARM_TEGRA186_CPUFREQ)
+=
tegra186-cpufreq.o
obj-$(CONFIG_ARM_TI_CPUFREQ)
+=
ti-cpufreq.o
obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ)
+=
vexpress-spc-cpufreq.o
obj-$(CONFIG_ACPI_CPPC_CPUFREQ)
+=
cppc_cpufreq.o
obj-$(CONFIG_MACH_MVEBU_V7)
+=
mvebu-cpufreq.o
##################################################################################
...
...
drivers/cpufreq/armada-37xx-cpufreq.c
0 → 100644
View file @
6b342944
// SPDX-License-Identifier: GPL-2.0+
/*
* CPU frequency scaling support for Armada 37xx platform.
*
* Copyright (C) 2017 Marvell
*
* Gregory CLEMENT <gregory.clement@free-electrons.com>
*/
#include <linux/clk.h>
#include <linux/cpu.h>
#include <linux/cpufreq.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/pm_opp.h>
#include <linux/regmap.h>
#include <linux/slab.h>
/* Power management in North Bridge register set */
#define ARMADA_37XX_NB_L0L1 0x18
#define ARMADA_37XX_NB_L2L3 0x1C
#define ARMADA_37XX_NB_TBG_DIV_OFF 13
#define ARMADA_37XX_NB_TBG_DIV_MASK 0x7
#define ARMADA_37XX_NB_CLK_SEL_OFF 11
#define ARMADA_37XX_NB_CLK_SEL_MASK 0x1
#define ARMADA_37XX_NB_CLK_SEL_TBG 0x1
#define ARMADA_37XX_NB_TBG_SEL_OFF 9
#define ARMADA_37XX_NB_TBG_SEL_MASK 0x3
#define ARMADA_37XX_NB_VDD_SEL_OFF 6
#define ARMADA_37XX_NB_VDD_SEL_MASK 0x3
#define ARMADA_37XX_NB_CONFIG_SHIFT 16
#define ARMADA_37XX_NB_DYN_MOD 0x24
#define ARMADA_37XX_NB_CLK_SEL_EN BIT(26)
#define ARMADA_37XX_NB_TBG_EN BIT(28)
#define ARMADA_37XX_NB_DIV_EN BIT(29)
#define ARMADA_37XX_NB_VDD_EN BIT(30)
#define ARMADA_37XX_NB_DFS_EN BIT(31)
#define ARMADA_37XX_NB_CPU_LOAD 0x30
#define ARMADA_37XX_NB_CPU_LOAD_MASK 0x3
#define ARMADA_37XX_DVFS_LOAD_0 0
#define ARMADA_37XX_DVFS_LOAD_1 1
#define ARMADA_37XX_DVFS_LOAD_2 2
#define ARMADA_37XX_DVFS_LOAD_3 3
/*
* On Armada 37xx the Power management manages 4 level of CPU load,
* each level can be associated with a CPU clock source, a CPU
* divider, a VDD level, etc...
*/
#define LOAD_LEVEL_NR 4
struct
armada_37xx_dvfs
{
u32
cpu_freq_max
;
u8
divider
[
LOAD_LEVEL_NR
];
};
static
struct
armada_37xx_dvfs
armada_37xx_dvfs
[]
=
{
{.
cpu_freq_max
=
1200
*
1000
*
1000
,
.
divider
=
{
1
,
2
,
4
,
6
}
},
{.
cpu_freq_max
=
1000
*
1000
*
1000
,
.
divider
=
{
1
,
2
,
4
,
5
}
},
{.
cpu_freq_max
=
800
*
1000
*
1000
,
.
divider
=
{
1
,
2
,
3
,
4
}
},
{.
cpu_freq_max
=
600
*
1000
*
1000
,
.
divider
=
{
2
,
4
,
5
,
6
}
},
};
static
struct
armada_37xx_dvfs
*
armada_37xx_cpu_freq_info_get
(
u32
freq
)
{
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
armada_37xx_dvfs
);
i
++
)
{
if
(
freq
==
armada_37xx_dvfs
[
i
].
cpu_freq_max
)
return
&
armada_37xx_dvfs
[
i
];
}
pr_err
(
"Unsupported CPU frequency %d MHz
\n
"
,
freq
/
1000000
);
return
NULL
;
}
/*
* Setup the four level managed by the hardware. Once the four level
* will be configured then the DVFS will be enabled.
*/
static
void
__init
armada37xx_cpufreq_dvfs_setup
(
struct
regmap
*
base
,
struct
clk
*
clk
,
u8
*
divider
)
{
int
load_lvl
;
struct
clk
*
parent
;
for
(
load_lvl
=
0
;
load_lvl
<
LOAD_LEVEL_NR
;
load_lvl
++
)
{
unsigned
int
reg
,
mask
,
val
,
offset
=
0
;
if
(
load_lvl
<=
ARMADA_37XX_DVFS_LOAD_1
)
reg
=
ARMADA_37XX_NB_L0L1
;
else
reg
=
ARMADA_37XX_NB_L2L3
;
if
(
load_lvl
==
ARMADA_37XX_DVFS_LOAD_0
||
load_lvl
==
ARMADA_37XX_DVFS_LOAD_2
)
offset
+=
ARMADA_37XX_NB_CONFIG_SHIFT
;
/* Set cpu clock source, for all the level we use TBG */
val
=
ARMADA_37XX_NB_CLK_SEL_TBG
<<
ARMADA_37XX_NB_CLK_SEL_OFF
;
mask
=
(
ARMADA_37XX_NB_CLK_SEL_MASK
<<
ARMADA_37XX_NB_CLK_SEL_OFF
);
/*
* Set cpu divider based on the pre-computed array in
* order to have balanced step.
*/
val
|=
divider
[
load_lvl
]
<<
ARMADA_37XX_NB_TBG_DIV_OFF
;
mask
|=
(
ARMADA_37XX_NB_TBG_DIV_MASK
<<
ARMADA_37XX_NB_TBG_DIV_OFF
);
/* Set VDD divider which is actually the load level. */
val
|=
load_lvl
<<
ARMADA_37XX_NB_VDD_SEL_OFF
;
mask
|=
(
ARMADA_37XX_NB_VDD_SEL_MASK
<<
ARMADA_37XX_NB_VDD_SEL_OFF
);
val
<<=
offset
;
mask
<<=
offset
;
regmap_update_bits
(
base
,
reg
,
mask
,
val
);
}
/*
* Set cpu clock source, for all the level we keep the same
* clock source that the one already configured. For this one
* we need to use the clock framework
*/
parent
=
clk_get_parent
(
clk
);
clk_set_parent
(
clk
,
parent
);
}
static
void
__init
armada37xx_cpufreq_disable_dvfs
(
struct
regmap
*
base
)
{
unsigned
int
reg
=
ARMADA_37XX_NB_DYN_MOD
,
mask
=
ARMADA_37XX_NB_DFS_EN
;
regmap_update_bits
(
base
,
reg
,
mask
,
0
);
}
static
void
__init
armada37xx_cpufreq_enable_dvfs
(
struct
regmap
*
base
)
{
unsigned
int
val
,
reg
=
ARMADA_37XX_NB_CPU_LOAD
,
mask
=
ARMADA_37XX_NB_CPU_LOAD_MASK
;
/* Start with the highest load (0) */
val
=
ARMADA_37XX_DVFS_LOAD_0
;
regmap_update_bits
(
base
,
reg
,
mask
,
val
);
/* Now enable DVFS for the CPUs */
reg
=
ARMADA_37XX_NB_DYN_MOD
;
mask
=
ARMADA_37XX_NB_CLK_SEL_EN
|
ARMADA_37XX_NB_TBG_EN
|
ARMADA_37XX_NB_DIV_EN
|
ARMADA_37XX_NB_VDD_EN
|
ARMADA_37XX_NB_DFS_EN
;
regmap_update_bits
(
base
,
reg
,
mask
,
mask
);
}
static
int
__init
armada37xx_cpufreq_driver_init
(
void
)
{
struct
armada_37xx_dvfs
*
dvfs
;
struct
platform_device
*
pdev
;
unsigned
int
cur_frequency
;
struct
regmap
*
nb_pm_base
;
struct
device
*
cpu_dev
;
int
load_lvl
,
ret
;
struct
clk
*
clk
;
nb_pm_base
=
syscon_regmap_lookup_by_compatible
(
"marvell,armada-3700-nb-pm"
);
if
(
IS_ERR
(
nb_pm_base
))
return
-
ENODEV
;
/* Before doing any configuration on the DVFS first, disable it */
armada37xx_cpufreq_disable_dvfs
(
nb_pm_base
);
/*
* On CPU 0 register the operating points supported (which are
* the nominal CPU frequency and full integer divisions of
* it).
*/
cpu_dev
=
get_cpu_device
(
0
);
if
(
!
cpu_dev
)
{
dev_err
(
cpu_dev
,
"Cannot get CPU
\n
"
);
return
-
ENODEV
;
}
clk
=
clk_get
(
cpu_dev
,
0
);
if
(
IS_ERR
(
clk
))
{
dev_err
(
cpu_dev
,
"Cannot get clock for CPU0
\n
"
);
return
PTR_ERR
(
clk
);
}
/* Get nominal (current) CPU frequency */
cur_frequency
=
clk_get_rate
(
clk
);
if
(
!
cur_frequency
)
{
dev_err
(
cpu_dev
,
"Failed to get clock rate for CPU
\n
"
);
return
-
EINVAL
;
}
dvfs
=
armada_37xx_cpu_freq_info_get
(
cur_frequency
);
if
(
!
dvfs
)
return
-
EINVAL
;
armada37xx_cpufreq_dvfs_setup
(
nb_pm_base
,
clk
,
dvfs
->
divider
);
for
(
load_lvl
=
ARMADA_37XX_DVFS_LOAD_0
;
load_lvl
<
LOAD_LEVEL_NR
;
load_lvl
++
)
{
unsigned
long
freq
=
cur_frequency
/
dvfs
->
divider
[
load_lvl
];
ret
=
dev_pm_opp_add
(
cpu_dev
,
freq
,
0
);
if
(
ret
)
{
/* clean-up the already added opp before leaving */
while
(
load_lvl
--
>
ARMADA_37XX_DVFS_LOAD_0
)
{
freq
=
cur_frequency
/
dvfs
->
divider
[
load_lvl
];
dev_pm_opp_remove
(
cpu_dev
,
freq
);
}
return
ret
;
}
}
/* Now that everything is setup, enable the DVFS at hardware level */
armada37xx_cpufreq_enable_dvfs
(
nb_pm_base
);
pdev
=
platform_device_register_simple
(
"cpufreq-dt"
,
-
1
,
NULL
,
0
);
return
PTR_ERR_OR_ZERO
(
pdev
);
}
/* late_initcall, to guarantee the driver is loaded after A37xx clock driver */
late_initcall
(
armada37xx_cpufreq_driver_init
);
MODULE_AUTHOR
(
"Gregory CLEMENT <gregory.clement@free-electrons.com>"
);
MODULE_DESCRIPTION
(
"Armada 37xx cpufreq driver"
);
MODULE_LICENSE
(
"GPL"
);
drivers/cpufreq/cpufreq-dt-platdev.c
View file @
6b342944
...
...
@@ -108,6 +108,14 @@ static const struct of_device_id blacklist[] __initconst = {
{
.
compatible
=
"marvell,armadaxp"
,
},
{
.
compatible
=
"mediatek,mt2701"
,
},
{
.
compatible
=
"mediatek,mt2712"
,
},
{
.
compatible
=
"mediatek,mt7622"
,
},
{
.
compatible
=
"mediatek,mt7623"
,
},
{
.
compatible
=
"mediatek,mt817x"
,
},
{
.
compatible
=
"mediatek,mt8173"
,
},
{
.
compatible
=
"mediatek,mt8176"
,
},
{
.
compatible
=
"nvidia,tegra124"
,
},
{
.
compatible
=
"st,stih407"
,
},
...
...
drivers/cpufreq/cpufreq.c
View file @
6b342944
...
...
@@ -601,19 +601,18 @@ static struct cpufreq_governor *find_governor(const char *str_governor)
/**
* cpufreq_parse_governor - parse a governor string
*/
static
int
cpufreq_parse_governor
(
char
*
str_governor
,
unsigned
int
*
policy
,
struct
cpufreq_governor
**
governor
)
static
int
cpufreq_parse_governor
(
char
*
str_governor
,
struct
cpufreq_policy
*
policy
)
{
int
err
=
-
EINVAL
;
if
(
cpufreq_driver
->
setpolicy
)
{
if
(
!
strncasecmp
(
str_governor
,
"performance"
,
CPUFREQ_NAME_LEN
))
{
*
policy
=
CPUFREQ_POLICY_PERFORMANCE
;
err
=
0
;
}
else
if
(
!
strncasecmp
(
str_governor
,
"powersave"
,
CPUFREQ_NAME_LEN
))
{
*
policy
=
CPUFREQ_POLICY_POWERSAVE
;
err
=
0
;
policy
->
policy
=
CPUFREQ_POLICY_PERFORMANCE
;
return
0
;
}
if
(
!
strncasecmp
(
str_governor
,
"powersave"
,
CPUFREQ_NAME_LEN
))
{
policy
->
policy
=
CPUFREQ_POLICY_POWERSAVE
;
return
0
;
}
}
else
{
struct
cpufreq_governor
*
t
;
...
...
@@ -621,26 +620,31 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
mutex_lock
(
&
cpufreq_governor_mutex
);
t
=
find_governor
(
str_governor
);
if
(
t
==
NULL
)
{
if
(
!
t
)
{
int
ret
;
mutex_unlock
(
&
cpufreq_governor_mutex
);
ret
=
request_module
(
"cpufreq_%s"
,
str_governor
);
mutex_lock
(
&
cpufreq_governor_mutex
);
if
(
ret
)
return
-
EINVAL
;
if
(
ret
==
0
)
t
=
find_governor
(
str_governor
);
}
mutex_lock
(
&
cpufreq_governor_mutex
);
if
(
t
!=
NULL
)
{
*
governor
=
t
;
err
=
0
;
t
=
find_governor
(
str_governor
);
}
if
(
t
&&
!
try_module_get
(
t
->
owner
))
t
=
NULL
;
mutex_unlock
(
&
cpufreq_governor_mutex
);
if
(
t
)
{
policy
->
governor
=
t
;
return
0
;
}
}
return
err
;
return
-
EINVAL
;
}
/**
...
...
@@ -760,11 +764,14 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
if
(
ret
!=
1
)
return
-
EINVAL
;
if
(
cpufreq_parse_governor
(
str_governor
,
&
new_policy
.
policy
,
&
new_policy
.
governor
))
if
(
cpufreq_parse_governor
(
str_governor
,
&
new_policy
))
return
-
EINVAL
;
ret
=
cpufreq_set_policy
(
policy
,
&
new_policy
);
if
(
new_policy
.
governor
)
module_put
(
new_policy
.
governor
->
owner
);
return
ret
?
ret
:
count
;
}
...
...
@@ -1044,8 +1051,7 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy)
if
(
policy
->
last_policy
)
new_policy
.
policy
=
policy
->
last_policy
;
else
cpufreq_parse_governor
(
gov
->
name
,
&
new_policy
.
policy
,
NULL
);
cpufreq_parse_governor
(
gov
->
name
,
&
new_policy
);
}
/* set default policy */
return
cpufreq_set_policy
(
policy
,
&
new_policy
);
...
...
@@ -2160,7 +2166,6 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor)
mutex_lock
(
&
cpufreq_governor_mutex
);
list_del
(
&
governor
->
governor_list
);
mutex_unlock
(
&
cpufreq_governor_mutex
);
return
;
}
EXPORT_SYMBOL_GPL
(
cpufreq_unregister_governor
);
...
...
drivers/cpufreq/longhaul.c
View file @
6b342944
...
...
@@ -894,7 +894,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy)
if
((
longhaul_version
!=
TYPE_LONGHAUL_V1
)
&&
(
scale_voltage
!=
0
))
longhaul_setup_voltagescaling
();
policy
->
cpuinfo
.
transition_latency
=
200000
;
/* n
sec */
policy
->
transition_delay_us
=
200000
;
/* u
sec */
return
cpufreq_table_validate_and_show
(
policy
,
longhaul_table
);
}
...
...
drivers/cpufreq/mediatek-cpufreq.c
View file @
6b342944
...
...
@@ -574,6 +574,7 @@ static struct platform_driver mtk_cpufreq_platdrv = {
/* List of machines supported by this driver */
static
const
struct
of_device_id
mtk_cpufreq_machines
[]
__initconst
=
{
{
.
compatible
=
"mediatek,mt2701"
,
},
{
.
compatible
=
"mediatek,mt2712"
,
},
{
.
compatible
=
"mediatek,mt7622"
,
},
{
.
compatible
=
"mediatek,mt7623"
,
},
{
.
compatible
=
"mediatek,mt817x"
,
},
...
...
drivers/cpufreq/mvebu-cpufreq.c
View file @
6b342944
...
...
@@ -76,12 +76,6 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
return
PTR_ERR
(
clk
);
}
/*
* In case of a failure of dev_pm_opp_add(), we don't
* bother with cleaning up the registered OPP (there's
* no function to do so), and simply cancel the
* registration of the cpufreq device.
*/
ret
=
dev_pm_opp_add
(
cpu_dev
,
clk_get_rate
(
clk
),
0
);
if
(
ret
)
{
clk_put
(
clk
);
...
...
@@ -91,7 +85,8 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
ret
=
dev_pm_opp_add
(
cpu_dev
,
clk_get_rate
(
clk
)
/
2
,
0
);
if
(
ret
)
{
clk_put
(
clk
);
return
ret
;
dev_err
(
cpu_dev
,
"Failed to register OPPs
\n
"
);
goto
opp_register_failed
;
}
ret
=
dev_pm_opp_set_sharing_cpus
(
cpu_dev
,
...
...
@@ -99,9 +94,16 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
if
(
ret
)
dev_err
(
cpu_dev
,
"%s: failed to mark OPPs as shared: %d
\n
"
,
__func__
,
ret
);
clk_put
(
clk
);
}
platform_device_register_simple
(
"cpufreq-dt"
,
-
1
,
NULL
,
0
);
return
0
;
opp_register_failed:
/* As registering has failed remove all the opp for all cpus */
dev_pm_opp_cpumask_remove_table
(
cpu_possible_mask
);
return
ret
;
}
device_initcall
(
armada_xp_pmsu_cpufreq_init
);
drivers/cpufreq/ti-cpufreq.c
View file @
6b342944
...
...
@@ -17,6 +17,7 @@
#include <linux/cpu.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/of_platform.h>
...
...
@@ -50,6 +51,7 @@ struct ti_cpufreq_soc_data {
unsigned
long
efuse_mask
;
unsigned
long
efuse_shift
;
unsigned
long
rev_offset
;
bool
multi_regulator
;
};
struct
ti_cpufreq_data
{
...
...
@@ -57,6 +59,7 @@ struct ti_cpufreq_data {
struct
device_node
*
opp_node
;
struct
regmap
*
syscon
;
const
struct
ti_cpufreq_soc_data
*
soc_data
;
struct
opp_table
*
opp_table
;
};
static
unsigned
long
amx3_efuse_xlate
(
struct
ti_cpufreq_data
*
opp_data
,
...
...
@@ -95,6 +98,7 @@ static struct ti_cpufreq_soc_data am3x_soc_data = {
.
efuse_offset
=
0x07fc
,
.
efuse_mask
=
0x1fff
,
.
rev_offset
=
0x600
,
.
multi_regulator
=
false
,
};
static
struct
ti_cpufreq_soc_data
am4x_soc_data
=
{
...
...
@@ -103,6 +107,7 @@ static struct ti_cpufreq_soc_data am4x_soc_data = {
.
efuse_offset
=
0x0610
,
.
efuse_mask
=
0x3f
,
.
rev_offset
=
0x600
,
.
multi_regulator
=
false
,
};
static
struct
ti_cpufreq_soc_data
dra7_soc_data
=
{
...
...
@@ -111,6 +116,7 @@ static struct ti_cpufreq_soc_data dra7_soc_data = {
.
efuse_mask
=
0xf80000
,
.
efuse_shift
=
19
,
.
rev_offset
=
0x204
,
.
multi_regulator
=
true
,
};
/**
...
...
@@ -195,12 +201,14 @@ static const struct of_device_id ti_cpufreq_of_match[] = {
{},
};
static
int
ti_cpufreq_
init
(
void
)
static
int
ti_cpufreq_
probe
(
struct
platform_device
*
pdev
)
{
u32
version
[
VERSION_COUNT
];
struct
device_node
*
np
;
const
struct
of_device_id
*
match
;
struct
opp_table
*
ti_opp_table
;
struct
ti_cpufreq_data
*
opp_data
;
const
char
*
const
reg_names
[]
=
{
"vdd"
,
"vbb"
};
int
ret
;
np
=
of_find_node_by_path
(
"/"
);
...
...
@@ -247,16 +255,29 @@ static int ti_cpufreq_init(void)
if
(
ret
)
goto
fail_put_node
;
ret
=
PTR_ERR_OR_ZERO
(
dev_pm_opp_set_supported_hw
(
opp_data
->
cpu_dev
,
version
,
VERSION_COUNT
)
);
if
(
ret
)
{
ti_opp_table
=
dev_pm_opp_set_supported_hw
(
opp_data
->
cpu_dev
,
version
,
VERSION_COUNT
);
if
(
IS_ERR
(
ti_opp_table
)
)
{
dev_err
(
opp_data
->
cpu_dev
,
"Failed to set supported hardware
\n
"
);
ret
=
PTR_ERR
(
ti_opp_table
);
goto
fail_put_node
;
}
of_node_put
(
opp_data
->
opp_node
);
opp_data
->
opp_table
=
ti_opp_table
;
if
(
opp_data
->
soc_data
->
multi_regulator
)
{
ti_opp_table
=
dev_pm_opp_set_regulators
(
opp_data
->
cpu_dev
,
reg_names
,
ARRAY_SIZE
(
reg_names
));
if
(
IS_ERR
(
ti_opp_table
))
{
dev_pm_opp_put_supported_hw
(
opp_data
->
opp_table
);
ret
=
PTR_ERR
(
ti_opp_table
);
goto
fail_put_node
;
}
}
of_node_put
(
opp_data
->
opp_node
);
register_cpufreq_dt:
platform_device_register_simple
(
"cpufreq-dt"
,
-
1
,
NULL
,
0
);
...
...
@@ -269,4 +290,22 @@ static int ti_cpufreq_init(void)
return
ret
;
}
device_initcall
(
ti_cpufreq_init
);
static
int
ti_cpufreq_init
(
void
)
{
platform_device_register_simple
(
"ti-cpufreq"
,
-
1
,
NULL
,
0
);
return
0
;
}
module_init
(
ti_cpufreq_init
);
static
struct
platform_driver
ti_cpufreq_driver
=
{
.
probe
=
ti_cpufreq_probe
,
.
driver
=
{
.
name
=
"ti-cpufreq"
,
},
};
module_platform_driver
(
ti_cpufreq_driver
);
MODULE_DESCRIPTION
(
"TI CPUFreq/OPP hw-supported driver"
);
MODULE_AUTHOR
(
"Dave Gerlach <d-gerlach@ti.com>"
);
MODULE_LICENSE
(
"GPL v2"
);
drivers/opp/Makefile
View file @
6b342944
...
...
@@ -2,3 +2,4 @@ ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
obj-y
+=
core.o cpu.o
obj-$(CONFIG_OF)
+=
of.o
obj-$(CONFIG_DEBUG_FS)
+=
debugfs.o
obj-$(CONFIG_ARM_TI_CPUFREQ)
+=
ti-opp-supply.o
drivers/opp/ti-opp-supply.c
0 → 100644
View file @
6b342944
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment