struct omap_vc_channel *vc = voltdm->vc;
struct omap_vdd_info *vdd = voltdm->vdd;
struct omap_volt_data *volt_data;
- const struct omap_vp_common_data *vp_common;
u32 vc_cmdval, vp_errgain_val;
- vp_common = vdd->vp_data->vp_common;
-
/* Check if sufficient pmic info is available for this vdd */
if (!voltdm->pmic) {
pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
/* Setting vp errorgain based on the voltage */
if (volt_data) {
- vp_errgain_val = voltdm->read(vdd->vp_data->vpconfig);
+ vp_errgain_val = voltdm->read(voltdm->vp->vpconfig);
vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
- vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask;
+ vp_errgain_val &= voltdm->vp->common->vpconfig_errorgain_mask;
vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
- vp_common->vpconfig_errorgain_shift;
- voltdm->write(vp_errgain_val, vdd->vp_data->vpconfig);
+ voltdm->vp->common->vpconfig_errorgain_shift;
+ voltdm->write(vp_errgain_val, voltdm->vp->vpconfig);
}
return 0;
/* Generic voltage parameters */
vdd->volt_scale = omap_vp_forceupdate_scale;
- vdd->vp_enabled = false;
+ voltdm->vp->enabled = false;
vdd->vp_rt_data.vpconfig_erroroffset =
(voltdm->pmic->vp_erroroffset <<
- vdd->vp_data->vp_common->vpconfig_erroroffset_shift);
+ voltdm->vp->common->vpconfig_erroroffset_shift);
timeout_val = (sys_clk_speed * voltdm->pmic->vp_timeout_us) / 1000;
vdd->vp_rt_data.vlimitto_timeout = timeout_val;
* @node: list_head linking all voltage domains
* @pwrdm_list: list_head linking all powerdomains in this voltagedomain
* @vc: pointer to VC channel associated with this voltagedomain
+ * @vp: pointer to VP associated with this voltagedomain
* @read: read a VC/VP register
* @write: write a VC/VP register
* @read: read-modify-write a VC/VP register
struct list_head pwrdm_list;
struct omap_vc_channel *vc;
const struct omap_vfsm_instance *vfsm;
+ struct omap_vp_instance *vp;
struct omap_voltdm_pmic *pmic;
/* VC/VP register access functions: SoC specific */
*
* @volt_data : voltage table having the distinct voltages supported
* by the domain and other associated per voltage data.
- * @vp_data : the register values, shifts, masks for various
- * vp registers
* @vp_rt_data : VP data derived at runtime, not predefined
* @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
* @volt_scale : API to scale the voltage of the vdd.
*/
struct omap_vdd_info {
struct omap_volt_data *volt_data;
- struct omap_vp_instance_data *vp_data;
struct omap_vp_runtime_data vp_rt_data;
struct dentry *debug_dir;
u32 curr_volt;
- bool vp_enabled;
int (*volt_scale) (struct voltagedomain *voltdm,
unsigned long target_volt);
.voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
};
-static struct omap_vdd_info omap3_vdd1_info = {
- .vp_data = &omap3_vp1_data,
-};
+static struct omap_vdd_info omap3_vdd1_info;
static const struct omap_vfsm_instance omap3_vdd2_vfsm = {
.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
.voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
};
-static struct omap_vdd_info omap3_vdd2_info = {
- .vp_data = &omap3_vp2_data,
-};
+static struct omap_vdd_info omap3_vdd2_info;
static struct voltagedomain omap3_voltdm_mpu = {
.name = "mpu_iva",
.rmw = omap3_prm_vcvp_rmw,
.vc = &omap3_vc_mpu,
.vfsm = &omap3_vdd1_vfsm,
+ .vp = &omap3_vp_mpu,
.vdd = &omap3_vdd1_info,
};
.rmw = omap3_prm_vcvp_rmw,
.vc = &omap3_vc_core,
.vfsm = &omap3_vdd2_vfsm,
+ .vp = &omap3_vp_core,
.vdd = &omap3_vdd2_info,
};
.voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
};
-static struct omap_vdd_info omap4_vdd_mpu_info = {
- .vp_data = &omap4_vp_mpu_data,
-};
+static struct omap_vdd_info omap4_vdd_mpu_info;
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,
-};
+static struct omap_vdd_info omap4_vdd_iva_info;
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,
-};
+static struct omap_vdd_info omap4_vdd_core_info;
static struct voltagedomain omap4_voltdm_mpu = {
.name = "mpu",
.rmw = omap4_prm_vcvp_rmw,
.vc = &omap4_vc_mpu,
.vfsm = &omap4_vdd_mpu_vfsm,
+ .vp = &omap4_vp_mpu,
.vdd = &omap4_vdd_mpu_info,
};
.rmw = omap4_prm_vcvp_rmw,
.vc = &omap4_vc_iva,
.vfsm = &omap4_vdd_iva_vfsm,
+ .vp = &omap4_vp_iva,
.vdd = &omap4_vdd_iva_info,
};
.rmw = omap4_prm_vcvp_rmw,
.vc = &omap4_vc_core,
.vfsm = &omap4_vdd_core_vfsm,
+ .vp = &omap4_vp_core,
.vdd = &omap4_vdd_core_info,
};
static void vp_latch_vsel(struct voltagedomain *voltdm)
{
- struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
+ struct omap_vp_instance *vp = voltdm->vp;
u32 vpconfig;
unsigned long uvdc;
char vsel;
vsel = voltdm->pmic->uv_to_vsel(uvdc);
vpconfig = voltdm->read(vp->vpconfig);
- vpconfig &= ~(vp->vp_common->vpconfig_initvoltage_mask |
- vp->vp_common->vpconfig_initvdd);
- vpconfig |= vsel << vp->vp_common->vpconfig_initvoltage_shift;
+ vpconfig &= ~(vp->common->vpconfig_initvoltage_mask |
+ vp->common->vpconfig_initvdd);
+ vpconfig |= vsel << vp->common->vpconfig_initvoltage_shift;
voltdm->write(vpconfig, vp->vpconfig);
/* Trigger initVDD value copy to voltage processor */
- voltdm->write((vpconfig | vp->vp_common->vpconfig_initvdd),
+ voltdm->write((vpconfig | vp->common->vpconfig_initvdd),
vp->vpconfig);
/* Clear initVDD copy trigger bit */
/* Generic voltage init functions */
void __init omap_vp_init(struct voltagedomain *voltdm)
{
- struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
+ struct omap_vp_instance *vp = voltdm->vp;
struct omap_vdd_info *vdd = voltdm->vdd;
u32 vp_val;
vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
(vdd->vp_rt_data.vpconfig_errorgain <<
- vp->vp_common->vpconfig_errorgain_shift) |
- vp->vp_common->vpconfig_timeouten;
+ vp->common->vpconfig_errorgain_shift) |
+ vp->common->vpconfig_timeouten;
voltdm->write(vp_val, vp->vpconfig);
vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin <<
- vp->vp_common->vstepmin_smpswaittimemin_shift) |
+ vp->common->vstepmin_smpswaittimemin_shift) |
(vdd->vp_rt_data.vstepmin_stepmin <<
- vp->vp_common->vstepmin_stepmin_shift));
+ vp->common->vstepmin_stepmin_shift));
voltdm->write(vp_val, vp->vstepmin);
vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax <<
- vp->vp_common->vstepmax_smpswaittimemax_shift) |
+ vp->common->vstepmax_smpswaittimemax_shift) |
(vdd->vp_rt_data.vstepmax_stepmax <<
- vp->vp_common->vstepmax_stepmax_shift));
+ vp->common->vstepmax_stepmax_shift));
voltdm->write(vp_val, vp->vstepmax);
vp_val = ((vdd->vp_rt_data.vlimitto_vddmax <<
- vp->vp_common->vlimitto_vddmax_shift) |
+ vp->common->vlimitto_vddmax_shift) |
(vdd->vp_rt_data.vlimitto_vddmin <<
- vp->vp_common->vlimitto_vddmin_shift) |
+ vp->common->vlimitto_vddmin_shift) |
(vdd->vp_rt_data.vlimitto_timeout <<
- vp->vp_common->vlimitto_timeout_shift));
+ vp->common->vlimitto_timeout_shift));
voltdm->write(vp_val, vp->vlimitto);
vp_debugfs_init(voltdm);
int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
unsigned long target_volt)
{
- struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
+ struct omap_vp_instance *vp = voltdm->vp;
u32 vpconfig;
u8 target_vsel, current_vsel;
int ret, timeout = 0;
* is <3us
*/
while (timeout++ < VP_TRANXDONE_TIMEOUT) {
- vp->vp_common->ops->clear_txdone(vp->id);
- if (!vp->vp_common->ops->check_txdone(vp->id))
+ vp->common->ops->clear_txdone(vp->id);
+ if (!vp->common->ops->check_txdone(vp->id))
break;
udelay(1);
}
/* Configure for VP-Force Update */
vpconfig = voltdm->read(vp->vpconfig);
- vpconfig &= ~(vp->vp_common->vpconfig_initvdd |
- vp->vp_common->vpconfig_forceupdate |
- vp->vp_common->vpconfig_initvoltage_mask);
+ vpconfig &= ~(vp->common->vpconfig_initvdd |
+ vp->common->vpconfig_forceupdate |
+ vp->common->vpconfig_initvoltage_mask);
vpconfig |= ((target_vsel <<
- vp->vp_common->vpconfig_initvoltage_shift));
+ vp->common->vpconfig_initvoltage_shift));
voltdm->write(vpconfig, vp->vpconfig);
/* Trigger initVDD value copy to voltage processor */
- vpconfig |= vp->vp_common->vpconfig_initvdd;
+ vpconfig |= vp->common->vpconfig_initvdd;
voltdm->write(vpconfig, vp->vpconfig);
/* Force update of voltage */
- vpconfig |= vp->vp_common->vpconfig_forceupdate;
+ vpconfig |= vp->common->vpconfig_forceupdate;
voltdm->write(vpconfig, vp->vpconfig);
/*
* Depends on SMPSWAITTIMEMIN/MAX and voltage change
*/
timeout = 0;
- omap_test_timeout(vp->vp_common->ops->check_txdone(vp->id),
+ omap_test_timeout(vp->common->ops->check_txdone(vp->id),
VP_TRANXDONE_TIMEOUT, timeout);
if (timeout >= VP_TRANXDONE_TIMEOUT)
pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
*/
timeout = 0;
while (timeout++ < VP_TRANXDONE_TIMEOUT) {
- vp->vp_common->ops->clear_txdone(vp->id);
- if (!vp->vp_common->ops->check_txdone(vp->id))
+ vp->common->ops->clear_txdone(vp->id);
+ if (!vp->common->ops->check_txdone(vp->id))
break;
udelay(1);
}
vpconfig = voltdm->read(vp->vpconfig);
/* Clear initVDD copy trigger bit */
- vpconfig &= ~vp->vp_common->vpconfig_initvdd;
+ vpconfig &= ~vp->common->vpconfig_initvdd;
voltdm->write(vpconfig, vp->vpconfig);
/* Clear force bit */
- vpconfig &= ~vp->vp_common->vpconfig_forceupdate;
+ vpconfig &= ~vp->common->vpconfig_forceupdate;
voltdm->write(vpconfig, vp->vpconfig);
return 0;
*/
unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
{
- struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
- struct omap_vdd_info *vdd;
+ struct omap_vp_instance *vp = voltdm->vp;
u8 curr_vsel;
if (!voltdm || IS_ERR(voltdm)) {
return 0;
}
- vdd = voltdm->vdd;
if (!voltdm->read) {
pr_err("%s: No read API for reading vdd_%s regs\n",
__func__, voltdm->name);
*/
void omap_vp_enable(struct voltagedomain *voltdm)
{
- struct omap_vp_instance_data *vp;
- struct omap_vdd_info *vdd;
+ struct omap_vp_instance *vp;
u32 vpconfig;
if (!voltdm || IS_ERR(voltdm)) {
return;
}
- vdd = voltdm->vdd;
- vp = voltdm->vdd->vp_data;
+ vp = voltdm->vp;
if (!voltdm->read || !voltdm->write) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
__func__, voltdm->name);
}
/* If VP is already enabled, do nothing. Return */
- if (vdd->vp_enabled)
+ if (vp->enabled)
return;
vp_latch_vsel(voltdm);
/* Enable VP */
vpconfig = voltdm->read(vp->vpconfig);
- vpconfig |= vp->vp_common->vpconfig_vpenable;
+ vpconfig |= vp->common->vpconfig_vpenable;
voltdm->write(vpconfig, vp->vpconfig);
- vdd->vp_enabled = true;
+ vp->enabled = true;
}
/**
*/
void omap_vp_disable(struct voltagedomain *voltdm)
{
- struct omap_vp_instance_data *vp;
- struct omap_vdd_info *vdd;
+ struct omap_vp_instance *vp;
u32 vpconfig;
int timeout;
return;
}
- vdd = voltdm->vdd;
- vp = voltdm->vdd->vp_data;
+ vp = voltdm->vp;
if (!voltdm->read || !voltdm->write) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
__func__, voltdm->name);
}
/* If VP is already disabled, do nothing. Return */
- if (!vdd->vp_enabled) {
+ if (!vp->enabled) {
pr_warning("%s: Trying to disable VP for vdd_%s when"
"it is already disabled\n", __func__, voltdm->name);
return;
/* Disable VP */
vpconfig = voltdm->read(vp->vpconfig);
- vpconfig &= ~vp->vp_common->vpconfig_vpenable;
+ vpconfig &= ~vp->common->vpconfig_vpenable;
voltdm->write(vpconfig, vp->vpconfig);
/*
pr_warning("%s: vdd_%s idle timedout\n",
__func__, voltdm->name);
- vdd->vp_enabled = false;
+ vp->enabled = false;
return;
}
static int vp_volt_debug_get(void *data, u64 *val)
{
struct voltagedomain *voltdm = (struct voltagedomain *)data;
- struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
+ struct omap_vp_instance *vp = voltdm->vp;
struct omap_vdd_info *vdd = voltdm->vdd;
u8 vsel;
};
/**
- * struct omap_vp_common_data - register data common to all VDDs
+ * struct omap_vp_common - register data common to all VDDs
* @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
* bitfield - remove one
* XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
*/
-struct omap_vp_common_data {
+struct omap_vp_common {
u32 vpconfig_errorgain_mask;
u32 vpconfig_initvoltage_mask;
u32 vpconfig_timeouten;
};
/**
- * struct omap_vp_instance_data - VP register offsets (per-VDD)
- * @vp_common: pointer to struct omap_vp_common_data * for this SoC
+ * struct omap_vp_instance - VP register offsets (per-VDD)
+ * @common: pointer to struct omap_vp_common * for this SoC
* @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
* @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
* @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
* @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
* @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
* @id: Unique identifier for VP instance.
+ * @enabled: flag to keep track of whether vp is enabled or not
*
* XXX vp_common is probably not needed since it is per-SoC
*/
-struct omap_vp_instance_data {
- const struct omap_vp_common_data *vp_common;
+struct omap_vp_instance {
+ const struct omap_vp_common *common;
u8 vpconfig;
u8 vstepmin;
u8 vstepmax;
u8 vstatus;
u8 voltage;
u8 id;
+ bool enabled;
};
/**
u8 vlimitto_vddmax;
};
-extern struct omap_vp_instance_data omap3_vp1_data;
-extern struct omap_vp_instance_data omap3_vp2_data;
+extern struct omap_vp_instance omap3_vp_mpu;
+extern struct omap_vp_instance omap3_vp_core;
-extern struct omap_vp_instance_data omap4_vp_mpu_data;
-extern struct omap_vp_instance_data omap4_vp_iva_data;
-extern struct omap_vp_instance_data omap4_vp_core_data;
+extern struct omap_vp_instance omap4_vp_mpu;
+extern struct omap_vp_instance omap4_vp_iva;
+extern struct omap_vp_instance omap4_vp_core;
void omap_vp_init(struct voltagedomain *voltdm);
void omap_vp_enable(struct voltagedomain *voltdm);
* VP data common to 34xx/36xx chips
* XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
*/
-static const struct omap_vp_common_data omap3_vp_common = {
+static const struct omap_vp_common omap3_vp_common = {
.vpconfig_erroroffset_shift = OMAP3430_ERROROFFSET_SHIFT,
.vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK,
.vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT,
.ops = &omap3_vp_ops,
};
-struct omap_vp_instance_data omap3_vp1_data = {
+struct omap_vp_instance omap3_vp_mpu = {
.id = OMAP3_VP_VDD_MPU_ID,
- .vp_common = &omap3_vp_common,
+ .common = &omap3_vp_common,
.vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET,
.vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
.vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET,
.voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET,
};
-struct omap_vp_instance_data omap3_vp2_data = {
+struct omap_vp_instance omap3_vp_core = {
.id = OMAP3_VP_VDD_CORE_ID,
- .vp_common = &omap3_vp_common,
+ .common = &omap3_vp_common,
.vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET,
.vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET,
.vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET,
* VP data common to 44xx chips
* XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
*/
-static const struct omap_vp_common_data omap4_vp_common = {
+static const struct omap_vp_common omap4_vp_common = {
.vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT,
.vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK,
.vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT,
.ops = &omap4_vp_ops,
};
-struct omap_vp_instance_data omap4_vp_mpu_data = {
+struct omap_vp_instance omap4_vp_mpu = {
.id = OMAP4_VP_VDD_MPU_ID,
- .vp_common = &omap4_vp_common,
+ .common = &omap4_vp_common,
.vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
.vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
.vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
.voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
};
-struct omap_vp_instance_data omap4_vp_iva_data = {
+struct omap_vp_instance omap4_vp_iva = {
.id = OMAP4_VP_VDD_IVA_ID,
- .vp_common = &omap4_vp_common,
+ .common = &omap4_vp_common,
.vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
.vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
.vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
.voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
};
-struct omap_vp_instance_data omap4_vp_core_data = {
+struct omap_vp_instance omap4_vp_core = {
.id = OMAP4_VP_VDD_CORE_ID,
- .vp_common = &omap4_vp_common,
+ .common = &omap4_vp_common,
.vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
.vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
.vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,