From: Kevin Hilman <khilman@deeprootsystems.com>
To: Thara Gopinath <thara@ti.com>
Cc: linux-omap@vger.kernel.org, paul@pwsan.com, vishwanath.bs@ti.com,
sawant@ti.com, b-cousson@ti.com
Subject: Re: [PATCH 10/13] OMAP3: Introduce custom set rate and get rate APIs for scalable devices
Date: Mon, 30 Aug 2010 17:06:36 -0700 [thread overview]
Message-ID: <87fwxvwsqb.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1282130412-12027-11-git-send-email-thara@ti.com> (Thara Gopinath's message of "Wed, 18 Aug 2010 16:50:09 +0530")
Thara Gopinath <thara@ti.com> writes:
> This patch also introduces omap3_mpu_set_rate, omap3_iva_set_rate,
> omap3_l3_set_rate, omap3_mpu_get_rate, omap3_iva_get_rate,
> omap3_l3_get_rate as device specific set rate and get rate
> APIs for OMAP3 mpu, iva and l3_main devices. This patch also
> calls into opp_populate_rate_fns during system init to register
> various set_rate and get_rate APIs with the generic opp
> framework.
>
> Signed-off-by: Thara Gopinath <thara@ti.com>
> ---
> arch/arm/mach-omap2/cpufreq34xx.c | 104 +++++++++++++++++++++++++++++++++++++
> 1 files changed, 104 insertions(+), 0 deletions(-)
These don't belong in cpufreq34xx.c (now known as opp3xxx_data.c) This
file is only for the OPP data itself. Any SoC specific code should go
into pm34xx.c.
Kevin
> diff --git a/arch/arm/mach-omap2/cpufreq34xx.c b/arch/arm/mach-omap2/cpufreq34xx.c
> index 195b5bc..8b9ef72 100644
> --- a/arch/arm/mach-omap2/cpufreq34xx.c
> +++ b/arch/arm/mach-omap2/cpufreq34xx.c
> @@ -24,8 +24,22 @@
>
> #include <plat/opp.h>
> #include <plat/cpu.h>
> +#include <plat/clock.h>
> +
> +#include "cm-regbits-34xx.h"
> +#include "prm.h"
> #include "omap3-opp.h"
>
> +static int omap3_mpu_set_rate(struct device *dev, unsigned long rate);
> +static int omap3_iva_set_rate(struct device *dev, unsigned long rate);
> +static int omap3_l3_set_rate(struct device *dev, unsigned long rate);
> +
> +static unsigned long omap3_mpu_get_rate(struct device *dev);
> +static unsigned long omap3_iva_get_rate(struct device *dev);
> +static unsigned long omap3_l3_get_rate(struct device *dev);
> +
> +struct clk *dpll1_clk, *dpll2_clk, *dpll3_clk;
> +
> static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
> /* MPU OPP1 */
> OMAP_OPP_DEF("mpu", true, 125000000, 975000),
> @@ -92,12 +106,82 @@ static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
> };
> static u32 omap36xx_opp_def_size = ARRAY_SIZE(omap36xx_opp_def_list);
>
> +
> +static int omap3_mpu_set_rate(struct device *dev, unsigned long rate)
> +{
> + unsigned long cur_rate = omap3_mpu_get_rate(dev);
> + int ret;
> +
> +#ifdef CONFIG_CPU_FREQ
> + struct cpufreq_freqs freqs_notify;
> +
> + freqs_notify.old = cur_rate / 1000;
> + freqs_notify.new = rate / 1000;
> + freqs_notify.cpu = 0;
> + /* Send pre notification to CPUFreq */
> + cpufreq_notify_transition(&freqs_notify, CPUFREQ_PRECHANGE);
> +#endif
> + ret = clk_set_rate(dpll1_clk, rate);
> + if (ret) {
> + dev_warn(dev, "%s: Unable to set rate to %ld\n",
> + __func__, rate);
> + return ret;
> + }
> +
> +#ifdef CONFIG_CPU_FREQ
> + /* Send a post notification to CPUFreq */
> + cpufreq_notify_transition(&freqs_notify, CPUFREQ_POSTCHANGE);
> +#endif
> +
> +#ifndef CONFIG_CPU_FREQ
> + /*Update loops_per_jiffy if processor speed is being changed*/
> + loops_per_jiffy = compute_lpj(loops_per_jiffy,
> + cur_rate / 1000, rate / 1000);
> +#endif
> + return 0;
> +}
> +
> +static unsigned long omap3_mpu_get_rate(struct device *dev)
> +{
> + return dpll1_clk->rate;
> +}
> +
> +static int omap3_iva_set_rate(struct device *dev, unsigned long rate)
> +{
> + return clk_set_rate(dpll2_clk, rate);
> +}
> +
> +static unsigned long omap3_iva_get_rate(struct device *dev)
> +{
> + return dpll2_clk->rate;
> +}
> +
> +static int omap3_l3_set_rate(struct device *dev, unsigned long rate)
> +{
> + int l3_div;
> +
> + l3_div = cm_read_mod_reg(CORE_MOD, CM_CLKSEL) &
> + OMAP3430_CLKSEL_L3_MASK;
> +
> + return clk_set_rate(dpll3_clk, rate * l3_div);
> +}
> +
> +static unsigned long omap3_l3_get_rate(struct device *dev)
> +{
> + int l3_div;
> +
> + l3_div = cm_read_mod_reg(CORE_MOD, CM_CLKSEL) &
> + OMAP3430_CLKSEL_L3_MASK;
> + return dpll3_clk->rate / l3_div;
> +}
> +
> /* Temp variable to allow multiple calls */
> static u8 __initdata omap3_table_init;
>
> int __init omap3_pm_init_opp_table(void)
> {
> struct omap_opp_def *opp_def, *omap3_opp_def_list;
> + struct device *dev;
> u32 omap3_opp_def_size;
> int i, r;
>
> @@ -122,6 +206,26 @@ int __init omap3_pm_init_opp_table(void)
> opp_def->freq, opp_def->hwmod_name);
> }
>
> + dpll1_clk = clk_get(NULL, "dpll1_ck");
> + dpll2_clk = clk_get(NULL, "dpll2_ck");
> + dpll3_clk = clk_get(NULL, "dpll3_m2_ck");
> +
> + /* Populate the set rate and get rate for mpu, iva and l3 device */
> + dev = omap2_get_mpuss_device();
> + if (dev)
> + opp_populate_rate_fns(dev, omap3_mpu_set_rate,
> + omap3_mpu_get_rate);
> +
> + dev = omap2_get_iva_device();
> + if (dev)
> + opp_populate_rate_fns(dev, omap3_iva_set_rate,
> + omap3_iva_get_rate);
> +
> + dev = omap2_get_l3_device();
> + if (dev)
> + opp_populate_rate_fns(dev, omap3_l3_set_rate,
> + omap3_l3_get_rate);
> +
> return 0;
> }
next prev parent reply other threads:[~2010-08-31 0:06 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 11:19 [PATCH 00/13] OMAP: Basic DVFS framework Thara Gopinath
2010-08-18 11:20 ` [PATCH 01/13] OMAP: Introduce a user list for each voltage domain instance in the voltage driver Thara Gopinath
2010-08-27 23:53 ` Kevin Hilman
2010-08-30 22:56 ` Kevin Hilman
2010-09-16 9:59 ` Gopinath, Thara
2010-09-16 15:20 ` Kevin Hilman
2010-09-17 14:33 ` Gopinath, Thara
2010-09-01 22:51 ` Kevin Hilman
2010-09-02 7:43 ` Thomas Petazzoni
2010-09-02 8:17 ` Nishanth Menon
2010-09-02 10:00 ` Felipe Balbi
2010-09-02 10:17 ` Nishanth Menon
2010-09-02 10:28 ` Felipe Balbi
2010-09-02 10:40 ` Nishanth Menon
2010-09-02 11:16 ` Felipe Balbi
2010-09-02 17:47 ` Kevin Hilman
2010-09-02 18:46 ` Nishanth Menon
2010-09-02 18:56 ` Kevin Hilman
2010-09-03 7:09 ` Gopinath, Thara
2010-09-03 16:41 ` Kevin Hilman
2010-09-03 17:30 ` Mark Brown
2010-09-03 18:00 ` Kevin Hilman
2010-09-03 18:20 ` Mark Brown
2010-09-06 19:59 ` Eduardo Valentin
2010-09-06 20:21 ` Liam Girdwood
2010-09-06 21:21 ` Mark Brown
2010-11-23 9:26 ` Thomas Petazzoni
2010-11-24 9:45 ` Thomas Petazzoni
2010-11-24 9:51 ` Mark Brown
2010-09-03 18:27 ` Kevin Hilman
2010-09-06 11:01 ` Mark Brown
2010-08-18 11:20 ` [PATCH 02/13] OMAP: Introduce API in the OPP layer to find the opp entry corresponding to a voltage Thara Gopinath
2010-08-18 11:20 ` [PATCH 03/13] OMAP: Introduce voltage domain information in the hwmod structures Thara Gopinath
2010-08-18 11:20 ` [PATCH 04/13] OMAP: Introduce API to return a device list associated with a voltage domain Thara Gopinath
2010-08-28 0:52 ` Kevin Hilman
2010-08-28 0:54 ` Kevin Hilman
2010-09-16 10:04 ` Gopinath, Thara
2010-09-16 15:22 ` Kevin Hilman
2010-09-17 14:48 ` Gopinath, Thara
2010-09-20 18:00 ` Kevin Hilman
2010-09-02 0:33 ` Kevin Hilman
2010-09-16 10:10 ` Gopinath, Thara
2010-09-16 15:23 ` Kevin Hilman
2010-08-18 11:20 ` [PATCH 05/13] OMAP: Introduce device specific set rate and get rate in device opp structures Thara Gopinath
2010-09-02 23:41 ` Kevin Hilman
2010-09-16 10:21 ` Gopinath, Thara
2010-09-16 15:28 ` Kevin Hilman
2010-09-17 14:55 ` Gopinath, Thara
2010-09-18 10:13 ` Cousson, Benoit
2010-09-20 17:35 ` Kevin Hilman
2010-09-29 11:16 ` Gopinath, Thara
2010-09-29 20:25 ` Cousson, Benoit
2010-08-18 11:20 ` [PATCH 06/13] OMAP: Voltage layer changes to support DVFS Thara Gopinath
2010-08-18 11:20 ` [PATCH 07/13] OMAP: Introduce dependent voltage domain support Thara Gopinath
2010-08-18 11:20 ` [PATCH 08/13] OMAP: Introduce device set_rate and get_rate Thara Gopinath
2010-08-18 11:20 ` [PATCH 09/13] OMAP: Disable smartreflex across DVFS Thara Gopinath
2010-08-18 11:20 ` [PATCH 10/13] OMAP3: Introduce custom set rate and get rate APIs for scalable devices Thara Gopinath
2010-08-31 0:06 ` Kevin Hilman [this message]
2010-08-18 11:20 ` [PATCH 11/13] OMAP3: Update cpufreq driver to use the new set_rate API Thara Gopinath
2010-08-18 11:20 ` [PATCH 12/13] OMAP3: Introduce voltage domain info in the hwmod structures Thara Gopinath
2010-08-18 11:20 ` [PATCH 13/13] OMAP3: Add voltage dependency table for VDD1 Thara Gopinath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fwxvwsqb.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=b-cousson@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=sawant@ti.com \
--cc=thara@ti.com \
--cc=vishwanath.bs@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.