All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up
@ 2011-03-15 14:33 Vishwanath BS
  2011-03-15 14:33 ` [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters Vishwanath BS
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Vishwanath BS @ 2011-03-15 14:33 UTC (permalink / raw)
  To: linux-omap; +Cc: Vishwanath BS

This patch series attempts to do some more clean up on OMAP Voltage layer on top
of the clean up done by Paul as part of
https://patchwork.kernel.org/patch/591421/

These patches are generated against latest omap-for-linus branch on Tony's tree
(commit id: 05f689400ea5fa3d71af82f910c8b140f87ad1f3) and tested on OMAP ZOOM3
and OMAP4430 SDP with Smartreflex enabled.

Vishwanath BS (3):
  OMAP PM: Seggregate Voltage layer parameters
  OMAP PM: Add support for bypassing VP/VC in Voltage layer
  OMAP PM: Add Board specific parameters for OMAP Volatge layer

 arch/arm/mach-omap2/board-4430sdp.c           |   52 +++++++
 arch/arm/mach-omap2/board-zoom.c              |   79 +++++++++++
 arch/arm/mach-omap2/omap_opp_data.h           |    8 +
 arch/arm/mach-omap2/omap_twl.c                |  113 ++++++++--------
 arch/arm/mach-omap2/opp3xxx_data.c            |   50 +++++++
 arch/arm/mach-omap2/opp4xxx_data.c            |   38 +++++
 arch/arm/mach-omap2/voltage.c                 |  179 ++++++++++++++++++++-----
 arch/arm/mach-omap2/voltage.h                 |  119 +++++++++++++++--
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |    4 +
 arch/arm/mach-omap2/voltagedomains44xx_data.c |    4 +
 10 files changed, 541 insertions(+), 105 deletions(-)


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters
  2011-03-15 14:33 [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Vishwanath BS
@ 2011-03-15 14:33 ` Vishwanath BS
  2011-03-17 23:20   ` Kevin Hilman
  2011-04-02  0:03   ` Kevin Hilman
  2011-03-15 14:33 ` [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer Vishwanath BS
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 18+ messages in thread
From: Vishwanath BS @ 2011-03-15 14:33 UTC (permalink / raw)
  To: linux-omap; +Cc: Vishwanath BS

Voltage layer takes various parameters which can be broadly classified as
1. OMAP/VP specific parameters
2. PMIC specific parameters
3. Board specific parameters

This patch attempts to categorize the parameters in current voltage layer into
above buckets. This will make voltage layer to work with different kinds of PMIC
and boards.

TODO: Provide infrastructure to use VC I2C (I2C4) for PMIC configuration (useful
for cases where PMIC is connected to OMAP only via I2C4.

Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/omap_opp_data.h           |    8 ++
 arch/arm/mach-omap2/omap_twl.c                |  108 ++++++++---------
 arch/arm/mach-omap2/opp3xxx_data.c            |   50 ++++++++
 arch/arm/mach-omap2/opp4xxx_data.c            |   38 ++++++
 arch/arm/mach-omap2/voltage.c                 |  167 ++++++++++++++++++++-----
 arch/arm/mach-omap2/voltage.h                 |  115 +++++++++++++++--
 arch/arm/mach-omap2/voltagedomains3xxx_data.c |    4 +
 arch/arm/mach-omap2/voltagedomains44xx_data.c |    4 +
 8 files changed, 393 insertions(+), 101 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h
index c784c12..70d61d2 100644
--- a/arch/arm/mach-omap2/omap_opp_data.h
+++ b/arch/arm/mach-omap2/omap_opp_data.h
@@ -86,11 +86,19 @@ extern int __init omap_init_opp_table(struct omap_opp_def *opp_def,
 
 extern struct omap_volt_data omap34xx_vddmpu_volt_data[];
 extern struct omap_volt_data omap34xx_vddcore_volt_data[];
+extern struct omap_vp_param omap34xx_mpu_vp_data;
+extern struct omap_vp_param omap34xx_core_vp_data;
+
 extern struct omap_volt_data omap36xx_vddmpu_volt_data[];
 extern struct omap_volt_data omap36xx_vddcore_volt_data[];
+extern struct omap_vp_param omap36xx_mpu_vp_data;
+extern struct omap_vp_param omap36xx_core_vp_data;
 
 extern struct omap_volt_data omap44xx_vdd_mpu_volt_data[];
 extern struct omap_volt_data omap44xx_vdd_iva_volt_data[];
 extern struct omap_volt_data omap44xx_vdd_core_volt_data[];
+extern struct omap_vp_param omap44xx_mpu_vp_data;
+extern struct omap_vp_param omap44xx_iva_vp_data;
+extern struct omap_vp_param omap44xx_core_vp_data;
 
 #endif		/* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 0a8e74e..f96d4b2 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -29,7 +29,6 @@
 #define OMAP3_VP_VSTEPMIN_VSTEPMIN	0x1
 #define OMAP3_VP_VSTEPMAX_VSTEPMAX	0x04
 #define OMAP3_VP_VLIMITTO_TIMEOUT_US	200
-
 #define OMAP3430_VP1_VLIMITTO_VDDMIN	0x14
 #define OMAP3430_VP1_VLIMITTO_VDDMAX	0x42
 #define OMAP3430_VP2_VLIMITTO_VDDMIN	0x18
@@ -44,12 +43,10 @@
 #define OMAP4_VDD_MPU_SR_VOLT_REG	0x55
 #define OMAP4_VDD_IVA_SR_VOLT_REG	0x5B
 #define OMAP4_VDD_CORE_SR_VOLT_REG	0x61
-
 #define OMAP4_VP_CONFIG_ERROROFFSET	0x00
 #define OMAP4_VP_VSTEPMIN_VSTEPMIN	0x01
 #define OMAP4_VP_VSTEPMAX_VSTEPMAX	0x04
 #define OMAP4_VP_VLIMITTO_TIMEOUT_US	200
-
 #define OMAP4_VP_MPU_VLIMITTO_VDDMIN	0xA
 #define OMAP4_VP_MPU_VLIMITTO_VDDMAX	0x39
 #define OMAP4_VP_IVA_VLIMITTO_VDDMIN	0xA
@@ -146,101 +143,96 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
 static struct omap_volt_pmic_info omap3_mpu_volt_info = {
 	.slew_rate		= 4000,
 	.step_size		= 12500,
-	.on_volt		= 1200000,
-	.onlp_volt		= 1000000,
-	.ret_volt		= 975000,
-	.off_volt		= 600000,
-	.volt_setup_time	= 0xfff,
-	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET,
-	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
-	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
+	.vp_timeout_us	= OMAP3_VP_VLIMITTO_TIMEOUT_US,
+	.i2c_slave_addr	= OMAP3_SRI2C_SLAVE_ADDR,
+	.pmic_reg		= OMAP3_VDD_MPU_SR_CONTROL_REG,
+	.vp_erroroffset	= OMAP3_VP_CONFIG_ERROROFFSET,
+	.vp_vstepmin	= OMAP3_VP_VSTEPMIN_VSTEPMIN,
+	.vp_vstepmax	= OMAP3_VP_VSTEPMAX_VSTEPMAX,
 	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
 	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,
-	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US,
-	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
-	.pmic_reg		= OMAP3_VDD_MPU_SR_CONTROL_REG,
 	.vsel_to_uv		= twl4030_vsel_to_uv,
 	.uv_to_vsel		= twl4030_uv_to_vsel,
+	.on_cmd			= twl4030_uv_to_vsel,
+	.onlp_cmd		= twl4030_uv_to_vsel,
+	.ret_cmd		= twl4030_uv_to_vsel,
+	.off_cmd		= twl4030_uv_to_vsel,
 };
 
 static struct omap_volt_pmic_info omap3_core_volt_info = {
 	.slew_rate		= 4000,
 	.step_size		= 12500,
-	.on_volt                = 1200000,
-	.onlp_volt              = 1000000,
-	.ret_volt               = 975000,
-	.off_volt               = 600000,
-	.volt_setup_time        = 0xfff,
-	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET,
-	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
-	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
+	.vp_timeout_us	= OMAP3_VP_VLIMITTO_TIMEOUT_US,
+	.i2c_slave_addr	= OMAP3_SRI2C_SLAVE_ADDR,
+	.pmic_reg		= OMAP3_VDD_CORE_SR_CONTROL_REG,
+	.vp_erroroffset	= OMAP3_VP_CONFIG_ERROROFFSET,
+	.vp_vstepmin	= OMAP3_VP_VSTEPMIN_VSTEPMIN,
+	.vp_vstepmax	= OMAP3_VP_VSTEPMAX_VSTEPMAX,
 	.vp_vddmin		= OMAP3430_VP2_VLIMITTO_VDDMIN,
 	.vp_vddmax		= OMAP3430_VP2_VLIMITTO_VDDMAX,
-	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US,
-	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
-	.pmic_reg		= OMAP3_VDD_CORE_SR_CONTROL_REG,
 	.vsel_to_uv		= twl4030_vsel_to_uv,
 	.uv_to_vsel		= twl4030_uv_to_vsel,
+	.on_cmd			= twl4030_uv_to_vsel,
+	.onlp_cmd		= twl4030_uv_to_vsel,
+	.ret_cmd		= twl4030_uv_to_vsel,
+	.off_cmd		= twl4030_uv_to_vsel,
 };
 
 static struct omap_volt_pmic_info omap4_mpu_volt_info = {
 	.slew_rate		= 4000,
 	.step_size		= 12500,
-	.on_volt		= 1350000,
-	.onlp_volt		= 1350000,
-	.ret_volt		= 837500,
-	.off_volt		= 600000,
-	.volt_setup_time	= 0,
-	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
-	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
-	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
+	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
+	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
+	.pmic_reg		= OMAP4_VDD_MPU_SR_VOLT_REG,
+	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
+	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
+	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
 	.vp_vddmin		= OMAP4_VP_MPU_VLIMITTO_VDDMIN,
 	.vp_vddmax		= OMAP4_VP_MPU_VLIMITTO_VDDMAX,
-	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
-	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
-	.pmic_reg		= OMAP4_VDD_MPU_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
+	.on_cmd			= twl4030_uv_to_vsel,
+	.onlp_cmd		= twl4030_uv_to_vsel,
+	.ret_cmd		= twl4030_uv_to_vsel,
+	.off_cmd		= twl4030_uv_to_vsel,
 };
 
 static struct omap_volt_pmic_info omap4_iva_volt_info = {
 	.slew_rate		= 4000,
 	.step_size		= 12500,
-	.on_volt		= 1100000,
-	.onlp_volt		= 1100000,
-	.ret_volt		= 837500,
-	.off_volt		= 600000,
-	.volt_setup_time	= 0,
-	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
-	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
-	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
+	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
+	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
+	.pmic_reg		= OMAP4_VDD_IVA_SR_VOLT_REG,
+	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
+	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
+	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
 	.vp_vddmin		= OMAP4_VP_IVA_VLIMITTO_VDDMIN,
 	.vp_vddmax		= OMAP4_VP_IVA_VLIMITTO_VDDMAX,
-	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
-	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
-	.pmic_reg		= OMAP4_VDD_IVA_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
+	.on_cmd			= twl4030_uv_to_vsel,
+	.onlp_cmd		= twl4030_uv_to_vsel,
+	.ret_cmd		= twl4030_uv_to_vsel,
+	.off_cmd		= twl4030_uv_to_vsel,
 };
 
 static struct omap_volt_pmic_info omap4_core_volt_info = {
 	.slew_rate		= 4000,
 	.step_size		= 12500,
-	.on_volt		= 1100000,
-	.onlp_volt		= 1100000,
-	.ret_volt		= 837500,
-	.off_volt		= 600000,
-	.volt_setup_time	= 0,
-	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
-	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
-	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
+	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
+	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
+	.pmic_reg		= OMAP4_VDD_CORE_SR_VOLT_REG,
+	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
+	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
+	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
 	.vp_vddmin		= OMAP4_VP_CORE_VLIMITTO_VDDMIN,
 	.vp_vddmax		= OMAP4_VP_CORE_VLIMITTO_VDDMAX,
-	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
-	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
-	.pmic_reg		= OMAP4_VDD_CORE_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
+	.on_cmd			= twl4030_uv_to_vsel,
+	.onlp_cmd		= twl4030_uv_to_vsel,
+	.ret_cmd		= twl4030_uv_to_vsel,
+	.off_cmd		= twl4030_uv_to_vsel,
 };
 
 int __init omap4_twl_init(void)
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
index d95f3f9..a614baf 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -26,6 +26,16 @@
 #include "pm.h"
 
 /* 34xx */
+/* OMAP VP parameter values */
+#define OMAP3430_VP1_VLIMITTO_VDDMIN	0x14
+#define OMAP3430_VP1_VLIMITTO_VDDMAX	0x42
+#define OMAP3430_VP2_VLIMITTO_VDDMIN	0x18
+#define OMAP3430_VP2_VLIMITTO_VDDMAX	0x2c
+
+#define OMAP3_ON_VOLTAGE_UV				1200000
+#define OMAP3_ONLP_VOLTAGE_UV			1000000
+#define OMAP3_RET_VOLTAGE_UV			975000
+#define OMAP3_OFF_VOLTAGE_UV			600000
 
 /* VDD1 */
 
@@ -44,6 +54,15 @@ struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
+struct omap_vp_param omap34xx_mpu_vp_data = {
+	.on_volt		= OMAP3_ON_VOLTAGE_UV,
+	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
+	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
+	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
+	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
+	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,
+};
+
 /* VDD2 */
 
 #define OMAP3430_VDD_CORE_OPP1_UV		975000
@@ -57,7 +76,20 @@ struct omap_volt_data omap34xx_vddcore_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
+struct omap_vp_param omap34xx_core_vp_data = {
+	.on_volt		= OMAP3_ON_VOLTAGE_UV,
+	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
+	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
+	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
+	.vp_vddmin		= OMAP3430_VP2_VLIMITTO_VDDMIN,
+	.vp_vddmax		= OMAP3430_VP2_VLIMITTO_VDDMAX,
+};
+
 /* 36xx */
+#define OMAP3630_VP1_VLIMITTO_VDDMIN	0x18
+#define OMAP3630_VP1_VLIMITTO_VDDMAX	0x3c
+#define OMAP3630_VP2_VLIMITTO_VDDMIN	0x18
+#define OMAP3630_VP2_VLIMITTO_VDDMAX	0x30
 
 /* VDD1 */
 
@@ -74,6 +106,14 @@ struct omap_volt_data omap36xx_vddmpu_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
+struct omap_vp_param omap36xx_mpu_vp_data = {
+	.on_volt		= OMAP3_ON_VOLTAGE_UV,
+	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
+	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
+	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
+	.vp_vddmin		= OMAP3630_VP1_VLIMITTO_VDDMIN,
+	.vp_vddmax		= OMAP3630_VP1_VLIMITTO_VDDMAX,
+};
 /* VDD2 */
 
 #define OMAP3630_VDD_CORE_OPP50_UV		1000000
@@ -85,6 +125,16 @@ struct omap_volt_data omap36xx_vddcore_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
+struct omap_vp_param omap36xx_core_vp_data = {
+	.on_volt		= OMAP3_ON_VOLTAGE_UV,
+	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
+	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
+	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
+	.vp_vddmin		= OMAP3630_VP2_VLIMITTO_VDDMIN,
+	.vp_vddmax		= OMAP3630_VP2_VLIMITTO_VDDMAX,
+};
+
+
 /* OPP data */
 
 static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c
index 2293ba2..d5a5d3f 100644
--- a/arch/arm/mach-omap2/opp4xxx_data.c
+++ b/arch/arm/mach-omap2/opp4xxx_data.c
@@ -30,6 +30,17 @@
  * Structures containing OMAP4430 voltage supported and various
  * voltage dependent data for each VDD.
  */
+#define OMAP4_VP_MPU_VLIMITTO_VDDMIN	0xA
+#define OMAP4_VP_MPU_VLIMITTO_VDDMAX	0x39
+#define OMAP4_VP_IVA_VLIMITTO_VDDMIN	0xA
+#define OMAP4_VP_IVA_VLIMITTO_VDDMAX	0x2D
+#define OMAP4_VP_CORE_VLIMITTO_VDDMIN	0xA
+#define OMAP4_VP_CORE_VLIMITTO_VDDMAX	0x28
+
+#define OMAP4_ON_VOLTAGE_UV				1350000
+#define OMAP4_ONLP_VOLTAGE_UV			1350000
+#define OMAP4_RET_VOLTAGE_UV			837500
+#define OMAP4_OFF_VOLTAGE_UV			600000
 
 #define OMAP4430_VDD_MPU_OPP50_UV		1025000
 #define OMAP4430_VDD_MPU_OPP100_UV		1200000
@@ -44,6 +55,15 @@ struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
+struct omap_vp_param omap44xx_mpu_vp_data = {
+	.on_volt		= OMAP4_ON_VOLTAGE_UV,
+	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
+	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
+	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
+	.vp_vddmin		= OMAP4_VP_MPU_VLIMITTO_VDDMIN,
+	.vp_vddmax		= OMAP4_VP_MPU_VLIMITTO_VDDMAX,
+};
+
 #define OMAP4430_VDD_IVA_OPP50_UV		1013000
 #define OMAP4430_VDD_IVA_OPP100_UV		1188000
 #define OMAP4430_VDD_IVA_OPPTURBO_UV		1300000
@@ -55,6 +75,15 @@ struct omap_volt_data omap44xx_vdd_iva_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
+struct omap_vp_param omap44xx_iva_vp_data = {
+	.on_volt		= OMAP4_ON_VOLTAGE_UV,
+	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
+	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
+	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
+	.vp_vddmin		= OMAP4_VP_IVA_VLIMITTO_VDDMIN,
+	.vp_vddmax		= OMAP4_VP_IVA_VLIMITTO_VDDMAX,
+};
+
 #define OMAP4430_VDD_CORE_OPP50_UV		1025000
 #define OMAP4430_VDD_CORE_OPP100_UV		1200000
 
@@ -64,6 +93,15 @@ struct omap_volt_data omap44xx_vdd_core_volt_data[] = {
 	VOLT_DATA_DEFINE(0, 0, 0, 0),
 };
 
+struct omap_vp_param omap44xx_core_vp_data = {
+	.on_volt		= OMAP4_ON_VOLTAGE_UV,
+	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
+	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
+	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
+	.vp_vddmin		= OMAP4_VP_CORE_VLIMITTO_VDDMIN,
+	.vp_vddmax		= OMAP4_VP_CORE_VLIMITTO_VDDMAX,
+};
+
 
 static struct omap_opp_def __initdata omap44xx_opp_def_list[] = {
 	/* MPU OPP1 - OPP50 */
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index c6facf7..2ac990f 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -42,7 +42,6 @@
 
 #define VOLTAGE_DIR_SIZE	16
 
-
 static struct omap_vdd_info **vdd_info;
 
 /*
@@ -124,9 +123,10 @@ static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
 
 	timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000;
 	vdd->vp_rt_data.vlimitto_timeout = timeout_val;
-	vdd->vp_rt_data.vlimitto_vddmin = vdd->pmic_info->vp_vddmin;
-	vdd->vp_rt_data.vlimitto_vddmax = vdd->pmic_info->vp_vddmax;
-
+	vdd->vp_rt_data.vlimitto_vddmin = (vdd->vp_param->vp_vddmin > vdd->pmic_info->vp_vddmin) ?
+						vdd->vp_param->vp_vddmin : vdd->pmic_info->vp_vddmin;
+	vdd->vp_rt_data.vlimitto_vddmax = (vdd->vp_param->vp_vddmax > vdd->pmic_info->vp_vddmax) ?
+						vdd->pmic_info->vp_vddmax : vdd->vp_param->vp_vddmax;
 	waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) *
 				sys_clk_speed) / 1000;
 	vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
@@ -523,15 +523,35 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
 
 static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
 {
+	struct clk *omap_32k_clk;
+	u32 omap_32k_clk_speed;
+	unsigned long temp;
+
 	/*
 	 * 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,
-		       OMAP3_PRM_VOLTOFFSET_OFFSET);
-	vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
-		       OMAP3_PRM_VOLTSETUP2_OFFSET);
+
+	omap_32k_clk = clk_get(NULL, "wkup_32k_fck");
+	if (IS_ERR(omap_32k_clk)) {
+		pr_warning("%s: Could not get the 32k_clk clk to calculate"
+			"various vdd_%s params\n", __func__, vdd->voltdm.name);
+		return;
+	}
+	omap_32k_clk_speed = clk_get_rate(omap_32k_clk);
+	clk_put(omap_32k_clk);
+
+	temp = vdd->board_data->omap3_board_data.vdd_setup_off.clksetup;
+	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
+	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET);
+
+	temp = vdd->board_data->omap3_board_data.vdd_setup_off.voltsetup2;
+	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
+	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_VOLTSETUP2_OFFSET);
+
+	temp = vdd->board_data->omap3_board_data.voltoffset;
+	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
+	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_VOLTOFFSET_OFFSET);
+
 }
 
 static void __init omap3_vc_init(struct omap_vdd_info *vdd)
@@ -539,21 +559,45 @@ static void __init omap3_vc_init(struct omap_vdd_info *vdd)
 	static bool is_initialized;
 	u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
 	u32 vc_val;
-
-	if (is_initialized)
-		return;
+	struct clk *sys_ck;
+	u32 sys_clk_speed;
+	unsigned long temp;
 
 	/* Set up the on, inactive, retention and off voltage */
-	on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
-	onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt);
-	ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt);
-	off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt);
+	on_vsel = vdd->pmic_info->on_cmd(vdd->vp_param->on_volt);
+	onlp_vsel = vdd->pmic_info->onlp_cmd(vdd->vp_param->onlp_volt);
+	ret_vsel = vdd->pmic_info->ret_cmd(vdd->vp_param->ret_volt);
+	off_vsel = vdd->pmic_info->off_cmd(vdd->vp_param->off_volt);
 	vc_val	= ((on_vsel << vdd->vc_data->vc_common->cmd_on_shift) |
 		(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);
 
+	sys_ck = clk_get(NULL, "sys_ck");
+	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);
+		return;
+	}
+	sys_clk_speed = clk_get_rate(sys_ck);
+	clk_put(sys_ck);
+	/* Divide to avoid overflow */
+	sys_clk_speed /= 1000000;
+
+	/* Configure the setup times */
+	vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg);
+	vc_val &= ~vdd->vfsm->voltsetup_mask;
+	temp = vdd->board_data->omap3_board_data.vdd_setup_off.voltsetup;
+	temp = temp * sys_clk_speed / 8;
+	vc_val |= temp << vdd->vfsm->voltsetup_shift;
+	vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg);
+
+	omap3_vfsm_init(vdd);
+
+	if (is_initialized)
+		return;
+
 	/*
 	 * Generic VC parameters init
 	 * XXX This data should be abstracted out
@@ -563,8 +607,6 @@ static void __init omap3_vc_init(struct omap_vdd_info *vdd)
 	vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, prm_mod_offs,
 			OMAP3_PRM_VC_I2C_CFG_OFFSET);
 
-	omap3_vfsm_init(vdd);
-
 	is_initialized = true;
 }
 
@@ -573,12 +615,69 @@ static void __init omap3_vc_init(struct omap_vdd_info *vdd)
 static void __init omap4_vc_init(struct omap_vdd_info *vdd)
 {
 	static bool is_initialized;
-	u32 vc_val;
+	u32 vc_val, temp, prescalar, ramp_count;
+	struct clk *sys_ck;
+	u32 sys_clk_speed;
 
-	if (is_initialized)
+	sys_ck = clk_get(NULL, "sys_clkin_ck");
+	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);
 		return;
+	}
+	sys_clk_speed = clk_get_rate(sys_ck);
+	clk_put(sys_ck);
+	/* Divide to avoid overflow */
+	sys_clk_speed /= 1000000;
+
+	/* Configure the setup times */
+	vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg);
+	temp = vdd->board_data->omap4_board_data.vdd_setup_off.voltsetup_ramp_down;
+	prescalar = temp * 63 / sys_clk_speed;
+	if (prescalar <= 16)
+		prescalar = 16;
+	else if (prescalar <= 64)
+		prescalar = 64;
+	else if (prescalar <= 128)
+		prescalar = 128;
+	else if (prescalar <= 512)
+		prescalar = 512;
+	else
+		pr_warning("%s: Invalid VoltOff set up time for vdd%s\n",
+			__func__, vdd->voltdm.name);
+
+	vc_val &= ~OMAP4430_RAMP_DOWN_PRESCAL_MASK;
+	vc_val |= prescalar << OMAP4430_RAMP_DOWN_PRESCAL_SHIFT;
+
+	ramp_count = (temp * sys_clk_speed / prescalar) << OMAP4430_RAMP_DOWN_COUNT_SHIFT;
+	vc_val &= ~OMAP4430_RAMP_DOWN_COUNT_MASK;
+	vc_val |= ramp_count;
+
+	temp = vdd->board_data->omap4_board_data.vdd_setup_off.voltsetup_ramp_up;
+	prescalar = temp * 63 / sys_clk_speed;
+	if (prescalar <= 16)
+		prescalar = 16;
+	else if (prescalar <= 64)
+		prescalar = 64;
+	else if (prescalar <= 128)
+		prescalar = 128;
+	else if (prescalar <= 512)
+		prescalar = 512;
+	else
+		pr_warning("%s: Invalid VoltOff set up time for vdd%s\n",
+			__func__, vdd->voltdm.name);
+
+	vc_val &= ~OMAP4430_RAMP_UP_PRESCAL_MASK;
+	vc_val |= prescalar << OMAP4430_RAMP_UP_PRESCAL_SHIFT;
 
-	/* TODO: Configure setup times and CMD_VAL values*/
+	ramp_count = (temp * sys_clk_speed / prescalar) << OMAP4430_RAMP_UP_COUNT_SHIFT;
+	vc_val &= ~OMAP4430_RAMP_UP_COUNT_MASK;
+	vc_val |= ramp_count;
+
+	vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg);
+
+	if (is_initialized)
+		return;
 
 	/*
 	 * Generic VC parameters init
@@ -629,13 +728,6 @@ static void __init omap_vc_init(struct omap_vdd_info *vdd)
 	vdd->write_reg(vc_val, prm_mod_offs,
 		       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->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);
-
 	if (cpu_is_omap34xx())
 		omap3_vc_init(vdd);
 	else if (cpu_is_omap44xx())
@@ -971,6 +1063,23 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
 	return 0;
 }
 
+int omap_voltage_register_board_params(struct voltagedomain *voltdm,
+		union omap_volt_board_data *board_params)
+{
+	struct omap_vdd_info *vdd;
+
+	if (!voltdm || IS_ERR(voltdm)) {
+		pr_warning("%s: VDD specified does not exist!\n", __func__);
+		return -EINVAL;
+	}
+
+	vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
+
+	vdd->board_data = board_params;
+
+	return 0;
+}
+
 /**
  * omap_voltage_get_dbgdir() - API to get pointer to the debugfs directory
  *				corresponding to a voltage domain.
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index e9f5408..de4e09b 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -23,14 +23,6 @@
 #define VOLTSCALE_VPFORCEUPDATE		1
 #define VOLTSCALE_VCBYPASS		2
 
-/*
- * OMAP3 GENERIC setup times. Revisit to see if these needs to be
- * passed from board or PMIC file
- */
-#define OMAP3_CLKSETUP		0xff
-#define OMAP3_VOLTOFFSET	0xff
-#define OMAP3_VOLTSETUP2	0xff
-
 /**
  * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
  * data
@@ -80,17 +72,25 @@ struct omap_volt_data {
  * struct omap_volt_pmic_info - PMIC specific data required by voltage driver.
  * @slew_rate:	PMIC slew rate (in uv/us)
  * @step_size:	PMIC voltage step size (in uv)
+ * @vp_erroroffset:	Offset value in the Error to Voltage converter
+ * @vp_vstepmin:	Minimum voltage step in mV
+ * @vp_vstepmax:	Maximum voltage step in mV
+ * @vp_vddmin:	Minimum voltage supply level in mV
+ * @vp_vddmax:	Maximum voltage supply level in mV
+ * @vp_timeout_us:	Voltage Controller's maximum wait time for response
+ * @i2c_slave_addr:	I2C slave address value for the Power IC device.
+ * @pmic_reg:	voltage configuration register address value for the
+ *				VDD channe
  * @vsel_to_uv:	PMIC API to convert vsel value to actual voltage in uV.
  * @uv_to_vsel:	PMIC API to convert voltage in uV to vsel value.
+ * @on_cmd:	PMIC API to send on command instruction
+ * @onlp_cmd:	PMIC API to send onlp command instruction
+ * @ret_cmd:	PMIC API to send ret command instruction
+ * @off_cmd:	PMIC API to send off command instruction
  */
 struct omap_volt_pmic_info {
 	int slew_rate;
 	int step_size;
-	u32 on_volt;
-	u32 onlp_volt;
-	u32 ret_volt;
-	u32 off_volt;
-	u16 volt_setup_time;
 	u8 vp_erroroffset;
 	u8 vp_vstepmin;
 	u8 vp_vstepmax;
@@ -101,11 +101,30 @@ struct omap_volt_pmic_info {
 	u8 pmic_reg;
 	unsigned long (*vsel_to_uv) (const u8 vsel);
 	u8 (*uv_to_vsel) (unsigned long uV);
+	unsigned char (*on_cmd)(unsigned long uV);
+	unsigned char (*onlp_cmd)(unsigned long uV);
+	unsigned char (*ret_cmd)(unsigned long uV);
+	unsigned char (*off_cmd)(unsigned long uV);
+};
+
+/**
+ * struct omap_vp_param - VP specific data required by voltage driver.
+ * @on_volt: on voltage for the device in mV
+ * @onlp_volt: inactive voltage for the device in mV
+ * @ret_volt: retention voltage for the device in mV
+ * @off_volt: off voltage for the device in mV
+ */
+struct omap_vp_param {
+	u32 on_volt;
+	u32 onlp_volt;
+	u32 ret_volt;
+	u32 off_volt;
+	u8 vp_vddmax;
+	u8 vp_vddmin;
 };
 
 /**
  * omap_vdd_info - Per Voltage Domain info
- *
  * @volt_data		: voltage table having the distinct voltages supported
  *			  by the domain and other associated per voltage data.
  * @pmic_info		: pmic specific parameters which should be populted by
@@ -116,6 +135,9 @@ struct omap_volt_pmic_info {
  * @vc_data		: structure containing various various vc registers,
  *			  shifts, masks etc.
  * @vfsm                : voltage manager FSM data
+ * @vfsm                : voltage manager FSM data
+ * @vp_param			: VP specific parameters
+ * @board_data			: board specific parameters
  * @voltdm		: pointer to the voltage domain structure
  * @debug_dir		: debug directory for this voltage domain.
  * @curr_volt		: current voltage for this vdd.
@@ -129,6 +151,8 @@ 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 omap_vp_param *vp_param;
+	union omap_volt_board_data *board_data;
 	struct voltagedomain voltdm;
 	struct dentry *debug_dir;
 	u32 curr_volt;
@@ -139,6 +163,61 @@ struct omap_vdd_info {
 		unsigned long target_volt);
 };
 
+/**
+ * omap3_vdd_setuptime - vdd set up time info
+ * @voltsetup	: setup time of the VDDregulators in us
+ * @clksetup	: setup time of the oscillator system clock (sys_clk) in us
+ * @voltsetup2	: Overall setup time of VDDregulators in us
+ */
+struct omap3_vdd_setuptime {
+	u16 voltsetup;
+	u16 clksetup;
+	u16 voltsetup2;
+};
+
+/**
+ * omap3_volt_board_data - vdd set up time info for OMAP3
+ * @vdd_setup_ret	: VDD setup time for retention mode
+ * @vdd_setup_off	: VDD setup time for off mode
+ * @voltoffset		: offset-time to de-assert sys_offmode
+ *					when exiting the OFF mode
+ */
+struct omap3_volt_board_data {
+	struct omap3_vdd_setuptime vdd_setup_ret;
+	struct omap3_vdd_setuptime vdd_setup_off;
+	u16 voltoffset;
+};
+
+/**
+ * omap4_volt_setuptime - vdd set up time info for OMAP4
+ * @voltsetup_ramp_up	: VDD ram up time in us
+ * @voltsetup_ramp_down	: VDD ram down time in us
+ */
+struct omap4_volt_setuptime {
+	u16 voltsetup_ramp_up;
+	u16 voltsetup_ramp_down;
+};
+
+/**
+ * omap4_volt_board_data - vdd set up time info for OMAP4
+ * @vdd_setup_ret	: VDD setup time for retention mode
+ * @vdd_setup_off	: VDD setup time for off mode
+ */
+struct omap4_volt_board_data {
+	struct omap4_volt_setuptime vdd_setup_ret;
+	struct omap4_volt_setuptime vdd_setup_off;
+};
+
+/**
+ * omap_volt_board_data - board specific voltage set up time data
+ * @omap3_board_data	: omap3 board data
+ * @omap4_board_data	: omap4 board data
+ */
+union omap_volt_board_data {
+	struct omap3_volt_board_data omap3_board_data;
+	struct omap4_volt_board_data omap4_board_data;
+};
+
 unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
 void omap_vp_enable(struct voltagedomain *voltdm);
 void omap_vp_disable(struct voltagedomain *voltdm);
@@ -163,6 +242,9 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
 struct voltagedomain *omap_voltage_domain_lookup(char *name);
 
 int omap_voltage_late_init(void);
+int omap_voltage_register_board_params(struct voltagedomain *voltdm,
+		union omap_volt_board_data *board_params);
+
 #else
 static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
 		struct omap_volt_pmic_info *pmic_info)
@@ -179,6 +261,11 @@ static inline struct voltagedomain *omap_voltage_domain_lookup(char *name)
 {
 	return ERR_PTR(-EINVAL);
 }
+static inline int omap_voltage_register_board_params(struct voltagedomain *voltdm,
+		struct omap_volt_board_data *board_params)
+{
+	return ERR_PTR(-EINVAL);
+}
 #endif
 
 #endif
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index def230f..62ae1ee 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -83,9 +83,13 @@ static int __init omap3xxx_voltage_early_init(void)
 	if (cpu_is_omap3630()) {
 		omap3_vdd1_info.volt_data = omap36xx_vddmpu_volt_data;
 		omap3_vdd2_info.volt_data = omap36xx_vddcore_volt_data;
+		omap3_vdd1_info.vp_param = &omap36xx_mpu_vp_data;
+		omap3_vdd2_info.vp_param = &omap36xx_core_vp_data;
 	} else {
 		omap3_vdd1_info.volt_data = omap34xx_vddmpu_volt_data;
 		omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
+		omap3_vdd1_info.vp_param = &omap34xx_mpu_vp_data;
+		omap3_vdd2_info.vp_param = &omap34xx_core_vp_data;
 	}
 
 	return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index cb64996..972760c 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -95,6 +95,10 @@ 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;
 
+	omap4_vdd_mpu_info.vp_param = &omap44xx_mpu_vp_data;
+	omap4_vdd_iva_info.vp_param = &omap44xx_iva_vp_data;
+	omap4_vdd_core_info.vp_param = &omap44xx_core_vp_data;
+
 	return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
 				       omap4_vdd_info,
 				       ARRAY_SIZE(omap4_vdd_info));
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer
  2011-03-15 14:33 [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Vishwanath BS
  2011-03-15 14:33 ` [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters Vishwanath BS
@ 2011-03-15 14:33 ` Vishwanath BS
  2011-03-15 15:16   ` Menon, Nishanth
  2011-03-16  6:58   ` Premi, Sanjeev
  2011-03-15 14:33 ` [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters for OMAP Volatge layer Vishwanath BS
  2011-03-15 15:07 ` [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Menon, Nishanth
  3 siblings, 2 replies; 18+ messages in thread
From: Vishwanath BS @ 2011-03-15 14:33 UTC (permalink / raw)
  To: linux-omap; +Cc: Vishwanath BS

Currently Voltage layer assumes that all PMICs use VP/VC for Voltage scaling.
There can be some instances where PMIC would want to bypass VP/VC for voltage
scaling. So make VOltage layer flexible enough to handle this.

Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/omap_twl.c |    5 +++++
 arch/arm/mach-omap2/voltage.c  |   12 +++++++-----
 arch/arm/mach-omap2/voltage.h  |    6 ++++++
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index f96d4b2..42f66c6 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -157,6 +157,7 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
 	.onlp_cmd		= twl4030_uv_to_vsel,
 	.ret_cmd		= twl4030_uv_to_vsel,
 	.off_cmd		= twl4030_uv_to_vsel,
+	.voltage_class	= VP_VC_CLASS,
 };
 
 static struct omap_volt_pmic_info omap3_core_volt_info = {
@@ -176,6 +177,7 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
 	.onlp_cmd		= twl4030_uv_to_vsel,
 	.ret_cmd		= twl4030_uv_to_vsel,
 	.off_cmd		= twl4030_uv_to_vsel,
+	.voltage_class	= VP_VC_CLASS,
 };
 
 static struct omap_volt_pmic_info omap4_mpu_volt_info = {
@@ -195,6 +197,7 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
 	.onlp_cmd		= twl4030_uv_to_vsel,
 	.ret_cmd		= twl4030_uv_to_vsel,
 	.off_cmd		= twl4030_uv_to_vsel,
+	.voltage_class	= VP_VC_CLASS,
 };
 
 static struct omap_volt_pmic_info omap4_iva_volt_info = {
@@ -214,6 +217,7 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
 	.onlp_cmd		= twl4030_uv_to_vsel,
 	.ret_cmd		= twl4030_uv_to_vsel,
 	.off_cmd		= twl4030_uv_to_vsel,
+	.voltage_class	= VP_VC_CLASS,
 };
 
 static struct omap_volt_pmic_info omap4_core_volt_info = {
@@ -233,6 +237,7 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
 	.onlp_cmd		= twl4030_uv_to_vsel,
 	.ret_cmd		= twl4030_uv_to_vsel,
 	.off_cmd		= twl4030_uv_to_vsel,
+	.voltage_class	= VP_VC_CLASS,
 };
 
 int __init omap4_twl_init(void)
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 2ac990f..73fa3ee 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -1194,11 +1194,13 @@ int __init omap_voltage_late_init(void)
 		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]))
-			continue;
-		omap_vc_init(vdd_info[i]);
-		vp_init(vdd_info[i]);
-		vdd_debugfs_init(vdd_info[i]);
+		if (vdd_info[i]->pmic_info->voltage_class == VP_VC_CLASS) {
+			if (omap_vdd_data_configure(vdd_info[i]))
+				continue;
+			omap_vc_init(vdd_info[i]);
+			vp_init(vdd_info[i]);
+			vdd_debugfs_init(vdd_info[i]);
+		}
 	}
 
 	return 0;
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index de4e09b..17b1e10
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -23,6 +23,9 @@
 #define VOLTSCALE_VPFORCEUPDATE		1
 #define VOLTSCALE_VCBYPASS		2
 
+#define VP_VC_CLASS 0
+#define REGULATOR_CLASS 1
+
 /**
  * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
  * data
@@ -87,6 +90,8 @@ struct omap_volt_data {
  * @onlp_cmd:	PMIC API to send onlp command instruction
  * @ret_cmd:	PMIC API to send ret command instruction
  * @off_cmd:	PMIC API to send off command instruction
+ * @voltage_class: Voltage class used for voltage scaling (can be VP/VC method
+ * 				or regulator based method for now).
  */
 struct omap_volt_pmic_info {
 	int slew_rate;
@@ -105,6 +110,7 @@ struct omap_volt_pmic_info {
 	unsigned char (*onlp_cmd)(unsigned long uV);
 	unsigned char (*ret_cmd)(unsigned long uV);
 	unsigned char (*off_cmd)(unsigned long uV);
+	u8 voltage_class;
 };
 
 /**
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters for OMAP Volatge layer
  2011-03-15 14:33 [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Vishwanath BS
  2011-03-15 14:33 ` [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters Vishwanath BS
  2011-03-15 14:33 ` [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer Vishwanath BS
@ 2011-03-15 14:33 ` Vishwanath BS
  2011-03-15 15:38   ` Menon, Nishanth
  2011-03-15 15:07 ` [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Menon, Nishanth
  3 siblings, 1 reply; 18+ messages in thread
From: Vishwanath BS @ 2011-03-15 14:33 UTC (permalink / raw)
  To: linux-omap; +Cc: Vishwanath BS

This patch adds board specific parameters for ZOOM3 and OMAP4430 SDP Boards.
The same needs to be done for other OMAP3 and OMAP4 boards once the approach
is accepted.

Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c |   52 +++++++++++++++++++++++
 arch/arm/mach-omap2/board-zoom.c    |   79 +++++++++++++++++++++++++++++++++++
 2 files changed, 131 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 670cbd5..6dda89c 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -41,6 +41,7 @@
 #include "hsmmc.h"
 #include "timer-gp.h"
 #include "control.h"
+#include "voltage.h"
 
 #define ETH_KS8851_IRQ			34
 #define ETH_KS8851_POWER_ON		48
@@ -248,6 +249,46 @@ static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
 	},
 };
 
+/* TODO: replace these dummy values with characterized latencies */
+static union omap_volt_board_data omap4430sdp_mpu_volt_data = {
+	.omap4_board_data = {
+		.vdd_setup_ret = {
+			.voltsetup_ramp_up	= 0xff,
+			.voltsetup_ramp_down = 0xff,
+		},
+		.vdd_setup_off = {
+			.voltsetup_ramp_up	= 0xff,
+			.voltsetup_ramp_down = 0xff,
+		},
+	}
+};
+
+static union omap_volt_board_data omap4430sdp_iva_volt_data = {
+	.omap4_board_data = {
+		.vdd_setup_ret = {
+			.voltsetup_ramp_up	= 0xff,
+			.voltsetup_ramp_down = 0xff,
+		},
+		.vdd_setup_off = {
+			.voltsetup_ramp_up	= 0xff,
+			.voltsetup_ramp_down = 0xff,
+		},
+	}
+};
+
+static union omap_volt_board_data omap4430sdp_core_volt_data = {
+	.omap4_board_data = {
+		.vdd_setup_ret = {
+			.voltsetup_ramp_up	= 0xff,
+			.voltsetup_ramp_down = 0xff,
+		},
+		.vdd_setup_off = {
+			.voltsetup_ramp_up	= 0xff,
+			.voltsetup_ramp_down = 0xff,
+		},
+	}
+};
+
 static int omap_ethernet_init(void)
 {
 	int status;
@@ -700,6 +741,7 @@ static void __init omap_4430sdp_init(void)
 {
 	int status;
 	int package = OMAP_PACKAGE_CBS;
+	struct voltagedomain *voltdm;
 
 	if (omap_rev() == OMAP4430_REV_ES1_0)
 		package = OMAP_PACKAGE_CBL;
@@ -728,6 +770,15 @@ static void __init omap_4430sdp_init(void)
 	status = omap4_keyboard_init(&sdp4430_keypad_data);
 	if (status)
 		pr_err("Keypad initialization failed: %d\n", status);
+
+	voltdm = omap_voltage_domain_lookup("mpu");
+	omap_voltage_register_board_params(voltdm, &omap4430sdp_mpu_volt_data);
+
+	voltdm = omap_voltage_domain_lookup("iva");
+	omap_voltage_register_board_params(voltdm, &omap4430sdp_iva_volt_data);
+
+	voltdm = omap_voltage_domain_lookup("core");
+	omap_voltage_register_board_params(voltdm, &omap4430sdp_core_volt_data);
 }
 
 static void __init omap_4430sdp_map_io(void)
@@ -746,3 +797,4 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
 	.init_machine	= omap_4430sdp_init,
 	.timer		= &omap_timer,
 MACHINE_END
+
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 7e895ff..d921a2e 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -27,12 +27,45 @@
 
 #include <mach/board-zoom.h>
 
+#include "voltage.h"
 #include "board-flash.h"
 #include "mux.h"
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "sdram-hynix-h8mbx00u0mer-0em.h"
 
 #define ZOOM3_EHCI_RESET_GPIO		64
+/*
+ * VOLTSETUP1 for RET & OFF
+ * Setup time (in us) of the VDD1 and VDD2 regulators.
+ * Number of sys_clk cycles required for VDD regulator to stabilize is
+ * devided by 8 and programmed in the register field for VDD1/VDD2.
+ */
+#define OMAP3_VOLTSETUP_VDD1_RET		28
+#define OMAP3_VOLTSETUP_VDD2_RET		26
+
+#define OMAP3_VOLTSETUP_VDD1_OFF		55
+#define OMAP3_VOLTSETUP_VDD2_OFF		49
+
+/*
+ * VOLTOFFSET for RET & OFF
+ * Offset-time to de-assert sys_offmode signal while exiting the OFF mode
+ * and when the OFF sequence is supervised by the Power IC.
+ */
+#define OMAP3_VOLTOFFSET_OFF	516
+
+#define OMAP3_SYSREQ_CKEN_TIME	31
+#define OMAP3_S2A_TIME			10041
+#define OMAP3_VDD_RAMP_TIME		1250
+
+#define OMAP3_VOLTSETUP2	(OMAP3_SYSREQ_CKEN_TIME + OMAP3_S2A_TIME + OMAP3_VDD_RAMP_TIME - OMAP3_VOLTOFFSET_OFF)
+
+/*
+ * OMAP3 CLKSETUP TIME for RET & OFF
+ * Setup time of the oscillator (sys_clk), based on number of
+ * 32 kHz clock cycles.
+ */
+#define OMAP3_CLKSETUP_RET		31
+#define OMAP3_CLKSETUP_OFF		(OMAP3_VOLTOFFSET_OFF + OMAP3_VOLTSETUP2)
 
 static void __init omap_zoom_init_early(void)
 {
@@ -115,8 +148,46 @@ static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
 	.reset_gpio_port[2]	= -EINVAL,
 };
 
+union omap_volt_board_data zoom_mpu_volt_data = {
+	.omap3_board_data = {
+		.vdd_setup_ret = {
+			.voltsetup	= OMAP3_VOLTSETUP_VDD1_RET,
+			.clksetup	= OMAP3_CLKSETUP_RET,
+			.voltsetup2		= 0,
+			},
+
+		.vdd_setup_off = {
+			.voltsetup	= OMAP3_VOLTSETUP_VDD1_OFF,
+			.clksetup	= OMAP3_CLKSETUP_OFF,
+			.voltsetup2	= OMAP3_VOLTSETUP2,
+		},
+		.voltoffset		= OMAP3_VOLTOFFSET_OFF
+	}
+};
+
+union omap_volt_board_data zoom_core_volt_data = {
+	.omap3_board_data = {
+		.vdd_setup_ret = {
+			.voltsetup	= OMAP3_VOLTSETUP_VDD2_RET,
+			.clksetup	= OMAP3_CLKSETUP_RET,
+			.voltsetup2		= 0,
+		},
+
+		.vdd_setup_off = {
+			.voltsetup	= OMAP3_VOLTSETUP_VDD2_OFF,
+			.clksetup	= OMAP3_CLKSETUP_OFF,
+			.voltsetup2	= OMAP3_VOLTSETUP2,
+		},
+
+		.voltoffset		= OMAP3_VOLTOFFSET_OFF
+	}
+};
+
+
 static void __init omap_zoom_init(void)
 {
+	struct voltagedomain *voltdm;
+
 	if (machine_is_omap_zoom2()) {
 		omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	} else if (machine_is_omap_zoom3()) {
@@ -130,6 +201,13 @@ static void __init omap_zoom_init(void)
 	zoom_debugboard_init();
 	zoom_peripherals_init();
 	zoom_display_init();
+
+	voltdm = omap_voltage_domain_lookup("mpu");
+	omap_voltage_register_board_params(voltdm, &zoom_mpu_volt_data);
+
+	voltdm = omap_voltage_domain_lookup("core");
+	omap_voltage_register_board_params(voltdm, &zoom_core_volt_data);
+
 }
 
 MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
@@ -151,3 +229,4 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
 	.init_machine	= omap_zoom_init,
 	.timer		= &omap_timer,
 MACHINE_END
+
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up
  2011-03-15 14:33 [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Vishwanath BS
                   ` (2 preceding siblings ...)
  2011-03-15 14:33 ` [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters for OMAP Volatge layer Vishwanath BS
@ 2011-03-15 15:07 ` Menon, Nishanth
  2011-03-15 16:06   ` Vishwanath Sripathy
  3 siblings, 1 reply; 18+ messages in thread
From: Menon, Nishanth @ 2011-03-15 15:07 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap

On Tue, Mar 15, 2011 at 20:03, Vishwanath BS <vishwanath.bs@ti.com> wrote:
>
> This patch series attempts to do some more clean up on OMAP Voltage layer on top
> of the clean up done by Paul as part of
> https://patchwork.kernel.org/patch/591421/
>
> These patches are generated against latest omap-for-linus branch on Tony's tree
> (commit id: 05f689400ea5fa3d71af82f910c8b140f87ad1f3) and tested on OMAP ZOOM3
> and OMAP4430 SDP with Smartreflex enabled.
>
> Vishwanath BS (3):
>  OMAP PM: Seggregate Voltage layer parameters
>  OMAP PM: Add support for bypassing VP/VC in Voltage layer
>  OMAP PM: Add Board specific parameters for OMAP Volatge layer

I dont really see why I need to keep fixing your $subjects, but here again,
all $subjects, OMAP3+: PM: makes more sense

>  OMAP PM: Seggregate Voltage layer parameters
                       ^^^^^^^ spell check please (tip: in vim, use
":help spell" to see how to use it while committing itself)
>  OMAP PM: Add support for bypassing VP/VC in Voltage layer
>  OMAP PM: Add Board specific parameters for OMAP Volatge layer

         ^^^^^^^^^ spell check voltage and I think you should be using
small letters for board and voltage

>
>  arch/arm/mach-omap2/board-4430sdp.c           |   52 +++++++

Curious if Panda and other OMAP3 platforms where considered.

>  arch/arm/mach-omap2/board-zoom.c              |   79 +++++++++++
>  arch/arm/mach-omap2/omap_opp_data.h           |    8 +
>  arch/arm/mach-omap2/omap_twl.c                |  113 ++++++++--------
>  arch/arm/mach-omap2/opp3xxx_data.c            |   50 +++++++
>  arch/arm/mach-omap2/opp4xxx_data.c            |   38 +++++
>  arch/arm/mach-omap2/voltage.c                 |  179 ++++++++++++++++++++-----
>  arch/arm/mach-omap2/voltage.h                 |  119 +++++++++++++++--
>  arch/arm/mach-omap2/voltagedomains3xxx_data.c |    4 +
>  arch/arm/mach-omap2/voltagedomains44xx_data.c |    4 +
>  10 files changed, 541 insertions(+), 105 deletions(-)
>


Regards,
Nishanth Menon
--
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] 18+ messages in thread

* Re: [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer
  2011-03-15 14:33 ` [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer Vishwanath BS
@ 2011-03-15 15:16   ` Menon, Nishanth
  2011-03-15 16:14     ` Vishwanath Sripathy
  2011-03-16  6:58   ` Premi, Sanjeev
  1 sibling, 1 reply; 18+ messages in thread
From: Menon, Nishanth @ 2011-03-15 15:16 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap

On Tue, Mar 15, 2011 at 20:03, Vishwanath BS <vishwanath.bs@ti.com> wrote:
> Currently Voltage layer assumes that all PMICs use VP/VC for Voltage scaling.
> There can be some instances where PMIC would want to bypass VP/VC for voltage
> scaling. So make VOltage layer flexible enough to handle this.
please fix VOltage.

The commit message does'nt actually explain enough. it is too vague.

>
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> ---
>  arch/arm/mach-omap2/omap_twl.c |    5 +++++
>  arch/arm/mach-omap2/voltage.c  |   12 +++++++-----
>  arch/arm/mach-omap2/voltage.h  |    6 ++++++
>  3 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
> index f96d4b2..42f66c6 100644
> --- a/arch/arm/mach-omap2/omap_twl.c
> +++ b/arch/arm/mach-omap2/omap_twl.c
> @@ -157,6 +157,7 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
>        .onlp_cmd               = twl4030_uv_to_vsel,
>        .ret_cmd                = twl4030_uv_to_vsel,
>        .off_cmd                = twl4030_uv_to_vsel,
> +       .voltage_class  = VP_VC_CLASS,

Do you need this all unassigned params in a static struct is 0 which
is basically VP_VC_CLASS.

>  };
>
>  static struct omap_volt_pmic_info omap3_core_volt_info = {
> @@ -176,6 +177,7 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
>        .onlp_cmd               = twl4030_uv_to_vsel,
>        .ret_cmd                = twl4030_uv_to_vsel,
>        .off_cmd                = twl4030_uv_to_vsel,
> +       .voltage_class  = VP_VC_CLASS,
here as well

>  };
>
>  static struct omap_volt_pmic_info omap4_mpu_volt_info = {
> @@ -195,6 +197,7 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
>        .onlp_cmd               = twl4030_uv_to_vsel,
>        .ret_cmd                = twl4030_uv_to_vsel,
>        .off_cmd                = twl4030_uv_to_vsel,
> +       .voltage_class  = VP_VC_CLASS,
again

>  };
>
>  static struct omap_volt_pmic_info omap4_iva_volt_info = {
> @@ -214,6 +217,7 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
>        .onlp_cmd               = twl4030_uv_to_vsel,
>        .ret_cmd                = twl4030_uv_to_vsel,
>        .off_cmd                = twl4030_uv_to_vsel,
> +       .voltage_class  = VP_VC_CLASS,
and again

>  };
>
>  static struct omap_volt_pmic_info omap4_core_volt_info = {
> @@ -233,6 +237,7 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
>        .onlp_cmd               = twl4030_uv_to_vsel,
>        .ret_cmd                = twl4030_uv_to_vsel,
>        .off_cmd                = twl4030_uv_to_vsel,
> +       .voltage_class  = VP_VC_CLASS,
and here
>  };
>
>  int __init omap4_twl_init(void)
> diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
> index 2ac990f..73fa3ee 100644
> --- a/arch/arm/mach-omap2/voltage.c
> +++ b/arch/arm/mach-omap2/voltage.c
> @@ -1194,11 +1194,13 @@ int __init omap_voltage_late_init(void)
>                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]))
> -                       continue;
> -               omap_vc_init(vdd_info[i]);
> -               vp_init(vdd_info[i]);
> -               vdd_debugfs_init(vdd_info[i]);
> +               if (vdd_info[i]->pmic_info->voltage_class == VP_VC_CLASS) {
> +                       if (omap_vdd_data_configure(vdd_info[i]))
> +                               continue;
> +                       omap_vc_init(vdd_info[i]);
> +                       vp_init(vdd_info[i]);
> +                       vdd_debugfs_init(vdd_info[i]);
> +               }

>        }
>
>        return 0;
> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
> index de4e09b..17b1e10
> --- a/arch/arm/mach-omap2/voltage.h
> +++ b/arch/arm/mach-omap2/voltage.h
> @@ -23,6 +23,9 @@
>  #define VOLTSCALE_VPFORCEUPDATE                1
>  #define VOLTSCALE_VCBYPASS             2
>
> +#define VP_VC_CLASS 0
> +#define REGULATOR_CLASS 1
please - could you ensure namespace is proper in macro usage?
I dont understand usage difference between VP_VC_CLASS and REGULATOR_CLASS

> +
>  /**
>  * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
>  * data
> @@ -87,6 +90,8 @@ struct omap_volt_data {
>  * @onlp_cmd:  PMIC API to send onlp command instruction
>  * @ret_cmd:   PMIC API to send ret command instruction
>  * @off_cmd:   PMIC API to send off command instruction
> + * @voltage_class: Voltage class used for voltage scaling (can be VP/VC method
> + *                             or regulator based method for now).
>  */
>  struct omap_volt_pmic_info {
>        int slew_rate;
> @@ -105,6 +110,7 @@ struct omap_volt_pmic_info {
>        unsigned char (*onlp_cmd)(unsigned long uV);
>        unsigned char (*ret_cmd)(unsigned long uV);
>        unsigned char (*off_cmd)(unsigned long uV);
> +       u8 voltage_class;
>  };
>
>  /**
> --
> 1.7.0.4
overall, other than deciding to initialize or not initialize VP/VC
based on class, I dont see how you have achieved $subject or $commit
message in terms of bring in bypass ability to VP/VC by introducing
class.

A) the $subject is wrong. you have just introduced voltage_class - I
suggest you state that instead.
B) how your patch achieves support for bypassing vp/vc is not clear
unfortunately.

Regards,
Nishanth Menon
--
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] 18+ messages in thread

* Re: [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters for OMAP Volatge layer
  2011-03-15 14:33 ` [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters for OMAP Volatge layer Vishwanath BS
@ 2011-03-15 15:38   ` Menon, Nishanth
  2011-03-16  5:53     ` Vishwanath Sripathy
  2011-03-17 23:25     ` Kevin Hilman
  0 siblings, 2 replies; 18+ messages in thread
From: Menon, Nishanth @ 2011-03-15 15:38 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap

On Tue, Mar 15, 2011 at 20:03, Vishwanath BS <vishwanath.bs@ti.com> wrote:
> This patch adds board specific parameters for ZOOM3 and OMAP4430 SDP Boards.
> The same needs to be done for other OMAP3 and OMAP4 boards once the approach
> is accepted.

Would have been great to see this info in 0/0 - what happens without
these changes on other boards?

[...]
> +union omap_volt_board_data zoom_mpu_volt_data = {
> +       .omap3_board_data = {
> +               .vdd_setup_ret = {
> +                       .voltsetup      = OMAP3_VOLTSETUP_VDD1_RET,
I disagree this is a board specific param - the help says "setup time
of the VDDregulators in us" - seems to me that it is PMIC information

> +                       .clksetup       = OMAP3_CLKSETUP_RET,
????? why cant i just give oscillator ramp time in uSec?

> +                       .voltsetup2             = 0,
why should I as  a board developer give this as well, why cant voltage
layer do addition and save me a param?

> +                       },
> +
> +               .vdd_setup_off = {
> +                       .voltsetup      = OMAP3_VOLTSETUP_VDD1_OFF,
> +                       .clksetup       = OMAP3_CLKSETUP_OFF,
> +                       .voltsetup2     = OMAP3_VOLTSETUP2,
> +               },
> +               .voltoffset             = OMAP3_VOLTOFFSET_OFF
"offset-time to de-assert sys_offmode when exiting the OFF mode" - how
am I supposed to measure that? again - why cant voltage layer add
numbers?

> +       }
> +};
> +

my overall suggestion - when I fill in board file params - I should say:
I use PMIC x, i have oscillator with ramp "y" uSec - the params should
talk my language as a board developers - I dont want to know indepth
details of voltage VP/VC registers and what they should contain. it is
upto voltage layer to translate, add, bit shift or do what ever is
necessary to take my board and pmic level details to register details.

Sorry, even though this is a good start for abstraction, the overall
motivation is missed, I think we need to work on it more.


Regards,
Nishanth Menon
--
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] 18+ messages in thread

* RE: [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up
  2011-03-15 15:07 ` [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Menon, Nishanth
@ 2011-03-15 16:06   ` Vishwanath Sripathy
  2011-03-16  1:18     ` Nishanth Menon
  0 siblings, 1 reply; 18+ messages in thread
From: Vishwanath Sripathy @ 2011-03-15 16:06 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: linux-omap

> -----Original Message-----
> From: Menon, Nishanth [mailto:nm@ti.com]
> Sent: Tuesday, March 15, 2011 8:38 PM
> To: Vishwanath BS
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up
>
> On Tue, Mar 15, 2011 at 20:03, Vishwanath BS
> <vishwanath.bs@ti.com> wrote:
> >
> > This patch series attempts to do some more clean up on OMAP Voltage
> layer on top
> > of the clean up done by Paul as part of
> > https://patchwork.kernel.org/patch/591421/
> >
> > These patches are generated against latest omap-for-linus branch on
> Tony's tree
> > (commit id: 05f689400ea5fa3d71af82f910c8b140f87ad1f3) and tested
> on OMAP ZOOM3
> > and OMAP4430 SDP with Smartreflex enabled.
> >
> > Vishwanath BS (3):
> >  OMAP PM: Seggregate Voltage layer parameters
> >  OMAP PM: Add support for bypassing VP/VC in Voltage layer
> >  OMAP PM: Add Board specific parameters for OMAP Volatge layer
>
> I dont really see why I need to keep fixing your $subjects, but here
> again,
> all $subjects, OMAP3+: PM: makes more sense
This is not OMAP3 specific. It applies to OMAP4 as well.

>
> >  OMAP PM: Seggregate Voltage layer parameters
>                        ^^^^^^^ spell check please (tip: in vim, use
> ":help spell" to see how to use it while committing itself)
Thanks.
> >  OMAP PM: Add support for bypassing VP/VC in Voltage layer
> >  OMAP PM: Add Board specific parameters for OMAP Volatge layer
>
>          ^^^^^^^^^ spell check voltage and I think you should be using
> small letters for board and voltage
>
> >
> >  arch/arm/mach-omap2/board-4430sdp.c           |   52 +++++++
>
> Curious if Panda and other OMAP3 platforms where considered.
That's TODO as per my Patch3 commit log.

Vishwa
>
> >  arch/arm/mach-omap2/board-zoom.c              |   79
> +++++++++++
> >  arch/arm/mach-omap2/omap_opp_data.h           |    8 +
> >  arch/arm/mach-omap2/omap_twl.c                |  113 ++++++++----
> ----
> >  arch/arm/mach-omap2/opp3xxx_data.c            |   50 +++++++
> >  arch/arm/mach-omap2/opp4xxx_data.c            |   38 +++++
> >  arch/arm/mach-omap2/voltage.c                 |  179
> ++++++++++++++++++++-----
> >  arch/arm/mach-omap2/voltage.h                 |  119
> +++++++++++++++--
> >  arch/arm/mach-omap2/voltagedomains3xxx_data.c |    4 +
> >  arch/arm/mach-omap2/voltagedomains44xx_data.c |    4 +
> >  10 files changed, 541 insertions(+), 105 deletions(-)
> >
>
>
> Regards,
> Nishanth Menon
--
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] 18+ messages in thread

* RE: [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer
  2011-03-15 15:16   ` Menon, Nishanth
@ 2011-03-15 16:14     ` Vishwanath Sripathy
  0 siblings, 0 replies; 18+ messages in thread
From: Vishwanath Sripathy @ 2011-03-15 16:14 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: linux-omap

> -----Original Message-----
> From: Menon, Nishanth [mailto:nm@ti.com]
> Sent: Tuesday, March 15, 2011 8:46 PM
> To: Vishwanath BS
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [RFC][PATCH 2/3] OMAP PM: Add support for bypassing
> VP/VC in Voltage layer
>
> On Tue, Mar 15, 2011 at 20:03, Vishwanath BS
> <vishwanath.bs@ti.com> wrote:
> > Currently Voltage layer assumes that all PMICs use VP/VC for Voltage
> scaling.
> > There can be some instances where PMIC would want to bypass VP/VC
> for voltage
> > scaling. So make VOltage layer flexible enough to handle this.
> please fix VOltage.
>
> The commit message does'nt actually explain enough. it is too vague.
>
> >
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> > ---
> >  arch/arm/mach-omap2/omap_twl.c |    5 +++++
> >  arch/arm/mach-omap2/voltage.c  |   12 +++++++-----
> >  arch/arm/mach-omap2/voltage.h  |    6 ++++++
> >  3 files changed, 18 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-
> omap2/omap_twl.c
> > index f96d4b2..42f66c6 100644
> > --- a/arch/arm/mach-omap2/omap_twl.c
> > +++ b/arch/arm/mach-omap2/omap_twl.c
> > @@ -157,6 +157,7 @@ static struct omap_volt_pmic_info
> omap3_mpu_volt_info = {
> >        .onlp_cmd               = twl4030_uv_to_vsel,
> >        .ret_cmd                = twl4030_uv_to_vsel,
> >        .off_cmd                = twl4030_uv_to_vsel,
> > +       .voltage_class  = VP_VC_CLASS,
>
> Do you need this all unassigned params in a static struct is 0 which
> is basically VP_VC_CLASS.
I did not get this. You do not need to fill all these parameters if you
are not using VP/VC.
>
> >  };
> >
> >  static struct omap_volt_pmic_info omap3_core_volt_info = {
> > @@ -176,6 +177,7 @@ static struct omap_volt_pmic_info
> omap3_core_volt_info = {
> >        .onlp_cmd               = twl4030_uv_to_vsel,
> >        .ret_cmd                = twl4030_uv_to_vsel,
> >        .off_cmd                = twl4030_uv_to_vsel,
> > +       .voltage_class  = VP_VC_CLASS,
> here as well
>
> >  };
> >
> >  static struct omap_volt_pmic_info omap4_mpu_volt_info = {
> > @@ -195,6 +197,7 @@ static struct omap_volt_pmic_info
> omap4_mpu_volt_info = {
> >        .onlp_cmd               = twl4030_uv_to_vsel,
> >        .ret_cmd                = twl4030_uv_to_vsel,
> >        .off_cmd                = twl4030_uv_to_vsel,
> > +       .voltage_class  = VP_VC_CLASS,
> again
>
> >  };
> >
> >  static struct omap_volt_pmic_info omap4_iva_volt_info = {
> > @@ -214,6 +217,7 @@ static struct omap_volt_pmic_info
> omap4_iva_volt_info = {
> >        .onlp_cmd               = twl4030_uv_to_vsel,
> >        .ret_cmd                = twl4030_uv_to_vsel,
> >        .off_cmd                = twl4030_uv_to_vsel,
> > +       .voltage_class  = VP_VC_CLASS,
> and again
>
> >  };
> >
> >  static struct omap_volt_pmic_info omap4_core_volt_info = {
> > @@ -233,6 +237,7 @@ static struct omap_volt_pmic_info
> omap4_core_volt_info = {
> >        .onlp_cmd               = twl4030_uv_to_vsel,
> >        .ret_cmd                = twl4030_uv_to_vsel,
> >        .off_cmd                = twl4030_uv_to_vsel,
> > +       .voltage_class  = VP_VC_CLASS,
> and here
> >  };
> >
> >  int __init omap4_twl_init(void)
> > diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-
> omap2/voltage.c
> > index 2ac990f..73fa3ee 100644
> > --- a/arch/arm/mach-omap2/voltage.c
> > +++ b/arch/arm/mach-omap2/voltage.c
> > @@ -1194,11 +1194,13 @@ int __init omap_voltage_late_init(void)
> >                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]))
> > -                       continue;
> > -               omap_vc_init(vdd_info[i]);
> > -               vp_init(vdd_info[i]);
> > -               vdd_debugfs_init(vdd_info[i]);
> > +               if (vdd_info[i]->pmic_info->voltage_class ==
> VP_VC_CLASS) {
> > +                       if (omap_vdd_data_configure(vdd_info[i]))
> > +                               continue;
> > +                       omap_vc_init(vdd_info[i]);
> > +                       vp_init(vdd_info[i]);
> > +                       vdd_debugfs_init(vdd_info[i]);
> > +               }
>
> >        }
> >
> >        return 0;
> > diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-
> omap2/voltage.h
> > index de4e09b..17b1e10
> > --- a/arch/arm/mach-omap2/voltage.h
> > +++ b/arch/arm/mach-omap2/voltage.h
> > @@ -23,6 +23,9 @@
> >  #define VOLTSCALE_VPFORCEUPDATE                1
> >  #define VOLTSCALE_VCBYPASS             2
> >
> > +#define VP_VC_CLASS 0
> > +#define REGULATOR_CLASS 1
> please - could you ensure namespace is proper in macro usage?
> I dont understand usage difference between VP_VC_CLASS and
> REGULATOR_CLASS
Use regulator class if you do not want to use OMAP Voltage layer.
>
> > +
> >  /**
> >  * struct omap_vfsm_instance_data - per-voltage manager FSM
> register/bitfield
> >  * data
> > @@ -87,6 +90,8 @@ struct omap_volt_data {
> >  * @onlp_cmd:  PMIC API to send onlp command instruction
> >  * @ret_cmd:   PMIC API to send ret command instruction
> >  * @off_cmd:   PMIC API to send off command instruction
> > + * @voltage_class: Voltage class used for voltage scaling (can be
> VP/VC method
> > + *                             or regulator based method for now).
> >  */
> >  struct omap_volt_pmic_info {
> >        int slew_rate;
> > @@ -105,6 +110,7 @@ struct omap_volt_pmic_info {
> >        unsigned char (*onlp_cmd)(unsigned long uV);
> >        unsigned char (*ret_cmd)(unsigned long uV);
> >        unsigned char (*off_cmd)(unsigned long uV);
> > +       u8 voltage_class;
> >  };
> >
> >  /**
> > --
> > 1.7.0.4
> overall, other than deciding to initialize or not initialize VP/VC
> based on class, I dont see how you have achieved $subject or $commit
> message in terms of bring in bypass ability to VP/VC by introducing
> class.
>
> A) the $subject is wrong. you have just introduced voltage_class - I
> suggest you state that instead.
> B) how your patch achieves support for bypassing vp/vc is not clear
> unfortunately.
I am not sure if you have really understood the patch.
The issue I am trying to address is, if someone wants to boot up OMAP +
some PMIC which does not use VP/VC for voltage scaling, how to achieve
that.

What do you mean by bypass ability?
If Voltage layer initialization is skipped (that's the case for regulator
class), then all subsequent voltage_scale calls will fail which is the
expected behavior.

Vishwa

>
> Regards,
> Nishanth Menon
--
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] 18+ messages in thread

* Re: [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up
  2011-03-15 16:06   ` Vishwanath Sripathy
@ 2011-03-16  1:18     ` Nishanth Menon
  0 siblings, 0 replies; 18+ messages in thread
From: Nishanth Menon @ 2011-03-16  1:18 UTC (permalink / raw)
  To: Vishwanath Sripathy; +Cc: linux-omap

Vishwanath Sripathy wrote, on 03/15/2011 09:36 PM:
>> -----Original Message-----
>> From: Menon, Nishanth [mailto:nm@ti.com]
>> Sent: Tuesday, March 15, 2011 8:38 PM
>> To: Vishwanath BS
>> Cc: linux-omap@vger.kernel.org
>> Subject: Re: [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up
>>
>> On Tue, Mar 15, 2011 at 20:03, Vishwanath BS
>> <vishwanath.bs@ti.com>  wrote:
>>>
>>> This patch series attempts to do some more clean up on OMAP Voltage
>> layer on top
>>> of the clean up done by Paul as part of
>>> https://patchwork.kernel.org/patch/591421/
>>>
>>> These patches are generated against latest omap-for-linus branch on
>> Tony's tree
>>> (commit id: 05f689400ea5fa3d71af82f910c8b140f87ad1f3) and tested
>> on OMAP ZOOM3
>>> and OMAP4430 SDP with Smartreflex enabled.
>>>
>>> Vishwanath BS (3):
>>>   OMAP PM: Seggregate Voltage layer parameters
>>>   OMAP PM: Add support for bypassing VP/VC in Voltage layer
>>>   OMAP PM: Add Board specific parameters for OMAP Volatge layer
>>
>> I dont really see why I need to keep fixing your $subjects, but here
>> again,
>> all $subjects, OMAP3+: PM: makes more sense
> This is not OMAP3 specific. It applies to OMAP4 as well.
which is why i recommended OMAP3+ and not OMAP3

>>
>>>
>>>   arch/arm/mach-omap2/board-4430sdp.c           |   52 +++++++
>>
>> Curious if Panda and other OMAP3 platforms where considered.
> That's TODO as per my Patch3 commit log.
would've been nice to see that info in 0/3

[..]
-- 
Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters for OMAP Volatge layer
  2011-03-15 15:38   ` Menon, Nishanth
@ 2011-03-16  5:53     ` Vishwanath Sripathy
  2011-03-17 23:25     ` Kevin Hilman
  1 sibling, 0 replies; 18+ messages in thread
From: Vishwanath Sripathy @ 2011-03-16  5:53 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: linux-omap

> -----Original Message-----
> From: Menon, Nishanth [mailto:nm@ti.com]
> Sent: Tuesday, March 15, 2011 9:08 PM
> To: Vishwanath BS
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters
> for OMAP Volatge layer
>
> On Tue, Mar 15, 2011 at 20:03, Vishwanath BS
> <vishwanath.bs@ti.com> wrote:
> > This patch adds board specific parameters for ZOOM3 and OMAP4430
> SDP Boards.
> > The same needs to be done for other OMAP3 and OMAP4 boards once
> the approach
> > is accepted.
>
> Would have been great to see this info in 0/0 - what happens without
> these changes on other boards?
Ok will fix it.
>
> [...]
> > +union omap_volt_board_data zoom_mpu_volt_data = {
> > +       .omap3_board_data = {
> > +               .vdd_setup_ret = {
> > +                       .voltsetup      = OMAP3_VOLTSETUP_VDD1_RET,
> I disagree this is a board specific param - the help says "setup time
> of the VDDregulators in us" - seems to me that it is PMIC information
Yes. This should be PMIC parameter. Thanks for catching it.
>
> > +                       .clksetup       = OMAP3_CLKSETUP_RET,
> ????? why cant i just give oscillator ramp time in uSec?
Clksetup = PRM_VOLTOFFSET + PRM_VOLTSETUP2.. So it is not just oscillator
ramp time.

>
> > +                       .voltsetup2             = 0,
> why should I as  a board developer give this as well, why cant voltage
> layer do addition and save me a param?
Do you want to give 5 other parameters just to save one parameter?
From the patch, it is very clear how this parameter is calculated. Board
developer just needs to change the values of other required parameters and
this parameter is automatically calculated.
>
> > +                       },
> > +
> > +               .vdd_setup_off = {
> > +                       .voltsetup      = OMAP3_VOLTSETUP_VDD1_OFF,
> > +                       .clksetup       = OMAP3_CLKSETUP_OFF,
> > +                       .voltsetup2     = OMAP3_VOLTSETUP2,
> > +               },
> > +               .voltoffset             = OMAP3_VOLTOFFSET_OFF
> "offset-time to de-assert sys_offmode when exiting the OFF mode" - how
> am I supposed to measure that? again - why cant voltage layer add
> numbers?
It is not question of mathematical computation here. There are the
parameters that have to be measured manually to find the actual delay.
If your concern is lack of documentation on how to measure it, I can
provide relevant links.
>
> > +       }
> > +};
> > +
>
> my overall suggestion - when I fill in board file params - I should say:
> I use PMIC x, i have oscillator with ramp "y" uSec - the params should
> talk my language as a board developers - I dont want to know indepth
> details of voltage VP/VC registers and what they should contain. it is
> upto voltage layer to translate, add, bit shift or do what ever is
> necessary to take my board and pmic level details to register details.
>
> Sorry, even though this is a good start for abstraction, the overall
> motivation is missed, I think we need to work on it more.
The motivation here is to enable different kinds of PMIC and Boards to
work with OMAP Voltage layer (and not just board file params).

For your concern on board file abstraction, I do not think there are
magical formulae to calculate all these parameters based on one parameter.

Some have to be measured manually and probably documentation would help as
to how and what to measure. Pls let me know if you have any such formulae
to calculate these parameters.
Also note that these board file params are required only for OMAP3.

Vishwa
>
>
> Regards,
> Nishanth Menon
--
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] 18+ messages in thread

* RE: [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer
  2011-03-15 14:33 ` [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer Vishwanath BS
  2011-03-15 15:16   ` Menon, Nishanth
@ 2011-03-16  6:58   ` Premi, Sanjeev
  1 sibling, 0 replies; 18+ messages in thread
From: Premi, Sanjeev @ 2011-03-16  6:58 UTC (permalink / raw)
  To: Sripathy, Vishwanath, linux-omap

> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org 
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of 
> Sripathy, Vishwanath
> Sent: Tuesday, March 15, 2011 8:04 PM
> To: linux-omap@vger.kernel.org
> Cc: Sripathy, Vishwanath
> Subject: [RFC][PATCH 2/3] OMAP PM: Add support for bypassing 
> VP/VC in Voltage layer
> 
> Currently Voltage layer assumes that all PMICs use VP/VC for 
> Voltage scaling.
> There can be some instances where PMIC would want to bypass 
> VP/VC for voltage
> scaling. So make VOltage layer flexible enough to handle this.

[sp] This series still considers various PMICs meaning various
PMICs in TWL family.

However, this isn't always the case. I had posted an RFC indicating
issues that we come across when PMIC is not TWLx0y0.

I now have an update version of these patches - will be posting
them shortly - for reference.

In my opinion the cleanup needs to start at the basic PMIC
integration - only then we can have separation of concerns - opp,
voltage and smartreflex.

See: http://marc.info/?l=linux-omap&m=129848392424250&w=2

~sanjeev

> 
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters
  2011-03-15 14:33 ` [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters Vishwanath BS
@ 2011-03-17 23:20   ` Kevin Hilman
  2011-03-18 12:00     ` Vishwanath Sripathy
  2011-04-02  0:03   ` Kevin Hilman
  1 sibling, 1 reply; 18+ messages in thread
From: Kevin Hilman @ 2011-03-17 23:20 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap

Vishwanath BS <vishwanath.bs@ti.com> writes:

> Voltage layer takes various parameters which can be broadly classified as
> 1. OMAP/VP specific parameters
> 2. PMIC specific parameters
> 3. Board specific parameters

For readability sake, this could be broken up along into 3 patches for
these 3 items.

>
> This patch attempts to categorize the parameters in current voltage layer into
> above buckets. This will make voltage layer to work with different kinds of PMIC
> and boards.
>
> TODO: Provide infrastructure to use VC I2C (I2C4) for PMIC configuration (useful
> for cases where PMIC is connected to OMAP only via I2C4.
>
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> ---
>  arch/arm/mach-omap2/omap_opp_data.h           |    8 ++
>  arch/arm/mach-omap2/omap_twl.c                |  108 ++++++++---------
>  arch/arm/mach-omap2/opp3xxx_data.c            |   50 ++++++++
>  arch/arm/mach-omap2/opp4xxx_data.c            |   38 ++++++
>  arch/arm/mach-omap2/voltage.c                 |  167 ++++++++++++++++++++-----
>  arch/arm/mach-omap2/voltage.h                 |  115 +++++++++++++++--
>  arch/arm/mach-omap2/voltagedomains3xxx_data.c |    4 +
>  arch/arm/mach-omap2/voltagedomains44xx_data.c |    4 +
>  8 files changed, 393 insertions(+), 101 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h
> index c784c12..70d61d2 100644
> --- a/arch/arm/mach-omap2/omap_opp_data.h
> +++ b/arch/arm/mach-omap2/omap_opp_data.h
> @@ -86,11 +86,19 @@ extern int __init omap_init_opp_table(struct omap_opp_def *opp_def,
>  
>  extern struct omap_volt_data omap34xx_vddmpu_volt_data[];
>  extern struct omap_volt_data omap34xx_vddcore_volt_data[];
> +extern struct omap_vp_param omap34xx_mpu_vp_data;
> +extern struct omap_vp_param omap34xx_core_vp_data;
> +
>  extern struct omap_volt_data omap36xx_vddmpu_volt_data[];
>  extern struct omap_volt_data omap36xx_vddcore_volt_data[];
> +extern struct omap_vp_param omap36xx_mpu_vp_data;
> +extern struct omap_vp_param omap36xx_core_vp_data;
>  
>  extern struct omap_volt_data omap44xx_vdd_mpu_volt_data[];
>  extern struct omap_volt_data omap44xx_vdd_iva_volt_data[];
>  extern struct omap_volt_data omap44xx_vdd_core_volt_data[];
> +extern struct omap_vp_param omap44xx_mpu_vp_data;
> +extern struct omap_vp_param omap44xx_iva_vp_data;
> +extern struct omap_vp_param omap44xx_core_vp_data;
>  
>  #endif		/* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */
> diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
> index 0a8e74e..f96d4b2 100644
> --- a/arch/arm/mach-omap2/omap_twl.c
> +++ b/arch/arm/mach-omap2/omap_twl.c
> @@ -29,7 +29,6 @@
>  #define OMAP3_VP_VSTEPMIN_VSTEPMIN	0x1
>  #define OMAP3_VP_VSTEPMAX_VSTEPMAX	0x04
>  #define OMAP3_VP_VLIMITTO_TIMEOUT_US	200
> -
>  #define OMAP3430_VP1_VLIMITTO_VDDMIN	0x14
>  #define OMAP3430_VP1_VLIMITTO_VDDMAX	0x42
>  #define OMAP3430_VP2_VLIMITTO_VDDMIN	0x18
> @@ -44,12 +43,10 @@
>  #define OMAP4_VDD_MPU_SR_VOLT_REG	0x55
>  #define OMAP4_VDD_IVA_SR_VOLT_REG	0x5B
>  #define OMAP4_VDD_CORE_SR_VOLT_REG	0x61
> -
>  #define OMAP4_VP_CONFIG_ERROROFFSET	0x00
>  #define OMAP4_VP_VSTEPMIN_VSTEPMIN	0x01
>  #define OMAP4_VP_VSTEPMAX_VSTEPMAX	0x04
>  #define OMAP4_VP_VLIMITTO_TIMEOUT_US	200
> -
>  #define OMAP4_VP_MPU_VLIMITTO_VDDMIN	0xA
>  #define OMAP4_VP_MPU_VLIMITTO_VDDMAX	0x39
>  #define OMAP4_VP_IVA_VLIMITTO_VDDMIN	0xA
> @@ -146,101 +143,96 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
>  static struct omap_volt_pmic_info omap3_mpu_volt_info = {
>  	.slew_rate		= 4000,
>  	.step_size		= 12500,
> -	.on_volt		= 1200000,
> -	.onlp_volt		= 1000000,
> -	.ret_volt		= 975000,
> -	.off_volt		= 600000,
> -	.volt_setup_time	= 0xfff,
> -	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET,
> -	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
> -	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
> +	.vp_timeout_us	= OMAP3_VP_VLIMITTO_TIMEOUT_US,
> +	.i2c_slave_addr	= OMAP3_SRI2C_SLAVE_ADDR,
> +	.pmic_reg		= OMAP3_VDD_MPU_SR_CONTROL_REG,
> +	.vp_erroroffset	= OMAP3_VP_CONFIG_ERROROFFSET,
> +	.vp_vstepmin	= OMAP3_VP_VSTEPMIN_VSTEPMIN,
> +	.vp_vstepmax	= OMAP3_VP_VSTEPMAX_VSTEPMAX,

Please check the resulting indentation, and be sure it aligns with existing.

>  	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
>  	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,
> -	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US,
> -	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
> -	.pmic_reg		= OMAP3_VDD_MPU_SR_CONTROL_REG,
>  	.vsel_to_uv		= twl4030_vsel_to_uv,
>  	.uv_to_vsel		= twl4030_uv_to_vsel,
> +	.on_cmd			= twl4030_uv_to_vsel,
> +	.onlp_cmd		= twl4030_uv_to_vsel,
> +	.ret_cmd		= twl4030_uv_to_vsel,
> +	.off_cmd		= twl4030_uv_to_vsel,

These need more description (in the changelog and the code),
particularily why we need several functions for seemingly do
the same thing.

>  };
>  
>  static struct omap_volt_pmic_info omap3_core_volt_info = {
>  	.slew_rate		= 4000,
>  	.step_size		= 12500,
> -	.on_volt                = 1200000,
> -	.onlp_volt              = 1000000,
> -	.ret_volt               = 975000,
> -	.off_volt               = 600000,
> -	.volt_setup_time        = 0xfff,
> -	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET,
> -	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
> -	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
> +	.vp_timeout_us	= OMAP3_VP_VLIMITTO_TIMEOUT_US,
> +	.i2c_slave_addr	= OMAP3_SRI2C_SLAVE_ADDR,
> +	.pmic_reg		= OMAP3_VDD_CORE_SR_CONTROL_REG,
> +	.vp_erroroffset	= OMAP3_VP_CONFIG_ERROROFFSET,
> +	.vp_vstepmin	= OMAP3_VP_VSTEPMIN_VSTEPMIN,
> +	.vp_vstepmax	= OMAP3_VP_VSTEPMAX_VSTEPMAX,
>  	.vp_vddmin		= OMAP3430_VP2_VLIMITTO_VDDMIN,
>  	.vp_vddmax		= OMAP3430_VP2_VLIMITTO_VDDMAX,
> -	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US,
> -	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
> -	.pmic_reg		= OMAP3_VDD_CORE_SR_CONTROL_REG,
>  	.vsel_to_uv		= twl4030_vsel_to_uv,
>  	.uv_to_vsel		= twl4030_uv_to_vsel,
> +	.on_cmd			= twl4030_uv_to_vsel,
> +	.onlp_cmd		= twl4030_uv_to_vsel,
> +	.ret_cmd		= twl4030_uv_to_vsel,
> +	.off_cmd		= twl4030_uv_to_vsel,
>  };
>  
>  static struct omap_volt_pmic_info omap4_mpu_volt_info = {
>  	.slew_rate		= 4000,
>  	.step_size		= 12500,
> -	.on_volt		= 1350000,
> -	.onlp_volt		= 1350000,
> -	.ret_volt		= 837500,
> -	.off_volt		= 600000,
> -	.volt_setup_time	= 0,
> -	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
> -	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> -	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> +	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> +	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
> +	.pmic_reg		= OMAP4_VDD_MPU_SR_VOLT_REG,
> +	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
> +	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> +	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
>  	.vp_vddmin		= OMAP4_VP_MPU_VLIMITTO_VDDMIN,
>  	.vp_vddmax		= OMAP4_VP_MPU_VLIMITTO_VDDMAX,
> -	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> -	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
> -	.pmic_reg		= OMAP4_VDD_MPU_SR_VOLT_REG,
>  	.vsel_to_uv		= twl6030_vsel_to_uv,
>  	.uv_to_vsel		= twl6030_uv_to_vsel,
> +	.on_cmd			= twl4030_uv_to_vsel,
> +	.onlp_cmd		= twl4030_uv_to_vsel,
> +	.ret_cmd		= twl4030_uv_to_vsel,
> +	.off_cmd		= twl4030_uv_to_vsel,
>  };
>  
>  static struct omap_volt_pmic_info omap4_iva_volt_info = {
>  	.slew_rate		= 4000,
>  	.step_size		= 12500,
> -	.on_volt		= 1100000,
> -	.onlp_volt		= 1100000,
> -	.ret_volt		= 837500,
> -	.off_volt		= 600000,
> -	.volt_setup_time	= 0,
> -	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
> -	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> -	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> +	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> +	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
> +	.pmic_reg		= OMAP4_VDD_IVA_SR_VOLT_REG,
> +	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
> +	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> +	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
>  	.vp_vddmin		= OMAP4_VP_IVA_VLIMITTO_VDDMIN,
>  	.vp_vddmax		= OMAP4_VP_IVA_VLIMITTO_VDDMAX,
> -	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> -	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
> -	.pmic_reg		= OMAP4_VDD_IVA_SR_VOLT_REG,
>  	.vsel_to_uv		= twl6030_vsel_to_uv,
>  	.uv_to_vsel		= twl6030_uv_to_vsel,
> +	.on_cmd			= twl4030_uv_to_vsel,
> +	.onlp_cmd		= twl4030_uv_to_vsel,
> +	.ret_cmd		= twl4030_uv_to_vsel,
> +	.off_cmd		= twl4030_uv_to_vsel,
>  };
>  
>  static struct omap_volt_pmic_info omap4_core_volt_info = {
>  	.slew_rate		= 4000,
>  	.step_size		= 12500,
> -	.on_volt		= 1100000,
> -	.onlp_volt		= 1100000,
> -	.ret_volt		= 837500,
> -	.off_volt		= 600000,
> -	.volt_setup_time	= 0,
> -	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
> -	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> -	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> +	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> +	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
> +	.pmic_reg		= OMAP4_VDD_CORE_SR_VOLT_REG,
> +	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
> +	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> +	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
>  	.vp_vddmin		= OMAP4_VP_CORE_VLIMITTO_VDDMIN,
>  	.vp_vddmax		= OMAP4_VP_CORE_VLIMITTO_VDDMAX,
> -	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> -	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
> -	.pmic_reg		= OMAP4_VDD_CORE_SR_VOLT_REG,
>  	.vsel_to_uv		= twl6030_vsel_to_uv,
>  	.uv_to_vsel		= twl6030_uv_to_vsel,
> +	.on_cmd			= twl4030_uv_to_vsel,
> +	.onlp_cmd		= twl4030_uv_to_vsel,
> +	.ret_cmd		= twl4030_uv_to_vsel,
> +	.off_cmd		= twl4030_uv_to_vsel,
>  };
>  
>  int __init omap4_twl_init(void)
> diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
> index d95f3f9..a614baf 100644
> --- a/arch/arm/mach-omap2/opp3xxx_data.c
> +++ b/arch/arm/mach-omap2/opp3xxx_data.c
> @@ -26,6 +26,16 @@
>  #include "pm.h"
>  
>  /* 34xx */
> +/* OMAP VP parameter values */
> +#define OMAP3430_VP1_VLIMITTO_VDDMIN	0x14
> +#define OMAP3430_VP1_VLIMITTO_VDDMAX	0x42
> +#define OMAP3430_VP2_VLIMITTO_VDDMIN	0x18
> +#define OMAP3430_VP2_VLIMITTO_VDDMAX	0x2c
> +

> +#define OMAP3_ON_VOLTAGE_UV				1200000
> +#define OMAP3_ONLP_VOLTAGE_UV			1000000
> +#define OMAP3_RET_VOLTAGE_UV			975000
> +#define OMAP3_OFF_VOLTAGE_UV			600000

s/OMAP3_/OMAP34XX_/

>  /* VDD1 */
>  
> @@ -44,6 +54,15 @@ struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
>  	VOLT_DATA_DEFINE(0, 0, 0, 0),
>  };
>  
> +struct omap_vp_param omap34xx_mpu_vp_data = {
> +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,

Any reason you're adding these as part of a VP struct.  These various values
(after being converted) are written to the VC (specifically VC_CMD_VAL)
and done in the vc_init function, so they should be in a VC specific struct.

Also, the changelog should discuss *why* you decided to move these from
the PMIC struct to this struct.  Doing so suggests these values will not
be different for different PMICs.  That needs to be discussed in the changelog.

> +	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
> +	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,

Now these exist in both the pmic_info struct and this struct. 

Again, the changelog needs to describe *why* you want them in both
places, and what the decision will be in using them.  For example: these
provide default values, PMIC values can override.


> +};
> +
>  /* VDD2 */
>  
>  #define OMAP3430_VDD_CORE_OPP1_UV		975000
> @@ -57,7 +76,20 @@ struct omap_volt_data omap34xx_vddcore_volt_data[] = {
>  	VOLT_DATA_DEFINE(0, 0, 0, 0),
>  };
>  
> +struct omap_vp_param omap34xx_core_vp_data = {
> +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
> +	.vp_vddmin		= OMAP3430_VP2_VLIMITTO_VDDMIN,
> +	.vp_vddmax		= OMAP3430_VP2_VLIMITTO_VDDMAX,
> +};
> +
>  /* 36xx */
> +#define OMAP3630_VP1_VLIMITTO_VDDMIN	0x18
> +#define OMAP3630_VP1_VLIMITTO_VDDMAX	0x3c
> +#define OMAP3630_VP2_VLIMITTO_VDDMIN	0x18
> +#define OMAP3630_VP2_VLIMITTO_VDDMAX	0x30
>  
>  /* VDD1 */
>  
> @@ -74,6 +106,14 @@ struct omap_volt_data omap36xx_vddmpu_volt_data[] = {
>  	VOLT_DATA_DEFINE(0, 0, 0, 0),
>  };
>  
> +struct omap_vp_param omap36xx_mpu_vp_data = {
> +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
> +	.vp_vddmin		= OMAP3630_VP1_VLIMITTO_VDDMIN,
> +	.vp_vddmax		= OMAP3630_VP1_VLIMITTO_VDDMAX,
> +};
>  /* VDD2 */
>  
>  #define OMAP3630_VDD_CORE_OPP50_UV		1000000
> @@ -85,6 +125,16 @@ struct omap_volt_data omap36xx_vddcore_volt_data[] = {
>  	VOLT_DATA_DEFINE(0, 0, 0, 0),
>  };
>  
> +struct omap_vp_param omap36xx_core_vp_data = {
> +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
> +	.vp_vddmin		= OMAP3630_VP2_VLIMITTO_VDDMIN,
> +	.vp_vddmax		= OMAP3630_VP2_VLIMITTO_VDDMAX,
> +};
> +
> +
>  /* OPP data */
>  
>  static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
> diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c
> index 2293ba2..d5a5d3f 100644
> --- a/arch/arm/mach-omap2/opp4xxx_data.c
> +++ b/arch/arm/mach-omap2/opp4xxx_data.c
> @@ -30,6 +30,17 @@
>   * Structures containing OMAP4430 voltage supported and various
>   * voltage dependent data for each VDD.
>   */
> +#define OMAP4_VP_MPU_VLIMITTO_VDDMIN	0xA
> +#define OMAP4_VP_MPU_VLIMITTO_VDDMAX	0x39
> +#define OMAP4_VP_IVA_VLIMITTO_VDDMIN	0xA
> +#define OMAP4_VP_IVA_VLIMITTO_VDDMAX	0x2D
> +#define OMAP4_VP_CORE_VLIMITTO_VDDMIN	0xA
> +#define OMAP4_VP_CORE_VLIMITTO_VDDMAX	0x28

minor: use lower-case hex values

> +#define OMAP4_ON_VOLTAGE_UV				1350000
> +#define OMAP4_ONLP_VOLTAGE_UV			1350000
> +#define OMAP4_RET_VOLTAGE_UV			837500
> +#define OMAP4_OFF_VOLTAGE_UV			600000
>  
>  #define OMAP4430_VDD_MPU_OPP50_UV		1025000
>  #define OMAP4430_VDD_MPU_OPP100_UV		1200000
> @@ -44,6 +55,15 @@ struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = {
>  	VOLT_DATA_DEFINE(0, 0, 0, 0),
>  };
>  
> +struct omap_vp_param omap44xx_mpu_vp_data = {
> +	.on_volt		= OMAP4_ON_VOLTAGE_UV,
> +	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
> +	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
> +	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
> +	.vp_vddmin		= OMAP4_VP_MPU_VLIMITTO_VDDMIN,
> +	.vp_vddmax		= OMAP4_VP_MPU_VLIMITTO_VDDMAX,
> +};
> +
>  #define OMAP4430_VDD_IVA_OPP50_UV		1013000
>  #define OMAP4430_VDD_IVA_OPP100_UV		1188000
>  #define OMAP4430_VDD_IVA_OPPTURBO_UV		1300000
> @@ -55,6 +75,15 @@ struct omap_volt_data omap44xx_vdd_iva_volt_data[] = {
>  	VOLT_DATA_DEFINE(0, 0, 0, 0),
>  };
>  
> +struct omap_vp_param omap44xx_iva_vp_data = {
> +	.on_volt		= OMAP4_ON_VOLTAGE_UV,
> +	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
> +	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
> +	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
> +	.vp_vddmin		= OMAP4_VP_IVA_VLIMITTO_VDDMIN,
> +	.vp_vddmax		= OMAP4_VP_IVA_VLIMITTO_VDDMAX,
> +};
> +
>  #define OMAP4430_VDD_CORE_OPP50_UV		1025000
>  #define OMAP4430_VDD_CORE_OPP100_UV		1200000
>  
> @@ -64,6 +93,15 @@ struct omap_volt_data omap44xx_vdd_core_volt_data[] = {
>  	VOLT_DATA_DEFINE(0, 0, 0, 0),
>  };
>  
> +struct omap_vp_param omap44xx_core_vp_data = {
> +	.on_volt		= OMAP4_ON_VOLTAGE_UV,
> +	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
> +	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
> +	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
> +	.vp_vddmin		= OMAP4_VP_CORE_VLIMITTO_VDDMIN,
> +	.vp_vddmax		= OMAP4_VP_CORE_VLIMITTO_VDDMAX,
> +};
> +
>  
>  static struct omap_opp_def __initdata omap44xx_opp_def_list[] = {
>  	/* MPU OPP1 - OPP50 */
> diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
> index c6facf7..2ac990f 100644
> --- a/arch/arm/mach-omap2/voltage.c
> +++ b/arch/arm/mach-omap2/voltage.c
> @@ -42,7 +42,6 @@
>  
>  #define VOLTAGE_DIR_SIZE	16
>  
> -
>  static struct omap_vdd_info **vdd_info;
>  
>  /*
> @@ -124,9 +123,10 @@ static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
>  
>  	timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000;
>  	vdd->vp_rt_data.vlimitto_timeout = timeout_val;
> -	vdd->vp_rt_data.vlimitto_vddmin = vdd->pmic_info->vp_vddmin;
> -	vdd->vp_rt_data.vlimitto_vddmax = vdd->pmic_info->vp_vddmax;
> -

Here would be a good spot to discuss the decision being made to pick the
min/max value.  This will very easily result in potentially picking one
value from your VP struct and another from the PMIC struct so needs to
be carefully described so reviewers can be sure it's doing what you
intend it do be doing.

> +	vdd->vp_rt_data.vlimitto_vddmin = (vdd->vp_param->vp_vddmin > vdd->pmic_info->vp_vddmin) ?
> +						vdd->vp_param->vp_vddmin : vdd->pmic_info->vp_vddmin;
> +	vdd->vp_rt_data.vlimitto_vddmax = (vdd->vp_param->vp_vddmax > vdd->pmic_info->vp_vddmax) ?
> +						vdd->pmic_info->vp_vddmax : vdd->vp_param->vp_vddmax;
>  	waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) *
>  				sys_clk_speed) / 1000;
>  	vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
> @@ -523,15 +523,35 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
>  
>  static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
>  {
> +	struct clk *omap_32k_clk;
> +	u32 omap_32k_clk_speed;
> +	unsigned long temp;
> +
>  	/*
>  	 * 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,
> -		       OMAP3_PRM_VOLTOFFSET_OFFSET);
> -	vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
> -		       OMAP3_PRM_VOLTSETUP2_OFFSET);
> +
> +	omap_32k_clk = clk_get(NULL, "wkup_32k_fck");
> +	if (IS_ERR(omap_32k_clk)) {
> +		pr_warning("%s: Could not get the 32k_clk clk to calculate"
> +			"various vdd_%s params\n", __func__, vdd->voltdm.name);
> +		return;
> +	}
> +	omap_32k_clk_speed = clk_get_rate(omap_32k_clk);
> +	clk_put(omap_32k_clk);
> +
> +	temp = vdd->board_data->omap3_board_data.vdd_setup_off.clksetup;

What if nobody has called omap_voltage_register_board_params() ?

What is need are some default values (probably as fields in the VDD
struct) which can be overridden by board files, but will provide
sensible defaults if no board file overrides are done.

> +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> +	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET);
> +
> +	temp = vdd->board_data->omap3_board_data.vdd_setup_off.voltsetup2;
> +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> +	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_VOLTSETUP2_OFFSET);
> +
> +	temp = vdd->board_data->omap3_board_data.voltoffset;
> +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> +	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_VOLTOFFSET_OFFSET);
> +
>  }
>  
>  static void __init omap3_vc_init(struct omap_vdd_info *vdd)
> @@ -539,21 +559,45 @@ static void __init omap3_vc_init(struct omap_vdd_info *vdd)
>  	static bool is_initialized;
>  	u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
>  	u32 vc_val;
> -
> -	if (is_initialized)
> -		return;
> +	struct clk *sys_ck;
> +	u32 sys_clk_speed;
> +	unsigned long temp;
>  
>  	/* Set up the on, inactive, retention and off voltage */
> -	on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
> -	onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt);
> -	ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt);
> -	off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt);
> +	on_vsel = vdd->pmic_info->on_cmd(vdd->vp_param->on_volt);
> +	onlp_vsel = vdd->pmic_info->onlp_cmd(vdd->vp_param->onlp_volt);
> +	ret_vsel = vdd->pmic_info->ret_cmd(vdd->vp_param->ret_volt);
> +	off_vsel = vdd->pmic_info->off_cmd(vdd->vp_param->off_volt);
>  	vc_val	= ((on_vsel << vdd->vc_data->vc_common->cmd_on_shift) |
>  		(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);
>  
> +	sys_ck = clk_get(NULL, "sys_ck");
> +	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);
> +		return;
> +	}
> +	sys_clk_speed = clk_get_rate(sys_ck);
> +	clk_put(sys_ck);
> +	/* Divide to avoid overflow */
> +	sys_clk_speed /= 1000000;
> +
> +	/* Configure the setup times */
> +	vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg);
> +	vc_val &= ~vdd->vfsm->voltsetup_mask;
> +	temp = vdd->board_data->omap3_board_data.vdd_setup_off.voltsetup;

again, fails if nobody has called the board override function.

> +	temp = temp * sys_clk_speed / 8;
> +	vc_val |= temp << vdd->vfsm->voltsetup_shift;
> +	vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg);
> +
> +	omap3_vfsm_init(vdd);
> +
> +	if (is_initialized)
> +		return;
> +
>  	/*
>  	 * Generic VC parameters init
>  	 * XXX This data should be abstracted out
> @@ -563,8 +607,6 @@ static void __init omap3_vc_init(struct omap_vdd_info *vdd)
>  	vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, prm_mod_offs,
>  			OMAP3_PRM_VC_I2C_CFG_OFFSET);
>  
> -	omap3_vfsm_init(vdd);
> -
>  	is_initialized = true;
>  }
>  
> @@ -573,12 +615,69 @@ static void __init omap3_vc_init(struct omap_vdd_info *vdd)
>  static void __init omap4_vc_init(struct omap_vdd_info *vdd)
>  {
>  	static bool is_initialized;
> -	u32 vc_val;
> +	u32 vc_val, temp, prescalar, ramp_count;
> +	struct clk *sys_ck;
> +	u32 sys_clk_speed;
>  
> -	if (is_initialized)
> +	sys_ck = clk_get(NULL, "sys_clkin_ck");
> +	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);
>  		return;
> +	}
> +	sys_clk_speed = clk_get_rate(sys_ck);
> +	clk_put(sys_ck);
> +	/* Divide to avoid overflow */
> +	sys_clk_speed /= 1000000;
> +
> +	/* Configure the setup times */
> +	vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg);
> +	temp = vdd->board_data->omap4_board_data.vdd_setup_off.voltsetup_ramp_down;
> +	prescalar = temp * 63 / sys_clk_speed;
> +	if (prescalar <= 16)
> +		prescalar = 16;
> +	else if (prescalar <= 64)
> +		prescalar = 64;
> +	else if (prescalar <= 128)
> +		prescalar = 128;
> +	else if (prescalar <= 512)
> +		prescalar = 512;
> +	else
> +		pr_warning("%s: Invalid VoltOff set up time for vdd%s\n",
> +			__func__, vdd->voltdm.name);
> +
> +	vc_val &= ~OMAP4430_RAMP_DOWN_PRESCAL_MASK;
> +	vc_val |= prescalar << OMAP4430_RAMP_DOWN_PRESCAL_SHIFT;
> +
> +	ramp_count = (temp * sys_clk_speed / prescalar) << OMAP4430_RAMP_DOWN_COUNT_SHIFT;
> +	vc_val &= ~OMAP4430_RAMP_DOWN_COUNT_MASK;
> +	vc_val |= ramp_count;
> +
> +	temp = vdd->board_data->omap4_board_data.vdd_setup_off.voltsetup_ramp_up;
> +	prescalar = temp * 63 / sys_clk_speed;
> +	if (prescalar <= 16)
> +		prescalar = 16;
> +	else if (prescalar <= 64)
> +		prescalar = 64;
> +	else if (prescalar <= 128)
> +		prescalar = 128;
> +	else if (prescalar <= 512)
> +		prescalar = 512;
> +	else
> +		pr_warning("%s: Invalid VoltOff set up time for vdd%s\n",
> +			__func__, vdd->voltdm.name);
> +
> +	vc_val &= ~OMAP4430_RAMP_UP_PRESCAL_MASK;
> +	vc_val |= prescalar << OMAP4430_RAMP_UP_PRESCAL_SHIFT;
>  
> -	/* TODO: Configure setup times and CMD_VAL values*/
> +	ramp_count = (temp * sys_clk_speed / prescalar) << OMAP4430_RAMP_UP_COUNT_SHIFT;
> +	vc_val &= ~OMAP4430_RAMP_UP_COUNT_MASK;
> +	vc_val |= ramp_count;
> +
> +	vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg);
> +
> +	if (is_initialized)
> +		return;
>  
>  	/*
>  	 * Generic VC parameters init
> @@ -629,13 +728,6 @@ static void __init omap_vc_init(struct omap_vdd_info *vdd)
>  	vdd->write_reg(vc_val, prm_mod_offs,
>  		       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->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);
> -
>  	if (cpu_is_omap34xx())
>  		omap3_vc_init(vdd);
>  	else if (cpu_is_omap44xx())
> @@ -971,6 +1063,23 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
>  	return 0;
>  }
>  
> +int omap_voltage_register_board_params(struct voltagedomain *voltdm,
> +		union omap_volt_board_data *board_params)
> +{
> +	struct omap_vdd_info *vdd;
> +
> +	if (!voltdm || IS_ERR(voltdm)) {
> +		pr_warning("%s: VDD specified does not exist!\n", __func__);
> +		return -EINVAL;
> +	}
> +
> +	vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
> +
> +	vdd->board_data = board_params;
> +
> +	return 0;
> +}
> +
>  /**
>   * omap_voltage_get_dbgdir() - API to get pointer to the debugfs directory
>   *				corresponding to a voltage domain.
> diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
> index e9f5408..de4e09b 100644
> --- a/arch/arm/mach-omap2/voltage.h
> +++ b/arch/arm/mach-omap2/voltage.h
> @@ -23,14 +23,6 @@
>  #define VOLTSCALE_VPFORCEUPDATE		1
>  #define VOLTSCALE_VCBYPASS		2
>  
> -/*
> - * OMAP3 GENERIC setup times. Revisit to see if these needs to be
> - * passed from board or PMIC file
> - */
> -#define OMAP3_CLKSETUP		0xff
> -#define OMAP3_VOLTOFFSET	0xff
> -#define OMAP3_VOLTSETUP2	0xff
> -
>  /**
>   * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
>   * data
> @@ -80,17 +72,25 @@ struct omap_volt_data {
>   * struct omap_volt_pmic_info - PMIC specific data required by voltage driver.
>   * @slew_rate:	PMIC slew rate (in uv/us)
>   * @step_size:	PMIC voltage step size (in uv)
> + * @vp_erroroffset:	Offset value in the Error to Voltage converter
> + * @vp_vstepmin:	Minimum voltage step in mV
> + * @vp_vstepmax:	Maximum voltage step in mV
> + * @vp_vddmin:	Minimum voltage supply level in mV
> + * @vp_vddmax:	Maximum voltage supply level in mV
> + * @vp_timeout_us:	Voltage Controller's maximum wait time for response
> + * @i2c_slave_addr:	I2C slave address value for the Power IC device.
> + * @pmic_reg:	voltage configuration register address value for the
> + *				VDD channe
>   * @vsel_to_uv:	PMIC API to convert vsel value to actual voltage in uV.
>   * @uv_to_vsel:	PMIC API to convert voltage in uV to vsel value.
> + * @on_cmd:	PMIC API to send on command instruction
> + * @onlp_cmd:	PMIC API to send onlp command instruction
> + * @ret_cmd:	PMIC API to send ret command instruction
> + * @off_cmd:	PMIC API to send off command instruction
>   */
>  struct omap_volt_pmic_info {
>  	int slew_rate;
>  	int step_size;
> -	u32 on_volt;
> -	u32 onlp_volt;
> -	u32 ret_volt;
> -	u32 off_volt;
> -	u16 volt_setup_time;
>  	u8 vp_erroroffset;
>  	u8 vp_vstepmin;
>  	u8 vp_vstepmax;
> @@ -101,11 +101,30 @@ struct omap_volt_pmic_info {
>  	u8 pmic_reg;
>  	unsigned long (*vsel_to_uv) (const u8 vsel);
>  	u8 (*uv_to_vsel) (unsigned long uV);
> +	unsigned char (*on_cmd)(unsigned long uV);
> +	unsigned char (*onlp_cmd)(unsigned long uV);
> +	unsigned char (*ret_cmd)(unsigned long uV);
> +	unsigned char (*off_cmd)(unsigned long uV);
> +};
> +
> +/**
> + * struct omap_vp_param - VP specific data required by voltage driver.
> + * @on_volt: on voltage for the device in mV
> + * @onlp_volt: inactive voltage for the device in mV
> + * @ret_volt: retention voltage for the device in mV
> + * @off_volt: off voltage for the device in mV
> + */
> +struct omap_vp_param {
> +	u32 on_volt;
> +	u32 onlp_volt;
> +	u32 ret_volt;
> +	u32 off_volt;
> +	u8 vp_vddmax;
> +	u8 vp_vddmin;
>  };
>  
>  /**
>   * omap_vdd_info - Per Voltage Domain info
> - *
>   * @volt_data		: voltage table having the distinct voltages supported
>   *			  by the domain and other associated per voltage data.
>   * @pmic_info		: pmic specific parameters which should be populted by
> @@ -116,6 +135,9 @@ struct omap_volt_pmic_info {
>   * @vc_data		: structure containing various various vc registers,
>   *			  shifts, masks etc.
>   * @vfsm                : voltage manager FSM data
> + * @vfsm                : voltage manager FSM data
> + * @vp_param			: VP specific parameters
> + * @board_data			: board specific parameters
>   * @voltdm		: pointer to the voltage domain structure
>   * @debug_dir		: debug directory for this voltage domain.
>   * @curr_volt		: current voltage for this vdd.
> @@ -129,6 +151,8 @@ 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 omap_vp_param *vp_param;
> +	union omap_volt_board_data *board_data;
>  	struct voltagedomain voltdm;
>  	struct dentry *debug_dir;
>  	u32 curr_volt;
> @@ -139,6 +163,61 @@ struct omap_vdd_info {
>  		unsigned long target_volt);
>  };
>  
> +/**
> + * omap3_vdd_setuptime - vdd set up time info
> + * @voltsetup	: setup time of the VDDregulators in us
> + * @clksetup	: setup time of the oscillator system clock (sys_clk) in us
> + * @voltsetup2	: Overall setup time of VDDregulators in us
> + */
> +struct omap3_vdd_setuptime {
> +	u16 voltsetup;
> +	u16 clksetup;
> +	u16 voltsetup2;
> +};
> +
> +/**
> + * omap3_volt_board_data - vdd set up time info for OMAP3
> + * @vdd_setup_ret	: VDD setup time for retention mode
> + * @vdd_setup_off	: VDD setup time for off mode
> + * @voltoffset		: offset-time to de-assert sys_offmode
> + *					when exiting the OFF mode
> + */
> +struct omap3_volt_board_data {
> +	struct omap3_vdd_setuptime vdd_setup_ret;
> +	struct omap3_vdd_setuptime vdd_setup_off;
> +	u16 voltoffset;
> +};
> +
> +/**
> + * omap4_volt_setuptime - vdd set up time info for OMAP4
> + * @voltsetup_ramp_up	: VDD ram up time in us
> + * @voltsetup_ramp_down	: VDD ram down time in us
> + */
> +struct omap4_volt_setuptime {
> +	u16 voltsetup_ramp_up;
> +	u16 voltsetup_ramp_down;
> +};
> +/**
> + * omap4_volt_board_data - vdd set up time info for OMAP4
> + * @vdd_setup_ret	: VDD setup time for retention mode
> + * @vdd_setup_off	: VDD setup time for off mode
> + */
> +struct omap4_volt_board_data {
> +	struct omap4_volt_setuptime vdd_setup_ret;
> +	struct omap4_volt_setuptime vdd_setup_off;
> +};

It appears OMAP4 has a CLKSETUP equivalent too.  c.f. CLKSETUPTIME
register in the SCRM.

> +/**
> + * omap_volt_board_data - board specific voltage set up time data
> + * @omap3_board_data	: omap3 board data
> + * @omap4_board_data	: omap4 board data
> + */
> +union omap_volt_board_data {
> +	struct omap3_volt_board_data omap3_board_data;
> +	struct omap4_volt_board_data omap4_board_data;
> +};

For board code, we need an SoC independent way of passing data.

Rather than board files providing the register values themselves, they
should just provide times.  The SoC specific code can then how to
program the registers (and prescalers etc.)

>  unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
>  void omap_vp_enable(struct voltagedomain *voltdm);
>  void omap_vp_disable(struct voltagedomain *voltdm);
> @@ -163,6 +242,9 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
>  struct voltagedomain *omap_voltage_domain_lookup(char *name);
>  
>  int omap_voltage_late_init(void);
> +int omap_voltage_register_board_params(struct voltagedomain *voltdm,
> +		union omap_volt_board_data *board_params);
> +
>  #else
>  static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
>  		struct omap_volt_pmic_info *pmic_info)
> @@ -179,6 +261,11 @@ static inline struct voltagedomain *omap_voltage_domain_lookup(char *name)
>  {
>  	return ERR_PTR(-EINVAL);
>  }
> +static inline int omap_voltage_register_board_params(struct voltagedomain *voltdm,
> +		struct omap_volt_board_data *board_params)
> +{
> +	return ERR_PTR(-EINVAL);
> +}
>  #endif
>  
>  #endif
> diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
> index def230f..62ae1ee 100644
> --- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
> +++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
> @@ -83,9 +83,13 @@ static int __init omap3xxx_voltage_early_init(void)
>  	if (cpu_is_omap3630()) {
>  		omap3_vdd1_info.volt_data = omap36xx_vddmpu_volt_data;
>  		omap3_vdd2_info.volt_data = omap36xx_vddcore_volt_data;
> +		omap3_vdd1_info.vp_param = &omap36xx_mpu_vp_data;
> +		omap3_vdd2_info.vp_param = &omap36xx_core_vp_data;
>  	} else {
>  		omap3_vdd1_info.volt_data = omap34xx_vddmpu_volt_data;
>  		omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
> +		omap3_vdd1_info.vp_param = &omap34xx_mpu_vp_data;
> +		omap3_vdd2_info.vp_param = &omap34xx_core_vp_data;
>  	}
>  
>  	return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
> diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
> index cb64996..972760c 100644
> --- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
> +++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
> @@ -95,6 +95,10 @@ 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;
>  
> +	omap4_vdd_mpu_info.vp_param = &omap44xx_mpu_vp_data;
> +	omap4_vdd_iva_info.vp_param = &omap44xx_iva_vp_data;
> +	omap4_vdd_core_info.vp_param = &omap44xx_core_vp_data;
> +
>  	return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
>  				       omap4_vdd_info,
>  				       ARRAY_SIZE(omap4_vdd_info));

Kevin

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters for OMAP Volatge layer
  2011-03-15 15:38   ` Menon, Nishanth
  2011-03-16  5:53     ` Vishwanath Sripathy
@ 2011-03-17 23:25     ` Kevin Hilman
  1 sibling, 0 replies; 18+ messages in thread
From: Kevin Hilman @ 2011-03-17 23:25 UTC (permalink / raw)
  To: Menon, Nishanth; +Cc: Vishwanath BS, linux-omap

"Menon, Nishanth" <nm@ti.com> writes:

[...]

> my overall suggestion - when I fill in board file params - I should say:
> I use PMIC x, i have oscillator with ramp "y" uSec - the params should
> talk my language as a board developers - I dont want to know indepth
> details of voltage VP/VC registers and what they should contain. it is
> upto voltage layer to translate, add, bit shift or do what ever is
> necessary to take my board and pmic level details to register details.

Completely agree with Nishanth.

See my comments on PATCH 1/3 which say basically the same thing.

Kevin

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters
  2011-03-17 23:20   ` Kevin Hilman
@ 2011-03-18 12:00     ` Vishwanath Sripathy
  0 siblings, 0 replies; 18+ messages in thread
From: Vishwanath Sripathy @ 2011-03-18 12:00 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap

> -----Original Message-----
> From: Kevin Hilman [mailto:khilman@ti.com]
> Sent: Friday, March 18, 2011 4:51 AM
> To: Vishwanath BS
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer
> parameters
>
> Vishwanath BS <vishwanath.bs@ti.com> writes:
>
> > Voltage layer takes various parameters which can be broadly classified
> as
> > 1. OMAP/VP specific parameters
> > 2. PMIC specific parameters
> > 3. Board specific parameters
>
> For readability sake, this could be broken up along into 3 patches for
> these 3 items.
OK. I need to check if I can get individual patches compilable when they
are split.
>
> >
> > This patch attempts to categorize the parameters in current voltage
> layer into
> > above buckets. This will make voltage layer to work with different
> kinds of PMIC
> > and boards.
> >
> > TODO: Provide infrastructure to use VC I2C (I2C4) for PMIC
> configuration (useful
> > for cases where PMIC is connected to OMAP only via I2C4.
> >
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
> > ---
> >  arch/arm/mach-omap2/omap_opp_data.h           |    8 ++
> >  arch/arm/mach-omap2/omap_twl.c                |  108 ++++++++----
> -----
> >  arch/arm/mach-omap2/opp3xxx_data.c            |   50 ++++++++
> >  arch/arm/mach-omap2/opp4xxx_data.c            |   38 ++++++
> >  arch/arm/mach-omap2/voltage.c                 |  167
> ++++++++++++++++++++-----
> >  arch/arm/mach-omap2/voltage.h                 |  115
> +++++++++++++++--
> >  arch/arm/mach-omap2/voltagedomains3xxx_data.c |    4 +
> >  arch/arm/mach-omap2/voltagedomains44xx_data.c |    4 +
> >  8 files changed, 393 insertions(+), 101 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/omap_opp_data.h
> b/arch/arm/mach-omap2/omap_opp_data.h
> > index c784c12..70d61d2 100644
> > --- a/arch/arm/mach-omap2/omap_opp_data.h
> > +++ b/arch/arm/mach-omap2/omap_opp_data.h
> > @@ -86,11 +86,19 @@ extern int __init omap_init_opp_table(struct
> omap_opp_def *opp_def,
> >
> >  extern struct omap_volt_data omap34xx_vddmpu_volt_data[];
> >  extern struct omap_volt_data omap34xx_vddcore_volt_data[];
> > +extern struct omap_vp_param omap34xx_mpu_vp_data;
> > +extern struct omap_vp_param omap34xx_core_vp_data;
> > +
> >  extern struct omap_volt_data omap36xx_vddmpu_volt_data[];
> >  extern struct omap_volt_data omap36xx_vddcore_volt_data[];
> > +extern struct omap_vp_param omap36xx_mpu_vp_data;
> > +extern struct omap_vp_param omap36xx_core_vp_data;
> >
> >  extern struct omap_volt_data omap44xx_vdd_mpu_volt_data[];
> >  extern struct omap_volt_data omap44xx_vdd_iva_volt_data[];
> >  extern struct omap_volt_data omap44xx_vdd_core_volt_data[];
> > +extern struct omap_vp_param omap44xx_mpu_vp_data;
> > +extern struct omap_vp_param omap44xx_iva_vp_data;
> > +extern struct omap_vp_param omap44xx_core_vp_data;
> >
> >  #endif		/*
> __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */
> > diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-
> omap2/omap_twl.c
> > index 0a8e74e..f96d4b2 100644
> > --- a/arch/arm/mach-omap2/omap_twl.c
> > +++ b/arch/arm/mach-omap2/omap_twl.c
> > @@ -29,7 +29,6 @@
> >  #define OMAP3_VP_VSTEPMIN_VSTEPMIN	0x1
> >  #define OMAP3_VP_VSTEPMAX_VSTEPMAX	0x04
> >  #define OMAP3_VP_VLIMITTO_TIMEOUT_US	200
> > -
> >  #define OMAP3430_VP1_VLIMITTO_VDDMIN	0x14
> >  #define OMAP3430_VP1_VLIMITTO_VDDMAX	0x42
> >  #define OMAP3430_VP2_VLIMITTO_VDDMIN	0x18
> > @@ -44,12 +43,10 @@
> >  #define OMAP4_VDD_MPU_SR_VOLT_REG	0x55
> >  #define OMAP4_VDD_IVA_SR_VOLT_REG	0x5B
> >  #define OMAP4_VDD_CORE_SR_VOLT_REG	0x61
> > -
> >  #define OMAP4_VP_CONFIG_ERROROFFSET	0x00
> >  #define OMAP4_VP_VSTEPMIN_VSTEPMIN	0x01
> >  #define OMAP4_VP_VSTEPMAX_VSTEPMAX	0x04
> >  #define OMAP4_VP_VLIMITTO_TIMEOUT_US	200
> > -
> >  #define OMAP4_VP_MPU_VLIMITTO_VDDMIN	0xA
> >  #define OMAP4_VP_MPU_VLIMITTO_VDDMAX	0x39
> >  #define OMAP4_VP_IVA_VLIMITTO_VDDMIN	0xA
> > @@ -146,101 +143,96 @@ static u8 twl6030_uv_to_vsel(unsigned
> long uv)
> >  static struct omap_volt_pmic_info omap3_mpu_volt_info = {
> >  	.slew_rate		= 4000,
> >  	.step_size		= 12500,
> > -	.on_volt		= 1200000,
> > -	.onlp_volt		= 1000000,
> > -	.ret_volt		= 975000,
> > -	.off_volt		= 600000,
> > -	.volt_setup_time	= 0xfff,
> > -	.vp_erroroffset		=
> OMAP3_VP_CONFIG_ERROROFFSET,
> > -	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
> > -	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
> > +	.vp_timeout_us	= OMAP3_VP_VLIMITTO_TIMEOUT_US,
> > +	.i2c_slave_addr	= OMAP3_SRI2C_SLAVE_ADDR,
> > +	.pmic_reg		= OMAP3_VDD_MPU_SR_CONTROL_REG,
> > +	.vp_erroroffset	= OMAP3_VP_CONFIG_ERROROFFSET,
> > +	.vp_vstepmin	= OMAP3_VP_VSTEPMIN_VSTEPMIN,
> > +	.vp_vstepmax	= OMAP3_VP_VSTEPMAX_VSTEPMAX,
>
> Please check the resulting indentation, and be sure it aligns with
existing.
OK
>
> >  	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
> >  	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,
> > -	.vp_timeout_us		=
> OMAP3_VP_VLIMITTO_TIMEOUT_US,
> > -	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
> > -	.pmic_reg		= OMAP3_VDD_MPU_SR_CONTROL_REG,
> >  	.vsel_to_uv		= twl4030_vsel_to_uv,
> >  	.uv_to_vsel		= twl4030_uv_to_vsel,
> > +	.on_cmd			= twl4030_uv_to_vsel,
> > +	.onlp_cmd		= twl4030_uv_to_vsel,
> > +	.ret_cmd		= twl4030_uv_to_vsel,
> > +	.off_cmd		= twl4030_uv_to_vsel,
>
> These need more description (in the changelog and the code),
> particularily why we need several functions for seemingly do
> the same thing.
For TWL platform these commands are the same. But there can be PMICS where
these fields can have different function pointers since on command will be
different from retention command etc.
>
> >  };
> >
> >  static struct omap_volt_pmic_info omap3_core_volt_info = {
> >  	.slew_rate		= 4000,
> >  	.step_size		= 12500,
> > -	.on_volt                = 1200000,
> > -	.onlp_volt              = 1000000,
> > -	.ret_volt               = 975000,
> > -	.off_volt               = 600000,
> > -	.volt_setup_time        = 0xfff,
> > -	.vp_erroroffset		=
> OMAP3_VP_CONFIG_ERROROFFSET,
> > -	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
> > -	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
> > +	.vp_timeout_us	= OMAP3_VP_VLIMITTO_TIMEOUT_US,
> > +	.i2c_slave_addr	= OMAP3_SRI2C_SLAVE_ADDR,
> > +	.pmic_reg		= OMAP3_VDD_CORE_SR_CONTROL_REG,
> > +	.vp_erroroffset	= OMAP3_VP_CONFIG_ERROROFFSET,
> > +	.vp_vstepmin	= OMAP3_VP_VSTEPMIN_VSTEPMIN,
> > +	.vp_vstepmax	= OMAP3_VP_VSTEPMAX_VSTEPMAX,
> >  	.vp_vddmin		= OMAP3430_VP2_VLIMITTO_VDDMIN,
> >  	.vp_vddmax		= OMAP3430_VP2_VLIMITTO_VDDMAX,
> > -	.vp_timeout_us		=
> OMAP3_VP_VLIMITTO_TIMEOUT_US,
> > -	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
> > -	.pmic_reg		= OMAP3_VDD_CORE_SR_CONTROL_REG,
> >  	.vsel_to_uv		= twl4030_vsel_to_uv,
> >  	.uv_to_vsel		= twl4030_uv_to_vsel,
> > +	.on_cmd			= twl4030_uv_to_vsel,
> > +	.onlp_cmd		= twl4030_uv_to_vsel,
> > +	.ret_cmd		= twl4030_uv_to_vsel,
> > +	.off_cmd		= twl4030_uv_to_vsel,
> >  };
> >
> >  static struct omap_volt_pmic_info omap4_mpu_volt_info = {
> >  	.slew_rate		= 4000,
> >  	.step_size		= 12500,
> > -	.on_volt		= 1350000,
> > -	.onlp_volt		= 1350000,
> > -	.ret_volt		= 837500,
> > -	.off_volt		= 600000,
> > -	.volt_setup_time	= 0,
> > -	.vp_erroroffset		=
> OMAP4_VP_CONFIG_ERROROFFSET,
> > -	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> > -	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> > +	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> > +	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
> > +	.pmic_reg		= OMAP4_VDD_MPU_SR_VOLT_REG,
> > +	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
> > +	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> > +	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> >  	.vp_vddmin		= OMAP4_VP_MPU_VLIMITTO_VDDMIN,
> >  	.vp_vddmax		= OMAP4_VP_MPU_VLIMITTO_VDDMAX,
> > -	.vp_timeout_us		=
> OMAP4_VP_VLIMITTO_TIMEOUT_US,
> > -	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
> > -	.pmic_reg		= OMAP4_VDD_MPU_SR_VOLT_REG,
> >  	.vsel_to_uv		= twl6030_vsel_to_uv,
> >  	.uv_to_vsel		= twl6030_uv_to_vsel,
> > +	.on_cmd			= twl4030_uv_to_vsel,
> > +	.onlp_cmd		= twl4030_uv_to_vsel,
> > +	.ret_cmd		= twl4030_uv_to_vsel,
> > +	.off_cmd		= twl4030_uv_to_vsel,
> >  };
> >
> >  static struct omap_volt_pmic_info omap4_iva_volt_info = {
> >  	.slew_rate		= 4000,
> >  	.step_size		= 12500,
> > -	.on_volt		= 1100000,
> > -	.onlp_volt		= 1100000,
> > -	.ret_volt		= 837500,
> > -	.off_volt		= 600000,
> > -	.volt_setup_time	= 0,
> > -	.vp_erroroffset		=
> OMAP4_VP_CONFIG_ERROROFFSET,
> > -	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> > -	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> > +	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> > +	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
> > +	.pmic_reg		= OMAP4_VDD_IVA_SR_VOLT_REG,
> > +	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
> > +	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> > +	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> >  	.vp_vddmin		= OMAP4_VP_IVA_VLIMITTO_VDDMIN,
> >  	.vp_vddmax		= OMAP4_VP_IVA_VLIMITTO_VDDMAX,
> > -	.vp_timeout_us		=
> OMAP4_VP_VLIMITTO_TIMEOUT_US,
> > -	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
> > -	.pmic_reg		= OMAP4_VDD_IVA_SR_VOLT_REG,
> >  	.vsel_to_uv		= twl6030_vsel_to_uv,
> >  	.uv_to_vsel		= twl6030_uv_to_vsel,
> > +	.on_cmd			= twl4030_uv_to_vsel,
> > +	.onlp_cmd		= twl4030_uv_to_vsel,
> > +	.ret_cmd		= twl4030_uv_to_vsel,
> > +	.off_cmd		= twl4030_uv_to_vsel,
> >  };
> >
> >  static struct omap_volt_pmic_info omap4_core_volt_info = {
> >  	.slew_rate		= 4000,
> >  	.step_size		= 12500,
> > -	.on_volt		= 1100000,
> > -	.onlp_volt		= 1100000,
> > -	.ret_volt		= 837500,
> > -	.off_volt		= 600000,
> > -	.volt_setup_time	= 0,
> > -	.vp_erroroffset		=
> OMAP4_VP_CONFIG_ERROROFFSET,
> > -	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> > -	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> > +	.vp_timeout_us	= OMAP4_VP_VLIMITTO_TIMEOUT_US,
> > +	.i2c_slave_addr	= OMAP4_SRI2C_SLAVE_ADDR,
> > +	.pmic_reg		= OMAP4_VDD_CORE_SR_VOLT_REG,
> > +	.vp_erroroffset	= OMAP4_VP_CONFIG_ERROROFFSET,
> > +	.vp_vstepmin	= OMAP4_VP_VSTEPMIN_VSTEPMIN,
> > +	.vp_vstepmax	= OMAP4_VP_VSTEPMAX_VSTEPMAX,
> >  	.vp_vddmin		= OMAP4_VP_CORE_VLIMITTO_VDDMIN,
> >  	.vp_vddmax		= OMAP4_VP_CORE_VLIMITTO_VDDMAX,
> > -	.vp_timeout_us		=
> OMAP4_VP_VLIMITTO_TIMEOUT_US,
> > -	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
> > -	.pmic_reg		= OMAP4_VDD_CORE_SR_VOLT_REG,
> >  	.vsel_to_uv		= twl6030_vsel_to_uv,
> >  	.uv_to_vsel		= twl6030_uv_to_vsel,
> > +	.on_cmd			= twl4030_uv_to_vsel,
> > +	.onlp_cmd		= twl4030_uv_to_vsel,
> > +	.ret_cmd		= twl4030_uv_to_vsel,
> > +	.off_cmd		= twl4030_uv_to_vsel,
> >  };
> >
> >  int __init omap4_twl_init(void)
> > diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-
> omap2/opp3xxx_data.c
> > index d95f3f9..a614baf 100644
> > --- a/arch/arm/mach-omap2/opp3xxx_data.c
> > +++ b/arch/arm/mach-omap2/opp3xxx_data.c
> > @@ -26,6 +26,16 @@
> >  #include "pm.h"
> >
> >  /* 34xx */
> > +/* OMAP VP parameter values */
> > +#define OMAP3430_VP1_VLIMITTO_VDDMIN	0x14
> > +#define OMAP3430_VP1_VLIMITTO_VDDMAX	0x42
> > +#define OMAP3430_VP2_VLIMITTO_VDDMIN	0x18
> > +#define OMAP3430_VP2_VLIMITTO_VDDMAX	0x2c
> > +
>
> > +#define OMAP3_ON_VOLTAGE_UV				1200000
> > +#define OMAP3_ONLP_VOLTAGE_UV			1000000
> > +#define OMAP3_RET_VOLTAGE_UV			975000
> > +#define OMAP3_OFF_VOLTAGE_UV			600000
>
> s/OMAP3_/OMAP34XX_/
OK
>
> >  /* VDD1 */
> >
> > @@ -44,6 +54,15 @@ struct omap_volt_data
> omap34xx_vddmpu_volt_data[] = {
> >  	VOLT_DATA_DEFINE(0, 0, 0, 0),
> >  };
> >
> > +struct omap_vp_param omap34xx_mpu_vp_data = {
> > +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> > +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> > +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> > +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
>
> Any reason you're adding these as part of a VP struct.  These various
> values
> (after being converted) are written to the VC (specifically VC_CMD_VAL)
> and done in the vc_init function, so they should be in a VC specific
struct.
Actually these are OMAP specific parameters. As you suggested I can make
it part of vc_rt_data.
>
> Also, the changelog should discuss *why* you decided to move these
> from
> the PMIC struct to this struct.  Doing so suggests these values will not
> be different for different PMICs.  That needs to be discussed in the
> changelog.
Since these are OMAP specific data, it has been moved from PMIC to OMAP
data. I will put more details in change log for this.

>
> > +	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
> > +	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,
>
> Now these exist in both the pmic_info struct and this struct.
>
> Again, the changelog needs to describe *why* you want them in both
> places, and what the decision will be in using them.  For example: these
> provide default values, PMIC values can override.
PMICs have min and max voltage as well as OMAP. We need to take the max of
these for min voltage and min of these for max voltage.
I will add more comments.
>
>
> > +};
> > +
> >  /* VDD2 */
> >
> >  #define OMAP3430_VDD_CORE_OPP1_UV		975000
> > @@ -57,7 +76,20 @@ struct omap_volt_data
> omap34xx_vddcore_volt_data[] = {
> >  	VOLT_DATA_DEFINE(0, 0, 0, 0),
> >  };
> >
> > +struct omap_vp_param omap34xx_core_vp_data = {
> > +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> > +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> > +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> > +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
> > +	.vp_vddmin		= OMAP3430_VP2_VLIMITTO_VDDMIN,
> > +	.vp_vddmax		= OMAP3430_VP2_VLIMITTO_VDDMAX,
> > +};
> > +
> >  /* 36xx */
> > +#define OMAP3630_VP1_VLIMITTO_VDDMIN	0x18
> > +#define OMAP3630_VP1_VLIMITTO_VDDMAX	0x3c
> > +#define OMAP3630_VP2_VLIMITTO_VDDMIN	0x18
> > +#define OMAP3630_VP2_VLIMITTO_VDDMAX	0x30
> >
> >  /* VDD1 */
> >
> > @@ -74,6 +106,14 @@ struct omap_volt_data
> omap36xx_vddmpu_volt_data[] = {
> >  	VOLT_DATA_DEFINE(0, 0, 0, 0),
> >  };
> >
> > +struct omap_vp_param omap36xx_mpu_vp_data = {
> > +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> > +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> > +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> > +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
> > +	.vp_vddmin		= OMAP3630_VP1_VLIMITTO_VDDMIN,
> > +	.vp_vddmax		= OMAP3630_VP1_VLIMITTO_VDDMAX,
> > +};
> >  /* VDD2 */
> >
> >  #define OMAP3630_VDD_CORE_OPP50_UV		1000000
> > @@ -85,6 +125,16 @@ struct omap_volt_data
> omap36xx_vddcore_volt_data[] = {
> >  	VOLT_DATA_DEFINE(0, 0, 0, 0),
> >  };
> >
> > +struct omap_vp_param omap36xx_core_vp_data = {
> > +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> > +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> > +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> > +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
> > +	.vp_vddmin		= OMAP3630_VP2_VLIMITTO_VDDMIN,
> > +	.vp_vddmax		= OMAP3630_VP2_VLIMITTO_VDDMAX,
> > +};
> > +
> > +
> >  /* OPP data */
> >
> >  static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
> > diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-
> omap2/opp4xxx_data.c
> > index 2293ba2..d5a5d3f 100644
> > --- a/arch/arm/mach-omap2/opp4xxx_data.c
> > +++ b/arch/arm/mach-omap2/opp4xxx_data.c
> > @@ -30,6 +30,17 @@
> >   * Structures containing OMAP4430 voltage supported and various
> >   * voltage dependent data for each VDD.
> >   */
> > +#define OMAP4_VP_MPU_VLIMITTO_VDDMIN	0xA
> > +#define OMAP4_VP_MPU_VLIMITTO_VDDMAX	0x39
> > +#define OMAP4_VP_IVA_VLIMITTO_VDDMIN	0xA
> > +#define OMAP4_VP_IVA_VLIMITTO_VDDMAX	0x2D
> > +#define OMAP4_VP_CORE_VLIMITTO_VDDMIN	0xA
> > +#define OMAP4_VP_CORE_VLIMITTO_VDDMAX	0x28
>
> minor: use lower-case hex values
OK
>
> > +#define OMAP4_ON_VOLTAGE_UV				1350000
> > +#define OMAP4_ONLP_VOLTAGE_UV			1350000
> > +#define OMAP4_RET_VOLTAGE_UV			837500
> > +#define OMAP4_OFF_VOLTAGE_UV			600000
> >
> >  #define OMAP4430_VDD_MPU_OPP50_UV		1025000
> >  #define OMAP4430_VDD_MPU_OPP100_UV		1200000
> > @@ -44,6 +55,15 @@ struct omap_volt_data
> omap44xx_vdd_mpu_volt_data[] = {
> >  	VOLT_DATA_DEFINE(0, 0, 0, 0),
> >  };
> >
> > +struct omap_vp_param omap44xx_mpu_vp_data = {
> > +	.on_volt		= OMAP4_ON_VOLTAGE_UV,
> > +	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
> > +	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
> > +	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
> > +	.vp_vddmin		= OMAP4_VP_MPU_VLIMITTO_VDDMIN,
> > +	.vp_vddmax		= OMAP4_VP_MPU_VLIMITTO_VDDMAX,
> > +};
> > +
> >  #define OMAP4430_VDD_IVA_OPP50_UV		1013000
> >  #define OMAP4430_VDD_IVA_OPP100_UV		1188000
> >  #define OMAP4430_VDD_IVA_OPPTURBO_UV		1300000
> > @@ -55,6 +75,15 @@ struct omap_volt_data
> omap44xx_vdd_iva_volt_data[] = {
> >  	VOLT_DATA_DEFINE(0, 0, 0, 0),
> >  };
> >
> > +struct omap_vp_param omap44xx_iva_vp_data = {
> > +	.on_volt		= OMAP4_ON_VOLTAGE_UV,
> > +	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
> > +	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
> > +	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
> > +	.vp_vddmin		= OMAP4_VP_IVA_VLIMITTO_VDDMIN,
> > +	.vp_vddmax		= OMAP4_VP_IVA_VLIMITTO_VDDMAX,
> > +};
> > +
> >  #define OMAP4430_VDD_CORE_OPP50_UV		1025000
> >  #define OMAP4430_VDD_CORE_OPP100_UV		1200000
> >
> > @@ -64,6 +93,15 @@ struct omap_volt_data
> omap44xx_vdd_core_volt_data[] = {
> >  	VOLT_DATA_DEFINE(0, 0, 0, 0),
> >  };
> >
> > +struct omap_vp_param omap44xx_core_vp_data = {
> > +	.on_volt		= OMAP4_ON_VOLTAGE_UV,
> > +	.onlp_volt		= OMAP4_ONLP_VOLTAGE_UV,
> > +	.ret_volt		= OMAP4_RET_VOLTAGE_UV,
> > +	.off_volt		= OMAP4_OFF_VOLTAGE_UV,
> > +	.vp_vddmin		= OMAP4_VP_CORE_VLIMITTO_VDDMIN,
> > +	.vp_vddmax		= OMAP4_VP_CORE_VLIMITTO_VDDMAX,
> > +};
> > +
> >
> >  static struct omap_opp_def __initdata omap44xx_opp_def_list[] = {
> >  	/* MPU OPP1 - OPP50 */
> > diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-
> omap2/voltage.c
> > index c6facf7..2ac990f 100644
> > --- a/arch/arm/mach-omap2/voltage.c
> > +++ b/arch/arm/mach-omap2/voltage.c
> > @@ -42,7 +42,6 @@
> >
> >  #define VOLTAGE_DIR_SIZE	16
> >
> > -
> >  static struct omap_vdd_info **vdd_info;
> >
> >  /*
> > @@ -124,9 +123,10 @@ static int __init
> _config_common_vdd_data(struct omap_vdd_info *vdd)
> >
> >  	timeout_val = (sys_clk_speed * vdd->pmic_info-
> >vp_timeout_us) / 1000;
> >  	vdd->vp_rt_data.vlimitto_timeout = timeout_val;
> > -	vdd->vp_rt_data.vlimitto_vddmin = vdd->pmic_info-
> >vp_vddmin;
> > -	vdd->vp_rt_data.vlimitto_vddmax = vdd->pmic_info-
> >vp_vddmax;
> > -
>
> Here would be a good spot to discuss the decision being made to pick the
> min/max value.  This will very easily result in potentially picking one
> value from your VP struct and another from the PMIC struct so needs to
> be carefully described so reviewers can be sure it's doing what you
> intend it do be doing.
Vdd_min value should be max of vp_vdd_min and pmic_vdd_min so that minimum
constraint is honored for both. Similarly the case for vdd_max.
I will more comments in the code for this.
>
> > +	vdd->vp_rt_data.vlimitto_vddmin = (vdd->vp_param-
> >vp_vddmin > vdd->pmic_info->vp_vddmin) ?
> > +						vdd->vp_param->vp_vddmin
> : vdd->pmic_info->vp_vddmin;
> > +	vdd->vp_rt_data.vlimitto_vddmax = (vdd->vp_param-
> >vp_vddmax > vdd->pmic_info->vp_vddmax) ?
> > +						vdd->pmic_info->vp_vddmax
> : vdd->vp_param->vp_vddmax;
> >  	waittime = ((vdd->pmic_info->step_size / vdd->pmic_info-
> >slew_rate) *
> >  				sys_clk_speed) / 1000;
> >  	vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
> > @@ -523,15 +523,35 @@ static int
> vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
> >
> >  static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
> >  {
> > +	struct clk *omap_32k_clk;
> > +	u32 omap_32k_clk_speed;
> > +	unsigned long temp;
> > +
> >  	/*
> >  	 * 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,
> > -		       OMAP3_PRM_VOLTOFFSET_OFFSET);
> > -	vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
> > -		       OMAP3_PRM_VOLTSETUP2_OFFSET);
> > +
> > +	omap_32k_clk = clk_get(NULL, "wkup_32k_fck");
> > +	if (IS_ERR(omap_32k_clk)) {
> > +		pr_warning("%s: Could not get the 32k_clk clk to
> calculate"
> > +			"various vdd_%s params\n", __func__, vdd-
> >voltdm.name);
> > +		return;
> > +	}
> > +	omap_32k_clk_speed = clk_get_rate(omap_32k_clk);
> > +	clk_put(omap_32k_clk);
> > +
> > +	temp = vdd->board_data-
> >omap3_board_data.vdd_setup_off.clksetup;
>
> What if nobody has called omap_voltage_register_board_params() ?
>
> What is need are some default values (probably as fields in the VDD
> struct) which can be overridden by board files, but will provide
> sensible defaults if no board file overrides are done.
OK. Make sense.
>
> > +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> > +	vdd->write_reg(temp, prm_mod_offs,
> OMAP3_PRM_CLKSETUP_OFFSET);
> > +
> > +	temp = vdd->board_data-
> >omap3_board_data.vdd_setup_off.voltsetup2;
> > +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> > +	vdd->write_reg(temp, prm_mod_offs,
> OMAP3_PRM_VOLTSETUP2_OFFSET);
> > +
> > +	temp = vdd->board_data->omap3_board_data.voltoffset;
> > +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> > +	vdd->write_reg(temp, prm_mod_offs,
> OMAP3_PRM_VOLTOFFSET_OFFSET);
> > +
> >  }
> >
> >  static void __init omap3_vc_init(struct omap_vdd_info *vdd)
> > @@ -539,21 +559,45 @@ static void __init omap3_vc_init(struct
> omap_vdd_info *vdd)
> >  	static bool is_initialized;
> >  	u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
> >  	u32 vc_val;
> > -
> > -	if (is_initialized)
> > -		return;
> > +	struct clk *sys_ck;
> > +	u32 sys_clk_speed;
> > +	unsigned long temp;
> >
> >  	/* Set up the on, inactive, retention and off voltage */
> > -	on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info-
> >on_volt);
> > -	onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info-
> >onlp_volt);
> > -	ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info-
> >ret_volt);
> > -	off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info-
> >off_volt);
> > +	on_vsel = vdd->pmic_info->on_cmd(vdd->vp_param->on_volt);
> > +	onlp_vsel = vdd->pmic_info->onlp_cmd(vdd->vp_param-
> >onlp_volt);
> > +	ret_vsel = vdd->pmic_info->ret_cmd(vdd->vp_param-
> >ret_volt);
> > +	off_vsel = vdd->pmic_info->off_cmd(vdd->vp_param->off_volt);
> >  	vc_val	= ((on_vsel << vdd->vc_data->vc_common-
> >cmd_on_shift) |
> >  		(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);
> >
> > +	sys_ck = clk_get(NULL, "sys_ck");
> > +	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);
> > +		return;
> > +	}
> > +	sys_clk_speed = clk_get_rate(sys_ck);
> > +	clk_put(sys_ck);
> > +	/* Divide to avoid overflow */
> > +	sys_clk_speed /= 1000000;
> > +
> > +	/* Configure the setup times */
> > +	vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm-
> >voltsetup_reg);
> > +	vc_val &= ~vdd->vfsm->voltsetup_mask;
> > +	temp = vdd->board_data-
> >omap3_board_data.vdd_setup_off.voltsetup;
>
> again, fails if nobody has called the board override function.
OK
>
> > +	temp = temp * sys_clk_speed / 8;
> > +	vc_val |= temp << vdd->vfsm->voltsetup_shift;
> > +	vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm-
> >voltsetup_reg);
> > +
> > +	omap3_vfsm_init(vdd);
> > +
> > +	if (is_initialized)
> > +		return;
> > +
> >  	/*
> >  	 * Generic VC parameters init
> >  	 * XXX This data should be abstracted out
> > @@ -563,8 +607,6 @@ static void __init omap3_vc_init(struct
> omap_vdd_info *vdd)
> >  	vdd->write_reg(OMAP3430_MCODE_SHIFT |
> OMAP3430_HSEN_MASK, prm_mod_offs,
> >  			OMAP3_PRM_VC_I2C_CFG_OFFSET);
> >
> > -	omap3_vfsm_init(vdd);
> > -
> >  	is_initialized = true;
> >  }
> >
> > @@ -573,12 +615,69 @@ static void __init omap3_vc_init(struct
> omap_vdd_info *vdd)
> >  static void __init omap4_vc_init(struct omap_vdd_info *vdd)
> >  {
> >  	static bool is_initialized;
> > -	u32 vc_val;
> > +	u32 vc_val, temp, prescalar, ramp_count;
> > +	struct clk *sys_ck;
> > +	u32 sys_clk_speed;
> >
> > -	if (is_initialized)
> > +	sys_ck = clk_get(NULL, "sys_clkin_ck");
> > +	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);
> >  		return;
> > +	}
> > +	sys_clk_speed = clk_get_rate(sys_ck);
> > +	clk_put(sys_ck);
> > +	/* Divide to avoid overflow */
> > +	sys_clk_speed /= 1000000;
> > +
> > +	/* Configure the setup times */
> > +	vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm-
> >voltsetup_reg);
> > +	temp = vdd->board_data-
> >omap4_board_data.vdd_setup_off.voltsetup_ramp_down;
> > +	prescalar = temp * 63 / sys_clk_speed;
> > +	if (prescalar <= 16)
> > +		prescalar = 16;
> > +	else if (prescalar <= 64)
> > +		prescalar = 64;
> > +	else if (prescalar <= 128)
> > +		prescalar = 128;
> > +	else if (prescalar <= 512)
> > +		prescalar = 512;
> > +	else
> > +		pr_warning("%s: Invalid VoltOff set up time for vdd%s\n",
> > +			__func__, vdd->voltdm.name);
> > +
> > +	vc_val &= ~OMAP4430_RAMP_DOWN_PRESCAL_MASK;
> > +	vc_val |= prescalar <<
> OMAP4430_RAMP_DOWN_PRESCAL_SHIFT;
> > +
> > +	ramp_count = (temp * sys_clk_speed / prescalar) <<
> OMAP4430_RAMP_DOWN_COUNT_SHIFT;
> > +	vc_val &= ~OMAP4430_RAMP_DOWN_COUNT_MASK;
> > +	vc_val |= ramp_count;
> > +
> > +	temp = vdd->board_data-
> >omap4_board_data.vdd_setup_off.voltsetup_ramp_up;
> > +	prescalar = temp * 63 / sys_clk_speed;
> > +	if (prescalar <= 16)
> > +		prescalar = 16;
> > +	else if (prescalar <= 64)
> > +		prescalar = 64;
> > +	else if (prescalar <= 128)
> > +		prescalar = 128;
> > +	else if (prescalar <= 512)
> > +		prescalar = 512;
> > +	else
> > +		pr_warning("%s: Invalid VoltOff set up time for vdd%s\n",
> > +			__func__, vdd->voltdm.name);
> > +
> > +	vc_val &= ~OMAP4430_RAMP_UP_PRESCAL_MASK;
> > +	vc_val |= prescalar << OMAP4430_RAMP_UP_PRESCAL_SHIFT;
> >
> > -	/* TODO: Configure setup times and CMD_VAL values*/
> > +	ramp_count = (temp * sys_clk_speed / prescalar) <<
> OMAP4430_RAMP_UP_COUNT_SHIFT;
> > +	vc_val &= ~OMAP4430_RAMP_UP_COUNT_MASK;
> > +	vc_val |= ramp_count;
> > +
> > +	vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm-
> >voltsetup_reg);
> > +
> > +	if (is_initialized)
> > +		return;
> >
> >  	/*
> >  	 * Generic VC parameters init
> > @@ -629,13 +728,6 @@ static void __init omap_vc_init(struct
> omap_vdd_info *vdd)
> >  	vdd->write_reg(vc_val, prm_mod_offs,
> >  		       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->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);
> > -
> >  	if (cpu_is_omap34xx())
> >  		omap3_vc_init(vdd);
> >  	else if (cpu_is_omap44xx())
> > @@ -971,6 +1063,23 @@ int omap_voltage_register_pmic(struct
> voltagedomain *voltdm,
> >  	return 0;
> >  }
> >
> > +int omap_voltage_register_board_params(struct voltagedomain
> *voltdm,
> > +		union omap_volt_board_data *board_params)
> > +{
> > +	struct omap_vdd_info *vdd;
> > +
> > +	if (!voltdm || IS_ERR(voltdm)) {
> > +		pr_warning("%s: VDD specified does not exist!\n",
> __func__);
> > +		return -EINVAL;
> > +	}
> > +
> > +	vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
> > +
> > +	vdd->board_data = board_params;
> > +
> > +	return 0;
> > +}
> > +
> >  /**
> >   * omap_voltage_get_dbgdir() - API to get pointer to the debugfs
> directory
> >   *				corresponding to a voltage domain.
> > diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-
> omap2/voltage.h
> > index e9f5408..de4e09b 100644
> > --- a/arch/arm/mach-omap2/voltage.h
> > +++ b/arch/arm/mach-omap2/voltage.h
> > @@ -23,14 +23,6 @@
> >  #define VOLTSCALE_VPFORCEUPDATE		1
> >  #define VOLTSCALE_VCBYPASS		2
> >
> > -/*
> > - * OMAP3 GENERIC setup times. Revisit to see if these needs to be
> > - * passed from board or PMIC file
> > - */
> > -#define OMAP3_CLKSETUP		0xff
> > -#define OMAP3_VOLTOFFSET	0xff
> > -#define OMAP3_VOLTSETUP2	0xff
> > -
> >  /**
> >   * struct omap_vfsm_instance_data - per-voltage manager FSM
> register/bitfield
> >   * data
> > @@ -80,17 +72,25 @@ struct omap_volt_data {
> >   * struct omap_volt_pmic_info - PMIC specific data required by
> voltage driver.
> >   * @slew_rate:	PMIC slew rate (in uv/us)
> >   * @step_size:	PMIC voltage step size (in uv)
> > + * @vp_erroroffset:	Offset value in the Error to Voltage
converter
> > + * @vp_vstepmin:	Minimum voltage step in mV
> > + * @vp_vstepmax:	Maximum voltage step in mV
> > + * @vp_vddmin:	Minimum voltage supply level in mV
> > + * @vp_vddmax:	Maximum voltage supply level in mV
> > + * @vp_timeout_us:	Voltage Controller's maximum wait time for
> response
> > + * @i2c_slave_addr:	I2C slave address value for the Power IC
> device.
> > + * @pmic_reg:	voltage configuration register address value for
the
> > + *				VDD channe
> >   * @vsel_to_uv:	PMIC API to convert vsel value to actual voltage
in
> uV.
> >   * @uv_to_vsel:	PMIC API to convert voltage in uV to vsel value.
> > + * @on_cmd:	PMIC API to send on command instruction
> > + * @onlp_cmd:	PMIC API to send onlp command instruction
> > + * @ret_cmd:	PMIC API to send ret command instruction
> > + * @off_cmd:	PMIC API to send off command instruction
> >   */
> >  struct omap_volt_pmic_info {
> >  	int slew_rate;
> >  	int step_size;
> > -	u32 on_volt;
> > -	u32 onlp_volt;
> > -	u32 ret_volt;
> > -	u32 off_volt;
> > -	u16 volt_setup_time;
> >  	u8 vp_erroroffset;
> >  	u8 vp_vstepmin;
> >  	u8 vp_vstepmax;
> > @@ -101,11 +101,30 @@ struct omap_volt_pmic_info {
> >  	u8 pmic_reg;
> >  	unsigned long (*vsel_to_uv) (const u8 vsel);
> >  	u8 (*uv_to_vsel) (unsigned long uV);
> > +	unsigned char (*on_cmd)(unsigned long uV);
> > +	unsigned char (*onlp_cmd)(unsigned long uV);
> > +	unsigned char (*ret_cmd)(unsigned long uV);
> > +	unsigned char (*off_cmd)(unsigned long uV);
> > +};
> > +
> > +/**
> > + * struct omap_vp_param - VP specific data required by voltage
> driver.
> > + * @on_volt: on voltage for the device in mV
> > + * @onlp_volt: inactive voltage for the device in mV
> > + * @ret_volt: retention voltage for the device in mV
> > + * @off_volt: off voltage for the device in mV
> > + */
> > +struct omap_vp_param {
> > +	u32 on_volt;
> > +	u32 onlp_volt;
> > +	u32 ret_volt;
> > +	u32 off_volt;
> > +	u8 vp_vddmax;
> > +	u8 vp_vddmin;
> >  };
> >
> >  /**
> >   * omap_vdd_info - Per Voltage Domain info
> > - *
> >   * @volt_data		: voltage table having the distinct
voltages
> supported
> >   *			  by the domain and other associated per voltage
> data.
> >   * @pmic_info		: pmic specific parameters which should be
> populted by
> > @@ -116,6 +135,9 @@ struct omap_volt_pmic_info {
> >   * @vc_data		: structure containing various various vc
> registers,
> >   *			  shifts, masks etc.
> >   * @vfsm                : voltage manager FSM data
> > + * @vfsm                : voltage manager FSM data
> > + * @vp_param			: VP specific parameters
> > + * @board_data			: board specific parameters
> >   * @voltdm		: pointer to the voltage domain structure
> >   * @debug_dir		: debug directory for this voltage domain.
> >   * @curr_volt		: current voltage for this vdd.
> > @@ -129,6 +151,8 @@ 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 omap_vp_param *vp_param;
> > +	union omap_volt_board_data *board_data;
> >  	struct voltagedomain voltdm;
> >  	struct dentry *debug_dir;
> >  	u32 curr_volt;
> > @@ -139,6 +163,61 @@ struct omap_vdd_info {
> >  		unsigned long target_volt);
> >  };
> >
> > +/**
> > + * omap3_vdd_setuptime - vdd set up time info
> > + * @voltsetup	: setup time of the VDDregulators in us
> > + * @clksetup	: setup time of the oscillator system clock
(sys_clk)
> in us
> > + * @voltsetup2	: Overall setup time of VDDregulators in us
> > + */
> > +struct omap3_vdd_setuptime {
> > +	u16 voltsetup;
> > +	u16 clksetup;
> > +	u16 voltsetup2;
> > +};
> > +
> > +/**
> > + * omap3_volt_board_data - vdd set up time info for OMAP3
> > + * @vdd_setup_ret	: VDD setup time for retention mode
> > + * @vdd_setup_off	: VDD setup time for off mode
> > + * @voltoffset		: offset-time to de-assert sys_offmode
> > + *					when exiting the OFF mode
> > + */
> > +struct omap3_volt_board_data {
> > +	struct omap3_vdd_setuptime vdd_setup_ret;
> > +	struct omap3_vdd_setuptime vdd_setup_off;
> > +	u16 voltoffset;
> > +};
> > +
> > +/**
> > + * omap4_volt_setuptime - vdd set up time info for OMAP4
> > + * @voltsetup_ramp_up	: VDD ram up time in us
> > + * @voltsetup_ramp_down	: VDD ram down time in us
> > + */
> > +struct omap4_volt_setuptime {
> > +	u16 voltsetup_ramp_up;
> > +	u16 voltsetup_ramp_down;
> > +};
> > +/**
> > + * omap4_volt_board_data - vdd set up time info for OMAP4
> > + * @vdd_setup_ret	: VDD setup time for retention mode
> > + * @vdd_setup_off	: VDD setup time for off mode
> > + */
> > +struct omap4_volt_board_data {
> > +	struct omap4_volt_setuptime vdd_setup_ret;
> > +	struct omap4_volt_setuptime vdd_setup_off;
> > +};
>
> It appears OMAP4 has a CLKSETUP equivalent too.  c.f. CLKSETUPTIME
> register in the SCRM.
Currently I do not see CLKSETUPTIME register being configured anywhere in
Voltage layer. But yes we need to have CLKSETUPTIME from board file and
PMICSETUPTIME from PMIC file. I will fix it in next version.
>
> > +/**
> > + * omap_volt_board_data - board specific voltage set up time data
> > + * @omap3_board_data	: omap3 board data
> > + * @omap4_board_data	: omap4 board data
> > + */
> > +union omap_volt_board_data {
> > +	struct omap3_volt_board_data omap3_board_data;
> > +	struct omap4_volt_board_data omap4_board_data;
> > +};
>
> For board code, we need an SoC independent way of passing data.
>
> Rather than board files providing the register values themselves, they
> should just provide times.  The SoC specific code can then how to
> program the registers (and prescalers etc.)
OK. I am investigating on this.

Vishwa
>
> >  unsigned long omap_vp_get_curr_volt(struct voltagedomain
> *voltdm);
> >  void omap_vp_enable(struct voltagedomain *voltdm);
> >  void omap_vp_disable(struct voltagedomain *voltdm);
> > @@ -163,6 +242,9 @@ void omap_change_voltscale_method(struct
> voltagedomain *voltdm,
> >  struct voltagedomain *omap_voltage_domain_lookup(char *name);
> >
> >  int omap_voltage_late_init(void);
> > +int omap_voltage_register_board_params(struct voltagedomain
> *voltdm,
> > +		union omap_volt_board_data *board_params);
> > +
> >  #else
> >  static inline int omap_voltage_register_pmic(struct voltagedomain
> *voltdm,
> >  		struct omap_volt_pmic_info *pmic_info)
> > @@ -179,6 +261,11 @@ static inline struct voltagedomain
> *omap_voltage_domain_lookup(char *name)
> >  {
> >  	return ERR_PTR(-EINVAL);
> >  }
> > +static inline int omap_voltage_register_board_params(struct
> voltagedomain *voltdm,
> > +		struct omap_volt_board_data *board_params)
> > +{
> > +	return ERR_PTR(-EINVAL);
> > +}
> >  #endif
> >
> >  #endif
> > diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
> b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
> > index def230f..62ae1ee 100644
> > --- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
> > +++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
> > @@ -83,9 +83,13 @@ static int __init
> omap3xxx_voltage_early_init(void)
> >  	if (cpu_is_omap3630()) {
> >  		omap3_vdd1_info.volt_data =
> omap36xx_vddmpu_volt_data;
> >  		omap3_vdd2_info.volt_data =
> omap36xx_vddcore_volt_data;
> > +		omap3_vdd1_info.vp_param = &omap36xx_mpu_vp_data;
> > +		omap3_vdd2_info.vp_param = &omap36xx_core_vp_data;
> >  	} else {
> >  		omap3_vdd1_info.volt_data =
> omap34xx_vddmpu_volt_data;
> >  		omap3_vdd2_info.volt_data =
> omap34xx_vddcore_volt_data;
> > +		omap3_vdd1_info.vp_param = &omap34xx_mpu_vp_data;
> > +		omap3_vdd2_info.vp_param = &omap34xx_core_vp_data;
> >  	}
> >
> >  	return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
> > diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c
> b/arch/arm/mach-omap2/voltagedomains44xx_data.c
> > index cb64996..972760c 100644
> > --- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
> > +++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
> > @@ -95,6 +95,10 @@ 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;
> >
> > +	omap4_vdd_mpu_info.vp_param = &omap44xx_mpu_vp_data;
> > +	omap4_vdd_iva_info.vp_param = &omap44xx_iva_vp_data;
> > +	omap4_vdd_core_info.vp_param = &omap44xx_core_vp_data;
> > +
> >  	return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
> >  				       omap4_vdd_info,
> >  				       ARRAY_SIZE(omap4_vdd_info));
>
> Kevin

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters
  2011-03-15 14:33 ` [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters Vishwanath BS
  2011-03-17 23:20   ` Kevin Hilman
@ 2011-04-02  0:03   ` Kevin Hilman
  2011-04-05  7:08     ` Vishwanath Sripathy
  1 sibling, 1 reply; 18+ messages in thread
From: Kevin Hilman @ 2011-04-02  0:03 UTC (permalink / raw)
  To: Vishwanath BS; +Cc: linux-omap

Hi Vishwa,

Vishwanath BS <vishwanath.bs@ti.com> writes:

> Voltage layer takes various parameters which can be broadly classified as
> 1. OMAP/VP specific parameters
> 2. PMIC specific parameters
> 3. Board specific parameters
>
> This patch attempts to categorize the parameters in current voltage layer into
> above buckets. This will make voltage layer to work with different kinds of PMIC
> and boards.
>
> TODO: Provide infrastructure to use VC I2C (I2C4) for PMIC configuration (useful
> for cases where PMIC is connected to OMAP only via I2C4.
>
> Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>

Looking back at this in light of the voltage layer cleanup/restructure
I've been working on, and I have a few more comments/questions.

First, I'm glad to see the various hard-coded setup times cleaned up and
made configuable.  Can you redo this on top of the voltage layer
cleanups in progress (my pm-wip/voltdm_b branch)?   More details on this
below...

[...]

> @@ -44,6 +54,15 @@ struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
>  	VOLT_DATA_DEFINE(0, 0, 0, 0),
>  };
>  
> +struct omap_vp_param omap34xx_mpu_vp_data = {
> +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
> +	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
> +	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,
> +};
> +

I'm glad to see these removed from the PMIC structure since they are not
PMIC-specific, but the _volt fields in this structure are written to the
VC, not the VP, so should not be part of a VP structure.

[...]

> @@ -523,15 +523,35 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
>  
>  static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
>  {
> +	struct clk *omap_32k_clk;
> +	u32 omap_32k_clk_speed;
> +	unsigned long temp;
> +
>  	/*
>  	 * 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,
> -		       OMAP3_PRM_VOLTOFFSET_OFFSET);
> -	vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
> -		       OMAP3_PRM_VOLTSETUP2_OFFSET);
> +
> +	omap_32k_clk = clk_get(NULL, "wkup_32k_fck");
> +	if (IS_ERR(omap_32k_clk)) {
> +		pr_warning("%s: Could not get the 32k_clk clk to calculate"
> +			"various vdd_%s params\n", __func__, vdd->voltdm.name);
> +		return;
> +	}
> +	omap_32k_clk_speed = clk_get_rate(omap_32k_clk);
> +	clk_put(omap_32k_clk);

You probably don't need to do a clk_get/clk_get_rate/clk_put of the 32k
clock, since we know what the rate of that clock is already. :)

IOW, 'omap_32k_clk_speed = (32 << 10)' should suffice.

> +	temp = vdd->board_data->omap3_board_data.vdd_setup_off.clksetup;
> +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> +	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET);
> +
> +	temp = vdd->board_data->omap3_board_data.vdd_setup_off.voltsetup2;
> +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> +	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_VOLTSETUP2_OFFSET);
> +
> +	temp = vdd->board_data->omap3_board_data.voltoffset;
> +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> +	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_VOLTOFFSET_OFFSET);

According to the TRM (vZK, section 4.12.5.1.2), the VOLTOFFSET value
should be calculated based on the CLKSETUP and VOLTSETUP2 registers, so
we probably don't need a configurable value for this.

[...]

> @@ -139,6 +163,61 @@ struct omap_vdd_info {
>  		unsigned long target_volt);
>  };
>  
> +/**
> + * omap3_vdd_setuptime - vdd set up time info
> + * @voltsetup	: setup time of the VDDregulators in us
> + * @clksetup	: setup time of the oscillator system clock (sys_clk) in us
> + * @voltsetup2	: Overall setup time of VDDregulators in us
> + */
> +struct omap3_vdd_setuptime {
> +	u16 voltsetup;
> +	u16 clksetup;
> +	u16 voltsetup2;
> +};
> +
> +/**
> + * omap3_volt_board_data - vdd set up time info for OMAP3
> + * @vdd_setup_ret	: VDD setup time for retention mode
> + * @vdd_setup_off	: VDD setup time for off mode
> + * @voltoffset		: offset-time to de-assert sys_offmode
> + *					when exiting the OFF mode
> + */
> +struct omap3_volt_board_data {
> +	struct omap3_vdd_setuptime vdd_setup_ret;
> +	struct omap3_vdd_setuptime vdd_setup_off;
> +	u16 voltoffset;

voltoffset can be dropped.  Based on TRM, voltoffset can be calulated
(see comment above.)

> +};
> +
> +/**
> + * omap4_volt_setuptime - vdd set up time info for OMAP4
> + * @voltsetup_ramp_up	: VDD ram up time in us
> + * @voltsetup_ramp_down	: VDD ram down time in us
> + */
> +struct omap4_volt_setuptime {
> +	u16 voltsetup_ramp_up;
> +	u16 voltsetup_ramp_down;
> +};
> +
> +/**
> + * omap4_volt_board_data - vdd set up time info for OMAP4
> + * @vdd_setup_ret	: VDD setup time for retention mode
> + * @vdd_setup_off	: VDD setup time for off mode
> + */
> +struct omap4_volt_board_data {
> +	struct omap4_volt_setuptime vdd_setup_ret;
> +	struct omap4_volt_setuptime vdd_setup_off;
> +};
> +
> +/**
> + * omap_volt_board_data - board specific voltage set up time data
> + * @omap3_board_data	: omap3 board data
> + * @omap4_board_data	: omap4 board data
> + */
> +union omap_volt_board_data {
> +	struct omap3_volt_board_data omap3_board_data;
> +	struct omap4_volt_board_data omap4_board_data;
> +};

For the setup times, we need a generic way to define these times that
can be used for both OMAP3 & OMAP4+.  

IIUC, The primary difference is that on OMAP4, both a ramp up and a ramp
down time are configurable, where OMAP3 has a single time for both.  If
the values are given in usecs and not in register values, defining a
common structure to handle both should be straight forward,

For OMAP3 and OMAP4, there you have a clock setup time, and then
separate voltage setup times for ret/sleep and off.  The structure can
contain both ramp up and ramp down times, but one will obviously be
ignored in the OMAP3 specific code that programs these registers
(probably in prmXXXX.c)

Kevin

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters
  2011-04-02  0:03   ` Kevin Hilman
@ 2011-04-05  7:08     ` Vishwanath Sripathy
  2011-04-05 18:16       ` Kevin Hilman
  0 siblings, 1 reply; 18+ messages in thread
From: Vishwanath Sripathy @ 2011-04-05  7:08 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap

> -----Original Message-----
> From: Kevin Hilman [mailto:khilman@ti.com]
> Sent: Saturday, April 02, 2011 5:33 AM
> To: Vishwanath BS
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer
> parameters
>
> Hi Vishwa,
>
> Vishwanath BS <vishwanath.bs@ti.com> writes:
>
> > Voltage layer takes various parameters which can be broadly
> classified as
> > 1. OMAP/VP specific parameters
> > 2. PMIC specific parameters
> > 3. Board specific parameters
> >
> > This patch attempts to categorize the parameters in current
> voltage layer into
> > above buckets. This will make voltage layer to work with different
> kinds of PMIC
> > and boards.
> >
> > TODO: Provide infrastructure to use VC I2C (I2C4) for PMIC
> configuration (useful
> > for cases where PMIC is connected to OMAP only via I2C4.
> >
> > Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com>
>
> Looking back at this in light of the voltage layer
> cleanup/restructure
> I've been working on, and I have a few more comments/questions.
>
> First, I'm glad to see the various hard-coded setup times cleaned up
> and
> made configuable.  Can you redo this on top of the voltage layer
> cleanups in progress (my pm-wip/voltdm_b branch)?   More details on
> this
> below...
Sure
>
> [...]
>
> > @@ -44,6 +54,15 @@ struct omap_volt_data
> omap34xx_vddmpu_volt_data[] = {
> >  	VOLT_DATA_DEFINE(0, 0, 0, 0),
> >  };
> >
> > +struct omap_vp_param omap34xx_mpu_vp_data = {
> > +	.on_volt		= OMAP3_ON_VOLTAGE_UV,
> > +	.onlp_volt		= OMAP3_ONLP_VOLTAGE_UV,
> > +	.ret_volt		= OMAP3_RET_VOLTAGE_UV,
> > +	.off_volt		= OMAP3_OFF_VOLTAGE_UV,
> > +	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
> > +	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,
> > +};
> > +
>
> I'm glad to see these removed from the PMIC structure since they are
> not
> PMIC-specific, but the _volt fields in this structure are written to
> the
> VC, not the VP, so should not be part of a VP structure.
Ack. Will fix it.
>
> [...]
>
> > @@ -523,15 +523,35 @@ static int
> vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
> >
> >  static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
> >  {
> > +	struct clk *omap_32k_clk;
> > +	u32 omap_32k_clk_speed;
> > +	unsigned long temp;
> > +
> >  	/*
> >  	 * 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,
> > -		       OMAP3_PRM_VOLTOFFSET_OFFSET);
> > -	vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
> > -		       OMAP3_PRM_VOLTSETUP2_OFFSET);
> > +
> > +	omap_32k_clk = clk_get(NULL, "wkup_32k_fck");
> > +	if (IS_ERR(omap_32k_clk)) {
> > +		pr_warning("%s: Could not get the 32k_clk clk to
> calculate"
> > +			"various vdd_%s params\n", __func__, vdd-
> >voltdm.name);
> > +		return;
> > +	}
> > +	omap_32k_clk_speed = clk_get_rate(omap_32k_clk);
> > +	clk_put(omap_32k_clk);
>
> You probably don't need to do a clk_get/clk_get_rate/clk_put of the
> 32k
> clock, since we know what the rate of that clock is already. :)
:-) I will optimize this.
>
> IOW, 'omap_32k_clk_speed = (32 << 10)' should suffice.
>
> > +	temp = vdd->board_data-
> >omap3_board_data.vdd_setup_off.clksetup;
> > +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> > +	vdd->write_reg(temp, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET);
> > +
> > +	temp = vdd->board_data-
> >omap3_board_data.vdd_setup_off.voltsetup2;
> > +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> > +	vdd->write_reg(temp, prm_mod_offs,
> OMAP3_PRM_VOLTSETUP2_OFFSET);
> > +
> > +	temp = vdd->board_data->omap3_board_data.voltoffset;
> > +	temp = temp * omap_32k_clk_speed / (1000 * 1000) + 1;
> > +	vdd->write_reg(temp, prm_mod_offs,
> OMAP3_PRM_VOLTOFFSET_OFFSET);
>
> According to the TRM (vZK, section 4.12.5.1.2), the VOLTOFFSET value
> should be calculated based on the CLKSETUP and VOLTSETUP2 registers,
> so
> we probably don't need a configurable value for this.
Yes..I am planning to remove these parameters being exposed to board file
and keep only minimal things (like oscillator ramp and ramp down time) in
boaord file. We should be able calculate these parameters based on these
generic parameters.
>
> [...]
>
> > @@ -139,6 +163,61 @@ struct omap_vdd_info {
> >  		unsigned long target_volt);
> >  };
> >
> > +/**
> > + * omap3_vdd_setuptime - vdd set up time info
> > + * @voltsetup	: setup time of the VDDregulators in us
> > + * @clksetup	: setup time of the oscillator system clock
> (sys_clk) in us
> > + * @voltsetup2	: Overall setup time of VDDregulators in us
> > + */
> > +struct omap3_vdd_setuptime {
> > +	u16 voltsetup;
> > +	u16 clksetup;
> > +	u16 voltsetup2;
> > +};
> > +
> > +/**
> > + * omap3_volt_board_data - vdd set up time info for OMAP3
> > + * @vdd_setup_ret	: VDD setup time for retention mode
> > + * @vdd_setup_off	: VDD setup time for off mode
> > + * @voltoffset		: offset-time to de-assert sys_offmode
> > + *					when exiting the OFF mode
> > + */
> > +struct omap3_volt_board_data {
> > +	struct omap3_vdd_setuptime vdd_setup_ret;
> > +	struct omap3_vdd_setuptime vdd_setup_off;
> > +	u16 voltoffset;
>
> voltoffset can be dropped.  Based on TRM, voltoffset can be
> calculated
yes
> (see comment above.)
>
> > +};
> > +
> > +/**
> > + * omap4_volt_setuptime - vdd set up time info for OMAP4
> > + * @voltsetup_ramp_up	: VDD ram up time in us
> > + * @voltsetup_ramp_down	: VDD ram down time in us
> > + */
> > +struct omap4_volt_setuptime {
> > +	u16 voltsetup_ramp_up;
> > +	u16 voltsetup_ramp_down;
> > +};
> > +
> > +/**
> > + * omap4_volt_board_data - vdd set up time info for OMAP4
> > + * @vdd_setup_ret	: VDD setup time for retention mode
> > + * @vdd_setup_off	: VDD setup time for off mode
> > + */
> > +struct omap4_volt_board_data {
> > +	struct omap4_volt_setuptime vdd_setup_ret;
> > +	struct omap4_volt_setuptime vdd_setup_off;
> > +};
> > +
> > +/**
> > + * omap_volt_board_data - board specific voltage set up time data
> > + * @omap3_board_data	: omap3 board data
> > + * @omap4_board_data	: omap4 board data
> > + */
> > +union omap_volt_board_data {
> > +	struct omap3_volt_board_data omap3_board_data;
> > +	struct omap4_volt_board_data omap4_board_data;
> > +};
>
> For the setup times, we need a generic way to define these times
> that
> can be used for both OMAP3 & OMAP4+.
>
> IIUC, The primary difference is that on OMAP4, both a ramp up and a
> ramp
> down time are configurable, where OMAP3 has a single time for both.
> If
> the values are given in usecs and not in register values, defining a
> common structure to handle both should be straight forward,
>
> For OMAP3 and OMAP4, there you have a clock setup time, and then
> separate voltage setup times for ret/sleep and off.  The structure
> can
> contain both ramp up and ramp down times, but one will obviously be
> ignored in the OMAP3 specific code that programs these registers
> (probably in prmXXXX.c)
Yes..I am coming up with a more generic way to provide set up latencies.

Vishwa
>
> Kevin

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters
  2011-04-05  7:08     ` Vishwanath Sripathy
@ 2011-04-05 18:16       ` Kevin Hilman
  0 siblings, 0 replies; 18+ messages in thread
From: Kevin Hilman @ 2011-04-05 18:16 UTC (permalink / raw)
  To: Vishwanath Sripathy; +Cc: linux-omap

Vishwanath Sripathy <vishwanath.bs@ti.com> writes:

[...]

> Yes..I am planning to remove these parameters being exposed to board file
> and keep only minimal things (like oscillator ramp and ramp down time) in
> boaord file. We should be able calculate these parameters based on these
> generic parameters.

[...]

> Yes..I am coming up with a more generic way to provide set up latencies.

Great!  Thanks.

For now, please base on my pm-wip/voltdm_b branch.  If you're feeling
adventurous, I've started some VP cleanup/restructure in my
pm-wip/voltdm_c branch as well.

Kevin

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-04-05 18:16 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-15 14:33 [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Vishwanath BS
2011-03-15 14:33 ` [RFC][PATCH 1/3] OMAP PM: Seggregate Voltage layer parameters Vishwanath BS
2011-03-17 23:20   ` Kevin Hilman
2011-03-18 12:00     ` Vishwanath Sripathy
2011-04-02  0:03   ` Kevin Hilman
2011-04-05  7:08     ` Vishwanath Sripathy
2011-04-05 18:16       ` Kevin Hilman
2011-03-15 14:33 ` [RFC][PATCH 2/3] OMAP PM: Add support for bypassing VP/VC in Voltage layer Vishwanath BS
2011-03-15 15:16   ` Menon, Nishanth
2011-03-15 16:14     ` Vishwanath Sripathy
2011-03-16  6:58   ` Premi, Sanjeev
2011-03-15 14:33 ` [RFC][PATCH 3/3] OMAP PM: Add Board specific parameters for OMAP Volatge layer Vishwanath BS
2011-03-15 15:38   ` Menon, Nishanth
2011-03-16  5:53     ` Vishwanath Sripathy
2011-03-17 23:25     ` Kevin Hilman
2011-03-15 15:07 ` [RFC][PATCH 0/3] OMAP PM: Voltage layer clean up Menon, Nishanth
2011-03-15 16:06   ` Vishwanath Sripathy
2011-03-16  1:18     ` Nishanth Menon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.