Skip to contentSkip to conversation

OMAP: voltage cleanup part C: VP cleanup

PATCH New Kevin Hilman 2 participants 15 messages Aug 29, 2011 – Sep 7, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover OMAP: voltage cleanup part C: VP cleanup

This series focuses on cleanup and better abstraction in the voltage processor (VP) layer.

Available in the pm-wip/voltdm_c branch of my linux-omap-pm tree
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git

Applies on v3.1-rc3 + the part A & B series.

Kevin

Kevin Hilman (11):
OMAP3+: VP: cleanup: move VP instance into voltdm, misc. renames OMAP3+: voltage: remove unneeded debugfs interface OMAP3+: VP: struct omap_vp_common: replace shift with __ffs(mask) OMAP3+: VP: move SoC-specific sys clock rate retreival late init OMAP3+: VP: move timing calculation/config into VP init OMAP3+: VP: create VP helper function for updating error gain OMAP3+: VP: remove omap_vp_runtime_data
OMAP3+: VP: move voltage scale function pointer into struct
voltagedomain
OMAP3+: VP: update_errorgain(): return error if VP OMAP3+: VP: remove unused omap_vp_get_curr_volt() OMAP3+: VP: combine setting init voltage into common function

Todd Poynor (1):
OMAP: VP: Explicitly mask VPVOLTAGE field

 arch/arm/mach-omap2/smartreflex.c             |   29 ++-
 arch/arm/mach-omap2/vc.c                      |   22 +--
 arch/arm/mach-omap2/voltage.c                 |  161 ++------------
 arch/arm/mach-omap2/voltage.h                 |   24 +--
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |   18 +-
 arch/arm/mach-omap2/voltagedomains44xx_data.c |   23 ++-
 arch/arm/mach-omap2/vp.c                      |  292 +++++++++----------------
 arch/arm/mach-omap2/vp.h                      |   91 +++-----
 arch/arm/mach-omap2/vp3xxx_data.c             |   16 +-
 arch/arm/mach-omap2/vp44xx_data.c             |   19 +-
 10 files changed, 226 insertions(+), 469 deletions(-)
Signature · 1 line
1.7.6
#1 lore raw

PATCH 1/12 OMAP3+: VP: cleanup: move VP instance into voltdm, misc. renames

- move VP instance struct from vdd_info into struct voltage domain
- remove _data suffix from structure name
- rename vp_ prefix from vp_common field: accesses are now vp->common
- move vp_enabled bool from vdd_info into VP instance
- remove remaining references to omap_vdd_info

No functional changes.

---
 arch/arm/mach-omap2/vc.c                      |   11 +--
 arch/arm/mach-omap2/voltage.c                 |    4 +-
 arch/arm/mach-omap2/voltage.h                 |    6 +--
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |   10 +--
 arch/arm/mach-omap2/voltagedomains44xx_data.c |   15 ++---
 arch/arm/mach-omap2/vp.c                      |   88 ++++++++++++-------------
 arch/arm/mach-omap2/vp.h                      |   24 ++++---
 arch/arm/mach-omap2/vp3xxx_data.c             |   10 ++--
 arch/arm/mach-omap2/vp44xx_data.c             |   14 ++--
 9 files changed, 83 insertions(+), 99 deletions(-)
arch/arm/mach-omap2/vc.c +4 -7
index 31362cd..d0f87cc 100644
@@ -98,11 +98,8 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
 	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",
@@ -139,12 +136,12 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
 
 	/* 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;
arch/arm/mach-omap2/voltage.c +2 -2
index 94f7fc4..c22b53c 100644
@@ -81,11 +81,11 @@ static int __init _config_common_vdd_data(struct voltagedomain *voltdm)
 
 	/* 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;
arch/arm/mach-omap2/voltage.h +1 -5
index a0ae5c6..65f94c7 100644
@@ -68,6 +68,7 @@ struct voltagedomain {
 	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 */
@@ -134,21 +135,16 @@ struct omap_voltdm_pmic {
  *
  * @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);
arch/arm/mach-omap2/voltagedomains3xxx_data.c +4 -6
index 4ea9a7b..4db2c6c 100644
@@ -37,9 +37,7 @@ static const struct omap_vfsm_instance omap3_vdd1_vfsm = {
 	.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,
@@ -47,9 +45,7 @@ static const struct omap_vfsm_instance omap3_vdd2_vfsm = {
 	.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",
@@ -59,6 +55,7 @@ static struct voltagedomain omap3_voltdm_mpu = {
 	.rmw = omap3_prm_vcvp_rmw,
 	.vc = &omap3_vc_mpu,
 	.vfsm = &omap3_vdd1_vfsm,
+	.vp = &omap3_vp_mpu,
 	.vdd = &omap3_vdd1_info,
 };
 
@@ -70,6 +67,7 @@ static struct voltagedomain omap3_voltdm_core = {
 	.rmw = omap3_prm_vcvp_rmw,
 	.vc = &omap3_vc_core,
 	.vfsm = &omap3_vdd2_vfsm,
+	.vp = &omap3_vp_core,
 	.vdd = &omap3_vdd2_info,
 };
 
arch/arm/mach-omap2/voltagedomains44xx_data.c +6 -9
index dd4bd22..3e7cb4e 100644
@@ -36,25 +36,19 @@ 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,
-};
+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",
@@ -64,6 +58,7 @@ static struct voltagedomain omap4_voltdm_mpu = {
 	.rmw = omap4_prm_vcvp_rmw,
 	.vc = &omap4_vc_mpu,
 	.vfsm = &omap4_vdd_mpu_vfsm,
+	.vp = &omap4_vp_mpu,
 	.vdd = &omap4_vdd_mpu_info,
 };
 
@@ -75,6 +70,7 @@ static struct voltagedomain omap4_voltdm_iva = {
 	.rmw = omap4_prm_vcvp_rmw,
 	.vc = &omap4_vc_iva,
 	.vfsm = &omap4_vdd_iva_vfsm,
+	.vp = &omap4_vp_iva,
 	.vdd = &omap4_vdd_iva_info,
 };
 
@@ -86,6 +82,7 @@ static struct voltagedomain omap4_voltdm_core = {
 	.rmw = omap4_prm_vcvp_rmw,
 	.vc = &omap4_vc_core,
 	.vfsm = &omap4_vdd_core_vfsm,
+	.vp = &omap4_vp_core,
 	.vdd = &omap4_vdd_core_info,
 };
 
arch/arm/mach-omap2/vp.c +41 -47

247 lines not on this page · raw message

arch/arm/mach-omap2/vp.h +13 -11
index 79aa8d3..1d63960 100644
@@ -45,7 +45,7 @@ struct omap_vp_ops {
 };
 
 /**
- * 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
@@ -67,7 +67,7 @@ struct omap_vp_ops {
  *     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;
@@ -89,18 +89,19 @@ struct omap_vp_common_data {
 };
 
 /**
- * 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
+ * @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;
@@ -108,6 +109,7 @@ struct omap_vp_instance_data {
 	u8 vstatus;
 	u8 voltage;
 	u8 id;
+	bool enabled;
 };
 
 /**
@@ -139,12 +141,12 @@ struct omap_vp_runtime_data {
 	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);
arch/arm/mach-omap2/vp3xxx_data.c +5 -5
index b01d333..79c3df9 100644
@@ -36,7 +36,7 @@ static const struct omap_vp_ops omap3_vp_ops = {
  * 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,
@@ -56,9 +56,9 @@ static const struct omap_vp_common_data omap3_vp_common = {
 	.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,
@@ -67,9 +67,9 @@ struct omap_vp_instance_data omap3_vp1_data = {
 	.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,
arch/arm/mach-omap2/vp44xx_data.c +7 -7
index 9704c7b..8f75cd9 100644
@@ -36,7 +36,7 @@ static const struct omap_vp_ops omap4_vp_ops = {
  * 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,
@@ -56,9 +56,9 @@ static const struct omap_vp_common_data omap4_vp_common = {
 	.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,
@@ -67,9 +67,9 @@ struct omap_vp_instance_data omap4_vp_mpu_data = {
 	.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,
@@ -78,9 +78,9 @@ struct omap_vp_instance_data omap4_vp_iva_data = {
 	.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,
Signature · 1 line
1.7.6
#2 lore raw

PATCH 2/12 OMAP3+: voltage: remove unneeded debugfs interface

In reply to Kevin Hilman

Remove read-only debugfs interface to VP values. Most of the values are init-time only and never change. Current voltage value should be retreived from the (eventual) regulator framework interface to the voltage domain.

Fixes to original version provided by Nishanth Menon <[email protected]>

---
 arch/arm/mach-omap2/smartreflex.c |   29 +++++++++-----
 arch/arm/mach-omap2/voltage.c     |   78 -------------------------------------
 arch/arm/mach-omap2/voltage.h     |    3 -
 arch/arm/mach-omap2/vp.c          |   63 -----------------------------
 4 files changed, 19 insertions(+), 154 deletions(-)
arch/arm/mach-omap2/smartreflex.c +19 -10
index 34c01a7..bb606c9 100644
@@ -62,6 +62,7 @@ static LIST_HEAD(sr_list);
 
 static struct omap_sr_class_data *sr_class;
 static struct omap_sr_pmic_data *sr_pmic_data;
+static struct dentry		*sr_dbg_dir;
 
 static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value)
 {
@@ -826,9 +827,10 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 	struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
 	struct omap_sr_data *pdata = pdev->dev.platform_data;
 	struct resource *mem, *irq;
-	struct dentry *vdd_dbg_dir, *nvalue_dir;
+	struct dentry *nvalue_dir;
 	struct omap_volt_data *volt_data;
 	int i, ret = 0;
+	char *name;
 
 	if (!sr_info) {
 		dev_err(&pdev->dev, "%s: unable to allocate sr_info\n",
@@ -899,18 +901,25 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 	}
 
 	dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__);
+	if (!sr_dbg_dir) {
+		sr_dbg_dir = debugfs_create_dir("smartreflex", NULL);
+		if (!sr_dbg_dir) {
+			ret = PTR_ERR(sr_dbg_dir);
+			pr_err("%s:sr debugfs dir creation failed(%d)\n",
+				__func__, ret);
+			goto err_iounmap;
+		}
+	}
 
-	/*
-	 * If the voltage domain debugfs directory is not created, do
-	 * not try to create rest of the debugfs entries.
-	 */
-	vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
-	if (!vdd_dbg_dir) {
-		ret = -EINVAL;
+	name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name);
+	if (!name) {
+		dev_err(&pdev->dev, "%s: Unable to alloc debugfs name\n",
+			__func__);
+		ret = -ENOMEM;
 		goto err_iounmap;
 	}
-
-	sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir);
+	sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir);
+	kfree(name);
 	if (IS_ERR(sr_info->dbg_dir)) {
 		dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
 			__func__);
arch/arm/mach-omap2/voltage.c +0 -78

108 lines not on this page · raw message

arch/arm/mach-omap2/voltage.h +0 -3
index 65f94c7..5261703 100644
@@ -136,14 +136,12 @@ struct omap_voltdm_pmic {
  * @volt_data		: voltage table having the distinct voltages supported
  *			  by the domain and other associated per voltage data.
  * @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.
  * @volt_scale		: API to scale the voltage of the vdd.
  */
 struct omap_vdd_info {
 	struct omap_volt_data *volt_data;
 	struct omap_vp_runtime_data vp_rt_data;
-	struct dentry *debug_dir;
 	u32 curr_volt;
 
 	int (*volt_scale) (struct voltagedomain *voltdm,
@@ -158,7 +156,6 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
 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);
 #ifdef CONFIG_PM
 int omap_voltage_register_pmic(struct voltagedomain *voltdm,
 			       struct omap_voltdm_pmic *pmic);
arch/arm/mach-omap2/vp.c +0 -63

83 lines not on this page · raw message

Signature · 1 line
1.7.6
#3 lore raw

PATCH 3/12 OMAP3+: VP: struct omap_vp_common: replace shift with __ffs(mask)

In reply to Kevin Hilman

In struct omap_vp_common, the shift value can be derived from the mask value by using __ffs(), so remove the shift value for the various VPCONFIG bitfields, and use __ffs() in the code for the shift value.

While here, rename field names in kerneldoc comment to match actual field names in structure. Also, cleanup indendentaion for other VP register accesses in omap_vp_init().

No functional changes.

---
 arch/arm/mach-omap2/vc.c          |    2 +-
 arch/arm/mach-omap2/voltage.c     |    2 +-
 arch/arm/mach-omap2/vp.c          |   29 ++++++++++++++---------------
 arch/arm/mach-omap2/vp.h          |   34 ++++++++++++++--------------------
 arch/arm/mach-omap2/vp3xxx_data.c |    4 +---
 arch/arm/mach-omap2/vp44xx_data.c |    4 +---
 6 files changed, 32 insertions(+), 43 deletions(-)
arch/arm/mach-omap2/vc.c +1 -1
index d0f87cc..d615a0d 100644
@@ -140,7 +140,7 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
 		vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
 		vp_errgain_val &= voltdm->vp->common->vpconfig_errorgain_mask;
 		vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
-			voltdm->vp->common->vpconfig_errorgain_shift;
+			__ffs(voltdm->vp->common->vpconfig_errorgain_mask);
 		voltdm->write(vp_errgain_val, voltdm->vp->vpconfig);
 	}
 
arch/arm/mach-omap2/voltage.c +1 -1
index eaa5f93..5b16fd1 100644
@@ -82,7 +82,7 @@ static int __init _config_common_vdd_data(struct voltagedomain *voltdm)
 
 	vdd->vp_rt_data.vpconfig_erroroffset =
 		(voltdm->pmic->vp_erroroffset <<
-		 voltdm->vp->common->vpconfig_erroroffset_shift);
+		 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask));
 
 	timeout_val = (sys_clk_speed * voltdm->pmic->vp_timeout_us) / 1000;
 	vdd->vp_rt_data.vlimitto_timeout = timeout_val;
arch/arm/mach-omap2/vp.c +14 -15
index c9a315f..297d094 100644
@@ -34,8 +34,7 @@ static void vp_latch_vsel(struct voltagedomain *voltdm)
 	vpconfig = voltdm->read(vp->vpconfig);
 	vpconfig &= ~(vp->common->vpconfig_initvoltage_mask |
 			vp->common->vpconfig_initvdd);
-	vpconfig |= vsel << vp->common->vpconfig_initvoltage_shift;
-
+	vpconfig |= vsel << __ffs(vp->common->vpconfig_initvoltage_mask);
 	voltdm->write(vpconfig, vp->vpconfig);
 
 	/* Trigger initVDD value copy to voltage processor */
@@ -61,28 +60,28 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
 
 	vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
 		(vdd->vp_rt_data.vpconfig_errorgain <<
-		vp->common->vpconfig_errorgain_shift) |
+		 __ffs(vp->common->vpconfig_errorgain_mask)) |
 		vp->common->vpconfig_timeouten;
 	voltdm->write(vp_val, vp->vpconfig);
 
 	vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin <<
-		vp->common->vstepmin_smpswaittimemin_shift) |
-		(vdd->vp_rt_data.vstepmin_stepmin <<
-		vp->common->vstepmin_stepmin_shift));
+		   vp->common->vstepmin_smpswaittimemin_shift) |
+		  (vdd->vp_rt_data.vstepmin_stepmin <<
+		   vp->common->vstepmin_stepmin_shift));
 	voltdm->write(vp_val, vp->vstepmin);
 
 	vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax <<
-		vp->common->vstepmax_smpswaittimemax_shift) |
-		(vdd->vp_rt_data.vstepmax_stepmax <<
-		vp->common->vstepmax_stepmax_shift));
+		   vp->common->vstepmax_smpswaittimemax_shift) |
+		  (vdd->vp_rt_data.vstepmax_stepmax <<
+		   vp->common->vstepmax_stepmax_shift));
 	voltdm->write(vp_val, vp->vstepmax);
 
 	vp_val = ((vdd->vp_rt_data.vlimitto_vddmax <<
-		vp->common->vlimitto_vddmax_shift) |
-		(vdd->vp_rt_data.vlimitto_vddmin <<
-		vp->common->vlimitto_vddmin_shift) |
-		(vdd->vp_rt_data.vlimitto_timeout <<
-		vp->common->vlimitto_timeout_shift));
+		   vp->common->vlimitto_vddmax_shift) |
+		  (vdd->vp_rt_data.vlimitto_vddmin <<
+		   vp->common->vlimitto_vddmin_shift) |
+		  (vdd->vp_rt_data.vlimitto_timeout <<
+		   vp->common->vlimitto_timeout_shift));
 	voltdm->write(vp_val, vp->vlimitto);
 }
 
@@ -121,7 +120,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 			vp->common->vpconfig_forceupdate |
 			vp->common->vpconfig_initvoltage_mask);
 	vpconfig |= ((target_vsel <<
-			vp->common->vpconfig_initvoltage_shift));
+		      __ffs(vp->common->vpconfig_initvoltage_mask)));
 	voltdm->write(vpconfig, vp->vpconfig);
 
 	/* Trigger initVDD value copy to voltage processor */
arch/arm/mach-omap2/vp.h +14 -20
index 1d63960..2afe11d 100644
@@ -46,37 +46,32 @@ struct omap_vp_ops {
 
 /**
  * struct omap_vp_common - register data common to all VDDs
+ * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
  * @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
+ * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
  * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
  * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
  * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
- * @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
- * @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
- * @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
- * @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
- * @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
- * @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
- * @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
- *
- * XXX It it not necessary to have both a mask and a shift for the same
- *     bitfield - remove one
- * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
+ * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
+ * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
+ * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
+ * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
+ * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
+ * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
+ * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
  */
 struct omap_vp_common {
+	u32 vpconfig_erroroffset_mask;
 	u32 vpconfig_errorgain_mask;
 	u32 vpconfig_initvoltage_mask;
-	u32 vpconfig_timeouten;
-	u32 vpconfig_initvdd;
-	u32 vpconfig_forceupdate;
-	u32 vpconfig_vpenable;
-	u8 vpconfig_erroroffset_shift;
-	u8 vpconfig_errorgain_shift;
-	u8 vpconfig_initvoltage_shift;
+	u8 vpconfig_timeouten;
+	u8 vpconfig_initvdd;
+	u8 vpconfig_forceupdate;
+	u8 vpconfig_vpenable;
 	u8 vstepmin_stepmin_shift;
 	u8 vstepmin_smpswaittimemin_shift;
 	u8 vstepmax_stepmax_shift;
@@ -127,7 +122,6 @@ struct omap_vp_instance {
  * XXX Is this structure really needed?  Why not just program the
  * device directly?  They are in PRM space, therefore in the WKUP
  * powerdomain, so register contents should not be lost in off-mode.
- * XXX Some of these fields are incorrectly named, e.g., vstep*
  */
 struct omap_vp_runtime_data {
 	u32 vpconfig_erroroffset;
arch/arm/mach-omap2/vp3xxx_data.c +1 -3
index 79c3df9..d429c44 100644
@@ -37,10 +37,8 @@ static const struct omap_vp_ops omap3_vp_ops = {
  * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
  */
 static const struct omap_vp_common omap3_vp_common = {
-	.vpconfig_erroroffset_shift = OMAP3430_ERROROFFSET_SHIFT,
+	.vpconfig_erroroffset_mask = OMAP3430_ERROROFFSET_MASK,
 	.vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK,
-	.vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT,
-	.vpconfig_initvoltage_shift = OMAP3430_INITVOLTAGE_SHIFT,
 	.vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK,
 	.vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK,
 	.vpconfig_initvdd = OMAP3430_INITVDD_MASK,
arch/arm/mach-omap2/vp44xx_data.c +1 -3
index 8f75cd9..0daf2a4 100644
@@ -37,10 +37,8 @@ static const struct omap_vp_ops omap4_vp_ops = {
  * XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
  */
 static const struct omap_vp_common omap4_vp_common = {
-	.vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT,
+	.vpconfig_erroroffset_mask = OMAP4430_ERROROFFSET_MASK,
 	.vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK,
-	.vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT,
-	.vpconfig_initvoltage_shift = OMAP4430_INITVOLTAGE_SHIFT,
 	.vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK,
 	.vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK,
 	.vpconfig_initvdd = OMAP4430_INITVDD_MASK,
Signature · 1 line
1.7.6
#4 lore raw

PATCH 4/12 OMAP3+: VP: move SoC-specific sys clock rate retreival late init

In reply to Kevin Hilman

Add sys clock name and rate to struct voltage domain. SoC specific voltagedomain init code initializes sys clock name. After clock framework is initialized, voltage late init will then use use the sys_clk rate to calculate the various timing that depend on that rate.

---
 arch/arm/mach-omap2/voltage.c                 |   47 +++++++++----------------
 arch/arm/mach-omap2/voltage.h                 |    5 +++
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |    8 ++++
 arch/arm/mach-omap2/voltagedomains44xx_data.c |    8 ++++
 4 files changed, 38 insertions(+), 30 deletions(-)
arch/arm/mach-omap2/voltage.c +17 -30
index 5b16fd1..533ea38 100644
@@ -21,10 +21,10 @@
 
 #include <linux/delay.h>
 #include <linux/io.h>
-#include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
+#include <linux/clk.h>
 
 #include <plat/common.h>
 
@@ -45,36 +45,12 @@ static LIST_HEAD(voltdm_list);
 
 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;
+	u32 sys_clk_rate, timeout_val, waittime;
 
-	/*
-	 * XXX Clockfw should handle this, or this should be in a
-	 * struct record
-	 */
-	if (cpu_is_omap24xx() || cpu_is_omap34xx())
-		sys_ck_name = "sys_ck";
-	else if (cpu_is_omap44xx())
-		sys_ck_name = "sys_clkin_ck";
-	else
-		return -EINVAL;
-
-	/*
-	 * Sys clk rate is require to calculate vp timeout value and
-	 * smpswaittimemin and smpswaittimemax.
-	 */
-	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__, voltdm->name);
-		return -EINVAL;
-	}
-	sys_clk_speed = clk_get_rate(sys_ck);
-	clk_put(sys_ck);
 	/* Divide to avoid overflow */
-	sys_clk_speed /= 1000;
+	sys_clk_rate = voltdm->sys_clk.rate / 1000;
+	WARN_ON(!sys_clk_rate);
 
 	/* Generic voltage parameters */
 	vdd->volt_scale = omap_vp_forceupdate_scale;
@@ -84,13 +60,13 @@ static int __init _config_common_vdd_data(struct voltagedomain *voltdm)
 		(voltdm->pmic->vp_erroroffset <<
 		 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask));
 
-	timeout_val = (sys_clk_speed * voltdm->pmic->vp_timeout_us) / 1000;
+	timeout_val = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
 	vdd->vp_rt_data.vlimitto_timeout = timeout_val;
 	vdd->vp_rt_data.vlimitto_vddmin = voltdm->pmic->vp_vddmin;
 	vdd->vp_rt_data.vlimitto_vddmax = voltdm->pmic->vp_vddmax;
 
 	waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
-				sys_clk_speed) / 1000;
+		    sys_clk_rate) / 1000;
 	vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
 	vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime;
 	vdd->vp_rt_data.vstepmin_stepmin = voltdm->pmic->vp_vstepmin;
@@ -346,9 +322,20 @@ int __init omap_voltage_late_init(void)
 	}
 
 	list_for_each_entry(voltdm, &voltdm_list, node) {
+		struct clk *sys_ck;
+
 		if (!voltdm->scalable)
 			continue;
 
+		sys_ck = clk_get(NULL, voltdm->sys_clk.name);
+		if (IS_ERR(sys_ck)) {
+			pr_warning("%s: Could not get sys clk.\n", __func__);
+			return -EINVAL;
+		}
+		voltdm->sys_clk.rate = clk_get_rate(sys_ck);
+		WARN_ON(!voltdm->sys_clk.rate);
+		clk_put(sys_ck);
+
 		if (voltdm->vc) {
 			voltdm->vdd->volt_scale = omap_vc_bypass_scale;
 			omap_vc_init_channel(voltdm);
arch/arm/mach-omap2/voltage.h +5 -0
index 5261703..d73c956 100644
@@ -76,6 +76,11 @@ struct voltagedomain {
 	void (*write) (u32 val, u8 offset);
 	u32 (*rmw)(u32 mask, u32 bits, u8 offset);
 
+	union {
+		const char *name;
+		u32 rate;
+	} sys_clk;
+
 	struct omap_vdd_info *vdd;
 };
 
arch/arm/mach-omap2/voltagedomains3xxx_data.c +8 -0
index 4db2c6c..e7a0be1 100644
@@ -82,8 +82,13 @@ static struct voltagedomain *voltagedomains_omap3[] __initdata = {
 	NULL,
 };
 
+static const char *sys_clk_name __initdata = "sys_ck";
+
 void __init omap3xxx_voltagedomains_init(void)
 {
+	struct voltagedomain *voltdm;
+	int i;
+
 	/*
 	 * XXX Will depend on the process, validation, and binning
 	 * for the currently-running IC
@@ -96,5 +101,8 @@ void __init omap3xxx_voltagedomains_init(void)
 		omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
 	}
 
+	for (i = 0; voltdm = voltagedomains_omap3[i], voltdm; i++)
+		voltdm->sys_clk.name = sys_clk_name;
+
 	voltdm_init(voltagedomains_omap3);
 };
arch/arm/mach-omap2/voltagedomains44xx_data.c +8 -0
index 3e7cb4e..9c20fbb 100644
@@ -98,8 +98,13 @@ static struct voltagedomain *voltagedomains_omap4[] __initdata = {
 	NULL,
 };
 
+static const char *sys_clk_name __initdata = "sys_clkin_ck";
+
 void __init omap44xx_voltagedomains_init(void)
 {
+	struct voltagedomain *voltdm;
+	int i;
+
 	/*
 	 * XXX Will depend on the process, validation, and binning
 	 * for the currently-running IC
@@ -108,5 +113,8 @@ void __init omap44xx_voltagedomains_init(void)
 	omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
 	omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
 
+	for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
+		voltdm->sys_clk.name = sys_clk_name;
+
 	voltdm_init(voltagedomains_omap4);
 };
Signature · 1 line
1.7.6
#5 lore raw

PATCH 5/12 OMAP3+: VP: move timing calculation/config into VP init

In reply to Kevin Hilman

Move VP timing calcluation (based on sys clock) and register programming into VP init.

---
 arch/arm/mach-omap2/voltage.c |   22 ----------------------
 arch/arm/mach-omap2/vp.c      |   23 ++++++++++++++++++++++-
 2 files changed, 22 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/voltage.c +0 -22
index 533ea38..4a15668 100644
@@ -46,31 +46,9 @@ static LIST_HEAD(voltdm_list);
 static int __init _config_common_vdd_data(struct voltagedomain *voltdm)
 {
 	struct omap_vdd_info *vdd = voltdm->vdd;
-	u32 sys_clk_rate, timeout_val, waittime;
-
-	/* Divide to avoid overflow */
-	sys_clk_rate = voltdm->sys_clk.rate / 1000;
-	WARN_ON(!sys_clk_rate);
 
 	/* Generic voltage parameters */
 	vdd->volt_scale = omap_vp_forceupdate_scale;
-	voltdm->vp->enabled = false;
-
-	vdd->vp_rt_data.vpconfig_erroroffset =
-		(voltdm->pmic->vp_erroroffset <<
-		 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask));
-
-	timeout_val = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
-	vdd->vp_rt_data.vlimitto_timeout = timeout_val;
-	vdd->vp_rt_data.vlimitto_vddmin = voltdm->pmic->vp_vddmin;
-	vdd->vp_rt_data.vlimitto_vddmax = voltdm->pmic->vp_vddmax;
-
-	waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
-		    sys_clk_rate) / 1000;
-	vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
-	vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime;
-	vdd->vp_rt_data.vstepmin_stepmin = voltdm->pmic->vp_vstepmin;
-	vdd->vp_rt_data.vstepmax_stepmax = voltdm->pmic->vp_vstepmax;
 
 	return 0;
 }
arch/arm/mach-omap2/vp.c +22 -1
index 297d094..ea61a47 100644
@@ -50,7 +50,7 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
 {
 	struct omap_vp_instance *vp = voltdm->vp;
 	struct omap_vdd_info *vdd = voltdm->vdd;
-	u32 vp_val;
+	u32 vp_val, sys_clk_rate, timeout_val, waittime;
 
 	if (!voltdm->read || !voltdm->write) {
 		pr_err("%s: No read/write API for accessing vdd_%s regs\n",
@@ -58,6 +58,27 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
 		return;
 	}
 
+	vp->enabled = false;
+
+	/* Divide to avoid overflow */
+	sys_clk_rate = voltdm->sys_clk.rate / 1000;
+
+	vdd->vp_rt_data.vpconfig_erroroffset =
+		(voltdm->pmic->vp_erroroffset <<
+		 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask));
+
+	timeout_val = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
+	vdd->vp_rt_data.vlimitto_timeout = timeout_val;
+	vdd->vp_rt_data.vlimitto_vddmin = voltdm->pmic->vp_vddmin;
+	vdd->vp_rt_data.vlimitto_vddmax = voltdm->pmic->vp_vddmax;
+
+	waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
+		    sys_clk_rate) / 1000;
+	vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
+	vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime;
+	vdd->vp_rt_data.vstepmin_stepmin = voltdm->pmic->vp_vstepmin;
+	vdd->vp_rt_data.vstepmax_stepmax = voltdm->pmic->vp_vstepmax;
+
 	vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
 		(vdd->vp_rt_data.vpconfig_errorgain <<
 		 __ffs(vp->common->vpconfig_errorgain_mask)) |
Signature · 1 line
1.7.6
#6 lore raw

PATCH 6/12 OMAP3+: VP: create VP helper function for updating error gain

In reply to Kevin Hilman

Create new helper function in VP layer for updating VP error gain. Currently used during pre-scale for VP force update and VC bypass.

TODO: determine if this can be removed from the pre-scale path and moved to VP enable path.

---
 arch/arm/mach-omap2/vc.c |   19 ++-----------------
 arch/arm/mach-omap2/vp.c |   19 +++++++++++++++++++
 arch/arm/mach-omap2/vp.h |    2 ++
 3 files changed, 23 insertions(+), 17 deletions(-)
arch/arm/mach-omap2/vc.c +2 -17
index d615a0d..38ba13b 100644
@@ -96,9 +96,7 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
 		      u8 *target_vsel, u8 *current_vsel)
 {
 	struct omap_vc_channel *vc = voltdm->vc;
-	struct omap_vdd_info *vdd = voltdm->vdd;
-	struct omap_volt_data *volt_data;
-	u32 vc_cmdval, vp_errgain_val;
+	u32 vc_cmdval;
 
 	/* Check if sufficient pmic info is available for this vdd */
 	if (!voltdm->pmic) {
@@ -120,11 +118,6 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
 		return -EINVAL;
 	}
 
-	/* Get volt_data corresponding to target_volt */
-	volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
-	if (IS_ERR(volt_data))
-		volt_data = NULL;
-
 	*target_vsel = voltdm->pmic->uv_to_vsel(target_volt);
 	*current_vsel = voltdm->pmic->uv_to_vsel(vdd->curr_volt);
 
@@ -134,15 +127,7 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
 	vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift);
 	voltdm->write(vc_cmdval, vc->cmdval_reg);
 
-	/* Setting vp errorgain based on the voltage */
-	if (volt_data) {
-		vp_errgain_val = voltdm->read(voltdm->vp->vpconfig);
-		vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
-		vp_errgain_val &= voltdm->vp->common->vpconfig_errorgain_mask;
-		vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
-			__ffs(voltdm->vp->common->vpconfig_errorgain_mask);
-		voltdm->write(vp_errgain_val, voltdm->vp->vpconfig);
-	}
+	omap_vp_update_errorgain(voltdm, target_volt);
 
 	return 0;
 }
arch/arm/mach-omap2/vp.c +19 -0
index ea61a47..f68a6db 100644
@@ -106,6 +106,25 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
 	voltdm->write(vp_val, vp->vlimitto);
 }
 
+int omap_vp_update_errorgain(struct voltagedomain *voltdm,
+			     unsigned long target_volt)
+{
+	struct omap_volt_data *volt_data;
+
+	/* Get volt_data corresponding to target_volt */
+	volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
+	if (IS_ERR(volt_data))
+		return -EINVAL;
+
+	/* Setting vp errorgain based on the voltage */
+	voltdm->rmw(voltdm->vp->common->vpconfig_errorgain_mask,
+		    volt_data->vp_errgain <<
+		    __ffs(voltdm->vp->common->vpconfig_errorgain_mask),
+		    voltdm->vp->vpconfig);
+
+	return 0;
+}
+
 /* VP force update method of voltage scaling */
 int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 			      unsigned long target_volt)
arch/arm/mach-omap2/vp.h +2 -0
index 2afe11d..71ac738 100644
@@ -148,5 +148,7 @@ void omap_vp_disable(struct voltagedomain *voltdm);
 unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
 int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 			      unsigned long target_volt);
+int omap_vp_update_errorgain(struct voltagedomain *voltdm,
+			     unsigned long target_volt);
 
 #endif
Signature · 1 line
1.7.6
#7 lore raw

PATCH 7/12 OMAP3+: VP: remove omap_vp_runtime_data

In reply to Kevin Hilman

Remove the "runtime" VP data in favor of direct programming of VP registers. The VP is in the PRM, which is in the wakeup powerdomain, so there is no need to keep the state dynamically.

Fixes to original version from Nishanth Menon <[email protected]>

---
 arch/arm/mach-omap2/voltage.h |    2 -
 arch/arm/mach-omap2/vp.c      |   70 ++++++++++++++++++-----------------------
 arch/arm/mach-omap2/vp.h      |   28 ----------------
 3 files changed, 31 insertions(+), 69 deletions(-)
arch/arm/mach-omap2/voltage.h +0 -2
index d73c956..5235eec 100644
@@ -140,13 +140,11 @@ struct omap_voltdm_pmic {
  *
  * @volt_data		: voltage table having the distinct voltages supported
  *			  by the domain and other associated per voltage data.
- * @vp_rt_data          : VP data derived at runtime, not predefined
  * @curr_volt		: current voltage for this vdd.
  * @volt_scale		: API to scale the voltage of the vdd.
  */
 struct omap_vdd_info {
 	struct omap_volt_data *volt_data;
-	struct omap_vp_runtime_data vp_rt_data;
 	u32 curr_volt;
 
 	int (*volt_scale) (struct voltagedomain *voltdm,
arch/arm/mach-omap2/vp.c +31 -39

86 lines not on this page · raw message

arch/arm/mach-omap2/vp.h +0 -28
index 71ac738..0d63267 100644
@@ -107,34 +107,6 @@ struct omap_vp_instance {
 	bool enabled;
 };
 
-/**
- * struct omap_vp_runtime_data - VP data populated at runtime by code
- * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
- * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
- * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
- * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
- * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
- * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
- * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
- * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
- * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
- *
- * XXX Is this structure really needed?  Why not just program the
- * device directly?  They are in PRM space, therefore in the WKUP
- * powerdomain, so register contents should not be lost in off-mode.
- */
-struct omap_vp_runtime_data {
-	u32 vpconfig_erroroffset;
-	u16 vpconfig_errorgain;
-	u16 vstepmin_smpswaittimemin;
-	u16 vstepmax_smpswaittimemax;
-	u16 vlimitto_timeout;
-	u8 vstepmin_stepmin;
-	u8 vstepmax_stepmax;
-	u8 vlimitto_vddmin;
-	u8 vlimitto_vddmax;
-};
-
 extern struct omap_vp_instance omap3_vp_mpu;
 extern struct omap_vp_instance omap3_vp_core;
 
Signature · 1 line
1.7.6
#9 lore raw

PATCH 9/12 OMAP: VP: Explicitly mask VPVOLTAGE field

In reply to Kevin Hilman

From: Todd Poynor <[email protected]>

Reading the VPVOLTAGE field of PRM_VP_*_VOLTAGE registers currently relies on a u32 -> u8 conversion to mask off the FORCEUPDATEWAIT field in the upper bits. Make this explicit using the mask symbol already defined, added as a new field in struct omap_vp_common.

---
 arch/arm/mach-omap2/vp.c          |    3 ++-
 arch/arm/mach-omap2/vp.h          |    2 ++
 arch/arm/mach-omap2/vp3xxx_data.c |    2 ++
 arch/arm/mach-omap2/vp44xx_data.c |    1 +
 4 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/vp.c +2 -1
index e7d38f6..3807620 100644
@@ -227,7 +227,8 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
 		return 0;
 	}
 
-	curr_vsel = voltdm->read(vp->voltage);
+	curr_vsel = (voltdm->read(vp->voltage) & vp->common->vpvoltage_mask)
+		>> __ffs(vp->common->vpvoltage_mask);
 
 	if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv) {
 		pr_warning("%s: PMIC function to convert vsel to voltage"
arch/arm/mach-omap2/vp.h +2 -0
index 0d63267..f78752b 100644
@@ -63,6 +63,7 @@ struct omap_vp_ops {
  * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
  * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
  * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
+ * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
  */
 struct omap_vp_common {
 	u32 vpconfig_erroroffset_mask;
@@ -79,6 +80,7 @@ struct omap_vp_common {
 	u8 vlimitto_vddmin_shift;
 	u8 vlimitto_vddmax_shift;
 	u8 vlimitto_timeout_shift;
+	u8 vpvoltage_mask;
 
 	const struct omap_vp_ops *ops;
 };
arch/arm/mach-omap2/vp3xxx_data.c +2 -0
index d429c44..260c554 100644
@@ -51,6 +51,8 @@ static const struct omap_vp_common omap3_vp_common = {
 	.vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT,
 	.vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT,
 	.vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT,
+	.vpvoltage_mask = OMAP3430_VPVOLTAGE_MASK,
+
 	.ops = &omap3_vp_ops,
 };
 
arch/arm/mach-omap2/vp44xx_data.c +1 -0
index 0daf2a4..b4e7704 100644
@@ -51,6 +51,7 @@ static const struct omap_vp_common omap4_vp_common = {
 	.vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT,
 	.vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT,
 	.vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT,
+	.vpvoltage_mask = OMAP4430_VPVOLTAGE_MASK,
 	.ops = &omap4_vp_ops,
 };
 
Signature · 1 line
1.7.6
#8 lore raw

PATCH 8/12 OMAP3+: VP: move voltage scale function pointer into struct voltagedomain

In reply to Kevin Hilman

Function pointer used for actual voltage scaling (e.g. VP force update or VC bypass) is moved from omap_vdd_info into struct voltagedomain, resulting in renames s/vdd->volt_scale/voltdm->scale/

No functional changes.

---
 arch/arm/mach-omap2/voltage.c |   24 +++++++-----------------
 arch/arm/mach-omap2/voltage.h |    8 ++++----
 2 files changed, 11 insertions(+), 21 deletions(-)
arch/arm/mach-omap2/voltage.c +7 -17
index 4a15668..32f0873 100644
@@ -45,10 +45,8 @@ static LIST_HEAD(voltdm_list);
 
 static int __init _config_common_vdd_data(struct voltagedomain *voltdm)
 {
-	struct omap_vdd_info *vdd = voltdm->vdd;
-
 	/* Generic voltage parameters */
-	vdd->volt_scale = omap_vp_forceupdate_scale;
+	voltdm->scale = omap_vp_forceupdate_scale;
 
 	return 0;
 }
@@ -107,22 +105,18 @@ unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm)
 int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
 		unsigned long target_volt)
 {
-	struct omap_vdd_info *vdd;
-
 	if (!voltdm || IS_ERR(voltdm)) {
 		pr_warning("%s: VDD specified does not exist!\n", __func__);
 		return -EINVAL;
 	}
 
-	vdd = voltdm->vdd;
-
-	if (!vdd->volt_scale) {
+	if (!voltdm->scale) {
 		pr_err("%s: No voltage scale API registered for vdd_%s\n",
 			__func__, voltdm->name);
 		return -ENODATA;
 	}
 
-	return vdd->volt_scale(voltdm, target_volt);
+	return voltdm->scale(voltdm, target_volt);
 }
 
 /**
@@ -258,23 +252,19 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
  * defined in voltage.h
  */
 void omap_change_voltscale_method(struct voltagedomain *voltdm,
-		int voltscale_method)
+				  int voltscale_method)
 {
-	struct omap_vdd_info *vdd;
-
 	if (!voltdm || IS_ERR(voltdm)) {
 		pr_warning("%s: VDD specified does not exist!\n", __func__);
 		return;
 	}
 
-	vdd = voltdm->vdd;
-
 	switch (voltscale_method) {
 	case VOLTSCALE_VPFORCEUPDATE:
-		vdd->volt_scale = omap_vp_forceupdate_scale;
+		voltdm->scale = omap_vp_forceupdate_scale;
 		return;
 	case VOLTSCALE_VCBYPASS:
-		vdd->volt_scale = omap_vc_bypass_scale;
+		voltdm->scale = omap_vc_bypass_scale;
 		return;
 	default:
 		pr_warning("%s: Trying to change the method of voltage scaling"
@@ -315,7 +305,7 @@ int __init omap_voltage_late_init(void)
 		clk_put(sys_ck);
 
 		if (voltdm->vc) {
-			voltdm->vdd->volt_scale = omap_vc_bypass_scale;
+			voltdm->scale = omap_vc_bypass_scale;
 			omap_vc_init_channel(voltdm);
 		}
 
arch/arm/mach-omap2/voltage.h +4 -4
index 5235eec..d2a0c24 100644
@@ -60,6 +60,7 @@ struct omap_vfsm_instance {
  * @pwrdm_node: list_head linking all powerdomains in this voltagedomain
  * @vdd: to be removed
  * @pwrdms: powerdomains in this voltagedomain
+ * @scale: function used to scale the voltage of the voltagedomain
  */
 struct voltagedomain {
 	char *name;
@@ -81,6 +82,9 @@ struct voltagedomain {
 		u32 rate;
 	} sys_clk;
 
+	int (*scale) (struct voltagedomain *voltdm,
+		      unsigned long target_volt);
+
 	struct omap_vdd_info *vdd;
 };
 
@@ -141,14 +145,10 @@ struct omap_voltdm_pmic {
  * @volt_data		: voltage table having the distinct voltages supported
  *			  by the domain and other associated per voltage data.
  * @curr_volt		: current voltage for this vdd.
- * @volt_scale		: API to scale the voltage of the vdd.
  */
 struct omap_vdd_info {
 	struct omap_volt_data *volt_data;
 	u32 curr_volt;
-
-	int (*volt_scale) (struct voltagedomain *voltdm,
-		unsigned long target_volt);
 };
 
 int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
Signature · 1 line
1.7.6
#11 lore raw

PATCH 10/12 OMAP3+: VP: update_errorgain(): return error if VP

In reply to Kevin Hilman

Add check for valid VP in omap_vp_update_errorgain()

---
 arch/arm/mach-omap2/vp.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/vp.c +3 -0
index 3807620..29698ac 100644
@@ -103,6 +103,9 @@ int omap_vp_update_errorgain(struct voltagedomain *voltdm,
 {
 	struct omap_volt_data *volt_data;
 
+	if (!voltdm->vp)
+		return -EINVAL;
+
 	/* Get volt_data corresponding to target_volt */
 	volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
 	if (IS_ERR(volt_data))
Signature · 1 line
1.7.6
#13 lore raw

PATCH 12/12 OMAP3+: VP: combine setting init voltage into common function

In reply to Kevin Hilman

combine VPCONFIG init voltage setup into common function and use from both vp_enable and from vp_forceupdate_scale().

NOTE: this patch changes the sequence of when the initVDD bit is cleared. The bit is now cleared immediately after it was written. Since only the rising edge of this bit has any affect according to the TRM, the exact timing of clearing of this bit should not have any effect.

---
 arch/arm/mach-omap2/vp.c |   58 +++++++++++++++-------------------------------
 1 files changed, 19 insertions(+), 39 deletions(-)
arch/arm/mach-omap2/vp.c +19 -39
index 24020ea..66bd700 100644
@@ -9,31 +9,18 @@
 #include "prm-regbits-44xx.h"
 #include "prm44xx.h"
 
-static void vp_latch_vsel(struct voltagedomain *voltdm)
+static u32 _vp_set_init_voltage(struct voltagedomain *voltdm, u32 volt)
 {
 	struct omap_vp_instance *vp = voltdm->vp;
 	u32 vpconfig;
-	unsigned long uvdc;
 	char vsel;
 
-	uvdc = omap_voltage_get_nom_volt(voltdm);
-	if (!uvdc) {
-		pr_warning("%s: unable to find current voltage for vdd_%s\n",
-			__func__, voltdm->name);
-		return;
-	}
-
-	if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) {
-		pr_warning("%s: PMIC function to convert voltage in uV to"
-			" vsel not registered\n", __func__);
-		return;
-	}
-
-	vsel = voltdm->pmic->uv_to_vsel(uvdc);
+	vsel = voltdm->pmic->uv_to_vsel(volt);
 
 	vpconfig = voltdm->read(vp->vpconfig);
 	vpconfig &= ~(vp->common->vpconfig_initvoltage_mask |
-			vp->common->vpconfig_initvdd);
+		      vp->common->vpconfig_forceupdate |
+		      vp->common->vpconfig_initvdd);
 	vpconfig |= vsel << __ffs(vp->common->vpconfig_initvoltage_mask);
 	voltdm->write(vpconfig, vp->vpconfig);
 
@@ -43,6 +30,8 @@ static void vp_latch_vsel(struct voltagedomain *voltdm)
 
 	/* Clear initVDD copy trigger bit */
 	voltdm->write(vpconfig, vp->vpconfig);
+
+	return vpconfig;
 }
 
 /* Generic voltage init functions */
@@ -149,22 +138,11 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 		return -ETIMEDOUT;
 	}
 
-	/* Configure for VP-Force Update */
-	vpconfig = voltdm->read(vp->vpconfig);
-	vpconfig &= ~(vp->common->vpconfig_initvdd |
-			vp->common->vpconfig_forceupdate |
-			vp->common->vpconfig_initvoltage_mask);
-	vpconfig |= ((target_vsel <<
-		      __ffs(vp->common->vpconfig_initvoltage_mask)));
-	voltdm->write(vpconfig, vp->vpconfig);
-
-	/* Trigger initVDD value copy to voltage processor */
-	vpconfig |= vp->common->vpconfig_initvdd;
-	voltdm->write(vpconfig, vp->vpconfig);
+	vpconfig = _vp_set_init_voltage(voltdm, target_volt);
 
 	/* Force update of voltage */
-	vpconfig |= vp->common->vpconfig_forceupdate;
-	voltdm->write(vpconfig, vp->vpconfig);
+	voltdm->write(vpconfig | vp->common->vpconfig_forceupdate,
+		      voltdm->vp->vpconfig);
 
 	/*
 	 * Wait for TransactionDone. Typical latency is <200us.
@@ -197,12 +175,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 			"to clear the TRANXDONE status\n",
 			__func__, voltdm->name);
 
-	vpconfig = voltdm->read(vp->vpconfig);
-	/* Clear initVDD copy trigger bit */
-	vpconfig &= ~vp->common->vpconfig_initvdd;
-	voltdm->write(vpconfig, vp->vpconfig);
 	/* Clear force bit */
-	vpconfig &= ~vp->common->vpconfig_forceupdate;
 	voltdm->write(vpconfig, vp->vpconfig);
 
 	return 0;
@@ -218,7 +191,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 void omap_vp_enable(struct voltagedomain *voltdm)
 {
 	struct omap_vp_instance *vp;
-	u32 vpconfig;
+	u32 vpconfig, volt;
 
 	if (!voltdm || IS_ERR(voltdm)) {
 		pr_warning("%s: VDD specified does not exist!\n", __func__);
@@ -236,12 +209,19 @@ void omap_vp_enable(struct voltagedomain *voltdm)
 	if (vp->enabled)
 		return;
 
-	vp_latch_vsel(voltdm);
+	volt = voltdm_get_voltage(voltdm);
+	if (!volt) {
+		pr_warning("%s: unable to find current voltage for %s\n",
+			   __func__, voltdm->name);
+		return;
+	}
+
+	vpconfig = _vp_set_init_voltage(voltdm, volt);
 
 	/* Enable VP */
-	vpconfig = voltdm->read(vp->vpconfig);
 	vpconfig |= vp->common->vpconfig_vpenable;
 	voltdm->write(vpconfig, vp->vpconfig);
+
 	vp->enabled = true;
 }
 
Signature · 1 line
1.7.6
#12 lore raw

PATCH 11/12 OMAP3+: VP: remove unused omap_vp_get_curr_volt()

In reply to Kevin Hilman
---
 arch/arm/mach-omap2/vp.c |   34 ----------------------------------
 arch/arm/mach-omap2/vp.h |    1 -
 2 files changed, 0 insertions(+), 35 deletions(-)
arch/arm/mach-omap2/vp.c +0 -34
index 29698ac..24020ea 100644
@@ -209,40 +209,6 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 }
 
 /**
- * omap_vp_get_curr_volt() - API to get the current vp voltage.
- * @voltdm:	pointer to the VDD.
- *
- * This API returns the current voltage for the specified voltage processor
- */
-unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
-{
-	struct omap_vp_instance *vp = voltdm->vp;
-	u8 curr_vsel;
-
-	if (!voltdm || IS_ERR(voltdm)) {
-		pr_warning("%s: VDD specified does not exist!\n", __func__);
-		return 0;
-	}
-
-	if (!voltdm->read) {
-		pr_err("%s: No read API for reading vdd_%s regs\n",
-			__func__, voltdm->name);
-		return 0;
-	}
-
-	curr_vsel = (voltdm->read(vp->voltage) & vp->common->vpvoltage_mask)
-		>> __ffs(vp->common->vpvoltage_mask);
-
-	if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv) {
-		pr_warning("%s: PMIC function to convert vsel to voltage"
-			"in uV not registerd\n", __func__);
-		return 0;
-	}
-
-	return voltdm->pmic->vsel_to_uv(curr_vsel);
-}
-
-/**
  * omap_vp_enable() - API to enable a particular VP
  * @voltdm:	pointer to the VDD whose VP is to be enabled.
  *
arch/arm/mach-omap2/vp.h +0 -1
index f78752b..d9bc4f1 100644
@@ -119,7 +119,6 @@ extern struct omap_vp_instance omap4_vp_core;
 void omap_vp_init(struct voltagedomain *voltdm);
 void omap_vp_enable(struct voltagedomain *voltdm);
 void omap_vp_disable(struct voltagedomain *voltdm);
-unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
 int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 			      unsigned long target_volt);
 int omap_vp_update_errorgain(struct voltagedomain *voltdm,
Signature · 1 line
1.7.6
#10 lore raw

PATCH 9/12 OMAP: VP: Explicitly mask VPVOLTAGE field

In reply to Kevin Hilman

Kevin,

Quoted 27 lines · Kevin Hilman

From: Todd Poynor <[email protected]>

Reading the VPVOLTAGE field of PRM_VP_*_VOLTAGE registers currently relies on a u32 -> u8 conversion to mask off the FORCEUPDATEWAIT field in the upper bits. ?Make this explicit using the mask symbol already defined, added as a new field in struct omap_vp_common.

---

?arch/arm/mach-omap2/vp.c ? ? ? ? ?| ? ?3 ++-
?arch/arm/mach-omap2/vp.h ? ? ? ? ?| ? ?2 ++
?arch/arm/mach-omap2/vp3xxx_data.c | ? ?2 ++
?arch/arm/mach-omap2/vp44xx_data.c | ? ?1 +

?4 files changed, 7 insertions(+), 1 deletions(-)

arch/arm/mach-omap2/vp.c +2 -1
index e7d38f6..3807620 100644
@@ -227,7 +227,8 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
 ? ? ? ? ? ? ? ?return 0;
 ? ? ? ?}
 
- ? ? ? curr_vsel = voltdm->read(vp->voltage);
+ ? ? ? curr_vsel = (voltdm->read(vp->voltage) & vp->common->vpvoltage_mask)
+ ? ? ? ? ? ? ? >> __ffs(vp->common->vpvoltage_mask);
#14 lore raw

cover OMAP: voltage cleanup part C: VP cleanup

In reply to Kevin Hilman

Kevin,

Quoted 10 lines · Kevin Hilman

This series focuses on cleanup and better abstraction in the voltage processor (VP) layer.

Available in the pm-wip/voltdm_c branch of my linux-omap-pm tree
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git

Applies on v3.1-rc3 + the part A & B series.

Kevin

Some comments have been sent on this patch set, otherwise OK after review.

FWIW:

Regards,
Jean

Quoted 38 lines

Kevin Hilman (11):
?OMAP3+: VP: cleanup: move VP instance into voltdm, misc. renames ?OMAP3+: voltage: remove unneeded debugfs interface ?OMAP3+: VP: struct omap_vp_common: replace shift with __ffs(mask) ?OMAP3+: VP: move SoC-specific sys clock rate retreival late init ?OMAP3+: VP: move timing calculation/config into VP init ?OMAP3+: VP: create VP helper function for updating error gain ?OMAP3+: VP: remove omap_vp_runtime_data
?OMAP3+: VP: move voltage scale function pointer into struct ? ?voltagedomain
?OMAP3+: VP: update_errorgain(): return error if VP ?OMAP3+: VP: remove unused omap_vp_get_curr_volt() ?OMAP3+: VP: combine setting init voltage into common function

Todd Poynor (1):
?OMAP: VP: Explicitly mask VPVOLTAGE field

?arch/arm/mach-omap2/smartreflex.c ? ? ? ? ? ? | ? 29 ++-
?arch/arm/mach-omap2/vc.c ? ? ? ? ? ? ? ? ? ? ?| ? 22 +--
?arch/arm/mach-omap2/voltage.c ? ? ? ? ? ? ? ? | ?161 ++------------
?arch/arm/mach-omap2/voltage.h ? ? ? ? ? ? ? ? | ? 24 +--
?arch/arm/mach-omap2/voltagedomains3xxx_data.c | ? 18 +-
?arch/arm/mach-omap2/voltagedomains44xx_data.c | ? 23 ++-
?arch/arm/mach-omap2/vp.c ? ? ? ? ? ? ? ? ? ? ?| ?292 +++++++++----------------
?arch/arm/mach-omap2/vp.h ? ? ? ? ? ? ? ? ? ? ?| ? 91 +++-----
?arch/arm/mach-omap2/vp3xxx_data.c ? ? ? ? ? ? | ? 16 +-
?arch/arm/mach-omap2/vp44xx_data.c ? ? ? ? ? ? | ? 19 +-

?10 files changed, 226 insertions(+), 469 deletions(-)

--
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html