* [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer
2011-03-19 0:18 [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
@ 2011-03-19 0:18 ` Kevin Hilman
2011-03-21 13:08 ` Cousson, Benoit
2011-03-22 19:13 ` Paul Walmsley
2011-03-19 0:18 ` [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure Kevin Hilman
` (6 subsequent siblings)
7 siblings, 2 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-19 0:18 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Walmsely, Benoit Cousson
The voltage domain pointer currently in struct omap_hwmod is not used
and does not belong here. Instead, voltage domains will be associated
with powerdomains in forthcoming patches.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 1adea9c..a5fa7c1 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -520,7 +520,6 @@ struct omap_hwmod {
struct clk *_clk;
struct omap_hwmod_opt_clk *opt_clks;
char *vdd_name;
- struct voltagedomain *voltdm;
struct omap_hwmod_ocp_if **masters; /* connect to *_IA */
struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */
void *dev_attr;
--
1.7.4
^ permalink raw reply related [flat|nested] 33+ messages in thread* Re: [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer
2011-03-19 0:18 ` [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer Kevin Hilman
@ 2011-03-21 13:08 ` Cousson, Benoit
2011-03-21 15:32 ` Kevin Hilman
2011-03-22 19:13 ` Paul Walmsley
1 sibling, 1 reply; 33+ messages in thread
From: Cousson, Benoit @ 2011-03-21 13:08 UTC (permalink / raw)
To: Hilman, Kevin; +Cc: linux-omap@vger.kernel.org, Paul Walmsely
Hi Kevin,
On 3/19/2011 1:18 AM, Hilman, Kevin wrote:
> The voltage domain pointer currently in struct omap_hwmod is not used
> and does not belong here. Instead, voltage domains will be associated
> with powerdomains in forthcoming patches.
Technically speaking, an IP, and thus the hwmod does belong to a voltage
domain, a power domain and a clock domain.
What is maybe important to add is that since clkdm < pwrdm < voltdm, we
can potentially avoid providing the information for the each domain type.
At some point the hwmod will have to contain a clkdm instead of relying
on the main_clk to get it... but that's another topic...
> Signed-off-by: Kevin Hilman<khilman@ti.com>
> ---
> arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
> index 1adea9c..a5fa7c1 100644
> --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
> +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
> @@ -520,7 +520,6 @@ struct omap_hwmod {
> struct clk *_clk;
> struct omap_hwmod_opt_clk *opt_clks;
> char *vdd_name;
And what about vdd_name? It should probably be removed as well.
Benoit
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer
2011-03-21 13:08 ` Cousson, Benoit
@ 2011-03-21 15:32 ` Kevin Hilman
2011-03-24 13:03 ` Gulati, Shweta
0 siblings, 1 reply; 33+ messages in thread
From: Kevin Hilman @ 2011-03-21 15:32 UTC (permalink / raw)
To: Cousson, Benoit; +Cc: linux-omap@vger.kernel.org, Paul Walmsely
"Cousson, Benoit" <b-cousson@ti.com> writes:
> Hi Kevin,
>
> On 3/19/2011 1:18 AM, Hilman, Kevin wrote:
>> The voltage domain pointer currently in struct omap_hwmod is not used
>> and does not belong here. Instead, voltage domains will be associated
>> with powerdomains in forthcoming patches.
>
> Technically speaking, an IP, and thus the hwmod does belong to a
> voltage domain, a power domain and a clock domain.
>
> What is maybe important to add is that since clkdm < pwrdm < voltdm,
> we can potentially avoid providing the information for the each domain
> type.
>
> At some point the hwmod will have to contain a clkdm instead of
> relying on the main_clk to get it... but that's another topic...
>
>> Signed-off-by: Kevin Hilman<khilman@ti.com>
>> ---
>> arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 -
>> 1 files changed, 0 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
>> index 1adea9c..a5fa7c1 100644
>> --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
>> +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
>> @@ -520,7 +520,6 @@ struct omap_hwmod {
>> struct clk *_clk;
>> struct omap_hwmod_opt_clk *opt_clks;
>> char *vdd_name;
>
> And what about vdd_name? It should probably be removed as well.
>
Yes, but it's currently used by the SR layer (currently the only user.)
Removing it required cleaning up the SR layer as well, so I decided to
leave the SR cleanups for someone else for the moment while I focus on
the voltage layer(s)
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer
2011-03-21 15:32 ` Kevin Hilman
@ 2011-03-24 13:03 ` Gulati, Shweta
2011-03-24 14:00 ` Kevin Hilman
0 siblings, 1 reply; 33+ messages in thread
From: Gulati, Shweta @ 2011-03-24 13:03 UTC (permalink / raw)
To: Kevin Hilman; +Cc: Cousson, Benoit, linux-omap@vger.kernel.org, Paul Walmsely
Kevin,
On Mon, Mar 21, 2011 at 9:02 PM, Kevin Hilman <khilman@ti.com> wrote:
> "Cousson, Benoit" <b-cousson@ti.com> writes:
>
>> Hi Kevin,
>>
>> On 3/19/2011 1:18 AM, Hilman, Kevin wrote:
>>> The voltage domain pointer currently in struct omap_hwmod is not used
>>> and does not belong here. Instead, voltage domains will be associated
>>> with powerdomains in forthcoming patches.
>>
>> Technically speaking, an IP, and thus the hwmod does belong to a
>> voltage domain, a power domain and a clock domain.
>>
>> What is maybe important to add is that since clkdm < pwrdm < voltdm,
>> we can potentially avoid providing the information for the each domain
>> type.
>>
>> At some point the hwmod will have to contain a clkdm instead of
>> relying on the main_clk to get it... but that's another topic...
>>
>>> Signed-off-by: Kevin Hilman<khilman@ti.com>
>>> ---
>>> arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 -
>>> 1 files changed, 0 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
>>> index 1adea9c..a5fa7c1 100644
>>> --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
>>> +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
>>> @@ -520,7 +520,6 @@ struct omap_hwmod {
>>> struct clk *_clk;
>>> struct omap_hwmod_opt_clk *opt_clks;
>>> char *vdd_name;
>>
>> And what about vdd_name? It should probably be removed as well.
>>
>
> Yes, but it's currently used by the SR layer (currently the only user.)
>
> Removing it required cleaning up the SR layer as well, so I decided to
> leave the SR cleanups for someone else for the moment while I focus on
> the voltage layer(s)
Even if we try to remove 'vdd_name', how should we get 'struct voltagedomain'
info corresponding to sr_mpu, sr_core in sr_dev_init API?
As functional clock of SR1 and SR2 are from
wake up domain, so even if we try to use current Clockdomain and
Powerdomain framework
APIs, to get 'clkdomain' pointer and then retrieve 'pwrdomain'
pointer, finally getting 'voltdomain'
pointer we would get 'WKUP' voltage domain ptr not the 'mpu' or 'core'
voltdomain pointer.
> Kevin
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Thanks,
Regards,
Shweta
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer
2011-03-24 13:03 ` Gulati, Shweta
@ 2011-03-24 14:00 ` Kevin Hilman
2011-03-24 15:14 ` Cousson, Benoit
0 siblings, 1 reply; 33+ messages in thread
From: Kevin Hilman @ 2011-03-24 14:00 UTC (permalink / raw)
To: Gulati, Shweta; +Cc: Cousson, Benoit, linux-omap@vger.kernel.org, Paul Walmsely
Hi Shweta,
"Gulati, Shweta" <shweta.gulati@ti.com> writes:
[...]
>>>
>>> And what about vdd_name? It should probably be removed as well.
>>>
>>
>> Yes, but it's currently used by the SR layer (currently the only user.)
>>
>> Removing it required cleaning up the SR layer as well, so I decided to
>> leave the SR cleanups for someone else for the moment while I focus on
>> the voltage layer(s)
>>
> Even if we try to remove 'vdd_name', how should we get 'struct voltagedomain'
> info corresponding to sr_mpu, sr_core in sr_dev_init API?
>
> As functional clock of SR1 and SR2 are from wake up domain, so even if
> we try to use current Clockdomain and Powerdomain framework APIs, to
> get 'clkdomain' pointer and then retrieve 'pwrdomain' pointer, finally
> getting 'voltdomain' pointer we would get 'WKUP' voltage domain ptr
> not the 'mpu' or 'core' voltdomain pointer.
Correct.
I got this far and realized not only does the voltage layer need a
cleanup, the SR layer needs a cleanup, but I need to focus on one thing
at a time.
As you noticed, what we need is the voltage domain of the SR sensor, not
the voltage domain of the SR IP.
Probably the best way to do this is ad the sensor voltage domain to the
dev_attr of each SR module.
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer
2011-03-24 14:00 ` Kevin Hilman
@ 2011-03-24 15:14 ` Cousson, Benoit
2011-03-25 5:00 ` Gulati, Shweta
0 siblings, 1 reply; 33+ messages in thread
From: Cousson, Benoit @ 2011-03-24 15:14 UTC (permalink / raw)
To: Hilman, Kevin; +Cc: Gulati, Shweta, linux-omap@vger.kernel.org, Paul Walmsely
On 3/24/2011 3:00 PM, Hilman, Kevin wrote:
> Hi Shweta,
>
> "Gulati, Shweta"<shweta.gulati@ti.com> writes:
>
> [...]
>
>>>>
>>>> And what about vdd_name? It should probably be removed as well.
>>>>
>>>
>>> Yes, but it's currently used by the SR layer (currently the only user.)
>>>
>>> Removing it required cleaning up the SR layer as well, so I decided to
>>> leave the SR cleanups for someone else for the moment while I focus on
>>> the voltage layer(s)
>>>
>> Even if we try to remove 'vdd_name', how should we get 'struct voltagedomain'
>> info corresponding to sr_mpu, sr_core in sr_dev_init API?
>>
>> As functional clock of SR1 and SR2 are from wake up domain, so even if
>> we try to use current Clockdomain and Powerdomain framework APIs, to
>> get 'clkdomain' pointer and then retrieve 'pwrdomain' pointer, finally
>> getting 'voltdomain' pointer we would get 'WKUP' voltage domain ptr
>> not the 'mpu' or 'core' voltdomain pointer.
>
> Correct.
>
> I got this far and realized not only does the voltage layer need a
> cleanup, the SR layer needs a cleanup, but I need to focus on one thing
> at a time.
>
> As you noticed, what we need is the voltage domain of the SR sensor, not
> the voltage domain of the SR IP.
>
> Probably the best way to do this is ad the sensor voltage domain to the
> dev_attr of each SR module.
Yep, I do agree. SR instances are all inside the CORE, but there is a
dedicated sensor in each scalable voltage domain.
dev_attr is the perfect place for that. In fact I do not understand why
it was not added there initially???
Even the kerneldoc is confusing and not accurate:
* @vdd_name: voltage domain name
Whereas, SR is using that to provide the name of the voltage rail
controlled by it.
Let's provide a quick patch to get rid of that and replace it by a dev_attr.
Shweta, are you volunteer? :-)
Thanks,
Benoit
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer
2011-03-24 15:14 ` Cousson, Benoit
@ 2011-03-25 5:00 ` Gulati, Shweta
0 siblings, 0 replies; 33+ messages in thread
From: Gulati, Shweta @ 2011-03-25 5:00 UTC (permalink / raw)
To: Cousson, Benoit; +Cc: Hilman, Kevin, linux-omap@vger.kernel.org, Paul Walmsely
Hi,
On Thu, Mar 24, 2011 at 8:44 PM, Cousson, Benoit <b-cousson@ti.com> wrote:
> On 3/24/2011 3:00 PM, Hilman, Kevin wrote:
>>
>> Hi Shweta,
>>
>> "Gulati, Shweta"<shweta.gulati@ti.com> writes:
>>
>> [...]
>>
>>>>>
>>>>> And what about vdd_name? It should probably be removed as well.
>>>>>
>>>>
>>>> Yes, but it's currently used by the SR layer (currently the only user.)
>>>>
>>>> Removing it required cleaning up the SR layer as well, so I decided to
>>>> leave the SR cleanups for someone else for the moment while I focus on
>>>> the voltage layer(s)
>>>>
>>> Even if we try to remove 'vdd_name', how should we get 'struct
>>> voltagedomain'
>>> info corresponding to sr_mpu, sr_core in sr_dev_init API?
>>>
>>> As functional clock of SR1 and SR2 are from wake up domain, so even if
>>> we try to use current Clockdomain and Powerdomain framework APIs, to
>>> get 'clkdomain' pointer and then retrieve 'pwrdomain' pointer, finally
>>> getting 'voltdomain' pointer we would get 'WKUP' voltage domain ptr
>>> not the 'mpu' or 'core' voltdomain pointer.
>>
>> Correct.
>>
>> I got this far and realized not only does the voltage layer need a
>> cleanup, the SR layer needs a cleanup, but I need to focus on one thing
>> at a time.
>>
>> As you noticed, what we need is the voltage domain of the SR sensor, not
>> the voltage domain of the SR IP.
>>
>> Probably the best way to do this is ad the sensor voltage domain to the
>> dev_attr of each SR module.
>
> Yep, I do agree. SR instances are all inside the CORE, but there is a
> dedicated sensor in each scalable voltage domain.
> dev_attr is the perfect place for that. In fact I do not understand why it
> was not added there initially???
>
> Even the kerneldoc is confusing and not accurate:
> * @vdd_name: voltage domain name
>
> Whereas, SR is using that to provide the name of the voltage rail controlled
> by it.
>
> Let's provide a quick patch to get rid of that and replace it by a dev_attr.
>
> Shweta, are you volunteer? :-)
Yes, I would submit Patch adding volt domain info in dev_attr of SR instances.
> Thanks,
> Benoit
>
--
Thanks,
Regards,
Shweta
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer
2011-03-19 0:18 ` [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer Kevin Hilman
2011-03-21 13:08 ` Cousson, Benoit
@ 2011-03-22 19:13 ` Paul Walmsley
1 sibling, 0 replies; 33+ messages in thread
From: Paul Walmsley @ 2011-03-22 19:13 UTC (permalink / raw)
To: Kevin Hilman; +Cc: linux-omap, Benoit Cousson
On Fri, 18 Mar 2011, Kevin Hilman wrote:
> The voltage domain pointer currently in struct omap_hwmod is not used
> and does not belong here. Instead, voltage domains will be associated
> with powerdomains in forthcoming patches.
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
- Paul
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure
2011-03-19 0:18 [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
2011-03-19 0:18 ` [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer Kevin Hilman
@ 2011-03-19 0:18 ` Kevin Hilman
2011-03-19 4:41 ` Santosh Shilimkar
2011-03-21 10:53 ` Premi, Sanjeev
2011-03-19 0:18 ` [PATCH 3/7] OMAP2+: voltage: start towards a new voltagedomain layer Kevin Hilman
` (5 subsequent siblings)
7 siblings, 2 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-19 0:18 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Walmsely, Benoit Cousson
Eliminate need for global variables for the various PRM module offsets by
making them part of the VDD structure.
Eventually, these will likely be moved again, or more likely removed,
but for now just getting rid of them as global variabes so that the
voltage domain initialization can be cleaned up.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
arch/arm/mach-omap2/voltage.c | 109 ++++++++++++-------------
arch/arm/mach-omap2/voltage.h | 6 +-
arch/arm/mach-omap2/voltagedomains3xxx_data.c | 10 +-
arch/arm/mach-omap2/voltagedomains44xx_data.c | 12 ++-
4 files changed, 67 insertions(+), 70 deletions(-)
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index c13b308..26c87a3 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -50,10 +50,6 @@ static struct omap_vdd_info **vdd_info;
*/
static int nr_scalable_vdd;
-/* XXX document */
-static s16 prm_mod_offs;
-static s16 prm_irqst_ocp_mod_offs;
-
static struct dentry *voltage_dir;
/* Init function pointers */
@@ -147,7 +143,7 @@ static int vp_volt_debug_get(void *data, u64 *val)
return -EINVAL;
}
- vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
+ vsel = vdd->read_reg(vdd->prm_mod, vdd->vp_data->voltage);
if (!vdd->pmic_info->vsel_to_uv) {
pr_warning("PMIC function to convert vsel to voltage"
@@ -197,19 +193,19 @@ static void vp_latch_vsel(struct omap_vdd_info *vdd)
vsel = vdd->pmic_info->uv_to_vsel(uvdc);
- vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
+ vpconfig = vdd->read_reg(vdd->prm_mod, vdd->vp_data->vpconfig);
vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvoltage_mask |
vdd->vp_data->vp_common->vpconfig_initvdd);
vpconfig |= vsel << vdd->vp_data->vp_common->vpconfig_initvoltage_shift;
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
/* Trigger initVDD value copy to voltage processor */
vdd->write_reg((vpconfig | vdd->vp_data->vp_common->vpconfig_initvdd),
- prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->prm_mod, vdd->vp_data->vpconfig);
/* Clear initVDD copy trigger bit */
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
}
/* Generic voltage init functions */
@@ -227,19 +223,19 @@ static void __init vp_init(struct omap_vdd_info *vdd)
(vdd->vp_rt_data.vpconfig_errorgain <<
vdd->vp_data->vp_common->vpconfig_errorgain_shift) |
vdd->vp_data->vp_common->vpconfig_timeouten;
- vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vp_val, vdd->prm_mod, vdd->vp_data->vpconfig);
vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin <<
vdd->vp_data->vp_common->vstepmin_smpswaittimemin_shift) |
(vdd->vp_rt_data.vstepmin_stepmin <<
vdd->vp_data->vp_common->vstepmin_stepmin_shift));
- vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmin);
+ vdd->write_reg(vp_val, vdd->prm_mod, vdd->vp_data->vstepmin);
vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax <<
vdd->vp_data->vp_common->vstepmax_smpswaittimemax_shift) |
(vdd->vp_rt_data.vstepmax_stepmax <<
vdd->vp_data->vp_common->vstepmax_stepmax_shift));
- vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmax);
+ vdd->write_reg(vp_val, vdd->prm_mod, vdd->vp_data->vstepmax);
vp_val = ((vdd->vp_rt_data.vlimitto_vddmax <<
vdd->vp_data->vp_common->vlimitto_vddmax_shift) |
@@ -247,7 +243,7 @@ static void __init vp_init(struct omap_vdd_info *vdd)
vdd->vp_data->vp_common->vlimitto_vddmin_shift) |
(vdd->vp_rt_data.vlimitto_timeout <<
vdd->vp_data->vp_common->vlimitto_timeout_shift));
- vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
+ vdd->write_reg(vp_val, vdd->prm_mod, vdd->vp_data->vlimitto);
}
static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
@@ -336,23 +332,23 @@ static int _pre_volt_scale(struct omap_vdd_info *vdd,
volt_data = NULL;
*target_vsel = vdd->pmic_info->uv_to_vsel(target_volt);
- *current_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
+ *current_vsel = vdd->read_reg(vdd->prm_mod, vdd->vp_data->voltage);
/* Setting the ON voltage to the new target voltage */
- vc_cmdval = vdd->read_reg(prm_mod_offs, vdd->vc_data->cmdval_reg);
+ vc_cmdval = vdd->read_reg(vdd->prm_mod, vdd->vc_data->cmdval_reg);
vc_cmdval &= ~vc_common->cmd_on_mask;
vc_cmdval |= (*target_vsel << vc_common->cmd_on_shift);
- vdd->write_reg(vc_cmdval, prm_mod_offs, vdd->vc_data->cmdval_reg);
+ vdd->write_reg(vc_cmdval, vdd->prm_mod, vdd->vc_data->cmdval_reg);
/* Setting vp errorgain based on the voltage */
if (volt_data) {
- vp_errgain_val = vdd->read_reg(prm_mod_offs,
+ vp_errgain_val = vdd->read_reg(vdd->prm_mod,
vdd->vp_data->vpconfig);
vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask;
vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
vp_common->vpconfig_errorgain_shift;
- vdd->write_reg(vp_errgain_val, prm_mod_offs,
+ vdd->write_reg(vp_errgain_val, vdd->prm_mod,
vdd->vp_data->vpconfig);
}
@@ -394,11 +390,11 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
(vdd->pmic_info->i2c_slave_addr <<
vdd->vc_data->vc_common->slaveaddr_shift);
- vdd->write_reg(vc_bypass_value, prm_mod_offs, vc_bypass_val_reg);
- vdd->write_reg(vc_bypass_value | vc_valid, prm_mod_offs,
+ vdd->write_reg(vc_bypass_value, vdd->prm_mod, vc_bypass_val_reg);
+ vdd->write_reg(vc_bypass_value | vc_valid, vdd->prm_mod,
vc_bypass_val_reg);
- vc_bypass_value = vdd->read_reg(prm_mod_offs, vc_bypass_val_reg);
+ vc_bypass_value = vdd->read_reg(vdd->prm_mod, vc_bypass_val_reg);
/*
* Loop till the bypass command is acknowledged from the SMPS.
* NOTE: This is legacy code. The loop count and retry count needs
@@ -417,7 +413,7 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
loop_cnt = 0;
udelay(10);
}
- vc_bypass_value = vdd->read_reg(prm_mod_offs,
+ vc_bypass_value = vdd->read_reg(vdd->prm_mod,
vc_bypass_val_reg);
}
@@ -445,8 +441,8 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
*/
while (timeout++ < VP_TRANXDONE_TIMEOUT) {
vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
- prm_irqst_ocp_mod_offs, prm_irqst_reg);
- if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
+ vdd->prm_irqst_mod, prm_irqst_reg);
+ if (!(vdd->read_reg(vdd->prm_irqst_mod, prm_irqst_reg) &
vdd->vp_data->prm_irqst_data->tranxdone_status))
break;
udelay(1);
@@ -458,28 +454,28 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
}
/* Configure for VP-Force Update */
- vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
+ vpconfig = vdd->read_reg(vdd->prm_mod, vdd->vp_data->vpconfig);
vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvdd |
vdd->vp_data->vp_common->vpconfig_forceupdate |
vdd->vp_data->vp_common->vpconfig_initvoltage_mask);
vpconfig |= ((target_vsel <<
vdd->vp_data->vp_common->vpconfig_initvoltage_shift));
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
/* Trigger initVDD value copy to voltage processor */
vpconfig |= vdd->vp_data->vp_common->vpconfig_initvdd;
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
/* Force update of voltage */
vpconfig |= vdd->vp_data->vp_common->vpconfig_forceupdate;
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
/*
* Wait for TransactionDone. Typical latency is <200us.
* Depends on SMPSWAITTIMEMIN/MAX and voltage change
*/
timeout = 0;
- omap_test_timeout((vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
+ omap_test_timeout((vdd->read_reg(vdd->prm_irqst_mod, prm_irqst_reg) &
vdd->vp_data->prm_irqst_data->tranxdone_status),
VP_TRANXDONE_TIMEOUT, timeout);
if (timeout >= VP_TRANXDONE_TIMEOUT)
@@ -496,8 +492,8 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
timeout = 0;
while (timeout++ < VP_TRANXDONE_TIMEOUT) {
vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
- prm_irqst_ocp_mod_offs, prm_irqst_reg);
- if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
+ vdd->prm_irqst_mod, prm_irqst_reg);
+ if (!(vdd->read_reg(vdd->prm_irqst_mod, prm_irqst_reg) &
vdd->vp_data->prm_irqst_data->tranxdone_status))
break;
udelay(1);
@@ -508,13 +504,13 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
"to clear the TRANXDONE status\n",
__func__, vdd->voltdm.name);
- vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
+ vpconfig = vdd->read_reg(vdd->prm_mod, vdd->vp_data->vpconfig);
/* Clear initVDD copy trigger bit */
vpconfig &= ~vdd->vp_data->vp_common->vpconfig_initvdd;
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
/* Clear force bit */
vpconfig &= ~vdd->vp_data->vp_common->vpconfig_forceupdate;
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
return 0;
}
@@ -525,10 +521,10 @@ static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
* Voltage Manager FSM parameters init
* XXX This data should be passed in from the board file
*/
- vdd->write_reg(OMAP3_CLKSETUP, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET);
- vdd->write_reg(OMAP3_VOLTOFFSET, prm_mod_offs,
+ vdd->write_reg(OMAP3_CLKSETUP, vdd->prm_mod, OMAP3_PRM_CLKSETUP_OFFSET);
+ vdd->write_reg(OMAP3_VOLTOFFSET, vdd->prm_mod,
OMAP3_PRM_VOLTOFFSET_OFFSET);
- vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
+ vdd->write_reg(OMAP3_VOLTSETUP2, vdd->prm_mod,
OMAP3_PRM_VOLTSETUP2_OFFSET);
}
@@ -550,15 +546,15 @@ static void __init omap3_vc_init(struct omap_vdd_info *vdd)
(onlp_vsel << vdd->vc_data->vc_common->cmd_onlp_shift) |
(ret_vsel << vdd->vc_data->vc_common->cmd_ret_shift) |
(off_vsel << vdd->vc_data->vc_common->cmd_off_shift));
- vdd->write_reg(vc_val, prm_mod_offs, vdd->vc_data->cmdval_reg);
+ vdd->write_reg(vc_val, vdd->prm_mod, vdd->vc_data->cmdval_reg);
/*
* Generic VC parameters init
* XXX This data should be abstracted out
*/
- vdd->write_reg(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK, prm_mod_offs,
+ vdd->write_reg(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK, vdd->prm_mod,
OMAP3_PRM_VC_CH_CONF_OFFSET);
- vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, prm_mod_offs,
+ vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, vdd->prm_mod,
OMAP3_PRM_VC_I2C_CFG_OFFSET);
omap3_vfsm_init(vdd);
@@ -585,11 +581,11 @@ static void __init omap4_vc_init(struct omap_vdd_info *vdd)
vc_val = (OMAP4430_RAV_VDD_MPU_L_MASK | OMAP4430_CMD_VDD_MPU_L_MASK |
OMAP4430_RAV_VDD_IVA_L_MASK | OMAP4430_CMD_VDD_IVA_L_MASK |
OMAP4430_RAV_VDD_CORE_L_MASK | OMAP4430_CMD_VDD_CORE_L_MASK);
- vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET);
+ vdd->write_reg(vc_val, vdd->prm_mod, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET);
/* XXX These are magic numbers and do not belong! */
vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
- vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
+ vdd->write_reg(vc_val, vdd->prm_mod, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
is_initialized = true;
}
@@ -612,27 +608,27 @@ static void __init omap_vc_init(struct omap_vdd_info *vdd)
}
/* Set up the SMPS_SA(i2c slave address in VC */
- vc_val = vdd->read_reg(prm_mod_offs,
+ vc_val = vdd->read_reg(vdd->prm_mod,
vdd->vc_data->vc_common->smps_sa_reg);
vc_val &= ~vdd->vc_data->smps_sa_mask;
vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_data->smps_sa_shift;
- vdd->write_reg(vc_val, prm_mod_offs,
+ vdd->write_reg(vc_val, vdd->prm_mod,
vdd->vc_data->vc_common->smps_sa_reg);
/* Setup the VOLRA(pmic reg addr) in VC */
- vc_val = vdd->read_reg(prm_mod_offs,
+ vc_val = vdd->read_reg(vdd->prm_mod,
vdd->vc_data->vc_common->smps_volra_reg);
vc_val &= ~vdd->vc_data->smps_volra_mask;
vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_data->smps_volra_shift;
- vdd->write_reg(vc_val, prm_mod_offs,
+ vdd->write_reg(vc_val, vdd->prm_mod,
vdd->vc_data->vc_common->smps_volra_reg);
/* Configure the setup times */
- vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg);
+ vc_val = vdd->read_reg(vdd->prm_mod, vdd->vfsm->voltsetup_reg);
vc_val &= ~vdd->vfsm->voltsetup_mask;
vc_val |= vdd->pmic_info->volt_setup_time <<
vdd->vfsm->voltsetup_shift;
- vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg);
+ vdd->write_reg(vc_val, vdd->prm_mod, vdd->vfsm->voltsetup_reg);
if (cpu_is_omap34xx())
omap3_vc_init(vdd);
@@ -713,7 +709,7 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
return 0;
}
- curr_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
+ curr_vsel = vdd->read_reg(vdd->prm_mod, vdd->vp_data->voltage);
if (!vdd->pmic_info || !vdd->pmic_info->vsel_to_uv) {
pr_warning("%s: PMIC function to convert vsel to voltage"
@@ -755,9 +751,9 @@ void omap_vp_enable(struct voltagedomain *voltdm)
vp_latch_vsel(vdd);
/* Enable VP */
- vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
+ vpconfig = vdd->read_reg(vdd->prm_mod, vdd->vp_data->vpconfig);
vpconfig |= vdd->vp_data->vp_common->vpconfig_vpenable;
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
vdd->vp_enabled = true;
}
@@ -794,14 +790,14 @@ void omap_vp_disable(struct voltagedomain *voltdm)
}
/* Disable VP */
- vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
+ vpconfig = vdd->read_reg(vdd->prm_mod, vdd->vp_data->vpconfig);
vpconfig &= ~vdd->vp_data->vp_common->vpconfig_vpenable;
- vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
+ vdd->write_reg(vpconfig, vdd->prm_mod, vdd->vp_data->vpconfig);
/*
* Wait for VP idle Typical latency is <2us. Maximum latency is ~100us
*/
- omap_test_timeout((vdd->read_reg(prm_mod_offs, vdd->vp_data->vstatus)),
+ omap_test_timeout((vdd->read_reg(vdd->prm_mod, vdd->vp_data->vstatus)),
VP_IDLE_TIMEOUT, timeout);
if (timeout >= VP_IDLE_TIMEOUT)
@@ -1094,12 +1090,9 @@ int __init omap_voltage_late_init(void)
}
/* XXX document */
-int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_ocp_mod,
- struct omap_vdd_info *omap_vdd_array[],
+int __init omap_voltage_early_init(struct omap_vdd_info *omap_vdd_array[],
u8 omap_vdd_count)
{
- prm_mod_offs = prm_mod;
- prm_irqst_ocp_mod_offs = prm_irqst_ocp_mod;
vdd_info = omap_vdd_array;
nr_scalable_vdd = omap_vdd_count;
return 0;
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index e9f5408..44edc1e 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -133,6 +133,9 @@ struct omap_vdd_info {
struct dentry *debug_dir;
u32 curr_volt;
bool vp_enabled;
+
+ s16 prm_mod;
+ s16 prm_irqst_mod;
u32 (*read_reg) (u16 mod, u8 offset);
void (*write_reg) (u32 val, u16 mod, u8 offset);
int (*volt_scale) (struct omap_vdd_info *vdd,
@@ -151,8 +154,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
unsigned long volt);
unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
-int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_mod,
- struct omap_vdd_info *omap_vdd_array[],
+int __init omap_voltage_early_init(struct omap_vdd_info *omap_vdd_array[],
u8 omap_vdd_count);
#ifdef CONFIG_PM
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index def230f..74c44d9 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -38,6 +38,8 @@ static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = {
};
static struct omap_vdd_info omap3_vdd1_info = {
+ .prm_mod = OMAP3430_GR_MOD,
+ .prm_irqst_mod = OCP_MOD,
.vp_data = &omap3_vp1_data,
.vc_data = &omap3_vc1_data,
.vfsm = &omap3_vdd1_vfsm_data,
@@ -53,6 +55,8 @@ static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
};
static struct omap_vdd_info omap3_vdd2_info = {
+ .prm_mod = OMAP3430_GR_MOD,
+ .prm_irqst_mod = OCP_MOD,
.vp_data = &omap3_vp2_data,
.vc_data = &omap3_vc2_data,
.vfsm = &omap3_vdd2_vfsm_data,
@@ -70,9 +74,6 @@ static struct omap_vdd_info *omap3_vdd_info[] = {
/* OMAP3 specific voltage init functions */
static int __init omap3xxx_voltage_early_init(void)
{
- s16 prm_mod = OMAP3430_GR_MOD;
- s16 prm_irqst_ocp_mod = OCP_MOD;
-
if (!cpu_is_omap34xx())
return 0;
@@ -88,8 +89,7 @@ static int __init omap3xxx_voltage_early_init(void)
omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
}
- return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
- omap3_vdd_info,
+ return omap_voltage_early_init(omap3_vdd_info,
ARRAY_SIZE(omap3_vdd_info));
};
core_initcall(omap3xxx_voltage_early_init);
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index cb64996..b9b23d6 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -37,6 +37,8 @@ static const struct omap_vfsm_instance_data omap4_vdd_mpu_vfsm_data = {
};
static struct omap_vdd_info omap4_vdd_mpu_info = {
+ .prm_mod = OMAP4430_PRM_DEVICE_INST,
+ .prm_irqst_mod = OMAP4430_PRM_OCP_SOCKET_INST,
.vp_data = &omap4_vp_mpu_data,
.vc_data = &omap4_vc_mpu_data,
.vfsm = &omap4_vdd_mpu_vfsm_data,
@@ -50,6 +52,8 @@ static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = {
};
static struct omap_vdd_info omap4_vdd_iva_info = {
+ .prm_mod = OMAP4430_PRM_DEVICE_INST,
+ .prm_irqst_mod = OMAP4430_PRM_OCP_SOCKET_INST,
.vp_data = &omap4_vp_iva_data,
.vc_data = &omap4_vc_iva_data,
.vfsm = &omap4_vdd_iva_vfsm_data,
@@ -63,6 +67,8 @@ static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = {
};
static struct omap_vdd_info omap4_vdd_core_info = {
+ .prm_mod = OMAP4430_PRM_DEVICE_INST,
+ .prm_irqst_mod = OMAP4430_PRM_OCP_SOCKET_INST,
.vp_data = &omap4_vp_core_data,
.vc_data = &omap4_vc_core_data,
.vfsm = &omap4_vdd_core_vfsm_data,
@@ -81,9 +87,6 @@ static struct omap_vdd_info *omap4_vdd_info[] = {
/* OMAP4 specific voltage init functions */
static int __init omap44xx_voltage_early_init(void)
{
- s16 prm_mod = OMAP4430_PRM_DEVICE_INST;
- s16 prm_irqst_ocp_mod = OMAP4430_PRM_OCP_SOCKET_INST;
-
if (!cpu_is_omap44xx())
return 0;
@@ -95,8 +98,7 @@ static int __init omap44xx_voltage_early_init(void)
omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
- return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
- omap4_vdd_info,
+ return omap_voltage_early_init(omap4_vdd_info,
ARRAY_SIZE(omap4_vdd_info));
};
core_initcall(omap44xx_voltage_early_init);
--
1.7.4
^ permalink raw reply related [flat|nested] 33+ messages in thread* RE: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure
2011-03-19 0:18 ` [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure Kevin Hilman
@ 2011-03-19 4:41 ` Santosh Shilimkar
2011-03-21 15:21 ` Kevin Hilman
2011-03-21 10:53 ` Premi, Sanjeev
1 sibling, 1 reply; 33+ messages in thread
From: Santosh Shilimkar @ 2011-03-19 4:41 UTC (permalink / raw)
To: Kevin Hilman, linux-omap; +Cc: Paul Walmsely, Benoit Cousson
Minor comment.
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Kevin Hilman
> Sent: Saturday, March 19, 2011 5:49 AM
> To: linux-omap@vger.kernel.org
> Cc: Paul Walmsely; Benoit Cousson
> Subject: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD
> structure
>
> Eliminate need for global variables for the various PRM module
> offsets by
> making them part of the VDD structure.
>
> Eventually, these will likely be moved again, or more likely
> removed,
> but for now just getting rid of them as global variabes so that the
> voltage domain initialization can be cleaned up.
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
> ---
> arch/arm/mach-omap2/voltage.c | 109 ++++++++++++--
> -----------
> arch/arm/mach-omap2/voltage.h | 6 +-
> arch/arm/mach-omap2/voltagedomains3xxx_data.c | 10 +-
> arch/arm/mach-omap2/voltagedomains44xx_data.c | 12 ++-
> 4 files changed, 67 insertions(+), 70 deletions(-)
>
[....]
> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-
> omap2/voltage.h
> index e9f5408..44edc1e 100644
> --- a/arch/arm/mach-omap2/voltage.h
> +++ b/arch/arm/mach-omap2/voltage.h
> @@ -133,6 +133,9 @@ struct omap_vdd_info {
> struct dentry *debug_dir;
> u32 curr_volt;
> bool vp_enabled;
> +
> + s16 prm_mod;
> + s16 prm_irqst_mod;
Can you also add kernel doc for above two
entries?
> u32 (*read_reg) (u16 mod, u8 offset);
> void (*write_reg) (u32 val, u16 mod, u8 offset);
> int (*volt_scale) (struct omap_vdd_info *vdd,
> @@ -151,8 +154,7 @@ struct omap_volt_data
> *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
> unsigned long volt);
> unsigned long omap_voltage_get_nom_volt(struct voltagedomain
> *voltdm);
> struct dentry *omap_voltage_get_dbgdir(struct voltagedomain
> *voltdm);
> -int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_mod,
> - struct omap_vdd_info *omap_vdd_array[],
> +int __init omap_voltage_early_init(struct omap_vdd_info
> *omap_vdd_array[],
> u8 omap_vdd_count);
> #ifdef CONFIG_PM
> int omap_voltage_register_pmic(struct voltagedomain *voltdm,
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure
2011-03-19 4:41 ` Santosh Shilimkar
@ 2011-03-21 15:21 ` Kevin Hilman
0 siblings, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-21 15:21 UTC (permalink / raw)
To: Santosh Shilimkar; +Cc: linux-omap, Paul Walmsely, Benoit Cousson
Santosh Shilimkar <santosh.shilimkar@ti.com> writes:
> Minor comment.
>> -----Original Message-----
>> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
>> owner@vger.kernel.org] On Behalf Of Kevin Hilman
>> Sent: Saturday, March 19, 2011 5:49 AM
>> To: linux-omap@vger.kernel.org
>> Cc: Paul Walmsely; Benoit Cousson
>> Subject: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD
>> structure
>>
>> Eliminate need for global variables for the various PRM module
>> offsets by
>> making them part of the VDD structure.
>>
>> Eventually, these will likely be moved again, or more likely
>> removed,
>> but for now just getting rid of them as global variabes so that the
>> voltage domain initialization can be cleaned up.
>>
>> Signed-off-by: Kevin Hilman <khilman@ti.com>
>> ---
>> arch/arm/mach-omap2/voltage.c | 109 ++++++++++++--
>> -----------
>> arch/arm/mach-omap2/voltage.h | 6 +-
>> arch/arm/mach-omap2/voltagedomains3xxx_data.c | 10 +-
>> arch/arm/mach-omap2/voltagedomains44xx_data.c | 12 ++-
>> 4 files changed, 67 insertions(+), 70 deletions(-)
>>
> [....]
>
>> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-
>> omap2/voltage.h
>> index e9f5408..44edc1e 100644
>> --- a/arch/arm/mach-omap2/voltage.h
>> +++ b/arch/arm/mach-omap2/voltage.h
>> @@ -133,6 +133,9 @@ struct omap_vdd_info {
>> struct dentry *debug_dir;
>> u32 curr_volt;
>> bool vp_enabled;
>> +
>> + s16 prm_mod;
>> + s16 prm_irqst_mod;
>
> Can you also add kernel doc for above two
> entries?
>
Yes, thanks.
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread
* RE: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure
2011-03-19 0:18 ` [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure Kevin Hilman
2011-03-19 4:41 ` Santosh Shilimkar
@ 2011-03-21 10:53 ` Premi, Sanjeev
2011-03-21 15:26 ` Kevin Hilman
2011-03-23 14:16 ` Kevin Hilman
1 sibling, 2 replies; 33+ messages in thread
From: Premi, Sanjeev @ 2011-03-21 10:53 UTC (permalink / raw)
To: Hilman, Kevin, linux-omap@vger.kernel.org; +Cc: Paul Walmsely, Cousson, Benoit
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Hilman, Kevin
> Sent: Saturday, March 19, 2011 5:49 AM
> To: linux-omap@vger.kernel.org
> Cc: Paul Walmsely; Cousson, Benoit
> Subject: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets
> into VDD structure
>
> Eliminate need for global variables for the various PRM
> module offsets by
> making them part of the VDD structure.
>
> Eventually, these will likely be moved again, or more likely removed,
> but for now just getting rid of them as global variabes so that the
> voltage domain initialization can be cleaned up.
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
[sp] This is almost what I intended to do in the clean-up patches
posted earlier; but for few differences.
Putting them here as well.
[snip...snip]
> diff --git a/arch/arm/mach-omap2/voltage.h
> b/arch/arm/mach-omap2/voltage.h
> index e9f5408..44edc1e 100644
> --- a/arch/arm/mach-omap2/voltage.h
> +++ b/arch/arm/mach-omap2/voltage.h
> @@ -133,6 +133,9 @@ struct omap_vdd_info {
> struct dentry *debug_dir;
> u32 curr_volt;
> bool vp_enabled;
> +
> + s16 prm_mod;
> + s16 prm_irqst_mod;
[sp] Can we match the type with the functions these are eventually
passed to?
Also, prm_mod is "comstant" for the silicon.
Shouldn't it be a local static instead. Else, same value is
repeated for each vdd.
~sanjeev
[snip...snip]
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure
2011-03-21 10:53 ` Premi, Sanjeev
@ 2011-03-21 15:26 ` Kevin Hilman
2011-03-23 14:16 ` Kevin Hilman
1 sibling, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-21 15:26 UTC (permalink / raw)
To: Premi, Sanjeev; +Cc: linux-omap@vger.kernel.org, Paul Walmsely, Cousson, Benoit
"Premi, Sanjeev" <premi@ti.com> writes:
>> -----Original Message-----
>> From: linux-omap-owner@vger.kernel.org
>> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Hilman, Kevin
>> Sent: Saturday, March 19, 2011 5:49 AM
>> To: linux-omap@vger.kernel.org
>> Cc: Paul Walmsely; Cousson, Benoit
>> Subject: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets
>> into VDD structure
>>
>> Eliminate need for global variables for the various PRM
>> module offsets by
>> making them part of the VDD structure.
>>
>> Eventually, these will likely be moved again, or more likely removed,
>> but for now just getting rid of them as global variabes so that the
>> voltage domain initialization can be cleaned up.
>>
>> Signed-off-by: Kevin Hilman <khilman@ti.com>
>
> [sp] This is almost what I intended to do in the clean-up patches
> posted earlier; but for few differences.
>
> Putting them here as well.
>
> [snip...snip]
>
>> diff --git a/arch/arm/mach-omap2/voltage.h
>> b/arch/arm/mach-omap2/voltage.h
>> index e9f5408..44edc1e 100644
>> --- a/arch/arm/mach-omap2/voltage.h
>> +++ b/arch/arm/mach-omap2/voltage.h
>> @@ -133,6 +133,9 @@ struct omap_vdd_info {
>> struct dentry *debug_dir;
>> u32 curr_volt;
>> bool vp_enabled;
>> +
>> + s16 prm_mod;
>> + s16 prm_irqst_mod;
>
> [sp] Can we match the type with the functions these are eventually
> passed to?
Yes, will change them to u16.
> Also, prm_mod is "comstant" for the silicon.
>
> Shouldn't it be a local static instead. Else, same value is
> repeated for each vdd.
Yes. As the changelog says these will likely be moved (or likely
removed all together) with further VC/VP cleanups which will move this
code into a dedicated VC/VP layers.
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure
2011-03-21 10:53 ` Premi, Sanjeev
2011-03-21 15:26 ` Kevin Hilman
@ 2011-03-23 14:16 ` Kevin Hilman
1 sibling, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-23 14:16 UTC (permalink / raw)
To: Premi, Sanjeev; +Cc: linux-omap@vger.kernel.org, Paul Walmsely, Cousson, Benoit
"Premi, Sanjeev" <premi@ti.com> writes:
[...]
>
>> diff --git a/arch/arm/mach-omap2/voltage.h
>> b/arch/arm/mach-omap2/voltage.h
>> index e9f5408..44edc1e 100644
>> --- a/arch/arm/mach-omap2/voltage.h
>> +++ b/arch/arm/mach-omap2/voltage.h
>> @@ -133,6 +133,9 @@ struct omap_vdd_info {
>> struct dentry *debug_dir;
>> u32 curr_volt;
>> bool vp_enabled;
>> +
>> + s16 prm_mod;
>> + s16 prm_irqst_mod;
>
> [sp] Can we match the type with the functions these are eventually
> passed to?
Looking closer at this, the functions that these values are passed to
actually take s16 values, so I will leave them as s16.
For example, for OMAP2/3, see prm2xxx_3xxx.h:
extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx);
extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx);
The reason this is important is that on 3430, these module offsets might
actually be negative (c.f. OMAP3430_IVA2_MOD in prcm-common.h)
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 3/7] OMAP2+: voltage: start towards a new voltagedomain layer
2011-03-19 0:18 [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
2011-03-19 0:18 ` [PATCH 1/7] OMAP2+: hwmod: remove unused voltagedomain pointer Kevin Hilman
2011-03-19 0:18 ` [PATCH 2/7] OMAP2+: voltage: move PRCM mod offets into VDD structure Kevin Hilman
@ 2011-03-19 0:18 ` Kevin Hilman
2011-03-19 0:18 ` [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register Kevin Hilman
` (4 subsequent siblings)
7 siblings, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-19 0:18 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Walmsely, Benoit Cousson
Start cleaning up the voltage layer to have a voltage domain layer
that resembles thae structure of the existing clock and power domain
layers. To that end:
- move the 'struct voltagedomain' out of 'struct omap_vdd_info' to
become the primary data structure.
- convert any functions taking a pointer to struct omap_vdd_info into
functions taking a struct voltagedomain pointer.
- convert the register & initialize of voltage domains to look like
that of powerdomains
- convert omap_voltage_domain_lookup() to voltdm_lookup(), modeled
after the current powerdomain and clockdomain lookup functions.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
arch/arm/mach-omap2/io.c | 3 +
arch/arm/mach-omap2/omap_twl.c | 10 +-
arch/arm/mach-omap2/pm.c | 2 +-
arch/arm/mach-omap2/sr_device.c | 2 +-
arch/arm/mach-omap2/voltage.c | 253 ++++++++++++++-----------
arch/arm/mach-omap2/voltage.h | 27 ++--
arch/arm/mach-omap2/voltagedomains3xxx_data.c | 34 ++--
arch/arm/mach-omap2/voltagedomains44xx_data.c | 44 +++---
8 files changed, 204 insertions(+), 171 deletions(-)
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 441e79d..44c2c3e 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -38,6 +38,7 @@
#include "io.h"
#include <plat/omap-pm.h>
+#include "voltage.h"
#include "powerdomain.h"
#include "clockdomain.h"
@@ -363,10 +364,12 @@ void __init omap2_init_common_infrastructure(void)
omap2xxx_clockdomains_init();
omap2430_hwmod_init();
} else if (cpu_is_omap34xx()) {
+ omap3xxx_voltagedomains_init();
omap3xxx_powerdomains_init();
omap3xxx_clockdomains_init();
omap3xxx_hwmod_init();
} else if (cpu_is_omap44xx()) {
+ omap44xx_voltagedomains_init();
omap44xx_powerdomains_init();
omap44xx_clockdomains_init();
omap44xx_hwmod_init();
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 0a8e74e..287aef2 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -250,13 +250,13 @@ int __init omap4_twl_init(void)
if (!cpu_is_omap44xx())
return -ENODEV;
- voltdm = omap_voltage_domain_lookup("mpu");
+ voltdm = voltdm_lookup("mpu");
omap_voltage_register_pmic(voltdm, &omap4_mpu_volt_info);
- voltdm = omap_voltage_domain_lookup("iva");
+ voltdm = voltdm_lookup("iva");
omap_voltage_register_pmic(voltdm, &omap4_iva_volt_info);
- voltdm = omap_voltage_domain_lookup("core");
+ voltdm = voltdm_lookup("core");
omap_voltage_register_pmic(voltdm, &omap4_core_volt_info);
return 0;
@@ -288,10 +288,10 @@ int __init omap3_twl_init(void)
if (!twl_sr_enable_autoinit)
omap3_twl_set_sr_bit(true);
- voltdm = omap_voltage_domain_lookup("mpu");
+ voltdm = voltdm_lookup("mpu");
omap_voltage_register_pmic(voltdm, &omap3_mpu_volt_info);
- voltdm = omap_voltage_domain_lookup("core");
+ voltdm = voltdm_lookup("core");
omap_voltage_register_pmic(voltdm, &omap3_core_volt_info);
return 0;
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 49486f5..917e1e3 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -181,7 +181,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
goto exit;
}
- voltdm = omap_voltage_domain_lookup(vdd_name);
+ voltdm = voltdm_lookup(vdd_name);
if (IS_ERR(voltdm)) {
printk(KERN_ERR "%s: Unable to get vdd pointer for vdd_%s\n",
__func__, vdd_name);
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 10d3c5e..2782d3f 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -102,7 +102,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
sr_data->senn_mod = 0x1;
sr_data->senp_mod = 0x1;
- sr_data->voltdm = omap_voltage_domain_lookup(oh->vdd_name);
+ sr_data->voltdm = voltdm_lookup(oh->vdd_name);
if (IS_ERR(sr_data->voltdm)) {
pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
__func__, oh->vdd_name);
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 26c87a3..1dc6967 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -40,20 +40,13 @@
#include "vc.h"
#include "vp.h"
-#define VOLTAGE_DIR_SIZE 16
-
-
-static struct omap_vdd_info **vdd_info;
-
-/*
- * Number of scalable voltage domains.
- */
-static int nr_scalable_vdd;
+static LIST_HEAD(voltdm_list);
+#define VOLTAGE_DIR_SIZE 16
static struct dentry *voltage_dir;
/* Init function pointers */
-static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
+static int vp_forceupdate_scale_voltage(struct voltagedomain *voltdm,
unsigned long target_volt);
static u32 omap3_voltage_read_reg(u16 mod, u8 offset)
@@ -77,11 +70,12 @@ static void omap4_voltage_write_reg(u32 val, u16 mod, u8 offset)
omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, mod, offset);
}
-static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
+static int __init _config_common_vdd_data(struct voltagedomain *voltdm)
{
char *sys_ck_name;
struct clk *sys_ck;
u32 sys_clk_speed, timeout_val, waittime;
+ struct omap_vdd_info *vdd = voltdm->vdd;
/*
* XXX Clockfw should handle this, or this should be in a
@@ -101,7 +95,7 @@ static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
sys_ck = clk_get(NULL, sys_ck_name);
if (IS_ERR(sys_ck)) {
pr_warning("%s: Could not get the sys clk to calculate"
- "various vdd_%s params\n", __func__, vdd->voltdm.name);
+ "various vdd_%s params\n", __func__, voltdm->name);
return -EINVAL;
}
sys_clk_speed = clk_get_rate(sys_ck);
@@ -135,7 +129,8 @@ static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
/* Voltage debugfs support */
static int vp_volt_debug_get(void *data, u64 *val)
{
- struct omap_vdd_info *vdd = (struct omap_vdd_info *) data;
+ struct voltagedomain *voltdm = (struct voltagedomain *)data;
+ struct omap_vdd_info *vdd = voltdm->vdd;
u8 vsel;
if (!vdd) {
@@ -157,14 +152,14 @@ static int vp_volt_debug_get(void *data, u64 *val)
static int nom_volt_debug_get(void *data, u64 *val)
{
- struct omap_vdd_info *vdd = (struct omap_vdd_info *) data;
+ struct voltagedomain *voltdm = (struct voltagedomain *)data;
- if (!vdd) {
+ if (!voltdm) {
pr_warning("Wrong paramater passed\n");
return -EINVAL;
}
- *val = omap_voltage_get_nom_volt(&vdd->voltdm);
+ *val = omap_voltage_get_nom_volt(voltdm);
return 0;
}
@@ -172,16 +167,17 @@ static int nom_volt_debug_get(void *data, u64 *val)
DEFINE_SIMPLE_ATTRIBUTE(vp_volt_debug_fops, vp_volt_debug_get, NULL, "%llu\n");
DEFINE_SIMPLE_ATTRIBUTE(nom_volt_debug_fops, nom_volt_debug_get, NULL,
"%llu\n");
-static void vp_latch_vsel(struct omap_vdd_info *vdd)
+static void vp_latch_vsel(struct voltagedomain *voltdm)
{
u32 vpconfig;
unsigned long uvdc;
char vsel;
+ struct omap_vdd_info *vdd = voltdm->vdd;
- uvdc = omap_voltage_get_nom_volt(&vdd->voltdm);
+ uvdc = omap_voltage_get_nom_volt(voltdm);
if (!uvdc) {
pr_warning("%s: unable to find current voltage for vdd_%s\n",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
return;
}
@@ -209,13 +205,14 @@ static void vp_latch_vsel(struct omap_vdd_info *vdd)
}
/* Generic voltage init functions */
-static void __init vp_init(struct omap_vdd_info *vdd)
+static void __init vp_init(struct voltagedomain *voltdm)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
u32 vp_val;
if (!vdd->read_reg || !vdd->write_reg) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
return;
}
@@ -246,25 +243,26 @@ static void __init vp_init(struct omap_vdd_info *vdd)
vdd->write_reg(vp_val, vdd->prm_mod, vdd->vp_data->vlimitto);
}
-static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
+static void __init vdd_debugfs_init(struct voltagedomain *voltdm)
{
char *name;
+ struct omap_vdd_info *vdd = voltdm->vdd;
name = kzalloc(VOLTAGE_DIR_SIZE, GFP_KERNEL);
if (!name) {
pr_warning("%s: Unable to allocate memory for debugfs"
" directory name for vdd_%s",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
return;
}
strcpy(name, "vdd_");
- strcat(name, vdd->voltdm.name);
+ strcat(name, voltdm->name);
vdd->debug_dir = debugfs_create_dir(name, voltage_dir);
kfree(name);
if (IS_ERR(vdd->debug_dir)) {
pr_warning("%s: Unable to create debugfs directory for"
- " vdd_%s\n", __func__, vdd->voltdm.name);
+ " vdd_%s\n", __func__, voltdm->name);
vdd->debug_dir = NULL;
return;
}
@@ -288,16 +286,17 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
(void) debugfs_create_x16("vp_timeout", S_IRUGO, vdd->debug_dir,
&(vdd->vp_rt_data.vlimitto_timeout));
(void) debugfs_create_file("curr_vp_volt", S_IRUGO, vdd->debug_dir,
- (void *) vdd, &vp_volt_debug_fops);
+ (void *) voltdm, &vp_volt_debug_fops);
(void) debugfs_create_file("curr_nominal_volt", S_IRUGO,
- vdd->debug_dir, (void *) vdd,
+ vdd->debug_dir, (void *) voltdm,
&nom_volt_debug_fops);
}
/* Voltage scale and accessory APIs */
-static int _pre_volt_scale(struct omap_vdd_info *vdd,
+static int _pre_volt_scale(struct voltagedomain *voltdm,
unsigned long target_volt, u8 *target_vsel, u8 *current_vsel)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
struct omap_volt_data *volt_data;
const struct omap_vc_common_data *vc_common;
const struct omap_vp_common_data *vp_common;
@@ -309,25 +308,25 @@ static int _pre_volt_scale(struct omap_vdd_info *vdd,
/* Check if suffiecient pmic info is available for this vdd */
if (!vdd->pmic_info) {
pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
return -EINVAL;
}
if (!vdd->pmic_info->uv_to_vsel) {
pr_err("%s: PMIC function to convert voltage in uV to"
"vsel not registered. Hence unable to scale voltage"
- "for vdd_%s\n", __func__, vdd->voltdm.name);
+ "for vdd_%s\n", __func__, voltdm->name);
return -ENODATA;
}
if (!vdd->read_reg || !vdd->write_reg) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
return -EINVAL;
}
/* Get volt_data corresponding to target_volt */
- volt_data = omap_voltage_get_voltdata(&vdd->voltdm, target_volt);
+ volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
if (IS_ERR(volt_data))
volt_data = NULL;
@@ -355,9 +354,10 @@ static int _pre_volt_scale(struct omap_vdd_info *vdd,
return 0;
}
-static void _post_volt_scale(struct omap_vdd_info *vdd,
+static void _post_volt_scale(struct voltagedomain *voltdm,
unsigned long target_volt, u8 target_vsel, u8 current_vsel)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
u32 smps_steps = 0, smps_delay = 0;
smps_steps = abs(target_vsel - current_vsel);
@@ -370,15 +370,16 @@ static void _post_volt_scale(struct omap_vdd_info *vdd,
}
/* vc_bypass_scale_voltage - VC bypass method of voltage scaling */
-static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
+static int vc_bypass_scale_voltage(struct voltagedomain *voltdm,
unsigned long target_volt)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
u32 loop_cnt = 0, retries_cnt = 0;
u32 vc_valid, vc_bypass_val_reg, vc_bypass_value;
u8 target_vsel, current_vsel;
int ret;
- ret = _pre_volt_scale(vdd, target_volt, &target_vsel, ¤t_vsel);
+ ret = _pre_volt_scale(voltdm, target_volt, &target_vsel, ¤t_vsel);
if (ret)
return ret;
@@ -417,19 +418,20 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
vc_bypass_val_reg);
}
- _post_volt_scale(vdd, target_volt, target_vsel, current_vsel);
+ _post_volt_scale(voltdm, target_volt, target_vsel, current_vsel);
return 0;
}
/* VP force update method of voltage scaling */
-static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
+static int vp_forceupdate_scale_voltage(struct voltagedomain *voltdm,
unsigned long target_volt)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
u32 vpconfig;
u8 target_vsel, current_vsel, prm_irqst_reg;
int ret, timeout = 0;
- ret = _pre_volt_scale(vdd, target_volt, &target_vsel, ¤t_vsel);
+ ret = _pre_volt_scale(voltdm, target_volt, &target_vsel, ¤t_vsel);
if (ret)
return ret;
@@ -449,7 +451,7 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
}
if (timeout >= VP_TRANXDONE_TIMEOUT) {
pr_warning("%s: vdd_%s TRANXDONE timeout exceeded."
- "Voltage change aborted", __func__, vdd->voltdm.name);
+ "Voltage change aborted", __func__, voltdm->name);
return -ETIMEDOUT;
}
@@ -481,9 +483,9 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
if (timeout >= VP_TRANXDONE_TIMEOUT)
pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
"TRANXDONE never got set after the voltage update\n",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
- _post_volt_scale(vdd, target_volt, target_vsel, current_vsel);
+ _post_volt_scale(voltdm, target_volt, target_vsel, current_vsel);
/*
* Disable TransactionDone interrupt , clear all status, clear
@@ -502,7 +504,7 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
if (timeout >= VP_TRANXDONE_TIMEOUT)
pr_warning("%s: vdd_%s TRANXDONE timeout exceeded while trying"
"to clear the TRANXDONE status\n",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
vpconfig = vdd->read_reg(vdd->prm_mod, vdd->vp_data->vpconfig);
/* Clear initVDD copy trigger bit */
@@ -515,8 +517,10 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
return 0;
}
-static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
+static void __init omap3_vfsm_init(struct voltagedomain *voltdm)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
+
/*
* Voltage Manager FSM parameters init
* XXX This data should be passed in from the board file
@@ -528,8 +532,9 @@ static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
OMAP3_PRM_VOLTSETUP2_OFFSET);
}
-static void __init omap3_vc_init(struct omap_vdd_info *vdd)
+static void __init omap3_vc_init(struct voltagedomain *voltdm)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
static bool is_initialized;
u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
u32 vc_val;
@@ -557,15 +562,16 @@ static void __init omap3_vc_init(struct omap_vdd_info *vdd)
vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, vdd->prm_mod,
OMAP3_PRM_VC_I2C_CFG_OFFSET);
- omap3_vfsm_init(vdd);
+ omap3_vfsm_init(voltdm);
is_initialized = true;
}
/* OMAP4 specific voltage init functions */
-static void __init omap4_vc_init(struct omap_vdd_info *vdd)
+static void __init omap4_vc_init(struct voltagedomain *voltdm)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
static bool is_initialized;
u32 vc_val;
@@ -590,20 +596,21 @@ static void __init omap4_vc_init(struct omap_vdd_info *vdd)
is_initialized = true;
}
-static void __init omap_vc_init(struct omap_vdd_info *vdd)
+static void __init omap_vc_init(struct voltagedomain *voltdm)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
u32 vc_val;
if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
pr_err("%s: PMIC info requried to configure vc for"
"vdd_%s not populated.Hence cannot initialize vc\n",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
return;
}
if (!vdd->read_reg || !vdd->write_reg) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
- __func__, vdd->voltdm.name);
+ __func__, voltdm->name);
return;
}
@@ -631,23 +638,24 @@ static void __init omap_vc_init(struct omap_vdd_info *vdd)
vdd->write_reg(vc_val, vdd->prm_mod, vdd->vfsm->voltsetup_reg);
if (cpu_is_omap34xx())
- omap3_vc_init(vdd);
+ omap3_vc_init(voltdm);
else if (cpu_is_omap44xx())
- omap4_vc_init(vdd);
+ omap4_vc_init(voltdm);
}
-static int __init omap_vdd_data_configure(struct omap_vdd_info *vdd)
+static int __init omap_vdd_data_configure(struct voltagedomain *voltdm)
{
+ struct omap_vdd_info *vdd = voltdm->vdd;
int ret = -EINVAL;
if (!vdd->pmic_info) {
pr_err("%s: PMIC info requried to configure vdd_%s not"
"populated.Hence cannot initialize vdd_%s\n",
- __func__, vdd->voltdm.name, vdd->voltdm.name);
+ __func__, voltdm->name, voltdm->name);
goto ovdc_out;
}
- if (IS_ERR_VALUE(_config_common_vdd_data(vdd)))
+ if (IS_ERR_VALUE(_config_common_vdd_data(voltdm)))
goto ovdc_out;
if (cpu_is_omap34xx()) {
@@ -681,7 +689,7 @@ unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm)
return 0;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
return vdd->curr_volt;
}
@@ -702,7 +710,7 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
return 0;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
if (!vdd->read_reg) {
pr_err("%s: No read API for reading vdd_%s regs\n",
__func__, voltdm->name);
@@ -737,7 +745,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
return;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
if (!vdd->read_reg || !vdd->write_reg) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
__func__, voltdm->name);
@@ -748,7 +756,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
if (vdd->vp_enabled)
return;
- vp_latch_vsel(vdd);
+ vp_latch_vsel(voltdm);
/* Enable VP */
vpconfig = vdd->read_reg(vdd->prm_mod, vdd->vp_data->vpconfig);
@@ -775,7 +783,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
return;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
if (!vdd->read_reg || !vdd->write_reg) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
__func__, voltdm->name);
@@ -828,7 +836,7 @@ int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
return -EINVAL;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
if (!vdd->volt_scale) {
pr_err("%s: No voltage scale API registered for vdd_%s\n",
@@ -836,7 +844,7 @@ int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
return -ENODATA;
}
- return vdd->volt_scale(vdd, target_volt);
+ return vdd->volt_scale(voltdm, target_volt);
}
/**
@@ -889,7 +897,7 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
return;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
*volt_data = vdd->volt_data;
}
@@ -920,7 +928,7 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
return ERR_PTR(-EINVAL);
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
if (!vdd->volt_data) {
pr_warning("%s: voltage table does not exist for vdd_%s\n",
@@ -958,7 +966,7 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
return -EINVAL;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
vdd->pmic_info = pmic_info;
@@ -985,7 +993,7 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
return NULL;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
return vdd->debug_dir;
}
@@ -1010,7 +1018,7 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
return;
}
- vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+ vdd = voltdm->vdd;
switch (voltscale_method) {
case VOLTSCALE_VPFORCEUPDATE:
@@ -1026,38 +1034,6 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
}
/**
- * omap_voltage_domain_lookup() - API to get the voltage domain pointer
- * @name: Name of the voltage domain
- *
- * This API looks up in the global vdd_info struct for the
- * existence of voltage domain <name>. If it exists, the API returns
- * a pointer to the voltage domain structure corresponding to the
- * VDD<name>. Else retuns error pointer.
- */
-struct voltagedomain *omap_voltage_domain_lookup(char *name)
-{
- int i;
-
- if (!vdd_info) {
- pr_err("%s: Voltage driver init not yet happened.Faulting!\n",
- __func__);
- return ERR_PTR(-EINVAL);
- }
-
- if (!name) {
- pr_err("%s: No name to get the votage domain!\n", __func__);
- return ERR_PTR(-EINVAL);
- }
-
- for (i = 0; i < nr_scalable_vdd; i++) {
- if (!(strcmp(name, vdd_info[i]->voltdm.name)))
- return &vdd_info[i]->voltdm;
- }
-
- return ERR_PTR(-EINVAL);
-}
-
-/**
* omap_voltage_late_init() - Init the various voltage parameters
*
* This API is to be called in the later stages of the
@@ -1066,9 +1042,9 @@ struct voltagedomain *omap_voltage_domain_lookup(char *name)
*/
int __init omap_voltage_late_init(void)
{
- int i;
+ struct voltagedomain *voltdm;
- if (!vdd_info) {
+ if (list_empty(&voltdm_list)) {
pr_err("%s: Voltage driver support not added\n",
__func__);
return -EINVAL;
@@ -1078,22 +1054,79 @@ int __init omap_voltage_late_init(void)
if (IS_ERR(voltage_dir))
pr_err("%s: Unable to create voltage debugfs main dir\n",
__func__);
- for (i = 0; i < nr_scalable_vdd; i++) {
- if (omap_vdd_data_configure(vdd_info[i]))
+ list_for_each_entry(voltdm, &voltdm_list, node) {
+ if (omap_vdd_data_configure(voltdm))
continue;
- omap_vc_init(vdd_info[i]);
- vp_init(vdd_info[i]);
- vdd_debugfs_init(vdd_info[i]);
+ omap_vc_init(voltdm);
+ vp_init(voltdm);
+ vdd_debugfs_init(voltdm);
}
return 0;
}
-/* XXX document */
-int __init omap_voltage_early_init(struct omap_vdd_info *omap_vdd_array[],
- u8 omap_vdd_count)
+static struct voltagedomain *_voltdm_lookup(const char *name)
{
- vdd_info = omap_vdd_array;
- nr_scalable_vdd = omap_vdd_count;
+ struct voltagedomain *voltdm, *temp_voltdm;
+
+ voltdm = NULL;
+
+ list_for_each_entry(temp_voltdm, &voltdm_list, node) {
+ if (!strcmp(name, temp_voltdm->name)) {
+ voltdm = temp_voltdm;
+ break;
+ }
+ }
+
+ return voltdm;
+}
+
+static int _voltdm_register(struct voltagedomain *voltdm)
+{
+ if (!voltdm || !voltdm->name)
+ return -EINVAL;
+
+ list_add(&voltdm->node, &voltdm_list);
+
+ pr_debug("voltagedomain: registered %s\n", voltdm->name);
+
return 0;
}
+
+/**
+ * voltdm_lookup - look up a voltagedomain by name, return a pointer
+ * @name: name of voltagedomain
+ *
+ * Find a registered voltagedomain by its name @name. Returns a pointer
+ * to the struct voltagedomain if found, or NULL otherwise.
+ */
+struct voltagedomain *voltdm_lookup(const char *name)
+{
+ struct voltagedomain *voltdm ;
+
+ if (!name)
+ return NULL;
+
+ voltdm = _voltdm_lookup(name);
+
+ return voltdm;
+}
+
+/**
+ * voltdm_init - set up the voltagedomain layer
+ * @voltdm_list: array of struct voltagedomain pointers to register
+ *
+ * Loop through the array of voltagedomains @voltdm_list, registering all
+ * that are available on the current CPU. If voltdm_list is supplied
+ * and not null, all of the referenced voltagedomains will be
+ * registered. No return value.
+ */
+void voltdm_init(struct voltagedomain **voltdms)
+{
+ struct voltagedomain **v;
+
+ if (voltdms) {
+ for (v = voltdms; *v; v++)
+ _voltdm_register(*v);
+ }
+}
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 44edc1e..122d8c1 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -31,6 +31,8 @@
#define OMAP3_VOLTOFFSET 0xff
#define OMAP3_VOLTSETUP2 0xff
+struct omap_vdd_info;
+
/**
* struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
* data
@@ -50,11 +52,14 @@ struct omap_vfsm_instance_data {
/**
* struct voltagedomain - omap voltage domain global structure.
- * @name: Name of the voltage domain which can be used as a unique
- * identifier.
+ * @name: Name of the voltage domain which can be used as a unique identifier.
+ * @node: list_head linking all voltage domains
+ * @vdd: to be removed
*/
struct voltagedomain {
char *name;
+ struct list_head node;
+ struct omap_vdd_info *vdd;
};
/**
@@ -116,7 +121,6 @@ struct omap_volt_pmic_info {
* @vc_data : structure containing various various vc registers,
* shifts, masks etc.
* @vfsm : voltage manager FSM data
- * @voltdm : pointer to the voltage domain structure
* @debug_dir : debug directory for this voltage domain.
* @curr_volt : current voltage for this vdd.
* @vp_enabled : flag to keep track of whether vp is enabled or not
@@ -129,7 +133,6 @@ struct omap_vdd_info {
struct omap_vp_runtime_data vp_rt_data;
struct omap_vc_instance_data *vc_data;
const struct omap_vfsm_instance_data *vfsm;
- struct voltagedomain voltdm;
struct dentry *debug_dir;
u32 curr_volt;
bool vp_enabled;
@@ -138,7 +141,7 @@ struct omap_vdd_info {
s16 prm_irqst_mod;
u32 (*read_reg) (u16 mod, u8 offset);
void (*write_reg) (u32 val, u16 mod, u8 offset);
- int (*volt_scale) (struct omap_vdd_info *vdd,
+ int (*volt_scale) (struct voltagedomain *voltdm,
unsigned long target_volt);
};
@@ -154,16 +157,11 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
unsigned long volt);
unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
-int __init omap_voltage_early_init(struct omap_vdd_info *omap_vdd_array[],
- u8 omap_vdd_count);
#ifdef CONFIG_PM
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
struct omap_volt_pmic_info *pmic_info);
void omap_change_voltscale_method(struct voltagedomain *voltdm,
int voltscale_method);
-/* API to get the voltagedomain pointer */
-struct voltagedomain *omap_voltage_domain_lookup(char *name);
-
int omap_voltage_late_init(void);
#else
static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
@@ -177,10 +175,11 @@ static inline int omap_voltage_late_init(void)
{
return -EINVAL;
}
-static inline struct voltagedomain *omap_voltage_domain_lookup(char *name)
-{
- return ERR_PTR(-EINVAL);
-}
#endif
+extern void omap3xxx_voltagedomains_init(void);
+extern void omap44xx_voltagedomains_init(void);
+
+struct voltagedomain *voltdm_lookup(const char *name);
+void voltdm_init(struct voltagedomain **voltdm_list);
#endif
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index 74c44d9..bd60468 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -43,9 +43,6 @@ static struct omap_vdd_info omap3_vdd1_info = {
.vp_data = &omap3_vp1_data,
.vc_data = &omap3_vc1_data,
.vfsm = &omap3_vdd1_vfsm_data,
- .voltdm = {
- .name = "mpu",
- },
};
static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
@@ -60,23 +57,26 @@ static struct omap_vdd_info omap3_vdd2_info = {
.vp_data = &omap3_vp2_data,
.vc_data = &omap3_vc2_data,
.vfsm = &omap3_vdd2_vfsm_data,
- .voltdm = {
- .name = "core",
- },
};
-/* OMAP3 VDD structures */
-static struct omap_vdd_info *omap3_vdd_info[] = {
- &omap3_vdd1_info,
- &omap3_vdd2_info,
+static struct voltagedomain omap3_voltdm_mpu = {
+ .name = "mpu",
+ .vdd = &omap3_vdd1_info,
};
-/* OMAP3 specific voltage init functions */
-static int __init omap3xxx_voltage_early_init(void)
-{
- if (!cpu_is_omap34xx())
- return 0;
+static struct voltagedomain omap3_voltdm_core = {
+ .name = "core",
+ .vdd = &omap3_vdd2_info,
+};
+static struct voltagedomain *voltagedomains_omap3[] __initdata = {
+ &omap3_voltdm_mpu,
+ &omap3_voltdm_core,
+ NULL,
+};
+
+void __init omap3xxx_voltagedomains_init(void)
+{
/*
* XXX Will depend on the process, validation, and binning
* for the currently-running IC
@@ -89,7 +89,5 @@ static int __init omap3xxx_voltage_early_init(void)
omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
}
- return omap_voltage_early_init(omap3_vdd_info,
- ARRAY_SIZE(omap3_vdd_info));
+ voltdm_init(voltagedomains_omap3);
};
-core_initcall(omap3xxx_voltage_early_init);
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index b9b23d6..a13fbb7 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -42,9 +42,6 @@ static struct omap_vdd_info omap4_vdd_mpu_info = {
.vp_data = &omap4_vp_mpu_data,
.vc_data = &omap4_vc_mpu_data,
.vfsm = &omap4_vdd_mpu_vfsm_data,
- .voltdm = {
- .name = "mpu",
- },
};
static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = {
@@ -57,9 +54,6 @@ static struct omap_vdd_info omap4_vdd_iva_info = {
.vp_data = &omap4_vp_iva_data,
.vc_data = &omap4_vc_iva_data,
.vfsm = &omap4_vdd_iva_vfsm_data,
- .voltdm = {
- .name = "iva",
- },
};
static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = {
@@ -72,24 +66,32 @@ static struct omap_vdd_info omap4_vdd_core_info = {
.vp_data = &omap4_vp_core_data,
.vc_data = &omap4_vc_core_data,
.vfsm = &omap4_vdd_core_vfsm_data,
- .voltdm = {
- .name = "core",
- },
};
-/* OMAP4 VDD structures */
-static struct omap_vdd_info *omap4_vdd_info[] = {
- &omap4_vdd_mpu_info,
- &omap4_vdd_iva_info,
- &omap4_vdd_core_info,
+static struct voltagedomain omap4_voltdm_mpu = {
+ .name = "mpu",
+ .vdd = &omap4_vdd_mpu_info,
};
-/* OMAP4 specific voltage init functions */
-static int __init omap44xx_voltage_early_init(void)
-{
- if (!cpu_is_omap44xx())
- return 0;
+static struct voltagedomain omap4_voltdm_iva = {
+ .name = "iva",
+ .vdd = &omap4_vdd_iva_info,
+};
+
+static struct voltagedomain omap4_voltdm_core = {
+ .name = "core",
+ .vdd = &omap4_vdd_core_info,
+};
+static struct voltagedomain *voltagedomains_omap4[] __initdata = {
+ &omap4_voltdm_mpu,
+ &omap4_voltdm_iva,
+ &omap4_voltdm_core,
+ NULL,
+};
+
+void __init omap44xx_voltagedomains_init(void)
+{
/*
* XXX Will depend on the process, validation, and binning
* for the currently-running IC
@@ -98,7 +100,5 @@ static int __init omap44xx_voltage_early_init(void)
omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
- return omap_voltage_early_init(omap4_vdd_info,
- ARRAY_SIZE(omap4_vdd_info));
+ voltdm_init(voltagedomains_omap4);
};
-core_initcall(omap44xx_voltage_early_init);
--
1.7.4
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register
2011-03-19 0:18 [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
` (2 preceding siblings ...)
2011-03-19 0:18 ` [PATCH 3/7] OMAP2+: voltage: start towards a new voltagedomain layer Kevin Hilman
@ 2011-03-19 0:18 ` Kevin Hilman
2011-03-22 19:23 ` Paul Walmsley
2011-03-19 0:18 ` [PATCH 5/7] OMAP2+: voltage: keep track of powerdomains in each voltagedomain Kevin Hilman
` (3 subsequent siblings)
7 siblings, 1 reply; 33+ messages in thread
From: Kevin Hilman @ 2011-03-19 0:18 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Walmsely, Benoit Cousson
When a powerdomain is registered, lookup the voltage domain by name
and keep a pointer to the containing voltagedomain in the powerdomain
structure.
Modeled after similar method between powerdomain and clockdomain layers.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
arch/arm/mach-omap2/powerdomain.c | 26 ++++++++++++++++++++++++++
arch/arm/mach-omap2/powerdomain.h | 8 ++++++++
arch/arm/mach-omap2/voltage.h | 1 +
3 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 49c6513..da86c72 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -77,6 +77,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
static int _pwrdm_register(struct powerdomain *pwrdm)
{
int i;
+ struct voltagedomain *voltdm;
if (!pwrdm || !pwrdm->name)
return -EINVAL;
@@ -94,6 +95,16 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
if (_pwrdm_lookup(pwrdm->name))
return -EEXIST;
+ if (pwrdm->voltdm.name) {
+ voltdm = voltdm_lookup(pwrdm->voltdm.name);
+ if (!voltdm) {
+ pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
+ pwrdm->name, pwrdm->voltdm.name);
+ return -EINVAL;
+ }
+ pwrdm->voltdm.ptr = voltdm;
+ }
+
list_add(&pwrdm->node, &pwrdm_list);
/* Initialize the powerdomain's state counter */
@@ -383,6 +394,21 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
}
/**
+ * pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
+ * @pwrdm: struct powerdomain *
+ *
+ * Return a pointer to the struct voltageomain that the specified powerdomain
+ * @pwrdm exists in, or returns NULL if @pwrdm is NULL.
+ */
+struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm)
+{
+ if (!pwrdm)
+ return NULL;
+
+ return pwrdm->voltdm.ptr;
+}
+
+/**
* pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
* @pwrdm: struct powerdomain *
*
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index 027f40b..3a1ec37 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -24,6 +24,8 @@
#include <plat/cpu.h>
+#include "voltage.h"
+
/* Powerdomain basic power states */
#define PWRDM_POWER_OFF 0x0
#define PWRDM_POWER_RET 0x1
@@ -78,6 +80,7 @@ struct powerdomain;
/**
* struct powerdomain - OMAP powerdomain
* @name: Powerdomain name
+ * @voltdm: voltagedomain containing this powerdomain
* @omap_chip: represents the OMAP chip types containing this pwrdm
* @prcm_offs: the address offset from CM_BASE/PRM_BASE
* @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs
@@ -98,6 +101,10 @@ struct powerdomain;
*/
struct powerdomain {
const char *name;
+ union {
+ const char *name;
+ struct voltagedomain *ptr;
+ } voltdm;
const struct omap_chip_id omap_chip;
const s16 prcm_offs;
const u8 pwrsts;
@@ -176,6 +183,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
int (*fn)(struct powerdomain *pwrdm,
struct clockdomain *clkdm));
+struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm);
int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 122d8c1..13e5ed9 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -182,4 +182,5 @@ extern void omap44xx_voltagedomains_init(void);
struct voltagedomain *voltdm_lookup(const char *name);
void voltdm_init(struct voltagedomain **voltdm_list);
+int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
#endif
--
1.7.4
^ permalink raw reply related [flat|nested] 33+ messages in thread* Re: [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register
2011-03-19 0:18 ` [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register Kevin Hilman
@ 2011-03-22 19:23 ` Paul Walmsley
2011-03-22 20:59 ` Cousson, Benoit
2011-03-23 0:17 ` Kevin Hilman
0 siblings, 2 replies; 33+ messages in thread
From: Paul Walmsley @ 2011-03-22 19:23 UTC (permalink / raw)
To: Kevin Hilman; +Cc: linux-omap, Benoit Cousson
Hi Kevin,
a couple of comments, now that i have the chance to look this over
closely.
Probably we should require every powerdomain to have a voltagedomain.
This will avoid the problems we're having with the clocks, in which not
every clock has a clockdomain pointer.
So I'd suggest splitting this patch up into two patches -- one to make the
changes the powerdomain structure, and the second to add the code into the
powerdomain.c. Between these two patches, we'd need patches to the
powerdomain data to add the voltagedomain names in.
then...
On Fri, 18 Mar 2011, Kevin Hilman wrote:
> When a powerdomain is registered, lookup the voltage domain by name
> and keep a pointer to the containing voltagedomain in the powerdomain
> structure.
>
> Modeled after similar method between powerdomain and clockdomain layers.
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
>
> ---
> arch/arm/mach-omap2/powerdomain.c | 26 ++++++++++++++++++++++++++
> arch/arm/mach-omap2/powerdomain.h | 8 ++++++++
> arch/arm/mach-omap2/voltage.h | 1 +
> 3 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
> index 49c6513..da86c72 100644
> --- a/arch/arm/mach-omap2/powerdomain.c
> +++ b/arch/arm/mach-omap2/powerdomain.c
> @@ -77,6 +77,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
> static int _pwrdm_register(struct powerdomain *pwrdm)
> {
> int i;
> + struct voltagedomain *voltdm;
>
> if (!pwrdm || !pwrdm->name)
> return -EINVAL;
> @@ -94,6 +95,16 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
> if (_pwrdm_lookup(pwrdm->name))
> return -EEXIST;
>
> + if (pwrdm->voltdm.name) {
we'd drop this
> + voltdm = voltdm_lookup(pwrdm->voltdm.name);
> + if (!voltdm) {
> + pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
> + pwrdm->name, pwrdm->voltdm.name);
> + return -EINVAL;
> + }
> + pwrdm->voltdm.ptr = voltdm;
> + }
> +
> list_add(&pwrdm->node, &pwrdm_list);
>
> /* Initialize the powerdomain's state counter */
> @@ -383,6 +394,21 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
> }
>
> /**
> + * pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
> + * @pwrdm: struct powerdomain *
> + *
> + * Return a pointer to the struct voltageomain that the specified powerdomain
> + * @pwrdm exists in, or returns NULL if @pwrdm is NULL.
> + */
> +struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm)
> +{
> + if (!pwrdm)
> + return NULL;
and this
> +
> + return pwrdm->voltdm.ptr;
> +}
> +
> +/**
> * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
> * @pwrdm: struct powerdomain *
> *
> diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
> index 027f40b..3a1ec37 100644
> --- a/arch/arm/mach-omap2/powerdomain.h
> +++ b/arch/arm/mach-omap2/powerdomain.h
> @@ -24,6 +24,8 @@
>
> #include <plat/cpu.h>
>
> +#include "voltage.h"
> +
> /* Powerdomain basic power states */
> #define PWRDM_POWER_OFF 0x0
> #define PWRDM_POWER_RET 0x1
> @@ -78,6 +80,7 @@ struct powerdomain;
> /**
> * struct powerdomain - OMAP powerdomain
> * @name: Powerdomain name
> + * @voltdm: voltagedomain containing this powerdomain
> * @omap_chip: represents the OMAP chip types containing this pwrdm
> * @prcm_offs: the address offset from CM_BASE/PRM_BASE
> * @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs
> @@ -98,6 +101,10 @@ struct powerdomain;
> */
> struct powerdomain {
> const char *name;
> + union {
> + const char *name;
> + struct voltagedomain *ptr;
> + } voltdm;
> const struct omap_chip_id omap_chip;
> const s16 prcm_offs;
> const u8 pwrsts;
> @@ -176,6 +183,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
> int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
> int (*fn)(struct powerdomain *pwrdm,
> struct clockdomain *clkdm));
> +struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm);
>
> int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
>
> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
> index 122d8c1..13e5ed9 100644
> --- a/arch/arm/mach-omap2/voltage.h
> +++ b/arch/arm/mach-omap2/voltage.h
> @@ -182,4 +182,5 @@ extern void omap44xx_voltagedomains_init(void);
>
> struct voltagedomain *voltdm_lookup(const char *name);
> void voltdm_init(struct voltagedomain **voltdm_list);
> +int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
> #endif
> --
> 1.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
- Paul
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register
2011-03-22 19:23 ` Paul Walmsley
@ 2011-03-22 20:59 ` Cousson, Benoit
2011-03-22 22:08 ` Paul Walmsley
2011-03-23 0:17 ` Kevin Hilman
1 sibling, 1 reply; 33+ messages in thread
From: Cousson, Benoit @ 2011-03-22 20:59 UTC (permalink / raw)
To: Paul Walmsley; +Cc: Hilman, Kevin, linux-omap@vger.kernel.org
Hi Paul,
On 3/22/2011 8:23 PM, Paul Walmsley wrote:
> Hi Kevin,
>
> a couple of comments, now that i have the chance to look this over
> closely.
>
> Probably we should require every powerdomain to have a voltagedomain.
> This will avoid the problems we're having with the clocks, in which not
> every clock has a clockdomain pointer.
I do agree with you, but not for the same reason :-)
Every power domain belongs to a voltage domain, scalable or not, so
that's why we should always have it.
On the other hand not every clock belong to a clockdomain, that's why we
have clock without clockdomain on OMAP.
A clockdomain is a just group of IPs that share the same interface clock.
Benoit
> So I'd suggest splitting this patch up into two patches -- one to make the
> changes the powerdomain structure, and the second to add the code into the
> powerdomain.c. Between these two patches, we'd need patches to the
> powerdomain data to add the voltagedomain names in.
>
> then...
>
> On Fri, 18 Mar 2011, Kevin Hilman wrote:
>
>> When a powerdomain is registered, lookup the voltage domain by name
>> and keep a pointer to the containing voltagedomain in the powerdomain
>> structure.
>>
>> Modeled after similar method between powerdomain and clockdomain layers.
>>
>> Signed-off-by: Kevin Hilman<khilman@ti.com>
>>
>> ---
>> arch/arm/mach-omap2/powerdomain.c | 26 ++++++++++++++++++++++++++
>> arch/arm/mach-omap2/powerdomain.h | 8 ++++++++
>> arch/arm/mach-omap2/voltage.h | 1 +
>> 3 files changed, 35 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
>> index 49c6513..da86c72 100644
>> --- a/arch/arm/mach-omap2/powerdomain.c
>> +++ b/arch/arm/mach-omap2/powerdomain.c
>> @@ -77,6 +77,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
>> static int _pwrdm_register(struct powerdomain *pwrdm)
>> {
>> int i;
>> + struct voltagedomain *voltdm;
>>
>> if (!pwrdm || !pwrdm->name)
>> return -EINVAL;
>> @@ -94,6 +95,16 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
>> if (_pwrdm_lookup(pwrdm->name))
>> return -EEXIST;
>>
>> + if (pwrdm->voltdm.name) {
>
> we'd drop this
>
>> + voltdm = voltdm_lookup(pwrdm->voltdm.name);
>> + if (!voltdm) {
>> + pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
>> + pwrdm->name, pwrdm->voltdm.name);
>> + return -EINVAL;
>> + }
>> + pwrdm->voltdm.ptr = voltdm;
>> + }
>> +
>> list_add(&pwrdm->node,&pwrdm_list);
>>
>> /* Initialize the powerdomain's state counter */
>> @@ -383,6 +394,21 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
>> }
>>
>> /**
>> + * pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
>> + * @pwrdm: struct powerdomain *
>> + *
>> + * Return a pointer to the struct voltageomain that the specified powerdomain
>> + * @pwrdm exists in, or returns NULL if @pwrdm is NULL.
>> + */
>> +struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm)
>> +{
>> + if (!pwrdm)
>> + return NULL;
>
> and this
>
>> +
>> + return pwrdm->voltdm.ptr;
>> +}
>> +
>> +/**
>> * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
>> * @pwrdm: struct powerdomain *
>> *
>> diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
>> index 027f40b..3a1ec37 100644
>> --- a/arch/arm/mach-omap2/powerdomain.h
>> +++ b/arch/arm/mach-omap2/powerdomain.h
>> @@ -24,6 +24,8 @@
>>
>> #include<plat/cpu.h>
>>
>> +#include "voltage.h"
>> +
>> /* Powerdomain basic power states */
>> #define PWRDM_POWER_OFF 0x0
>> #define PWRDM_POWER_RET 0x1
>> @@ -78,6 +80,7 @@ struct powerdomain;
>> /**
>> * struct powerdomain - OMAP powerdomain
>> * @name: Powerdomain name
>> + * @voltdm: voltagedomain containing this powerdomain
>> * @omap_chip: represents the OMAP chip types containing this pwrdm
>> * @prcm_offs: the address offset from CM_BASE/PRM_BASE
>> * @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs
>> @@ -98,6 +101,10 @@ struct powerdomain;
>> */
>> struct powerdomain {
>> const char *name;
>> + union {
>> + const char *name;
>> + struct voltagedomain *ptr;
>> + } voltdm;
>> const struct omap_chip_id omap_chip;
>> const s16 prcm_offs;
>> const u8 pwrsts;
>> @@ -176,6 +183,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
>> int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
>> int (*fn)(struct powerdomain *pwrdm,
>> struct clockdomain *clkdm));
>> +struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm);
>>
>> int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
>>
>> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
>> index 122d8c1..13e5ed9 100644
>> --- a/arch/arm/mach-omap2/voltage.h
>> +++ b/arch/arm/mach-omap2/voltage.h
>> @@ -182,4 +182,5 @@ extern void omap44xx_voltagedomains_init(void);
>>
>> struct voltagedomain *voltdm_lookup(const char *name);
>> void voltdm_init(struct voltagedomain **voltdm_list);
>> +int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
>> #endif
>> --
>> 1.7.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
>
> - Paul
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register
2011-03-22 20:59 ` Cousson, Benoit
@ 2011-03-22 22:08 ` Paul Walmsley
2011-03-22 23:04 ` Cousson, Benoit
0 siblings, 1 reply; 33+ messages in thread
From: Paul Walmsley @ 2011-03-22 22:08 UTC (permalink / raw)
To: Cousson, Benoit; +Cc: Hilman, Kevin, linux-omap@vger.kernel.org
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1463 bytes --]
Hi Benoît,
On Tue, 22 Mar 2011, Cousson, Benoit wrote:
> On the other hand not every clock belong to a clockdomain, that's why we
> have clock without clockdomain on OMAP. A clockdomain is a just group of
> IPs that share the same interface clock.
PRCM clockdomains also include functional clocks. See for example the
OMAP4 Public TRM Rev. O Section 3.1.1.1.3 "Clock Domain" ('The clockdomain
of CM_B is composed of two clocks: a functional clock (FCLK2) and an
interface clock (ICLK1)', and also later, 'The PRCM module lets software
check the status of the clock domain functional clocks').
Both the TRM and the OMAP4 functional specification clearly link PRCM
clockdomain idle management to the state of the clockdomain's functional
clocks. See for example OMAP4 Public TRM Rev. O Table 3-11 "Clock Domain
Clock States" ('INACTIVE: ... Every optional functional clock in the clock
domain is gated.')
Beyond the PRCM, the Linux-OMAP clockdomain code is not only concerned
with PRCM-controllable clockdomains. It is intended to be a generically
useful way to connect clocks to the powerdomain and voltagedomain that the
clock exists in, even if there are no explicit PRCM registers associated
with the clockdomain. These "powerdomains" and "voltagedomains" also may
not be directly PRCM controllable.
Every clock that is in the Linux-OMAP clock tree should have a clockdomain
associated with it.
- Paul
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register
2011-03-22 22:08 ` Paul Walmsley
@ 2011-03-22 23:04 ` Cousson, Benoit
2011-04-02 1:17 ` Paul Walmsley
0 siblings, 1 reply; 33+ messages in thread
From: Cousson, Benoit @ 2011-03-22 23:04 UTC (permalink / raw)
To: Paul Walmsley; +Cc: Hilman, Kevin, linux-omap@vger.kernel.org
I knew you will answer that one :-)
On 3/22/2011 11:08 PM, Paul Walmsley wrote:
> Hi Benoît,
>
> On Tue, 22 Mar 2011, Cousson, Benoit wrote:
>
>> On the other hand not every clock belong to a clockdomain, that's why we
>> have clock without clockdomain on OMAP. A clockdomain is a just group of
>> IPs that share the same interface clock.
>
> PRCM clockdomains also include functional clocks. See for example the
> OMAP4 Public TRM Rev. O Section 3.1.1.1.3 "Clock Domain" ('The clockdomain
> of CM_B is composed of two clocks: a functional clock (FCLK2) and an
> interface clock (ICLK1)', and also later, 'The PRCM module lets software
> check the status of the clock domain functional clocks').
True, but that does not change the definition of the clock domain (same
paragraph):
"A clock domain is a group of modules fed by clock signals controlled by
the same clock manager in the PRCM module (see Figure 3-2)."
My point was that a clock domain is related to modules that share some
clocks.
So yes, a clock domain will contains modules and their related iclk and
fclk. But that does not means that every clocks will belong to a
clockdomain.
All the non leaf clocks will not have any clock domain since they will
not be attached to any module directly.
> Both the TRM and the OMAP4 functional specification clearly link PRCM
> clockdomain idle management to the state of the clockdomain's functional
> clocks. See for example OMAP4 Public TRM Rev. O Table 3-11 "Clock Domain
> Clock States" ('INACTIVE: ... Every optional functional clock in the clock
> domain is gated.')
That just means that each clock that supplies a module must be idled in
order to allow the clock domain to transition.
The clock domain FSM is using both iclk and fclk state to trigger the
domain transition, but that same clock could be used in another clock
domain too.
> Beyond the PRCM, the Linux-OMAP clockdomain code is not only concerned
> with PRCM-controllable clockdomains. It is intended to be a generically
> useful way to connect clocks to the powerdomain and voltagedomain that the
> clock exists in, even if there are no explicit PRCM registers associated
> with the clockdomain. These "powerdomains" and "voltagedomains" also may
> not be directly PRCM controllable.
In that case, you cannot call that clockdomain anymore since this is not
the proper definition used by the PRCM. If you do not have a module, you
cannot have a clockdomain.
OMAP4 partitioning is following this hierarchy: module < clockdomain <
powerdomain < voltagedomain < device.
The clocks are not part of the hierarchy and for a good reason, the can
be shared across the whole device.
> Every clock that is in the Linux-OMAP clock tree should have a clockdomain
> associated with it.
Mmm... What domain will you use for sys_clk or 32k_clk? or for any DPLL
or HS divider?
And what for?
I know that the clockdomain name is confusing, but why do you want to
change its definition?
Benoit
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register
2011-03-22 23:04 ` Cousson, Benoit
@ 2011-04-02 1:17 ` Paul Walmsley
0 siblings, 0 replies; 33+ messages in thread
From: Paul Walmsley @ 2011-04-02 1:17 UTC (permalink / raw)
To: Cousson, Benoit; +Cc: Hilman, Kevin, linux-omap@vger.kernel.org
On Wed, 23 Mar 2011, Cousson, Benoit wrote:
> On 3/22/2011 11:08 PM, Paul Walmsley wrote:
> > On Tue, 22 Mar 2011, Cousson, Benoit wrote:
> >
> > > On the other hand not every clock belong to a clockdomain, that's why we
> > > have clock without clockdomain on OMAP. A clockdomain is a just group of
> > > IPs that share the same interface clock.
> >
> > PRCM clockdomains also include functional clocks. See for example the
> > OMAP4 Public TRM Rev. O Section 3.1.1.1.3 "Clock Domain" ('The clockdomain
> > of CM_B is composed of two clocks: a functional clock (FCLK2) and an
> > interface clock (ICLK1)', and also later, 'The PRCM module lets software
> > check the status of the clock domain functional clocks').
>
> True, but that does not change the definition of the clock domain (same
> paragraph):
> "A clock domain is a group of modules fed by clock signals controlled by the
> same clock manager in the PRCM module (see Figure 3-2)."
>
> My point was that a clock domain is related to modules that share some clocks.
> So yes, a clock domain will contains modules and their related iclk and fclk.
> But that does not means that every clocks will belong to a clockdomain.
> All the non leaf clocks will not have any clock domain since they will not be
> attached to any module directly.
In the OMAP Linux code, we use clockdomains for three purposes:
1. as a way to control the PRCM clockdomain hardware
2. as a way to associate clocks with powerdomains
3. as a way to group clocks that have similar idle behavior
So yes. All non-leaf clocks should be associated with OMAP Linux
clockdomains also, since those clocks will be associated with powerdomains
and also will be grouped by idle behavior.
> > Both the TRM and the OMAP4 functional specification clearly link PRCM
> > clockdomain idle management to the state of the clockdomain's functional
> > clocks. See for example OMAP4 Public TRM Rev. O Table 3-11 "Clock Domain
> > Clock States" ('INACTIVE: ... Every optional functional clock in the clock
> > domain is gated.')
>
> That just means that each clock that supplies a module must be idled in order
> to allow the clock domain to transition.
> The clock domain FSM is using both iclk and fclk state to trigger the domain
> transition, but that same clock could be used in another clock domain too.
When the same clock is used in another clockdomain, another struct clk is
created for that clock with a different clockdomain. We already have this
situation with OMAP3's 54MHz clock, for example.
> > Beyond the PRCM, the Linux-OMAP clockdomain code is not only concerned
> > with PRCM-controllable clockdomains. It is intended to be a generically
> > useful way to connect clocks to the powerdomain and voltagedomain that the
> > clock exists in, even if there are no explicit PRCM registers associated
> > with the clockdomain. These "powerdomains" and "voltagedomains" also may
> > not be directly PRCM controllable.
>
> In that case, you cannot call that clockdomain anymore since this is not the
> proper definition used by the PRCM. If you do not have a module, you cannot
> have a clockdomain.
That may be the way that TI considers it in the AutoPRCM data or the
system PRCM, but the OMAP Linux clockdomain code uses a superset
definition and has done so for a few years now.
> OMAP4 partitioning is following this hierarchy: module < clockdomain <
> powerdomain < voltagedomain < device. The clocks are not part of the
> hierarchy and for a good reason, the can be shared across the whole
> device.
As mentioned before, each instance of a clock in a different clockdomain
should have a different struct clk associated with it.
> > Every clock that is in the Linux-OMAP clock tree should have a clockdomain
> > associated with it.
>
> Mmm... What domain will you use for sys_clk
sys_clk and related clocks should go into a sys_clkdm or hf_sys_clkdm
> or 32k_clk?
The external 32KiHZ oscillator should be associated with wkup_clkdm.
> or for any DPLL or HS divider?
Those go into separate DPLL clockdomains. This is already there in OMAP3.
> And what for?
2. as a way to associate clocks with powerdomains
3. as a way to group clocks that have similar idle behavior
Also, the original idea was to put autoidle control for the DPLLs and the
external HF clock LDO into the clockdomain layer, since it already had a
convenient concept for hardware automatic idle, vs. software controlled
idle. That part may not be needed any longer, now that we've added
autoidle support back into the clock code.
> I know that the clockdomain name is confusing, but why do you want to change
> its definition?
- Paul
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register
2011-03-22 19:23 ` Paul Walmsley
2011-03-22 20:59 ` Cousson, Benoit
@ 2011-03-23 0:17 ` Kevin Hilman
1 sibling, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-23 0:17 UTC (permalink / raw)
To: Paul Walmsley; +Cc: linux-omap, Benoit Cousson
Paul Walmsley <paul@pwsan.com> writes:
> Hi Kevin,
>
> a couple of comments, now that i have the chance to look this over
> closely.
>
> Probably we should require every powerdomain to have a voltagedomain.
> This will avoid the problems we're having with the clocks, in which not
> every clock has a clockdomain pointer.
>
> So I'd suggest splitting this patch up into two patches -- one to make the
> changes the powerdomain structure, and the second to add the code into the
> powerdomain.c. Between these two patches, we'd need patches to the
> powerdomain data to add the voltagedomain names in.
OK, Benoit and I talked earlier today and agreed on this as well. He
has already generated the OMAP4 data as well, so split up, and drop the
checks below as you suggest.
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 5/7] OMAP2+: voltage: keep track of powerdomains in each voltagedomain
2011-03-19 0:18 [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
` (3 preceding siblings ...)
2011-03-19 0:18 ` [PATCH 4/7] OMAP2+: powerdomain: add voltage domain lookup during register Kevin Hilman
@ 2011-03-19 0:18 ` Kevin Hilman
2011-03-22 19:35 ` Paul Walmsley
2011-03-19 0:18 ` [PATCH 6/7] OMAP2+: voltage: move prm_irqst_reg from VP into voltage domain Kevin Hilman
` (2 subsequent siblings)
7 siblings, 1 reply; 33+ messages in thread
From: Kevin Hilman @ 2011-03-19 0:18 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Walmsely, Benoit Cousson
When a powerdomain is registered and it has an associated voltage domain,
add the powerdomain to the voltagedomain using voltdm_add_pwrdm().
Modeled after a similar relationship between clockdomains and powerdomains.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
arch/arm/mach-omap2/powerdomain.c | 1 +
arch/arm/mach-omap2/voltage.c | 77 +++++++++++++++++++++++++++++++++++++
arch/arm/mach-omap2/voltage.h | 11 +++++
3 files changed, 89 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index da86c72..2f16b43 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -103,6 +103,7 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
return -EINVAL;
}
pwrdm->voltdm.ptr = voltdm;
+ voltdm_add_pwrdm(voltdm, pwrdm);
}
list_add(&pwrdm->node, &pwrdm_list);
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 1dc6967..c25df81 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -36,6 +36,7 @@
#include "control.h"
#include "voltage.h"
+#include "powerdomain.h"
#include "vc.h"
#include "vp.h"
@@ -1081,6 +1082,82 @@ static struct voltagedomain *_voltdm_lookup(const char *name)
return voltdm;
}
+/**
+ * voltdm_add_pwrdm - add a powerdomain to a voltagedomain
+ * @voltdm: struct voltagedomain * to add the powerdomain to
+ * @pwrdm: struct powerdomain * to associate with a voltagedomain
+ *
+ * Associate the powerdomain @pwrdm with a voltagedomain @voltdm. This
+ * enables the use of voltdm_for_each_pwrdm(). Returns -EINVAL if
+ * presented with invalid pointers; -ENOMEM if memory could not be allocated;
+ * or 0 upon success.
+ */
+int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
+{
+ int i;
+ int ret = -EINVAL;
+
+ if (!voltdm || !pwrdm)
+ return -EINVAL;
+
+ pr_debug("voltagedomain: associating powerdomain %s with voltagedomain "
+ "%s\n", pwrdm->name, voltdm->name);
+
+ for (i = 0; i < VOLTDM_MAX_PWRDMS; i++) {
+ if (!voltdm->voltdm_pwrdms[i])
+ break;
+#ifdef DEBUG
+ if (voltdm->voltdm_pwrdms[i] == pwrdm) {
+ ret = -EINVAL;
+ goto vap_exit;
+ }
+#endif
+ }
+
+ if (i == VOLTDM_MAX_PWRDMS) {
+ pr_debug("voltagedomain: increase VOLTDM_MAX_PWRDMS for "
+ "voltdm %s pwrdm %s\n", voltdm->name, pwrdm->name);
+ WARN_ON(1);
+ ret = -ENOMEM;
+ goto vap_exit;
+ }
+
+ voltdm->voltdm_pwrdms[i] = pwrdm;
+
+ ret = 0;
+
+vap_exit:
+ return ret;
+}
+
+/**
+ * voltdm_for_each_pwrdm - call function on each pwrdm in a voltdm
+ * @voltdm: struct voltagedomain * to iterate over
+ * @fn: callback function *
+ *
+ * Call the supplied function @fn for each powerdomain in the voltagedomain
+ * @voltdm. The callback function can return anything but 0 to bail
+ * out early from the iterator. Returns -EINVAL if presented with
+ * invalid pointers; or passes along the last return value of the
+ * callback function, which should be 0 for success or anything else
+ * to indicate failure.
+ */
+int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
+ int (*fn)(struct voltagedomain *voltdm,
+ struct powerdomain *pwrdm))
+{
+ int ret = 0;
+ int i;
+
+ if (!fn)
+ return -EINVAL;
+
+ for (i = 0; i < VOLTDM_MAX_PWRDMS && !ret; i++)
+ ret = (*fn)(voltdm, voltdm->voltdm_pwrdms[i]);
+
+ return ret;
+}
+
static int _voltdm_register(struct voltagedomain *voltdm)
{
if (!voltdm || !voltdm->name)
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 13e5ed9..8e25126 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -19,6 +19,11 @@
#include "vc.h"
#include "vp.h"
+/*
+ * Maximum number of powerdomains that can be associated with a voltagedomain.
+ */
+#define VOLTDM_MAX_PWRDMS 10
+
/* XXX document */
#define VOLTSCALE_VPFORCEUPDATE 1
#define VOLTSCALE_VCBYPASS 2
@@ -55,11 +60,14 @@ struct omap_vfsm_instance_data {
* @name: Name of the voltage domain which can be used as a unique identifier.
* @node: list_head linking all voltage domains
* @vdd: to be removed
+ * @voltdm_pwrdms: powerdomains in this voltagedomain
*/
struct voltagedomain {
char *name;
struct list_head node;
struct omap_vdd_info *vdd;
+
+ struct powerdomain *voltdm_pwrdms[VOLTDM_MAX_PWRDMS];
};
/**
@@ -183,4 +191,7 @@ extern void omap44xx_voltagedomains_init(void);
struct voltagedomain *voltdm_lookup(const char *name);
void voltdm_init(struct voltagedomain **voltdm_list);
int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
+int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
+ int (*fn)(struct voltagedomain *voltdm,
+ struct powerdomain *pwrdm));
#endif
--
1.7.4
^ permalink raw reply related [flat|nested] 33+ messages in thread* Re: [PATCH 5/7] OMAP2+: voltage: keep track of powerdomains in each voltagedomain
2011-03-19 0:18 ` [PATCH 5/7] OMAP2+: voltage: keep track of powerdomains in each voltagedomain Kevin Hilman
@ 2011-03-22 19:35 ` Paul Walmsley
2011-03-23 0:18 ` Kevin Hilman
0 siblings, 1 reply; 33+ messages in thread
From: Paul Walmsley @ 2011-03-22 19:35 UTC (permalink / raw)
To: Kevin Hilman; +Cc: linux-omap, Benoit Cousson
Hi Kevin,
a couple of comments,
On Fri, 18 Mar 2011, Kevin Hilman wrote:
> When a powerdomain is registered and it has an associated voltage domain,
> add the powerdomain to the voltagedomain using voltdm_add_pwrdm().
>
> Modeled after a similar relationship between clockdomains and powerdomains.
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
> ---
> arch/arm/mach-omap2/powerdomain.c | 1 +
> arch/arm/mach-omap2/voltage.c | 77 +++++++++++++++++++++++++++++++++++++
> arch/arm/mach-omap2/voltage.h | 11 +++++
> 3 files changed, 89 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
> index da86c72..2f16b43 100644
> --- a/arch/arm/mach-omap2/powerdomain.c
> +++ b/arch/arm/mach-omap2/powerdomain.c
> @@ -103,6 +103,7 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
> return -EINVAL;
> }
> pwrdm->voltdm.ptr = voltdm;
> + voltdm_add_pwrdm(voltdm, pwrdm);
> }
>
> list_add(&pwrdm->node, &pwrdm_list);
> diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
> index 1dc6967..c25df81 100644
> --- a/arch/arm/mach-omap2/voltage.c
> +++ b/arch/arm/mach-omap2/voltage.c
> @@ -36,6 +36,7 @@
> #include "control.h"
>
> #include "voltage.h"
> +#include "powerdomain.h"
>
> #include "vc.h"
> #include "vp.h"
> @@ -1081,6 +1082,82 @@ static struct voltagedomain *_voltdm_lookup(const char *name)
> return voltdm;
> }
>
> +/**
> + * voltdm_add_pwrdm - add a powerdomain to a voltagedomain
> + * @voltdm: struct voltagedomain * to add the powerdomain to
> + * @pwrdm: struct powerdomain * to associate with a voltagedomain
> + *
> + * Associate the powerdomain @pwrdm with a voltagedomain @voltdm. This
> + * enables the use of voltdm_for_each_pwrdm(). Returns -EINVAL if
> + * presented with invalid pointers; -ENOMEM if memory could not be allocated;
> + * or 0 upon success.
> + */
> +int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
> +{
> + int i;
> + int ret = -EINVAL;
> +
> + if (!voltdm || !pwrdm)
> + return -EINVAL;
> +
> + pr_debug("voltagedomain: associating powerdomain %s with voltagedomain "
> + "%s\n", pwrdm->name, voltdm->name);
> +
> + for (i = 0; i < VOLTDM_MAX_PWRDMS; i++) {
> + if (!voltdm->voltdm_pwrdms[i])
> + break;
> +#ifdef DEBUG
> + if (voltdm->voltdm_pwrdms[i] == pwrdm) {
> + ret = -EINVAL;
> + goto vap_exit;
> + }
> +#endif
> + }
> +
> + if (i == VOLTDM_MAX_PWRDMS) {
> + pr_debug("voltagedomain: increase VOLTDM_MAX_PWRDMS for "
> + "voltdm %s pwrdm %s\n", voltdm->name, pwrdm->name);
> + WARN_ON(1);
> + ret = -ENOMEM;
> + goto vap_exit;
> + }
> +
> + voltdm->voltdm_pwrdms[i] = pwrdm;
> +
> + ret = 0;
> +
> +vap_exit:
> + return ret;
> +}
> +
> +/**
> + * voltdm_for_each_pwrdm - call function on each pwrdm in a voltdm
> + * @voltdm: struct voltagedomain * to iterate over
> + * @fn: callback function *
> + *
> + * Call the supplied function @fn for each powerdomain in the voltagedomain
> + * @voltdm. The callback function can return anything but 0 to bail
> + * out early from the iterator. Returns -EINVAL if presented with
> + * invalid pointers; or passes along the last return value of the
> + * callback function, which should be 0 for success or anything else
> + * to indicate failure.
> + */
> +int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
> + int (*fn)(struct voltagedomain *voltdm,
> + struct powerdomain *pwrdm))
> +{
> + int ret = 0;
> + int i;
> +
> + if (!fn)
> + return -EINVAL;
> +
> + for (i = 0; i < VOLTDM_MAX_PWRDMS && !ret; i++)
> + ret = (*fn)(voltdm, voltdm->voltdm_pwrdms[i]);
> +
> + return ret;
> +}
> +
> static int _voltdm_register(struct voltagedomain *voltdm)
> {
> if (!voltdm || !voltdm->name)
> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
> index 13e5ed9..8e25126 100644
> --- a/arch/arm/mach-omap2/voltage.h
> +++ b/arch/arm/mach-omap2/voltage.h
> @@ -19,6 +19,11 @@
> #include "vc.h"
> #include "vp.h"
>
> +/*
> + * Maximum number of powerdomains that can be associated with a voltagedomain.
> + */
> +#define VOLTDM_MAX_PWRDMS 10
Since there are so many, I'd suggest using a list instead...
> +
> /* XXX document */
> #define VOLTSCALE_VPFORCEUPDATE 1
> #define VOLTSCALE_VCBYPASS 2
> @@ -55,11 +60,14 @@ struct omap_vfsm_instance_data {
> * @name: Name of the voltage domain which can be used as a unique identifier.
> * @node: list_head linking all voltage domains
> * @vdd: to be removed
> + * @voltdm_pwrdms: powerdomains in this voltagedomain
> */
> struct voltagedomain {
> char *name;
> struct list_head node;
> struct omap_vdd_info *vdd;
> +
> + struct powerdomain *voltdm_pwrdms[VOLTDM_MAX_PWRDMS];
... and just a minor nit in naming, I don't think the "voltdm_" part of
the name is necessary, it seems redundant to me. (And yes, I do think the
"pwrdm_" is redundant in the struct powerdomain too ;-)
> };
>
> /**
> @@ -183,4 +191,7 @@ extern void omap44xx_voltagedomains_init(void);
> struct voltagedomain *voltdm_lookup(const char *name);
> void voltdm_init(struct voltagedomain **voltdm_list);
> int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
> +int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
> + int (*fn)(struct voltagedomain *voltdm,
> + struct powerdomain *pwrdm));
> #endif
> --
> 1.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
- Paul
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 5/7] OMAP2+: voltage: keep track of powerdomains in each voltagedomain
2011-03-22 19:35 ` Paul Walmsley
@ 2011-03-23 0:18 ` Kevin Hilman
0 siblings, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-23 0:18 UTC (permalink / raw)
To: Paul Walmsley; +Cc: linux-omap, Benoit Cousson
Paul Walmsley <paul@pwsan.com> writes:
> Hi Kevin,
>
> a couple of comments,
>
> On Fri, 18 Mar 2011, Kevin Hilman wrote:
>
>> When a powerdomain is registered and it has an associated voltage domain,
>> add the powerdomain to the voltagedomain using voltdm_add_pwrdm().
>>
>> Modeled after a similar relationship between clockdomains and powerdomains.
>>
>> Signed-off-by: Kevin Hilman <khilman@ti.com>
>> ---
>> arch/arm/mach-omap2/powerdomain.c | 1 +
>> arch/arm/mach-omap2/voltage.c | 77 +++++++++++++++++++++++++++++++++++++
>> arch/arm/mach-omap2/voltage.h | 11 +++++
>> 3 files changed, 89 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
>> index da86c72..2f16b43 100644
>> --- a/arch/arm/mach-omap2/powerdomain.c
>> +++ b/arch/arm/mach-omap2/powerdomain.c
>> @@ -103,6 +103,7 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
>> return -EINVAL;
>> }
>> pwrdm->voltdm.ptr = voltdm;
>> + voltdm_add_pwrdm(voltdm, pwrdm);
>> }
>>
>> list_add(&pwrdm->node, &pwrdm_list);
>> diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
>> index 1dc6967..c25df81 100644
>> --- a/arch/arm/mach-omap2/voltage.c
>> +++ b/arch/arm/mach-omap2/voltage.c
>> @@ -36,6 +36,7 @@
>> #include "control.h"
>>
>> #include "voltage.h"
>> +#include "powerdomain.h"
>>
>> #include "vc.h"
>> #include "vp.h"
>> @@ -1081,6 +1082,82 @@ static struct voltagedomain *_voltdm_lookup(const char *name)
>> return voltdm;
>> }
>>
>> +/**
>> + * voltdm_add_pwrdm - add a powerdomain to a voltagedomain
>> + * @voltdm: struct voltagedomain * to add the powerdomain to
>> + * @pwrdm: struct powerdomain * to associate with a voltagedomain
>> + *
>> + * Associate the powerdomain @pwrdm with a voltagedomain @voltdm. This
>> + * enables the use of voltdm_for_each_pwrdm(). Returns -EINVAL if
>> + * presented with invalid pointers; -ENOMEM if memory could not be allocated;
>> + * or 0 upon success.
>> + */
>> +int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
>> +{
>> + int i;
>> + int ret = -EINVAL;
>> +
>> + if (!voltdm || !pwrdm)
>> + return -EINVAL;
>> +
>> + pr_debug("voltagedomain: associating powerdomain %s with voltagedomain "
>> + "%s\n", pwrdm->name, voltdm->name);
>> +
>> + for (i = 0; i < VOLTDM_MAX_PWRDMS; i++) {
>> + if (!voltdm->voltdm_pwrdms[i])
>> + break;
>> +#ifdef DEBUG
>> + if (voltdm->voltdm_pwrdms[i] == pwrdm) {
>> + ret = -EINVAL;
>> + goto vap_exit;
>> + }
>> +#endif
>> + }
>> +
>> + if (i == VOLTDM_MAX_PWRDMS) {
>> + pr_debug("voltagedomain: increase VOLTDM_MAX_PWRDMS for "
>> + "voltdm %s pwrdm %s\n", voltdm->name, pwrdm->name);
>> + WARN_ON(1);
>> + ret = -ENOMEM;
>> + goto vap_exit;
>> + }
>> +
>> + voltdm->voltdm_pwrdms[i] = pwrdm;
>> +
>> + ret = 0;
>> +
>> +vap_exit:
>> + return ret;
>> +}
>> +
>> +/**
>> + * voltdm_for_each_pwrdm - call function on each pwrdm in a voltdm
>> + * @voltdm: struct voltagedomain * to iterate over
>> + * @fn: callback function *
>> + *
>> + * Call the supplied function @fn for each powerdomain in the voltagedomain
>> + * @voltdm. The callback function can return anything but 0 to bail
>> + * out early from the iterator. Returns -EINVAL if presented with
>> + * invalid pointers; or passes along the last return value of the
>> + * callback function, which should be 0 for success or anything else
>> + * to indicate failure.
>> + */
>> +int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
>> + int (*fn)(struct voltagedomain *voltdm,
>> + struct powerdomain *pwrdm))
>> +{
>> + int ret = 0;
>> + int i;
>> +
>> + if (!fn)
>> + return -EINVAL;
>> +
>> + for (i = 0; i < VOLTDM_MAX_PWRDMS && !ret; i++)
>> + ret = (*fn)(voltdm, voltdm->voltdm_pwrdms[i]);
>> +
>> + return ret;
>> +}
>> +
>> static int _voltdm_register(struct voltagedomain *voltdm)
>> {
>> if (!voltdm || !voltdm->name)
>> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
>> index 13e5ed9..8e25126 100644
>> --- a/arch/arm/mach-omap2/voltage.h
>> +++ b/arch/arm/mach-omap2/voltage.h
>> @@ -19,6 +19,11 @@
>> #include "vc.h"
>> #include "vp.h"
>>
>> +/*
>> + * Maximum number of powerdomains that can be associated with a voltagedomain.
>> + */
>> +#define VOLTDM_MAX_PWRDMS 10
>
> Since there are so many, I'd suggest using a list instead...
>
Agreed, I thought the same when I copy-paste'd from pwrdm code.
Will rework.
>> +
>> /* XXX document */
>> #define VOLTSCALE_VPFORCEUPDATE 1
>> #define VOLTSCALE_VCBYPASS 2
>> @@ -55,11 +60,14 @@ struct omap_vfsm_instance_data {
>> * @name: Name of the voltage domain which can be used as a unique identifier.
>> * @node: list_head linking all voltage domains
>> * @vdd: to be removed
>> + * @voltdm_pwrdms: powerdomains in this voltagedomain
>> */
>> struct voltagedomain {
>> char *name;
>> struct list_head node;
>> struct omap_vdd_info *vdd;
>> +
>> + struct powerdomain *voltdm_pwrdms[VOLTDM_MAX_PWRDMS];
>
> ... and just a minor nit in naming, I don't think the "voltdm_" part of
> the name is necessary, it seems redundant to me.
Agreed.
> (And yes, I do think the "pwrdm_" is redundant in the struct
> powerdomain too ;-)
:)
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 6/7] OMAP2+: voltage: move prm_irqst_reg from VP into voltage domain
2011-03-19 0:18 [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
` (4 preceding siblings ...)
2011-03-19 0:18 ` [PATCH 5/7] OMAP2+: voltage: keep track of powerdomains in each voltagedomain Kevin Hilman
@ 2011-03-19 0:18 ` Kevin Hilman
2011-03-19 0:18 ` [PATCH 7/7] OMAP3: powerdomain data: add voltage domains Kevin Hilman
2011-03-23 0:31 ` [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
7 siblings, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-19 0:18 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Walmsely, Benoit Cousson
The prm_irqst_reg is not part of the VP. Move it up into the common
voltage domain struct.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
arch/arm/mach-omap2/voltage.c | 15 +++++++--------
arch/arm/mach-omap2/voltage.h | 1 +
arch/arm/mach-omap2/voltagedomains3xxx_data.c | 2 ++
arch/arm/mach-omap2/voltagedomains44xx_data.c | 3 +++
arch/arm/mach-omap2/vp.h | 3 ---
arch/arm/mach-omap2/vp3xxx_data.c | 2 --
arch/arm/mach-omap2/vp44xx_data.c | 3 ---
7 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index c25df81..89b8e38 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -429,23 +429,21 @@ static int vp_forceupdate_scale_voltage(struct voltagedomain *voltdm,
{
struct omap_vdd_info *vdd = voltdm->vdd;
u32 vpconfig;
- u8 target_vsel, current_vsel, prm_irqst_reg;
+ u8 target_vsel, current_vsel;
int ret, timeout = 0;
ret = _pre_volt_scale(voltdm, target_volt, &target_vsel, ¤t_vsel);
if (ret)
return ret;
- prm_irqst_reg = vdd->vp_data->prm_irqst_data->prm_irqst_reg;
-
/*
* Clear all pending TransactionDone interrupt/status. Typical latency
* is <3us
*/
while (timeout++ < VP_TRANXDONE_TIMEOUT) {
vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
- vdd->prm_irqst_mod, prm_irqst_reg);
- if (!(vdd->read_reg(vdd->prm_irqst_mod, prm_irqst_reg) &
+ vdd->prm_irqst_mod, vdd->prm_irqst_reg);
+ if (!(vdd->read_reg(vdd->prm_irqst_mod, vdd->prm_irqst_reg) &
vdd->vp_data->prm_irqst_data->tranxdone_status))
break;
udelay(1);
@@ -478,7 +476,8 @@ static int vp_forceupdate_scale_voltage(struct voltagedomain *voltdm,
* Depends on SMPSWAITTIMEMIN/MAX and voltage change
*/
timeout = 0;
- omap_test_timeout((vdd->read_reg(vdd->prm_irqst_mod, prm_irqst_reg) &
+ omap_test_timeout((vdd->read_reg(vdd->prm_irqst_mod,
+ vdd->prm_irqst_reg) &
vdd->vp_data->prm_irqst_data->tranxdone_status),
VP_TRANXDONE_TIMEOUT, timeout);
if (timeout >= VP_TRANXDONE_TIMEOUT)
@@ -495,8 +494,8 @@ static int vp_forceupdate_scale_voltage(struct voltagedomain *voltdm,
timeout = 0;
while (timeout++ < VP_TRANXDONE_TIMEOUT) {
vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
- vdd->prm_irqst_mod, prm_irqst_reg);
- if (!(vdd->read_reg(vdd->prm_irqst_mod, prm_irqst_reg) &
+ vdd->prm_irqst_mod, vdd->prm_irqst_reg);
+ if (!(vdd->read_reg(vdd->prm_irqst_mod, vdd->prm_irqst_reg) &
vdd->vp_data->prm_irqst_data->tranxdone_status))
break;
udelay(1);
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 8e25126..f805478 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -147,6 +147,7 @@ struct omap_vdd_info {
s16 prm_mod;
s16 prm_irqst_mod;
+ u8 prm_irqst_reg;
u32 (*read_reg) (u16 mod, u8 offset);
void (*write_reg) (u32 val, u16 mod, u8 offset);
int (*volt_scale) (struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index bd60468..80c2e95 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -40,6 +40,7 @@ static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = {
static struct omap_vdd_info omap3_vdd1_info = {
.prm_mod = OMAP3430_GR_MOD,
.prm_irqst_mod = OCP_MOD,
+ .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
.vp_data = &omap3_vp1_data,
.vc_data = &omap3_vc1_data,
.vfsm = &omap3_vdd1_vfsm_data,
@@ -54,6 +55,7 @@ static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
static struct omap_vdd_info omap3_vdd2_info = {
.prm_mod = OMAP3430_GR_MOD,
.prm_irqst_mod = OCP_MOD,
+ .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
.vp_data = &omap3_vp2_data,
.vc_data = &omap3_vc2_data,
.vfsm = &omap3_vdd2_vfsm_data,
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index a13fbb7..bb3dc61 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -39,6 +39,7 @@ static const struct omap_vfsm_instance_data omap4_vdd_mpu_vfsm_data = {
static struct omap_vdd_info omap4_vdd_mpu_info = {
.prm_mod = OMAP4430_PRM_DEVICE_INST,
.prm_irqst_mod = OMAP4430_PRM_OCP_SOCKET_INST,
+ .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
.vp_data = &omap4_vp_mpu_data,
.vc_data = &omap4_vc_mpu_data,
.vfsm = &omap4_vdd_mpu_vfsm_data,
@@ -51,6 +52,7 @@ static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = {
static struct omap_vdd_info omap4_vdd_iva_info = {
.prm_mod = OMAP4430_PRM_DEVICE_INST,
.prm_irqst_mod = OMAP4430_PRM_OCP_SOCKET_INST,
+ .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
.vp_data = &omap4_vp_iva_data,
.vc_data = &omap4_vc_iva_data,
.vfsm = &omap4_vdd_iva_vfsm_data,
@@ -63,6 +65,7 @@ static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = {
static struct omap_vdd_info omap4_vdd_core_info = {
.prm_mod = OMAP4430_PRM_DEVICE_INST,
.prm_irqst_mod = OMAP4430_PRM_OCP_SOCKET_INST,
+ .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
.vp_data = &omap4_vp_core_data,
.vc_data = &omap4_vc_core_data,
.vfsm = &omap4_vdd_core_vfsm_data,
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
index 7ce134f..77fb634 100644
--- a/arch/arm/mach-omap2/vp.h
+++ b/arch/arm/mach-omap2/vp.h
@@ -68,16 +68,13 @@ struct omap_vp_common_data {
/**
* struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
- * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM
* @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
*
- * XXX prm_irqst_reg does not belong here
* XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
* hardware bug
* XXX This structure is probably not needed
*/
struct omap_vp_prm_irqst_data {
- u8 prm_irqst_reg;
u32 tranxdone_status;
};
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c
index 6452170..d05eff8 100644
--- a/arch/arm/mach-omap2/vp3xxx_data.c
+++ b/arch/arm/mach-omap2/vp3xxx_data.c
@@ -50,7 +50,6 @@ static const struct omap_vp_common_data omap3_vp_common = {
};
static const struct omap_vp_prm_irqst_data omap3_vp1_prm_irqst_data = {
- .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
.tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
};
@@ -66,7 +65,6 @@ struct omap_vp_instance_data omap3_vp1_data = {
};
static const struct omap_vp_prm_irqst_data omap3_vp2_prm_irqst_data = {
- .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
.tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
};
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c
index 65d1ad6..86221c8 100644
--- a/arch/arm/mach-omap2/vp44xx_data.c
+++ b/arch/arm/mach-omap2/vp44xx_data.c
@@ -51,7 +51,6 @@ static const struct omap_vp_common_data omap4_vp_common = {
};
static const struct omap_vp_prm_irqst_data omap4_vp_mpu_prm_irqst_data = {
- .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
.tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK,
};
@@ -67,7 +66,6 @@ struct omap_vp_instance_data omap4_vp_mpu_data = {
};
static const struct omap_vp_prm_irqst_data omap4_vp_iva_prm_irqst_data = {
- .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
.tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK,
};
@@ -83,7 +81,6 @@ struct omap_vp_instance_data omap4_vp_iva_data = {
};
static const struct omap_vp_prm_irqst_data omap4_vp_core_prm_irqst_data = {
- .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
.tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
};
--
1.7.4
^ permalink raw reply related [flat|nested] 33+ messages in thread* [PATCH 7/7] OMAP3: powerdomain data: add voltage domains
2011-03-19 0:18 [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
` (5 preceding siblings ...)
2011-03-19 0:18 ` [PATCH 6/7] OMAP2+: voltage: move prm_irqst_reg from VP into voltage domain Kevin Hilman
@ 2011-03-19 0:18 ` Kevin Hilman
2011-03-22 19:30 ` Paul Walmsley
2011-03-23 0:31 ` [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
7 siblings, 1 reply; 33+ messages in thread
From: Kevin Hilman @ 2011-03-19 0:18 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Walmsely, Benoit Cousson
Add voltage domain name to indicate which voltagedomain each
powerdomain is in. A missing voltage domain name means that that
powerdomain is not in one of the currently scalable voltage domains.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
arch/arm/mach-omap2/powerdomains3xxx_data.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c
index 9c9c113..bd01025 100644
--- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
@@ -52,6 +52,7 @@ static struct powerdomain iva2_pwrdm = {
[2] = PWRSTS_OFF_ON,
[3] = PWRSTS_ON,
},
+ .voltdm = { .name = "mpu" },
};
static struct powerdomain mpu_3xxx_pwrdm = {
@@ -68,6 +69,7 @@ static struct powerdomain mpu_3xxx_pwrdm = {
.pwrsts_mem_on = {
[0] = PWRSTS_OFF_ON,
},
+ .voltdm = { .name = "mpu" },
};
/*
@@ -98,6 +100,7 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
[0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
[1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
},
+ .voltdm = { .name = "core" },
};
static struct powerdomain core_3xxx_es3_1_pwrdm = {
@@ -121,6 +124,7 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = {
[0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
[1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
},
+ .voltdm = { .name = "core" },
};
static struct powerdomain dss_pwrdm = {
@@ -157,6 +161,7 @@ static struct powerdomain sgx_pwrdm = {
.pwrsts_mem_on = {
[0] = PWRSTS_ON, /* MEMONSTATE */
},
+ .voltdm = { .name = "core" },
};
static struct powerdomain cam_pwrdm = {
@@ -172,6 +177,7 @@ static struct powerdomain cam_pwrdm = {
.pwrsts_mem_on = {
[0] = PWRSTS_ON, /* MEMONSTATE */
},
+ .voltdm = { .name = "core" },
};
static struct powerdomain per_pwrdm = {
@@ -187,12 +193,14 @@ static struct powerdomain per_pwrdm = {
.pwrsts_mem_on = {
[0] = PWRSTS_ON, /* MEMONSTATE */
},
+ .voltdm = { .name = "core" },
};
static struct powerdomain emu_pwrdm = {
.name = "emu_pwrdm",
.prcm_offs = OMAP3430_EMU_MOD,
.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+ .voltdm = { .name = "core" },
};
static struct powerdomain neon_pwrdm = {
@@ -201,6 +209,7 @@ static struct powerdomain neon_pwrdm = {
.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
.pwrsts = PWRSTS_OFF_RET_ON,
.pwrsts_logic_ret = PWRSTS_RET,
+ .voltdm = { .name = "core" },
};
static struct powerdomain usbhost_pwrdm = {
@@ -223,6 +232,7 @@ static struct powerdomain usbhost_pwrdm = {
.pwrsts_mem_on = {
[0] = PWRSTS_ON, /* MEMONSTATE */
},
+ .voltdm = { .name = "core" },
};
static struct powerdomain dpll1_pwrdm = {
--
1.7.4
^ permalink raw reply related [flat|nested] 33+ messages in thread* Re: [PATCH 7/7] OMAP3: powerdomain data: add voltage domains
2011-03-19 0:18 ` [PATCH 7/7] OMAP3: powerdomain data: add voltage domains Kevin Hilman
@ 2011-03-22 19:30 ` Paul Walmsley
2011-03-22 21:09 ` Cousson, Benoit
0 siblings, 1 reply; 33+ messages in thread
From: Paul Walmsley @ 2011-03-22 19:30 UTC (permalink / raw)
To: Kevin Hilman; +Cc: linux-omap, Benoit Cousson
Hi Kevin,
a couple of comments below..
On Fri, 18 Mar 2011, Kevin Hilman wrote:
> Add voltage domain name to indicate which voltagedomain each
> powerdomain is in. A missing voltage domain name means that that
> powerdomain is not in one of the currently scalable voltage domains.
Before you add these, you might want to change the voltagedomain names for
OMAP3. I don't think it's correct to refer to the VDD1 voltagedomain as
"mpu" since it includes both the MPU and IVA. Probably best to use simply
"vdd1" and "vdd2" since that is the historical usage.
also...
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
> ---
> arch/arm/mach-omap2/powerdomains3xxx_data.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c
> index 9c9c113..bd01025 100644
> --- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
> +++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
> @@ -52,6 +52,7 @@ static struct powerdomain iva2_pwrdm = {
> [2] = PWRSTS_OFF_ON,
> [3] = PWRSTS_ON,
> },
> + .voltdm = { .name = "mpu" },
> };
>
> static struct powerdomain mpu_3xxx_pwrdm = {
> @@ -68,6 +69,7 @@ static struct powerdomain mpu_3xxx_pwrdm = {
> .pwrsts_mem_on = {
> [0] = PWRSTS_OFF_ON,
> },
> + .voltdm = { .name = "mpu" },
> };
>
> /*
> @@ -98,6 +100,7 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
> [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
> [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
> },
> + .voltdm = { .name = "core" },
> };
>
> static struct powerdomain core_3xxx_es3_1_pwrdm = {
> @@ -121,6 +124,7 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = {
> [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
> [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
> },
> + .voltdm = { .name = "core" },
> };
>
> static struct powerdomain dss_pwrdm = {
> @@ -157,6 +161,7 @@ static struct powerdomain sgx_pwrdm = {
> .pwrsts_mem_on = {
> [0] = PWRSTS_ON, /* MEMONSTATE */
> },
> + .voltdm = { .name = "core" },
> };
>
> static struct powerdomain cam_pwrdm = {
> @@ -172,6 +177,7 @@ static struct powerdomain cam_pwrdm = {
> .pwrsts_mem_on = {
> [0] = PWRSTS_ON, /* MEMONSTATE */
> },
> + .voltdm = { .name = "core" },
> };
>
> static struct powerdomain per_pwrdm = {
> @@ -187,12 +193,14 @@ static struct powerdomain per_pwrdm = {
> .pwrsts_mem_on = {
> [0] = PWRSTS_ON, /* MEMONSTATE */
> },
> + .voltdm = { .name = "core" },
> };
>
> static struct powerdomain emu_pwrdm = {
> .name = "emu_pwrdm",
> .prcm_offs = OMAP3430_EMU_MOD,
> .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
> + .voltdm = { .name = "core" },
> };
>
> static struct powerdomain neon_pwrdm = {
> @@ -201,6 +209,7 @@ static struct powerdomain neon_pwrdm = {
> .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
> .pwrsts = PWRSTS_OFF_RET_ON,
> .pwrsts_logic_ret = PWRSTS_RET,
> + .voltdm = { .name = "core" },
This is in VDD1.
> };
>
> static struct powerdomain usbhost_pwrdm = {
> @@ -223,6 +232,7 @@ static struct powerdomain usbhost_pwrdm = {
> .pwrsts_mem_on = {
> [0] = PWRSTS_ON, /* MEMONSTATE */
> },
> + .voltdm = { .name = "core" },
> };
>
> static struct powerdomain dpll1_pwrdm = {
These DPLL powerdomains should have voltagedomains also. DPLL1 is in
VDD1, I believe. I think the rest are in VDD2.
- Paul
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 7/7] OMAP3: powerdomain data: add voltage domains
2011-03-22 19:30 ` Paul Walmsley
@ 2011-03-22 21:09 ` Cousson, Benoit
2011-03-22 22:15 ` Paul Walmsley
0 siblings, 1 reply; 33+ messages in thread
From: Cousson, Benoit @ 2011-03-22 21:09 UTC (permalink / raw)
To: Paul Walmsley; +Cc: Hilman, Kevin, linux-omap@vger.kernel.org
On 3/22/2011 8:30 PM, Paul Walmsley wrote:
> Hi Kevin,
>
> a couple of comments below..
>
> On Fri, 18 Mar 2011, Kevin Hilman wrote:
>
>> Add voltage domain name to indicate which voltagedomain each
>> powerdomain is in. A missing voltage domain name means that that
>> powerdomain is not in one of the currently scalable voltage domains.
>
> Before you add these, you might want to change the voltagedomain names for
> OMAP3. I don't think it's correct to refer to the VDD1 voltagedomain as
> "mpu" since it includes both the MPU and IVA. Probably best to use simply
> "vdd1" and "vdd2" since that is the historical usage.
Yes, but it was confusing, hence the change on OMAP4.
"core" is fine and better that vdd2, maybe "mpu_iva" will be better for
vdd1.
Moreover, it will be consistent will all the OMAP4+ chips.
[...]
>> static struct powerdomain dpll1_pwrdm = {
>
> These DPLL powerdomains should have voltagedomains also. DPLL1 is in
> VDD1, I believe. I think the rest are in VDD2.
DPLL1 (MPU) & DPLL2 (IVA) are inside vdd1, DPLL3, 4 & 5 are inside the
core (vdd2)
Benoit
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 7/7] OMAP3: powerdomain data: add voltage domains
2011-03-22 21:09 ` Cousson, Benoit
@ 2011-03-22 22:15 ` Paul Walmsley
2011-03-23 0:20 ` Kevin Hilman
0 siblings, 1 reply; 33+ messages in thread
From: Paul Walmsley @ 2011-03-22 22:15 UTC (permalink / raw)
To: Cousson, Benoit; +Cc: Hilman, Kevin, linux-omap@vger.kernel.org
On Tue, 22 Mar 2011, Cousson, Benoit wrote:
> On 3/22/2011 8:30 PM, Paul Walmsley wrote:
> > On Fri, 18 Mar 2011, Kevin Hilman wrote:
> >
> > > Add voltage domain name to indicate which voltagedomain each
> > > powerdomain is in. A missing voltage domain name means that that
> > > powerdomain is not in one of the currently scalable voltage domains.
> >
> > Before you add these, you might want to change the voltagedomain names for
> > OMAP3. I don't think it's correct to refer to the VDD1 voltagedomain as
> > "mpu" since it includes both the MPU and IVA. Probably best to use simply
> > "vdd1" and "vdd2" since that is the historical usage.
>
> Yes, but it was confusing, hence the change on OMAP4.
> "core" is fine and better that vdd2, maybe "mpu_iva" will be better for vdd1.
> Moreover, it will be consistent will all the OMAP4+ chips.
Calling it "mpu_iva" is fine with me also.
> > > static struct powerdomain dpll1_pwrdm = {
> >
> > These DPLL powerdomains should have voltagedomains also. DPLL1 is in
> > VDD1, I believe. I think the rest are in VDD2.
>
> DPLL1 (MPU) & DPLL2 (IVA) are inside vdd1, DPLL3, 4 & 5 are inside the core
> (vdd2)
Indeed.
- Paul
^ permalink raw reply [flat|nested] 33+ messages in thread* Re: [PATCH 7/7] OMAP3: powerdomain data: add voltage domains
2011-03-22 22:15 ` Paul Walmsley
@ 2011-03-23 0:20 ` Kevin Hilman
0 siblings, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-23 0:20 UTC (permalink / raw)
To: Paul Walmsley; +Cc: Cousson, Benoit, linux-omap@vger.kernel.org
Paul Walmsley <paul@pwsan.com> writes:
> On Tue, 22 Mar 2011, Cousson, Benoit wrote:
>
>> On 3/22/2011 8:30 PM, Paul Walmsley wrote:
>> > On Fri, 18 Mar 2011, Kevin Hilman wrote:
>> >
>> > > Add voltage domain name to indicate which voltagedomain each
>> > > powerdomain is in. A missing voltage domain name means that that
>> > > powerdomain is not in one of the currently scalable voltage domains.
>> >
>> > Before you add these, you might want to change the voltagedomain names for
>> > OMAP3. I don't think it's correct to refer to the VDD1 voltagedomain as
>> > "mpu" since it includes both the MPU and IVA. Probably best to use simply
>> > "vdd1" and "vdd2" since that is the historical usage.
>>
>> Yes, but it was confusing, hence the change on OMAP4.
>> "core" is fine and better that vdd2, maybe "mpu_iva" will be better for vdd1.
>> Moreover, it will be consistent will all the OMAP4+ chips.
>
> Calling it "mpu_iva" is fine with me also.
>
OK, will use "mpu_iva" and "core". I much prefer these to vdd1 & vdd2.
>> > > static struct powerdomain dpll1_pwrdm = {
>> >
>> > These DPLL powerdomains should have voltagedomains also. DPLL1 is in
>> > VDD1, I believe. I think the rest are in VDD2.
>>
>> DPLL1 (MPU) & DPLL2 (IVA) are inside vdd1, DPLL3, 4 & 5 are inside the core
>> (vdd2)
>
> Indeed.
>
Thanks, will fix.
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure.
2011-03-19 0:18 [PATCH 0/7] OMAP2+: voltage layer cleanup and restructure Kevin Hilman
` (6 preceding siblings ...)
2011-03-19 0:18 ` [PATCH 7/7] OMAP3: powerdomain data: add voltage domains Kevin Hilman
@ 2011-03-23 0:31 ` Kevin Hilman
7 siblings, 0 replies; 33+ messages in thread
From: Kevin Hilman @ 2011-03-23 0:31 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Walmsely, Benoit Cousson
Kevin Hilman <khilman@ti.com> writes:
> In order to implement a clean DVFS layer, the current voltage layer
> needs quite a bit of cleanup and restructure. Many of the details
> were described by Paul in his initial cleanup[1], and this series is
> continuing in that direction.
>
> This series is currently also available in my pm-wip/voltdm branch and
> based on my pm-core branch.
FYI... while waiting for me to post an updated series here (which now
has a bunch more patches) you're free to look at my current
pm-wip/voltdm branch which has all my work-in-progress.
Kevin
^ permalink raw reply [flat|nested] 33+ messages in thread