mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
ARM: SoC driver updates for v4.3
Some releases this branch is nearly empty, others we have more stuff. It
tends to gather drivers that need SoC modification or dependencies such
that they have to (also) go in through our tree.
For this release, we have merged in part of the reset controller tree
(with handshake that the parts we have merged in will remain stable),
as well as dependencies on a few clock branches.
In general, new items here are:
- Qualcomm driver for SMM/SMD, which is how they communicate with the
coprocessors on (some) of their platforms
- Memory controller work for ARM's PL172 memory controller
- Reset drivers for various platforms
- PMU power domain support for Marvell platforms
- Tegra support for T132/T210 SoCs: PMC, fuse, memory controller per-SoC support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJV5Ou9AAoJEIwa5zzehBx3/k4P/jA5CVNiDvIs0GoTR3uGOuec
MYd19oKf76reV1oL5bBSpg9uryJd3fPzK0JC/qU3pYfsCVFp2TWZD7liNpitqHyt
2xL02gzJQgjHzL3QrxTQrOFJDO6P8Vm2k/5pI0KX1beoulHvI+iHejNryXGjSKSx
9vbs1GPXU9IV831YOHSaMmHz727J65bbZE8Up113ctT+WbEIc1g/ihKzUgi/8xXW
RniMxGsX8HynE3VH+UBDMbY6XkOmzZa1Wabgll735MXwIUFG1+TsvHNuGehXUski
ySwqk67en25i0F/Q7oobLSZwCPbA6Ylxk9aOfr0AnAqOEKwgKWS+K7HkEiNMz7yh
nt22b5SVkQ80sTCbNEkdJajOZ8oRalUae19CGxvMfVh77LmQ2sRI9iJrwXcxkt8W
ASs6uDDAUNC5pIWfjeJE50vsDr//Hed/WtsIjenYOtb+RI1kru5iTTgp4oLPBiy5
OeHxOfiL7gPvyZQbuPgMKAGdoGBsa/7wTM7KWJCMP6mPGHpShO8XUUsuljqKHm4w
nBV7eZRMiIuWkjRKw4bjp7R0NVKR5sOfAkZhjCsXB0aqA/NU2zyNbViWcGCh6yj8
3beZ93SdEdrKX6N8pPiAhGTMFA6eev8YeUHO7kM4IhC91ILjHlPpCs1pYk3pwEkO
ABC7GyMY6Olg1pZJweEa
=B6jn
-----END PGP SIGNATURE-----
Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver updates from Olof Johansson:
"Some releases this branch is nearly empty, others we have more stuff.
It tends to gather drivers that need SoC modification or dependencies
such that they have to (also) go in through our tree.
For this release, we have merged in part of the reset controller tree
(with handshake that the parts we have merged in will remain stable),
as well as dependencies on a few clock branches.
In general, new items here are:
- Qualcomm driver for SMM/SMD, which is how they communicate with the
coprocessors on (some) of their platforms
- memory controller work for ARM's PL172 memory controller
- reset drivers for various platforms
- PMU power domain support for Marvell platforms
- Tegra support for T132/T210 SoCs: PMC, fuse, memory controller
per-SoC support"
* tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (49 commits)
ARM: tegra: cpuidle: implement cpuidle_state.enter_freeze()
ARM: tegra: Disable cpuidle if PSCI is available
soc/tegra: pmc: Use existing pclk reference
soc/tegra: pmc: Remove unnecessary return statement
soc: tegra: Remove redundant $(CONFIG_ARCH_TEGRA) in Makefile
memory: tegra: Add Tegra210 support
memory: tegra: Add support for a variable-size client ID bitfield
clk: shmobile: rz: Add CPG/MSTP Clock Domain support
clk: shmobile: rcar-gen2: Add CPG/MSTP Clock Domain support
clk: shmobile: r8a7779: Add CPG/MSTP Clock Domain support
clk: shmobile: r8a7778: Add CPG/MSTP Clock Domain support
clk: shmobile: Add CPG/MSTP Clock Domain support
ARM: dove: create a proper PMU driver for power domains, PMU IRQs and resets
reset: reset-zynq: Adding support for Xilinx Zynq reset controller.
docs: dts: Added documentation for Xilinx Zynq Reset Controller bindings.
MIPS: ath79: Add the reset controller to the AR9132 dtsi
reset: Add a driver for the reset controller on the AR71XX/AR9XXX
devicetree: Add bindings for the ATH79 reset controller
reset: socfpga: Update reset-socfpga to read the altr,modrst-offset property
doc: dt: add documentation for lpc1850-rgu reset driver
...
This commit is contained in:
commit
102178108e
88 changed files with 6781 additions and 498 deletions
|
|
@ -247,12 +247,19 @@ config ARM_SPEAR_CPUFREQ
|
|||
help
|
||||
This adds the CPUFreq driver support for SPEAr SOCs.
|
||||
|
||||
config ARM_TEGRA_CPUFREQ
|
||||
bool "TEGRA CPUFreq support"
|
||||
config ARM_TEGRA20_CPUFREQ
|
||||
bool "Tegra20 CPUFreq support"
|
||||
depends on ARCH_TEGRA
|
||||
default y
|
||||
help
|
||||
This adds the CPUFreq driver support for TEGRA SOCs.
|
||||
This adds the CPUFreq driver support for Tegra20 SOCs.
|
||||
|
||||
config ARM_TEGRA124_CPUFREQ
|
||||
tristate "Tegra124 CPUFreq support"
|
||||
depends on ARCH_TEGRA && CPUFREQ_DT
|
||||
default y
|
||||
help
|
||||
This adds the CPUFreq driver support for Tegra124 SOCs.
|
||||
|
||||
config ARM_PXA2xx_CPUFREQ
|
||||
tristate "Intel PXA2xx CPUfreq driver"
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ obj-$(CONFIG_ARM_S5PV210_CPUFREQ) += s5pv210-cpufreq.o
|
|||
obj-$(CONFIG_ARM_SA1100_CPUFREQ) += sa1100-cpufreq.o
|
||||
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_TEGRA20_CPUFREQ) += tegra20-cpufreq.o
|
||||
obj-$(CONFIG_ARM_TEGRA124_CPUFREQ) += tegra124-cpufreq.o
|
||||
obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o
|
||||
|
||||
##################################################################################
|
||||
|
|
|
|||
214
drivers/cpufreq/tegra124-cpufreq.c
Normal file
214
drivers/cpufreq/tegra124-cpufreq.c
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
* Tegra 124 cpufreq driver
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; 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/clk.h>
|
||||
#include <linux/cpufreq-dt.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_opp.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct tegra124_cpufreq_priv {
|
||||
struct regulator *vdd_cpu_reg;
|
||||
struct clk *cpu_clk;
|
||||
struct clk *pllp_clk;
|
||||
struct clk *pllx_clk;
|
||||
struct clk *dfll_clk;
|
||||
struct platform_device *cpufreq_dt_pdev;
|
||||
};
|
||||
|
||||
static int tegra124_cpu_switch_to_dfll(struct tegra124_cpufreq_priv *priv)
|
||||
{
|
||||
struct clk *orig_parent;
|
||||
int ret;
|
||||
|
||||
ret = clk_set_rate(priv->dfll_clk, clk_get_rate(priv->cpu_clk));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
orig_parent = clk_get_parent(priv->cpu_clk);
|
||||
clk_set_parent(priv->cpu_clk, priv->pllp_clk);
|
||||
|
||||
ret = clk_prepare_enable(priv->dfll_clk);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
clk_set_parent(priv->cpu_clk, priv->dfll_clk);
|
||||
|
||||
return 0;
|
||||
|
||||
out:
|
||||
clk_set_parent(priv->cpu_clk, orig_parent);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void tegra124_cpu_switch_to_pllx(struct tegra124_cpufreq_priv *priv)
|
||||
{
|
||||
clk_set_parent(priv->cpu_clk, priv->pllp_clk);
|
||||
clk_disable_unprepare(priv->dfll_clk);
|
||||
regulator_sync_voltage(priv->vdd_cpu_reg);
|
||||
clk_set_parent(priv->cpu_clk, priv->pllx_clk);
|
||||
}
|
||||
|
||||
static struct cpufreq_dt_platform_data cpufreq_dt_pd = {
|
||||
.independent_clocks = false,
|
||||
};
|
||||
|
||||
static int tegra124_cpufreq_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct tegra124_cpufreq_priv *priv;
|
||||
struct device_node *np;
|
||||
struct device *cpu_dev;
|
||||
struct platform_device_info cpufreq_dt_devinfo = {};
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
cpu_dev = get_cpu_device(0);
|
||||
if (!cpu_dev)
|
||||
return -ENODEV;
|
||||
|
||||
np = of_cpu_device_node_get(0);
|
||||
if (!np)
|
||||
return -ENODEV;
|
||||
|
||||
priv->vdd_cpu_reg = regulator_get(cpu_dev, "vdd-cpu");
|
||||
if (IS_ERR(priv->vdd_cpu_reg)) {
|
||||
ret = PTR_ERR(priv->vdd_cpu_reg);
|
||||
goto out_put_np;
|
||||
}
|
||||
|
||||
priv->cpu_clk = of_clk_get_by_name(np, "cpu_g");
|
||||
if (IS_ERR(priv->cpu_clk)) {
|
||||
ret = PTR_ERR(priv->cpu_clk);
|
||||
goto out_put_vdd_cpu_reg;
|
||||
}
|
||||
|
||||
priv->dfll_clk = of_clk_get_by_name(np, "dfll");
|
||||
if (IS_ERR(priv->dfll_clk)) {
|
||||
ret = PTR_ERR(priv->dfll_clk);
|
||||
goto out_put_cpu_clk;
|
||||
}
|
||||
|
||||
priv->pllx_clk = of_clk_get_by_name(np, "pll_x");
|
||||
if (IS_ERR(priv->pllx_clk)) {
|
||||
ret = PTR_ERR(priv->pllx_clk);
|
||||
goto out_put_dfll_clk;
|
||||
}
|
||||
|
||||
priv->pllp_clk = of_clk_get_by_name(np, "pll_p");
|
||||
if (IS_ERR(priv->pllp_clk)) {
|
||||
ret = PTR_ERR(priv->pllp_clk);
|
||||
goto out_put_pllx_clk;
|
||||
}
|
||||
|
||||
ret = tegra124_cpu_switch_to_dfll(priv);
|
||||
if (ret)
|
||||
goto out_put_pllp_clk;
|
||||
|
||||
cpufreq_dt_devinfo.name = "cpufreq-dt";
|
||||
cpufreq_dt_devinfo.parent = &pdev->dev;
|
||||
cpufreq_dt_devinfo.data = &cpufreq_dt_pd;
|
||||
cpufreq_dt_devinfo.size_data = sizeof(cpufreq_dt_pd);
|
||||
|
||||
priv->cpufreq_dt_pdev =
|
||||
platform_device_register_full(&cpufreq_dt_devinfo);
|
||||
if (IS_ERR(priv->cpufreq_dt_pdev)) {
|
||||
ret = PTR_ERR(priv->cpufreq_dt_pdev);
|
||||
goto out_switch_to_pllx;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
return 0;
|
||||
|
||||
out_switch_to_pllx:
|
||||
tegra124_cpu_switch_to_pllx(priv);
|
||||
out_put_pllp_clk:
|
||||
clk_put(priv->pllp_clk);
|
||||
out_put_pllx_clk:
|
||||
clk_put(priv->pllx_clk);
|
||||
out_put_dfll_clk:
|
||||
clk_put(priv->dfll_clk);
|
||||
out_put_cpu_clk:
|
||||
clk_put(priv->cpu_clk);
|
||||
out_put_vdd_cpu_reg:
|
||||
regulator_put(priv->vdd_cpu_reg);
|
||||
out_put_np:
|
||||
of_node_put(np);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int tegra124_cpufreq_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct tegra124_cpufreq_priv *priv = platform_get_drvdata(pdev);
|
||||
|
||||
platform_device_unregister(priv->cpufreq_dt_pdev);
|
||||
tegra124_cpu_switch_to_pllx(priv);
|
||||
|
||||
clk_put(priv->pllp_clk);
|
||||
clk_put(priv->pllx_clk);
|
||||
clk_put(priv->dfll_clk);
|
||||
clk_put(priv->cpu_clk);
|
||||
regulator_put(priv->vdd_cpu_reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver tegra124_cpufreq_platdrv = {
|
||||
.driver.name = "cpufreq-tegra124",
|
||||
.probe = tegra124_cpufreq_probe,
|
||||
.remove = tegra124_cpufreq_remove,
|
||||
};
|
||||
|
||||
static int __init tegra_cpufreq_init(void)
|
||||
{
|
||||
int ret;
|
||||
struct platform_device *pdev;
|
||||
|
||||
if (!of_machine_is_compatible("nvidia,tegra124"))
|
||||
return -ENODEV;
|
||||
|
||||
/*
|
||||
* Platform driver+device required for handling EPROBE_DEFER with
|
||||
* the regulator and the DFLL clock
|
||||
*/
|
||||
ret = platform_driver_register(&tegra124_cpufreq_platdrv);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pdev = platform_device_register_simple("cpufreq-tegra124", -1, NULL, 0);
|
||||
if (IS_ERR(pdev)) {
|
||||
platform_driver_unregister(&tegra124_cpufreq_platdrv);
|
||||
return PTR_ERR(pdev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(tegra_cpufreq_init);
|
||||
|
||||
MODULE_AUTHOR("Tuomas Tynkkynen <[email protected]>");
|
||||
MODULE_DESCRIPTION("cpufreq driver for NVIDIA Tegra124");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
Loading…
Reference in a new issue