Tegra: Use cpufreq-cpu0 driver
Subsystems (7)
Viresh Kumar
maintainercover Tegra: Use cpufreq-cpu0 driver
Hi Stephen,
This is the first attempt to get rid of tegra-cpufreq driver. This patchset tries to add supporting infrastructure for tegra to use cpufreq-cpu0 driver.
I don't have hardware to test it and so is compiled tested only.. Few bits may be missing as I couldn't think of all aspects and so may need your help getting them fixed.
Once this is tested by you, I would like to take it through my ARM cpufreq tree if nobody else has a problem with it.
Thanks
--
Viresh.
Viresh Kumar (6):
clk: Tegra: Add CPU0 clock driver
ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
ARM: Tegra: Enable OPP library
ARM: Tegra: defconfig: select cpufreq-cpu0 driver
ARM: Tegra: start using cpufreq-cpu0 driver
cpufreq: Tegra: Remove tegra-cpufreq driver
arch/arm/boot/dts/tegra114.dtsi | 12 ++ arch/arm/boot/dts/tegra20.dtsi | 12 ++ arch/arm/boot/dts/tegra30.dtsi | 12 ++ arch/arm/configs/tegra_defconfig | 1 + arch/arm/mach-tegra/Kconfig | 2 + arch/arm/mach-tegra/tegra.c | 2 + drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-cpu.c | 164 ++++++++++++++++++++++ drivers/clk/tegra/clk-tegra30.c | 4 + drivers/cpufreq/Kconfig.arm | 8 -- drivers/cpufreq/Makefile | 1 - drivers/cpufreq/tegra-cpufreq.c | 291 --------------------------------------- include/linux/clk/tegra.h | 1 + 13 files changed, 211 insertions(+), 300 deletions(-) create mode 100644 drivers/clk/tegra/clk-cpu.c delete mode 100644 drivers/cpufreq/tegra-cpufreq.c
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 1/6 clk: Tegra: Add CPU0 clock driver
This patch adds CPU0's clk driver for Tegra. It will be used by the generic cpufreq-cpu0 driver to get/set cpu clk.
Most of the platform specific bits are picked from tegra-cpufreq.c.
--- drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-cpu.c | 164 ++++++++++++++++++++++++++++++++++++++++ drivers/clk/tegra/clk-tegra30.c | 4 + include/linux/clk/tegra.h | 1 + 4 files changed, 170 insertions(+) create mode 100644 drivers/clk/tegra/clk-cpu.c
drivers/clk/tegra/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-y += clk-super.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o +obj-$(CONFIG_GENERIC_CPUFREQ_CPU0) += clk-cpu.o
drivers/clk/tegra/clk-cpu.c new file +164 -0
164 lines not on this page · raw message
drivers/clk/tegra/clk-tegra30.c +4 -0
@@ -1396,6 +1396,10 @@ static void __init tegra30_super_clk_init(void) CLK_SET_RATE_PARENT, 1, 2);clk_register_clkdev (clk,"twd" ,NULL ); clks[twd] = clk; + +/* cpu0 clk for cpufreq driver */ + clk =tegra_clk_register_cpu0 (); +clk_register_clkdev (clk,NULL ,"cpu0" ); }static const char *mux_pllacp_clkm[] = {"pll_a_out0" ,"unused" ,"pll_p" ,
include/linux/clk/tegra.h +1 -0
@@ -128,5 +128,6 @@ static inline void tegra_periph_reset_deassert(struct clk *c) {}static inline void tegra_periph_reset_assert (struct clk *c) {}#endif void tegra_clocks_apply_init_table (void ); +struct clk *tegra_clk_register_cpu0 (void );#endif /* __LINUX_CLK_TEGRA_H_ */
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
Quoting Viresh Kumar (2013-08-07 07:46:43)
Quoted 6 lines
This patch adds CPU0's clk driver for Tegra. It will be used by the generic cpufreq-cpu0 driver to get/set cpu clk.
Most of the platform specific bits are picked from
tegra-cpufreq.c.Signed-off-by Viresh Kumar <[email protected]>
Hi Viresh,
It is nice to see more CPUfreq consolidation.
I'm currently hacking on a patch to introduce clk_coordinate_rates(). That function may be a better fit for this sort of thing compared to overloading the .set_rate callback. I'll try to get the patches on the list ASAP and will Cc you.
Regards,
Mike
Quoted 215 lines
--- drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-cpu.c | 164 ++++++++++++++++++++++++++++++++++++++++ drivers/clk/tegra/clk-tegra30.c | 4 + include/linux/clk/tegra.h | 1 + 4 files changed, 170 insertions(+) create mode 100644 drivers/clk/tegra/clk-cpu.cdrivers/clk/tegra/Makefile +1
-0@@ -10,3 +10,4 @@ obj-y += clk-super.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o +obj-$(CONFIG_GENERIC_CPUFREQ_CPU0) += clk-cpu.odrivers/clk/tegra/clk-cpu.c new file +164
-0@@ -0,0 +1,164 @@ +/* +* Copyright (C) 2013 Linaro +* +* Author: Viresh Kumar <[email protected]> +* +* This file is licensed under the terms of the GNU General Public +* License version 2. This program is licensed "as is" without any +* warranty of any kind, whether express or implied. +*/ + +/* +* Responsible for setting cpu0 clk as requested by cpufreq-cpu0 driver +* +* All platform specific bits are taken from tegra-cpufreq driver. +*/ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/slab.h> + +#define to_clk_cpu0 (_hw) container_of(_hw, struct clk_cpu0, hw) + +struct clk_cpu0 { +struct clk_hw hw; +spinlock_t *lock; +}; + +static struct clk *cpu_clk; +static struct clk *pll_x_clk; +static struct clk *pll_p_clk; +static struct clk *emc_clk; + +static unsigned long cpu0_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +return clk_get_rate (cpu_clk); +} + +static long cpu0_round_rate (struct clk_hw *hw,unsigned long drate, +unsigned long *parent_rate) +{ +return clk_round_rate (cpu_clk, drate); +} + +static int cpu0_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate) +{ +int ret; + +/* +* Vote on memory bus frequency based on cpu frequency +* This sets the minimum frequency, display or avp may request higher +*/ +if (rate >=816000000 ) +clk_set_rate (emc_clk,600000000 );/* cpu 816 MHz, emc max */ +else if (rate >=456000000 ) +clk_set_rate (emc_clk,300000000 );/* cpu 456 MHz, emc 150Mhz */ +else +clk_set_rate (emc_clk,100000000 );/* emc 50Mhz */ + +/* +* Take an extra reference to the main pll so it doesn't turn +* off when we move the cpu off of it +*/ +clk_prepare_enable (pll_x_clk); + + ret =clk_set_parent (cpu_clk, pll_p_clk); +if (ret) { +pr_err ("%s: Failed to switch cpu to clock pll_p\n" , __func__); + goto out; + } + +if (rate ==clk_get_rate (pll_p_clk)) + goto out; + + ret =clk_set_rate (pll_x_clk, rate); +if (ret) { +pr_err ("Failed to change pll_x to %lu\n" , rate); + goto out; + } + + ret =clk_set_parent (cpu_clk, pll_x_clk); +if (ret) { +pr_err ("Failed to switch cpu to clock pll_x\n" ); + goto out; + } + +out: +clk_disable_unprepare (pll_x_clk); +return ret; +} + +static struct clk_ops clk_cpu0_ops = { + .recalc_rate = cpu0_recalc_rate, + .round_rate = cpu0_round_rate, + .set_rate = cpu0_set_rate, +}; + +struct clk *tegra_clk_register_cpu0 (void ) +{ +struct clk_init_data init; +struct clk_cpu0 *cpu0; +struct clk *clk; + + cpu0 =kzalloc (sizeof (*cpu0),GFP_KERNEL ); +if (!cpu0) { +pr_err ("%s: could not allocate cpu0 clk\n" , __func__); +return ERR_PTR (-ENOMEM ); + } + + cpu_clk =clk_get_sys (NULL ,"cpu" ); +if (IS_ERR (cpu_clk)) { + clk = cpu_clk; + goto free_mem; + } + + pll_x_clk =clk_get_sys (NULL ,"pll_x" ); +if (IS_ERR (pll_x_clk)) { + clk = pll_x_clk; + goto put_cpu_clk; + } + + pll_p_clk =clk_get_sys (NULL ,"pll_p_cclk" ); +if (IS_ERR (pll_p_clk)) { + clk = pll_p_clk; + goto put_pll_x_clk; + } + + emc_clk =clk_get_sys ("cpu" ,"emc" ); +if (IS_ERR (emc_clk)) { + clk = emc_clk; + goto put_pll_p_clk; + } + + cpu0->hw.init = &init; + + init.name ="cpu0" ; + init.ops = &clk_cpu0_ops; + init.flags =CLK_IS_ROOT |CLK_GET_RATE_NOCACHE ; + init.num_parents =0 ; + + clk =clk_register (NULL , &cpu0->hw); +if (!IS_ERR (clk)) +return clk; + +clk_prepare_enable (emc_clk); +clk_prepare_enable (cpu_clk); + +clk_put (emc_clk); +put_pll_p_clk: +clk_put (pll_p_clk); +put_pll_x_clk: +clk_put (pll_x_clk); +put_cpu_clk: +clk_put (cpu_clk); +free_mem: +kfree (cpu0); + +pr_err ("%s: clk register failed\n" , __func__); + +return NULL ; +}drivers/clk/tegra/clk-tegra30.c +4
-0@@ -1396,6 +1396,10 @@ static void __init tegra30_super_clk_init(void) CLK_SET_RATE_PARENT, 1, 2);clk_register_clkdev (clk,"twd" ,NULL ); clks[twd] = clk; + +/* cpu0 clk for cpufreq driver */ + clk =tegra_clk_register_cpu0 (); +clk_register_clkdev (clk,NULL ,"cpu0" ); }static const char *mux_pllacp_clkm[] = {"pll_a_out0" ,"unused" ,"pll_p" ,include/linux/clk/tegra.h +1
-0@@ -128,5 +128,6 @@ static inline void tegra_periph_reset_deassert(struct clk *c) {}static inline void tegra_periph_reset_assert (struct clk *c) {}#endif void tegra_clocks_apply_init_table (void ); +struct clk *tegra_clk_register_cpu0 (void );#endif /* __LINUX_CLK_TEGRA_H_ */ Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
In reply to Viresh KumarQuoted 4 lines · Viresh Kumar
This patch adds CPU0's clk driver for Tegra. It will be used by the generic cpufreq-cpu0 driver to get/set cpu clk.
Most of the platform specific bits are picked from
tegra-cpufreq.c.
Hmmm. I'm not sure if it makes sense to represent this as a clock object; isn't this more of a virtual construct that manages the rate of the clock, rather than an actual clock? The actual clock already exists as "cpu".
Viresh Kumar
maintainerRe: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
Quoted 10 lines · Stephen Warren
Quoted 4 lines · Viresh Kumar
This patch adds CPU0's clk driver for Tegra. It will be used by the generic cpufreq-cpu0 driver to get/set cpu clk.
Most of the platform specific bits are picked from
tegra-cpufreq.c.Hmmm. I'm not sure if it makes sense to represent this as a clock object; isn't this more of a virtual construct that manages the rate of the clock, rather than an actual clock? The actual clock already exists as "cpu".
I see it as this: There is a clock in system for cpu, call it "cpu". Now we must be able to provide get/set routines for it. A set should set the frequency to whatever is asked for and should really worry about how that is being set. This part is internal to "cpu" clk.
This is what cpufreq-cpu0 driver should expect and does. Current "cpu" clock implemented doesn't provide this facility ? And so this wrapper made sense to me.
Re: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
Quoted 12 lines · Viresh Kumar
Quoted 10 lines · Stephen Warren
Quoted 4 lines · Viresh Kumar
This patch adds CPU0's clk driver for Tegra. It will be used by the generic cpufreq-cpu0 driver to get/set cpu clk.
Most of the platform specific bits are picked from
tegra-cpufreq.c.Hmmm. I'm not sure if it makes sense to represent this as a clock object; isn't this more of a virtual construct that manages the rate of the clock, rather than an actual clock? The actual clock already exists as "cpu".
Quoted 4 lines
I see it as this: There is a clock in system for cpu, call it "cpu". Now we must be able to provide get/set routines for it. A set should set the frequency to whatever is asked for and should really worry about how that is being set. This part is internal to "cpu" clk.
Sure.
Quoted 3 lines
This is what cpufreq-cpu0 driver should expect and does. Current "cpu" clock implemented doesn't provide this facility ? And so this wrapper made sense to me.
But the additional management logic on top of the raw clock is exactly what the cpufreq driver is for. This patch series is basically moving the cpufreq driver code inside the clock code instead.
Viresh Kumar
maintainerRe: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
Quoted 20 lines · Stephen Warren
Quoted 12 lines · Viresh Kumar
Quoted 10 lines · Stephen Warren
Quoted 4 lines · Viresh Kumar
This patch adds CPU0's clk driver for Tegra. It will be used by the generic cpufreq-cpu0 driver to get/set cpu clk.
Most of the platform specific bits are picked from
tegra-cpufreq.c.Hmmm. I'm not sure if it makes sense to represent this as a clock object; isn't this more of a virtual construct that manages the rate of the clock, rather than an actual clock? The actual clock already exists as "cpu".
Quoted 4 lines
I see it as this: There is a clock in system for cpu, call it "cpu". Now we must be able to provide get/set routines for it. A set should set the frequency to whatever is asked for and should really worry about how that is being set. This part is internal to "cpu" clk.
Sure.
Quoted 7 lines
Quoted 3 lines
This is what cpufreq-cpu0 driver should expect and does. Current "cpu" clock implemented doesn't provide this facility ? And so this wrapper made sense to me.
But the additional management logic on top of the raw clock is exactly what the cpufreq driver is for. This patch series is basically moving the cpufreq driver code inside the clock code instead.
Above "sure" didn't go very well with what you wrote here :)
The additional management that we are required to do isn't cpufreq driver specific but cpu or platform specific. cpufreq shouldn't care about how CPU's clock is set to a particular frequency, its headache of CPU's clk driver instead. cpu is yet another device and so clk_set_rate() must be enough to set its frequency....
There might be other frameworks that need to set frequency of this device later on and surely we don't want to replicate such piece of code to every user..
Does it make sense to you?
Re: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
Quoted 25 lines · Viresh Kumar
Quoted 24 lines · Stephen Warren
Quoted 12 lines · Viresh Kumar
Quoted 10 lines · Stephen Warren
Quoted 4 lines · Viresh Kumar
This patch adds CPU0's clk driver for Tegra. It will be used by the generic cpufreq-cpu0 driver to get/set cpu clk.
Most of the platform specific bits are picked from
tegra-cpufreq.c.Hmmm. I'm not sure if it makes sense to represent this as a clock object; isn't this more of a virtual construct that manages the rate of the clock, rather than an actual clock? The actual clock already exists as "cpu".
Quoted 4 lines
I see it as this: There is a clock in system for cpu, call it "cpu". Now we must be able to provide get/set routines for it. A set should set the frequency to whatever is asked for and should really worry about how that is being set. This part is internal to "cpu" clk.
Sure.
Quoted 3 lines
This is what cpufreq-cpu0 driver should expect and does. Current "cpu" clock implemented doesn't provide this facility ? And so this wrapper made sense to me.
Quoted 8 lines
Quoted 3 lines
But the additional management logic on top of the raw clock is exactly what the cpufreq driver is for. This patch series is basically moving the cpufreq driver code inside the clock code instead.
Above "sure" didn't go very well with what you wrote here :)
The additional management that we are required to do isn't cpufreq driver specific but cpu or platform specific.
Right, and that's *exactly* what having a cpufreq driver is for; to implement the details of CPU clock management.
Viresh Kumar
maintainerRe: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
Quoted 2 lines · Stephen Warren
Right, and that's *exactly* what having a cpufreq driver is for; to implement the details of CPU clock management.
cpufreq drivers used to keep such information since a long time, probably because there wasn't another place to keep them and provide generic API's (like generic clock framework).. And so this replication started to get in place which we are trying to get rid of now.
All cpufreq drivers share a lot of common code which can go away and so cpufreq-cpu0 was introduced..
With this patchset this replication goes away for tegra atleast at the cost of a platform specific clk-cpu driver.. I think that's a good deal, isn't it?
And that's the only way you can use these generic drivers that we have...
Re: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
Quoted 10 lines · Viresh Kumar
Quoted 2 lines · Stephen Warren
Right, and that's *exactly* what having a cpufreq driver is for; to implement the details of CPU clock management.
cpufreq drivers used to keep such information since a long time, probably because there wasn't another place to keep them and provide generic API's (like generic clock framework).. And so this replication started to get in place which we are trying to get rid of now.
Quoted 6 lines
All cpufreq drivers share a lot of common code which can go away and so cpufreq-cpu0 was introduced..
With this patchset this replication goes away for tegra atleast at the cost of a platform specific clk-cpu driver.. I think that's a good deal, isn't it?
I think this patch series is simply moving the custom per-SoC code somewhere else (clock driver) so that the cpufreq drivers can be simpler. However, the clock drivers are more complex, and now represent concepts that aren't really clocks.
So, no I'm not sure it's good.
Quoted 2 lines
And that's the only way you can use these generic drivers that we have...
I don't think so. I think it's reasonable to have a per-SoC cpufreq driver whose primary content is the parameterization data and/or custom hooks for a unified core cpufreq driver. The duplicate parts of each cpufreq driver can be moved into the core cpufreq driver, but the non-duplicate parts remain. That's how many other subsystems work (MMC, USB, ASoC spring to mind).
Viresh Kumar
maintainerRe: [PATCH 1/6] clk: Tegra: Add CPU0 clock driver
Quoted 6 lines · Stephen Warren
I don't think so. I think it's reasonable to have a per-SoC cpufreq driver whose primary content is the parameterization data and/or custom hooks for a unified core cpufreq driver. The duplicate parts of each cpufreq driver can be moved into the core cpufreq driver, but the non-duplicate parts remain. That's how many other subsystems work (MMC, USB, ASoC spring to mind).
Guys in the --to list:
Please shout before its too late...
I can understand why Stephen is asking not to implement a virtual clock driver for cpu as there is no clock corresponding to that.. We are just playing with existing clocks there..
But I thought these clock APIs can be considered as hooks that we were looking for and so shouldn't be a problem..
But yes, different people see things differently..
So, if I take Stephen's suggestions then I need to implement hooks into cpufreq-cpu0 driver for taking freq-table/ setting clk rates, etc...
Let me know if anybody has a issue with that before we actually implement that..
--
viresh
Viresh Kumar
maintainerPATCH 2/6 ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
In reply to Viresh Kumarcpufreq-cpu0 driver needs OPPs to be present in DT which can be probed by it to get frequency table. This patch adds OPPs and clock-latency to tegra cpu0 node for multiple SoCs.
Voltage levels aren't used until now for tegra and so a flat value which would eventually be ignored is used to represent voltage.
--- arch/arm/boot/dts/tegra114.dtsi | 12 ++++++++++++ arch/arm/boot/dts/tegra20.dtsi | 12 ++++++++++++ arch/arm/boot/dts/tegra30.dtsi | 12 ++++++++++++ 3 files changed, 36 insertions(+)
arch/arm/boot/dts/tegra114.dtsi +12 -0
@@ -438,6 +438,18 @@ device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0>; + operating-points = < + /* kHz ignored */ + 216000 1000000 + 312000 1000000 + 456000 1000000 + 608000 1000000 + 760000 1000000 + 816000 1000000 + 912000 1000000 + 1000000 1000000 + >; + clock-latency = <300000>; }; cpu@1 {
arch/arm/boot/dts/tegra20.dtsi +12 -0
@@ -577,6 +577,18 @@ device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0>; + operating-points = < + /* kHz ignored */ + 216000 1000000 + 312000 1000000 + 456000 1000000 + 608000 1000000 + 760000 1000000 + 816000 1000000 + 912000 1000000 + 1000000 1000000 + >; + clock-latency = <300000>; }; cpu@1 {
arch/arm/boot/dts/tegra30.dtsi +12 -0
@@ -569,6 +569,18 @@ device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0>; + operating-points = < + /* kHz ignored */ + 216000 1000000 + 312000 1000000 + 456000 1000000 + 608000 1000000 + 760000 1000000 + 816000 1000000 + 912000 1000000 + 1000000 1000000 + >; + clock-latency = <300000>; }; cpu@1 {
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Quoted 6 lines · Viresh Kumar
cpufreq-cpu0 driver needs OPPs to be present in DT which can be probed by it to get frequency table. This patch adds OPPs and clock-latency to tegra cpu0 node for multiple SoCs.
Voltage levels aren't used until now for tegra and so a flat value which would eventually be ignored is used to represent voltage.
This patch is problematic w.r.t. DT being an ABI.
We can certainly add new optional properties to a DT binding that enable new features. However, a new version of a binding can't require new properties to exist that didn't before, since that means that old DTs won't work with new kernels that require the new properties.
As such, I believe we do need some Tegra-specific piece of code that defines these OPP tables in the kernel, so that the operating-points property is not needed.
Similarly, we can't put invalid voltages into the DT, since if a later kernel version starts actually using that field, the HW will no longer work correctly. Unless perhaps we put 0 into the DT and make the binding define that 0 means "you can't change the voltage at all away from the boot value"?
Is the operating-points property documented inDocumentation/devicetree/bindings/ somewhere?
(Also Cc'ing the DT mailing list and maintainers)
Quoted 21 lines
arch/arm/boot/dts/tegra114.dtsi +12
-0@@ -438,6 +438,18 @@ device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0>; + operating-points = < + /* kHz ignored */ + 216000 1000000 + 312000 1000000 + 456000 1000000 + 608000 1000000 + 760000 1000000 + 816000 1000000 + 912000 1000000 + 1000000 1000000 + >; + clock-latency = <300000>; };
Viresh Kumar
maintainerRe: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Quoted 9 lines · Stephen Warren
Quoted 6 lines · Viresh Kumar
cpufreq-cpu0 driver needs OPPs to be present in DT which can be probed by it to get frequency table. This patch adds OPPs and clock-latency to tegra cpu0 node for multiple SoCs.
Voltage levels aren't used until now for tegra and so a flat value which would eventually be ignored is used to represent voltage.
This patch is problematic w.r.t. DT being an ABI.
:(
Quoted 4 lines
We can certainly add new optional properties to a DT binding that enable new features. However, a new version of a binding can't require new properties to exist that didn't before, since that means that old DTs won't work with new kernels that require the new properties.
To be honest I didn't get it completely. You meant operating-points wasn't present before? Its here:
Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt Documentation/devicetree/bindings/power/opp.txt
Or you meant, Tegra never required voltage levels and we are getting them in here.
Quoted 3 lines
As such, I believe we do need some Tegra-specific piece of code that defines these OPP tables in the kernel, so that the operating-points property is not needed.
Generic cpufreq driver depends on OPP library and so somebody has to provide them. Now you can do it by calling opp_add() for each OPP you have or otherwise.
Btw, you must have some specific voltage level for each freq, we can get them here..
Quoted 5 lines
Similarly, we can't put invalid voltages into the DT, since if a later kernel version starts actually using that field, the HW will no longer work correctly. Unless perhaps we put 0 into the DT and make the binding define that 0 means "you can't change the voltage at all away from the boot value"?
Hmm.. so if you help me in getting actual voltage levels for these freqs then this problem will be resolved. Otherwise I can check what will happen if we pass zero to voltage.
Quoted 2 lines
Is the operating-points property documented in
Documentation/devicetree/bindings/somewhere?
Check above.
Quoted 1 line
(Also Cc'ing the DT mailing list and maintainers)
Thanks.
Re: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Quoted 18 lines · Viresh Kumar
Quoted 9 lines · Stephen Warren
Quoted 6 lines · Viresh Kumar
cpufreq-cpu0 driver needs OPPs to be present in DT which can be probed by it to get frequency table. This patch adds OPPs and clock-latency to tegra cpu0 node for multiple SoCs.
Voltage levels aren't used until now for tegra and so a flat value which would eventually be ignored is used to represent voltage.
This patch is problematic w.r.t. DT being an ABI.
:(
Quoted 4 lines
We can certainly add new optional properties to a DT binding that enable new features. However, a new version of a binding can't require new properties to exist that didn't before, since that means that old DTs won't work with new kernels that require the new properties.
Quoted 8 lines
To be honest I didn't get it completely. You meant operating-points wasn't present before? Its here:
Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txtDocumentation/devicetree/bindings/power/opp.txtOr you meant, Tegra never required voltage levels and we are getting them in here.
The current Tegra *.dts files do not contain this property. The current Tegra *.dts files must continue to work without modification in future kernels.
Quoted 7 lines
Quoted 3 lines
As such, I believe we do need some Tegra-specific piece of code that defines these OPP tables in the kernel, so that the operating-points property is not needed.
Generic cpufreq driver depends on OPP library and so somebody has to provide them. Now you can do it by calling
opp_add()for each OPP you have or otherwise.
Sure. That's what the Tegra-specific cpufreq driver should do. It should be the top-level cpufreq driver. If parts of the code can be implemented by library functions or a core parameterizable driver, then presumably the Tegra driver would simply exist to provide those parameters and/or callback functions to the generic driver.
Quoted 2 lines
Btw, you must have some specific voltage level for each freq, we can get them here..
Yes, I'm sure we do, but I have no idea what they are:-( It may even be board-specific or SoC-SKU-specific. I think we should defer this aspect for now.
Viresh Kumar
maintainerRe: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Quoted 25 lines · Stephen Warren
Quoted 24 lines · Viresh Kumar
Quoted 9 lines · Stephen Warren
Quoted 6 lines · Viresh Kumar
cpufreq-cpu0 driver needs OPPs to be present in DT which can be probed by it to get frequency table. This patch adds OPPs and clock-latency to tegra cpu0 node for multiple SoCs.
Voltage levels aren't used until now for tegra and so a flat value which would eventually be ignored is used to represent voltage.
This patch is problematic w.r.t. DT being an ABI.
:(
Quoted 4 lines
We can certainly add new optional properties to a DT binding that enable new features. However, a new version of a binding can't require new properties to exist that didn't before, since that means that old DTs won't work with new kernels that require the new properties.
To be honest I didn't get it completely. You meant operating-points wasn't present before? Its here:
Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txtDocumentation/devicetree/bindings/power/opp.txt
Quoted 6 lines
Quoted 2 lines
Or you meant, Tegra never required voltage levels and we are getting them in here.
The current Tegra *.dts files do not contain this property. The current Tegra *.dts files must continue to work without modification in future kernels.
But that can't be true always.. Specially when we are moving things to DT...
For example, we are moving your DMA driver to DT and hence in the platform code, we are making a new DT node + removing static platform device.
Now, old DT can't work with new kernel... That is just not possible. That statement might be true for cases where we are just upgrading existing DT support (but I doubt it there as well :) )..
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
As such, I believe we do need some Tegra-specific piece of code that defines these OPP tables in the kernel, so that the operating-points property is not needed.
Generic cpufreq driver depends on OPP library and so somebody has to provide them. Now you can do it by calling
opp_add()for each OPP you have or otherwise.
Quoted 5 lines
Sure. That's what the Tegra-specific cpufreq driver should do. It should be the top-level cpufreq driver. If parts of the code can be implemented by library functions or a core parameterizable driver, then presumably the Tegra driver would simply exist to provide those parameters and/or callback functions to the generic driver.
That would be something similar to what we are discussing on other thread about new platform device...
You are asking me to go back to platform specific code instead of DT. When there exists a generic enough way of providing this information via DT, why should we put this in a driver?
Quoted 6 lines
Quoted 2 lines
Btw, you must have some specific voltage level for each freq, we can get them here..
Yes, I'm sure we do, but I have no idea what they are:-( It may even be board-specific or SoC-SKU-specific. I think we should defer this aspect for now.
Ok.
Re: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Quoted 29 lines · Viresh Kumar
Quoted 28 lines · Stephen Warren
Quoted 26 lines · Viresh Kumar
Quoted 9 lines · Stephen Warren
Quoted 6 lines · Viresh Kumar
cpufreq-cpu0 driver needs OPPs to be present in DT which can be probed by it to get frequency table. This patch adds OPPs and clock-latency to tegra cpu0 node for multiple SoCs.
Voltage levels aren't used until now for tegra and so a flat value which would eventually be ignored is used to represent voltage.
This patch is problematic w.r.t. DT being an ABI.
:(
Quoted 4 lines
We can certainly add new optional properties to a DT binding that enable new features. However, a new version of a binding can't require new properties to exist that didn't before, since that means that old DTs won't work with new kernels that require the new properties.
To be honest I didn't get it completely. You meant operating-points wasn't present before? Its here:
Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txtDocumentation/devicetree/bindings/power/opp.txtOr you meant, Tegra never required voltage levels and we are getting them in here.
Quoted 6 lines
Quoted 3 lines
The current Tegra *.dts files do not contain this property. The current Tegra *.dts files must continue to work without modification in future kernels.
But that can't be true always.. Specially when we are moving things to DT...
It has to be, or DT isn't an ABI.
Since DT is defined as being an ABI, it has to be true.
The solution here that allows DT to be an ABI is to be the data into the drivers (or core SoC support code) rather than DT.
Quoted 7 lines
For example, we are moving your DMA driver to DT and hence in the platform code, we are making a new DT node + removing static platform device.
Now, old DT can't work with new kernel... That is just not possible. That statement might be true for cases where we are just upgrading existing DT support (but I doubt it there as well :) )..
Well yes, converting existing platforms to DT piece-meal was probably a mistake in retrospect. What we should have done is added parallel DT and non-DT support, and only allow features to be enabled when booting DT if they were triggered by DT nodes, and never allowed additional drivers to be registered by board files.
Your point is indeed why suddenly deciding that DT is an ABI when it wasn't being enforced before is painful.
Quoted 14 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
As such, I believe we do need some Tegra-specific piece of code that defines these OPP tables in the kernel, so that the operating-points property is not needed.
Generic cpufreq driver depends on OPP library and so somebody has to provide them. Now you can do it by calling
opp_add()for each OPP you have or otherwise.Quoted 5 lines
Sure. That's what the Tegra-specific cpufreq driver should do. It should be the top-level cpufreq driver. If parts of the code can be implemented by library functions or a core parameterizable driver, then presumably the Tegra driver would simply exist to provide those parameters and/or callback functions to the generic driver.
Quoted 6 lines
That would be something similar to what we are discussing on other thread about new platform device...
You are asking me to go back to platform specific code instead of DT. When there exists a generic enough way of providing this information via DT, why should we put this in a driver?
I think that drivers should include all data that doesn't need to vary; there's no point putting data into DT just to parse it out into the same tables that the driver could have embedded itself from the start.
Re: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
In reply to Stephen WarrenAm Mittwoch, den 07.08.2013, 12:55 -0600 schrieb Stephen Warren:
Quoted 46 lines · Viresh Kumar
Quoted 18 lines · Stephen Warren
Quoted 9 lines · Viresh Kumar
Quoted 6 lines
cpufreq-cpu0 driver needs OPPs to be present in DT which can be probed by it to get frequency table. This patch adds OPPs and clock-latency to tegra cpu0 node for multiple SoCs.
Voltage levels aren't used until now for tegra and so a flat value which would eventually be ignored is used to represent voltage.
This patch is problematic w.r.t. DT being an ABI.
:(
Quoted 4 lines
We can certainly add new optional properties to a DT binding that enable new features. However, a new version of a binding can't require new properties to exist that didn't before, since that means that old DTs won't work with new kernels that require the new properties.
Quoted 8 lines
To be honest I didn't get it completely. You meant operating-points wasn't present before? Its here:
Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txtDocumentation/devicetree/bindings/power/opp.txtOr you meant, Tegra never required voltage levels and we are getting them in here.
The current Tegra *.dts files do not contain this property. The current Tegra *.dts files must continue to work without modification in future kernels.
Quoted 7 lines
Quoted 3 lines
As such, I believe we do need some Tegra-specific piece of code that defines these OPP tables in the kernel, so that the operating-points property is not needed.
Generic cpufreq driver depends on OPP library and so somebody has to provide them. Now you can do it by calling
opp_add()for each OPP you have or otherwise.Sure. That's what the Tegra-specific cpufreq driver should do. It should be the top-level cpufreq driver. If parts of the code can be implemented by library functions or a core parameterizable driver, then presumably the Tegra driver would simply exist to provide those parameters and/or callback functions to the generic driver.
Quoted 6 lines
Quoted 2 lines
Btw, you must have some specific voltage level for each freq, we can get them here..
Yes, I'm sure we do, but I have no idea what they are:-( It may even be board-specific or SoC-SKU-specific. I think we should defer this aspect for now.
From what I learned those voltage levels are dependent on both the Speedo and the process ID of the specific Tegra processor. So you really get a two dimensional mapping table instead of a single OPP. Also you can not scale the CPU voltage on it's own, but have to make sure the core voltage isn't too far away from. Then core voltage also depends on the operating states of engines like GR2D or even display.
Regards,
Lucas
Signature · 4 lines
Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Viresh Kumar
maintainerRe: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Quoted 6 lines · Lucas Stach
From what I learned those voltage levels are dependent on both the Speedo and the process ID of the specific Tegra processor. So you really get a two dimensional mapping table instead of a single OPP. Also you can not scale the CPU voltage on it's own, but have to make sure the core voltage isn't too far away from. Then core voltage also depends on the operating states of engines like GR2D or even display.
So if they depend on a certain type of SoC, which they should, then we can get these initialized from that SoC's dts/dtsi file instead of a common file.. And so that would resolve the issue you just reported.
Now I haven't proposed in the patch that we will change these voltage levels at all.. This is regulator specific code and would come into play only when regulators are registered for cpu.. Otherwise we will just play with frequency..
Passing OPP instead of just list of frequencies is the generic way this is done now a days..
Re: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Am Donnerstag, den 08.08.2013, 19:41 +0530 schrieb Viresh Kumar:
Quoted 8 lines · Lucas Stach
Quoted 6 lines
From what I learned those voltage levels are dependent on both the Speedo and the process ID of the specific Tegra processor. So you really get a two dimensional mapping table instead of a single OPP. Also you can not scale the CPU voltage on it's own, but have to make sure the core voltage isn't too far away from. Then core voltage also depends on the operating states of engines like GR2D or even display.
Quoted 4 lines
So if they depend on a certain type of SoC, which they should, then we can get these initialized from that SoC's dts/dtsi file instead of a common file.. And so that would resolve the issue you just reported.
You can certainly define the mapping table in DT where a specialized Tegra cpufreq driver could read it in and then map frequency to voltage. But that's a runtime decision, as Speedo and process ID are fuse values and can not be represented in DT.
Quoted 7 lines
Now I haven't proposed in the patch that we will change these voltage levels at all.. This is regulator specific code and would come into play only when regulators are registered for cpu.. Otherwise we will just play with frequency..
Passing OPP instead of just list of frequencies is the generic way this is done now a days..
The problem with this is that the hardware description now associates voltages with certain frequencies and even if they are not used by the Linux driver they are plain wrong.
Regards,
Lucas
Signature · 4 lines
Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Viresh Kumar
maintainerRe: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Quoted 8 lines · Lucas Stach
You can certainly define the mapping table in DT where a specialized Tegra cpufreq driver could read it in and then map frequency to voltage. But that's a runtime decision, as Speedo and process ID are fuse values and can not be represented in DT.
The problem with this is that the hardware description now associates voltages with certain frequencies and even if they are not used by the Linux driver they are plain wrong.
Hmm. I understand.
Then we probably need mach-tegra/opp.c to call opp_add() for all such OPPs.. Neither DT nor cpufreq driver are the right place for this.
Re: [PATCH 2/6] ARM: Tegra: Add CPU's OPPs for using cpufreq-cpu0 driver
Quoted 6 lines · Viresh Kumar
Quoted 4 lines · Lucas Stach
You can certainly define the mapping table in DT where a specialized Tegra cpufreq driver could read it in and then map frequency to voltage. But that's a runtime decision, as Speedo and process ID are fuse values and can not be represented in DT.
Quoted 7 lines
Quoted 3 lines
The problem with this is that the hardware description now associates voltages with certain frequencies and even if they are not used by the Linux driver they are plain wrong.
Hmm. I understand.
Then we probably needmach-tegra/opp.cto callopp_add()for all such OPPs.. Neither DT nor cpufreq driver are the right place for this.
This is similar to what I suspected might be the case on other platforms (in addition to known iMx and OMAP). Could you see/comment on [1] to see if it meets your needs.
We should like to avoid dealing custom SoC specific OPP, if we are able to generalize the need. ofcourse, I am yet to submit a official proposal, but more SoCs the current proposal can handle, the better it will be for all of us.
[1] http://marc.info/?l=linux-pm&m=137589225305971&w=2
--
Regards,
Nishanth Menon
Viresh Kumar
maintainerPATCH 3/6 ARM: Tegra: Enable OPP library
In reply to Viresh Kumarcpufreq-cpu0 driver is dependent on OPP library and hence we need to enable it for Tegra as we are going to use cpufreq-cpu0.
--- arch/arm/mach-tegra/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-tegra/Kconfig +2 -0
@@ -1,6 +1,8 @@ config ARCH_TEGRA bool "NVIDIA Tegra" if ARCH_MULTI_V7 select ARCH_HAS_CPUFREQ + select ARCH_HAS_OPP + select PM_OPP if PM select ARCH_REQUIRE_GPIOLIB select CLKDEV_LOOKUP select CLKSRC_MMIO
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 3/6] ARM: Tegra: Enable OPP library
Quoted 2 lines · Viresh Kumar
cpufreq-cpu0 driver is dependent on OPP library and hence we need to enable it for Tegra as we are going to use cpufreq-cpu0.
Shouldn't these be selected by something in drivers/cpufreq/Kconfig?
Viresh Kumar
maintainerRe: [PATCH 3/6] ARM: Tegra: Enable OPP library
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Viresh Kumar
cpufreq-cpu0 driver is dependent on OPP library and hence we need to enable it for Tegra as we are going to use cpufreq-cpu0.
Shouldn't these be selected by something in
drivers/cpufreq/Kconfig?
There is nothing tegra specific in that directory now and so probably this is the best place :)
Creating a config option only for this doesn't sound great to me..
Viresh Kumar
maintainerPATCH 4/6 ARM: Tegra: defconfig: select cpufreq-cpu0 driver
In reply to Viresh KumarTegra requires cpufreq-cpu0 driver to be compiled in and hence we select it from the defconfig.
--- arch/arm/configs/tegra_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/tegra_defconfig +1 -0
@@ -38,6 +38,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_KEXEC=y CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +CONFIG_GENERIC_CPUFREQ_CPU0=y CONFIG_CPU_IDLE=y CONFIG_VFP=y CONFIG_PM_RUNTIME=y
Signature · 1 line
1.7.12.rc2.18.g61b472e
Viresh Kumar
maintainerPATCH 5/6 ARM: Tegra: start using cpufreq-cpu0 driver
In reply to Viresh Kumarcpufreq-cpu0 driver can be probed over DT only if a corresponding device node is created for the SoC which wants to use it. Lets create a platform device for cpufreq-cpu0 driver for Tegra.
Also it removes the Kconfig entry responsible to compiling tegra-cpufreq driver and hence there will not be any conflicts between two cpufreq drivers.
--- arch/arm/mach-tegra/tegra.c | 2 ++ drivers/cpufreq/Kconfig.arm | 8 -------- 2 files changed, 2 insertions(+), 8 deletions(-)
arch/arm/mach-tegra/tegra.c +2 -0
@@ -82,11 +82,13 @@ static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {static void __init tegra_dt_init (void ) { +struct platform_device_info devinfo = { .name ="cpufreq-cpu0" , };struct soc_device_attribute *soc_dev_attr;struct soc_device *soc_dev;struct device *parent =NULL ;tegra_clocks_apply_init_table (); +platform_device_register_full (&devinfo); soc_dev_attr =kzalloc (sizeof (*soc_dev_attr),GFP_KERNEL );if (!soc_dev_attr)
drivers/cpufreq/Kconfig.arm +0 -8
@@ -215,11 +215,3 @@ config ARM_SPEAR_CPUFREQ default y help This adds the CPUFreq driver support for SPEAr SOCs. - -config ARM_TEGRA_CPUFREQ - bool "TEGRA CPUFreq support" - depends on ARCH_TEGRA - select CPU_FREQ_TABLE - default y - help - This adds the CPUFreq driver support for TEGRA SOCs.
Signature · 1 line
1.7.12.rc2.18.g61b472e
Re: [PATCH 5/6] ARM: Tegra: start using cpufreq-cpu0 driver
arch/arm/mach-tegra/tegra.c static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { · line 85
Quoted 12 lines · Viresh Kumar
cpufreq-cpu0 driver can be probed over DT only if a corresponding device node is created for the SoC which wants to use it. Lets create a platform device for cpufreq-cpu0 driver for Tegra.
Also it removes the
Kconfigentry responsible to compiling tegra-cpufreq driver and hence there will not be any conflicts between two cpufreq drivers.arch/arm/mach-tegra/tegra.c +1
-0static void __init tegra_dt_init (void ) { +struct platform_device_info devinfo = { .name ="cpufreq-cpu0" , };
static? const?
arch/arm/mach-tegra/tegra.c static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { · line 91
Quoted 6 lines
arch/arm/mach-tegra/tegra.c +1
-0struct soc_device_attribute *soc_dev_attr;struct soc_device *soc_dev;struct device *parent =NULL ;tegra_clocks_apply_init_table (); +platform_device_register_full (&devinfo);
This seems awfully like going back to board files. Shouldn't something that binds to the CPU nodes register the cpufreq device automatically, based on the CPU's compatible value?
Viresh Kumar
maintainerRe: [PATCH 5/6] ARM: Tegra: start using cpufreq-cpu0 driver
Quoted 8 lines · Stephen Warren
Quoted 6 lines · Viresh Kumar
cpufreq-cpu0 driver can be probed over DT only if a corresponding device node is created for the SoC which wants to use it. Lets create a platform device for cpufreq-cpu0 driver for Tegra.
Also it removes the
Kconfigentry responsible to compiling tegra-cpufreq driver and hence there will not be any conflicts between two cpufreq drivers.
Quoted 7 lines
arch/arm/mach-tegra/tegra.c static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { · line 85
Quoted 5 lines
arch/arm/mach-tegra/tegra.c +1
-0static void __init tegra_dt_init (void ) { +struct platform_device_info devinfo = { .name ="cpufreq-cpu0" , };static? const?
static: yes
const: no, as it might be modified by platform_device_register_full()
Quoted 10 lines
Quoted 6 lines
struct soc_device_attribute *soc_dev_attr; struct soc_device *soc_dev; struct device *parent = NULL; tegra_clocks_apply_init_table();+
platform_device_register_full(&devinfo);This seems awfully like going back to board files. Shouldn't something that binds to the CPU nodes register the cpufreq device automatically, based on the CPU's compatible value?
This link has got some information why we can't have a node for cpufreq or a compatibility value..
Re: [PATCH 5/6] ARM: Tegra: start using cpufreq-cpu0 driver
Quoted 21 lines · Viresh Kumar
Quoted 20 lines · Stephen Warren
Quoted 18 lines · Viresh Kumar
cpufreq-cpu0 driver can be probed over DT only if a corresponding device node is created for the SoC which wants to use it. Lets create a platform device for cpufreq-cpu0 driver for Tegra.
Also it removes the
Kconfigentry responsible to compiling tegra-cpufreq driver and hence there will not be any conflicts between two cpufreq drivers.arch/arm/mach-tegra/tegra.c +2
-0static void __init tegra_dt_init (void ) { +struct platform_device_info devinfo = { .name ="cpufreq-cpu0" , };struct soc_device_attribute *soc_dev_attr;struct soc_device *soc_dev;struct device *parent =NULL ;tegra_clocks_apply_init_table (); +platform_device_register_full (&devinfo);
Quoted 8 lines
Quoted 3 lines
This seems awfully like going back to board files. Shouldn't something that binds to the CPU nodes register the cpufreq device automatically, based on the CPU's compatible value?
This link has got some information why we can't have a node for cpufreq or a compatibility value..
That link only describes why we shouldn't have a dedicated compatible value for cpufreq. I certainly agree with that. However, I think it's reasonable that whatever code binds to:
compatible = "arm,cortex-a9";
... should instantiate any virtual devices that relate to the CPU.
Doing so would be similar to how the Tegra I2S driver instantiates the internal struct device that ASoC needs for the PCM/DMA device, rather than having board-dt-tegra20.c do it, like it would have done in board-file days.
Viresh Kumar
maintainerRe: [PATCH 5/6] ARM: Tegra: start using cpufreq-cpu0 driver
Quoted 7 lines · Stephen Warren
That link only describes why we shouldn't have a dedicated compatible value for cpufreq. I certainly agree with that. However, I think it's reasonable that whatever code binds to:
compatible = "arm,cortex-a9";... should instantiate any virtual devices that relate to the CPU.
But how would we know here if platform really wants us to probe cpufreq-cpu0 driver? On multiplatform kernel there can be multiple cpufreq drivers available and there has to be some sort of code in DT or platform code that reflects which driver we want to use.
We never required a device node for cpufreq, platform device was added just to solve this issue.
Quoted 4 lines
Doing so would be similar to how the Tegra I2S driver instantiates the internal struct device that ASoC needs for the PCM/DMA device, rather than having
board-dt-tegra20.cdo it, like it would have done in board-file days.
I haven't gone through it yet though :)
Re: [PATCH 5/6] ARM: Tegra: start using cpufreq-cpu0 driver
Quoted 5 lines · Viresh Kumar
Quoted 4 lines · Stephen Warren
That link only describes why we shouldn't have a dedicated compatible value for cpufreq. I certainly agree with that. However, I think it's reasonable that whatever code binds to:
Quoted 8 lines
Quoted 3 lines
compatible = "arm,cortex-a9";... should instantiate any virtual devices that relate to the CPU.
But how would we know here if platform really wants us to probe cpufreq-cpu0 driver? On multiplatform kernel there can be multiple cpufreq drivers available and there has to be some sort of code in DT or platform code that reflects which driver we want to use.
Presumably the code would look at the top-level DT node's compatible value (e.g. "nvidia,tegra20").
Viresh Kumar
maintainerRe: [PATCH 5/6] ARM: Tegra: start using cpufreq-cpu0 driver
Quoted 10 lines · Stephen Warren
Quoted 9 lines · Viresh Kumar
Quoted 7 lines · Stephen Warren
That link only describes why we shouldn't have a dedicated compatible value for cpufreq. I certainly agree with that. However, I think it's reasonable that whatever code binds to:
compatible = "arm,cortex-a9";... should instantiate any virtual devices that relate to the CPU.
Quoted 7 lines
Quoted 4 lines
But how would we know here if platform really wants us to probe cpufreq-cpu0 driver? On multiplatform kernel there can be multiple cpufreq drivers available and there has to be some sort of code in DT or platform code that reflects which driver we want to use.
Presumably the code would look at the top-level DT node's compatible value (e.g. "nvidia,tegra20").
So you are actually asking us to get a compatibility list inside cpufreq-cpu0 driver which will list all the platforms for which this driver would work?
Honestly speaking I wasn't in favor of getting a platform-device registered for cpufreq-cpu0 earlier and had few discussion on the thread I passed to you.
The problem with the new solution you just proposed is, for every new platform that comes in we need to update this file.. And that's it probably..
Don't know how others would see it...
@Rafael/Rob/Shawn: Any suggestions here?
Viresh Kumar
maintainerPATCH 6/6 cpufreq: Tegra: Remove tegra-cpufreq driver
In reply to Viresh KumarWe are using generic cpufreq-cpu0 driver, so lets get rid of platform specific tegra-cpufreq.c driver.
--- drivers/cpufreq/Makefile | 1 - drivers/cpufreq/tegra-cpufreq.c | 291 ---------------------------------------- 2 files changed, 292 deletions(-) delete mode 100644 drivers/cpufreq/tegra-cpufreq.c
drivers/cpufreq/Makefile +0 -1
@@ -76,7 +76,6 @@ 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 ################################################################################## # PowerPC platform drivers
drivers/cpufreq/tegra-cpufreq.c deleted +0 -291
291 lines not on this page · raw message
Signature · 1 line
1.7.12.rc2.18.g61b472e
Quoted 4 lines · Viresh Kumar
Hi Stephen,
This is the first attempt to get rid of tegra-cpufreq driver. This patchset tries to add supporting infrastructure for tegra to use cpufreq-cpu0 driver.
If tegra has only 4-core fast cpu, I would agree with the patch set. But now I'm not so sure. Tegra cpuquiet driver and cluster switch may need special settings of cpufreq driver.
Thanks
Richard
Viresh Kumar
maintainerQuoted 9 lines · Richard Zhao
Quoted 4 lines · Viresh Kumar
Hi Stephen,
This is the first attempt to get rid of tegra-cpufreq driver. This patchset tries to add supporting infrastructure for tegra to use cpufreq-cpu0 driver.
If tegra has only 4-core fast cpu, I would agree with the patch set. But now I'm not so sure. Tegra cpuquiet driver and cluster switch may need special settings of cpufreq driver.
I am not familiar with the latest happenings.. This change should be good enough for not breaking anything that is working with current tegra cpufreq driver.. If there is a new SoC with different needs then we can talk about it separately.. As that might not be able to use tegra-cpufreq driver anyway..