]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
OMAP3+: VC: cleanup voltage setup time configuration
authorKevin Hilman <khilman@ti.com>
Tue, 29 Mar 2011 21:36:04 +0000 (14:36 -0700)
committerKevin Hilman <khilman@ti.com>
Thu, 15 Sep 2011 19:08:19 +0000 (12:08 -0700)
- 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>
arch/arm/mach-omap2/vc.c
arch/arm/mach-omap2/vc.h
arch/arm/mach-omap2/voltage.h
arch/arm/mach-omap2/voltagedomains3xxx_data.c
arch/arm/mach-omap2/voltagedomains44xx_data.c

index 8f0105a7bb4b988b15ef124f4e82e21e86c01254..f78e62abe7206aa43c131b08fcb01fa70525fea2 100644 (file)
@@ -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);
index 43a0c5c2b07a50ab98c02602f1154f457153d8d1..6e8806b598237db0b559674eb9b87c2ac00b41b9 100644 (file)
@@ -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;
index 3f49807a36e8af4991bb9db551cc0d7be607b675..99df2d13e42edb99adb6ea70b33a0ce4c51ab9f1 100644 (file)
@@ -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;
index 1d667490bc95cf00598c811db05cd7cd41b763e0..ce5a7971addf949ef9ccd3c98d57cd1f5c974f70 100644 (file)
  * 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,
 };
 
index e435795d61b7dc78da85a2fed7825bdd2f406f4e..dd4bd222739a9e4b50310bac8b0d307ad0d8c7a7 100644 (file)
 #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,
 };