summaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2011-03-29 14:36:04 -0700
committerKevin Hilman <khilman@ti.com>2011-09-15 12:08:19 -0700
commit5892bb1fc6430d086f5c2a4216f9ed00070e31ad (patch)
tree6a64fdd3e6d4e80cae63c1fa3c947383b1024d7e /arch/arm
parent78614e0f8f32dca52beebaadfb53c2a3acf1604a (diff)
OMAP3+: VC: cleanup voltage setup time configuration
- add setup_time field to struct omap_vc_channel (init'd from PMIC data) - use VC/VP register access helper for read/modify/write - move VFSM structure from omap_vdd_info into struct voltagedomain - remove redunant _data suffix from VFSM structures and variables - remove voltsetup_shift, use ffs() on the mask value to find the shift Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/vc.c10
-rw-r--r--arch/arm/mach-omap2/vc.h2
-rw-r--r--arch/arm/mach-omap2/voltage.h11
-rw-r--r--arch/arm/mach-omap2/voltagedomains3xxx_data.c10
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c12
5 files changed, 19 insertions, 26 deletions
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 8f0105a7bb4..f78e62abe72 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -223,7 +223,6 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
{
struct omap_vc_channel *vc = voltdm->vc;
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"
@@ -242,6 +241,7 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr;
vc->volt_reg_addr = vdd->pmic_info->volt_reg_addr;
vc->cmd_reg_addr = vdd->pmic_info->cmd_reg_addr;
+ vc->setup_time = vdd->pmic_info->volt_setup_time;
/* Configure the i2c slave address for this VC */
voltdm->rmw(vc->smps_sa_mask,
@@ -260,11 +260,9 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
vc->common->smps_cmdra_reg);
/* Configure the setup times */
- vc_val = voltdm->read(vdd->vfsm->voltsetup_reg);
- vc_val &= ~vdd->vfsm->voltsetup_mask;
- vc_val |= vdd->pmic_info->volt_setup_time <<
- vdd->vfsm->voltsetup_shift;
- voltdm->write(vc_val, vdd->vfsm->voltsetup_reg);
+ voltdm->rmw(voltdm->vfsm->voltsetup_mask,
+ vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask),
+ voltdm->vfsm->voltsetup_reg);
if (cpu_is_omap34xx())
omap3_vc_init_channel(voltdm);
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 43a0c5c2b07..6e8806b5982 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -61,6 +61,7 @@ struct omap_vc_common {
* @i2c_slave_addr: I2C slave address of PMIC for this VC channel
* @volt_reg_addr: voltage configuration register address
* @cmd_reg_addr: command configuration register address
+ * @setup_time: setup time (in sys_clk cycles) of regulator for this channel
* @common: pointer to VC common data for this platform
* @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register
* @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
@@ -72,6 +73,7 @@ struct omap_vc_channel {
u16 i2c_slave_addr;
u16 volt_reg_addr;
u16 cmd_reg_addr;
+ u16 setup_time;
/* register access data */
const struct omap_vc_common *common;
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 3f49807a36e..99df2d13e42 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -36,20 +36,16 @@ struct powerdomain;
struct omap_vdd_info;
/**
- * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
+ * struct omap_vfsm_instance - per-voltage manager FSM register/bitfield
* data
* @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
* @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
- * @voltsetup_shift: SETUP_TIME* field shift in the PRM_VOLTSETUP* register
*
* XXX What about VOLTOFFSET/VOLTCTRL?
- * XXX It is not necessary to have both a _mask and a _shift for the same
- * bitfield - remove one!
*/
-struct omap_vfsm_instance_data {
+struct omap_vfsm_instance {
u32 voltsetup_mask;
u8 voltsetup_reg;
- u8 voltsetup_shift;
};
/**
@@ -70,6 +66,7 @@ struct voltagedomain {
struct list_head node;
struct list_head pwrdm_list;
struct omap_vc_channel *vc;
+ const struct omap_vfsm_instance *vfsm;
/* VC/VP register access functions: SoC specific */
u32 (*read) (u8 offset);
@@ -139,7 +136,6 @@ struct omap_volt_pmic_info {
* @vp_data : the register values, shifts, masks for various
* vp registers
* @vp_rt_data : VP data derived at runtime, not predefined
- * @vfsm : voltage manager FSM data
* @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
@@ -150,7 +146,6 @@ struct omap_vdd_info {
struct omap_volt_pmic_info *pmic_info;
struct omap_vp_instance_data *vp_data;
struct omap_vp_runtime_data vp_rt_data;
- const struct omap_vfsm_instance_data *vfsm;
struct dentry *debug_dir;
u32 curr_volt;
bool vp_enabled;
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index 1d667490bc9..ce5a7971add 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -31,26 +31,22 @@
* VDD data
*/
-static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = {
+static const struct omap_vfsm_instance omap3_vdd1_vfsm = {
.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
- .voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT,
.voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
};
static struct omap_vdd_info omap3_vdd1_info = {
.vp_data = &omap3_vp1_data,
- .vfsm = &omap3_vdd1_vfsm_data,
};
-static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
+static const struct omap_vfsm_instance omap3_vdd2_vfsm = {
.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
- .voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT,
.voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
};
static struct omap_vdd_info omap3_vdd2_info = {
.vp_data = &omap3_vp2_data,
- .vfsm = &omap3_vdd2_vfsm_data,
};
static struct voltagedomain omap3_voltdm_mpu = {
@@ -60,6 +56,7 @@ static struct voltagedomain omap3_voltdm_mpu = {
.write = omap3_prm_vcvp_write,
.rmw = omap3_prm_vcvp_rmw,
.vc = &omap3_vc_mpu,
+ .vfsm = &omap3_vdd1_vfsm,
.vdd = &omap3_vdd1_info,
};
@@ -70,6 +67,7 @@ static struct voltagedomain omap3_voltdm_core = {
.write = omap3_prm_vcvp_write,
.rmw = omap3_prm_vcvp_rmw,
.vc = &omap3_vc_core,
+ .vfsm = &omap3_vdd2_vfsm,
.vdd = &omap3_vdd2_info,
};
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index e435795d61b..dd4bd222739 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -32,31 +32,28 @@
#include "vc.h"
#include "vp.h"
-static const struct omap_vfsm_instance_data omap4_vdd_mpu_vfsm_data = {
+static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
.voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
};
static struct omap_vdd_info omap4_vdd_mpu_info = {
.vp_data = &omap4_vp_mpu_data,
- .vfsm = &omap4_vdd_mpu_vfsm_data,
};
-static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = {
+static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
.voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
};
static struct omap_vdd_info omap4_vdd_iva_info = {
.vp_data = &omap4_vp_iva_data,
- .vfsm = &omap4_vdd_iva_vfsm_data,
};
-static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = {
+static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
.voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
};
static struct omap_vdd_info omap4_vdd_core_info = {
.vp_data = &omap4_vp_core_data,
- .vfsm = &omap4_vdd_core_vfsm_data,
};
static struct voltagedomain omap4_voltdm_mpu = {
@@ -66,6 +63,7 @@ static struct voltagedomain omap4_voltdm_mpu = {
.write = omap4_prm_vcvp_write,
.rmw = omap4_prm_vcvp_rmw,
.vc = &omap4_vc_mpu,
+ .vfsm = &omap4_vdd_mpu_vfsm,
.vdd = &omap4_vdd_mpu_info,
};
@@ -76,6 +74,7 @@ static struct voltagedomain omap4_voltdm_iva = {
.write = omap4_prm_vcvp_write,
.rmw = omap4_prm_vcvp_rmw,
.vc = &omap4_vc_iva,
+ .vfsm = &omap4_vdd_iva_vfsm,
.vdd = &omap4_vdd_iva_info,
};
@@ -86,6 +85,7 @@ static struct voltagedomain omap4_voltdm_core = {
.write = omap4_prm_vcvp_write,
.rmw = omap4_prm_vcvp_rmw,
.vc = &omap4_vc_core,
+ .vfsm = &omap4_vdd_core_vfsm,
.vdd = &omap4_vdd_core_info,
};