All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 18/22] OMAP2+: VC: support PMICs with separate voltage and command registers
Date: Mon, 29 Aug 2011 10:35:51 -0700	[thread overview]
Message-ID: <1314639355-12713-19-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1314639355-12713-1-git-send-email-khilman@ti.com>

The VC layer can support PMICs with separate voltage and command
registers by putting the different registers in the PRM_VC_SMPS_VOL_RA
and PRCM_VC_SMPS_CMD_RA registers respectively.

The PMIC data must supply at least a voltage register address
(volt_reg_addr).  The command register address (cmd_reg_addr) is
optional.  If the PMIC data does not supply a separate command
register address, the VC will use the voltage register address for both.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/omap_twl.c |   10 +++++-----
 arch/arm/mach-omap2/vc.c       |    4 ++--
 arch/arm/mach-omap2/voltage.h  |    3 ++-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 760487b..3249fe3 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -158,7 +158,7 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP3_VDD_MPU_SR_CONTROL_REG,
 	.vsel_to_uv		= twl4030_vsel_to_uv,
 	.uv_to_vsel		= twl4030_uv_to_vsel,
 };
@@ -178,7 +178,7 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP3_VDD_CORE_SR_CONTROL_REG,
 	.vsel_to_uv		= twl4030_vsel_to_uv,
 	.uv_to_vsel		= twl4030_uv_to_vsel,
 };
@@ -198,7 +198,7 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP4_VDD_MPU_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
 };
@@ -218,7 +218,7 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP4_VDD_IVA_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
 };
@@ -238,7 +238,7 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP4_VDD_CORE_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
 };
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 7643940..720c0cd 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -106,7 +106,7 @@ int omap_vc_bypass_scale(struct voltagedomain *voltdm,
 	vc_valid = vc->common->valid;
 	vc_bypass_val_reg = vc->common->bypass_val_reg;
 	vc_bypass_value = (target_vsel << vc->common->data_shift) |
-			(vdd->pmic_info->pmic_reg <<
+			(vdd->pmic_info->volt_reg_addr <<
 			vc->common->regaddr_shift) |
 			(vdd->pmic_info->i2c_slave_addr <<
 			vc->common->slaveaddr_shift);
@@ -255,7 +255,7 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
 	vc_val = vdd->read_reg(vc->common->prm_mod,
 			       vc->common->smps_volra_reg);
 	vc_val &= ~vc->smps_volra_mask;
-	vc_val |= vdd->pmic_info->pmic_reg << vc->smps_volra_shift;
+	vc_val |= vdd->pmic_info->volt_reg_addr << vc->smps_volra_shift;
 	vdd->write_reg(vc_val, vc->common->prm_mod,
 		       vc->common->smps_volra_reg);
 
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 83fa239..641597c 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -112,7 +112,8 @@ struct omap_volt_pmic_info {
 	u8 vp_vddmax;
 	u8 vp_timeout_us;
 	u8 i2c_slave_addr;
-	u8 pmic_reg;
+	u8 volt_reg_addr;
+	u8 cmd_reg_addr;
 	unsigned long (*vsel_to_uv) (const u8 vsel);
 	u8 (*uv_to_vsel) (unsigned long uV);
 };
-- 
1.7.6


WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 18/22] OMAP2+: VC: support PMICs with separate voltage and command registers
Date: Mon, 29 Aug 2011 10:35:51 -0700	[thread overview]
Message-ID: <1314639355-12713-19-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1314639355-12713-1-git-send-email-khilman@ti.com>

The VC layer can support PMICs with separate voltage and command
registers by putting the different registers in the PRM_VC_SMPS_VOL_RA
and PRCM_VC_SMPS_CMD_RA registers respectively.

The PMIC data must supply at least a voltage register address
(volt_reg_addr).  The command register address (cmd_reg_addr) is
optional.  If the PMIC data does not supply a separate command
register address, the VC will use the voltage register address for both.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/omap_twl.c |   10 +++++-----
 arch/arm/mach-omap2/vc.c       |    4 ++--
 arch/arm/mach-omap2/voltage.h  |    3 ++-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 760487b..3249fe3 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -158,7 +158,7 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP3_VDD_MPU_SR_CONTROL_REG,
 	.vsel_to_uv		= twl4030_vsel_to_uv,
 	.uv_to_vsel		= twl4030_uv_to_vsel,
 };
@@ -178,7 +178,7 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP3_VDD_CORE_SR_CONTROL_REG,
 	.vsel_to_uv		= twl4030_vsel_to_uv,
 	.uv_to_vsel		= twl4030_uv_to_vsel,
 };
@@ -198,7 +198,7 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP4_VDD_MPU_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
 };
@@ -218,7 +218,7 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP4_VDD_IVA_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
 };
@@ -238,7 +238,7 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
 	.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,
+	.volt_reg_addr		= OMAP4_VDD_CORE_SR_VOLT_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
 };
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 7643940..720c0cd 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -106,7 +106,7 @@ int omap_vc_bypass_scale(struct voltagedomain *voltdm,
 	vc_valid = vc->common->valid;
 	vc_bypass_val_reg = vc->common->bypass_val_reg;
 	vc_bypass_value = (target_vsel << vc->common->data_shift) |
-			(vdd->pmic_info->pmic_reg <<
+			(vdd->pmic_info->volt_reg_addr <<
 			vc->common->regaddr_shift) |
 			(vdd->pmic_info->i2c_slave_addr <<
 			vc->common->slaveaddr_shift);
@@ -255,7 +255,7 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
 	vc_val = vdd->read_reg(vc->common->prm_mod,
 			       vc->common->smps_volra_reg);
 	vc_val &= ~vc->smps_volra_mask;
-	vc_val |= vdd->pmic_info->pmic_reg << vc->smps_volra_shift;
+	vc_val |= vdd->pmic_info->volt_reg_addr << vc->smps_volra_shift;
 	vdd->write_reg(vc_val, vc->common->prm_mod,
 		       vc->common->smps_volra_reg);
 
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 83fa239..641597c 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -112,7 +112,8 @@ struct omap_volt_pmic_info {
 	u8 vp_vddmax;
 	u8 vp_timeout_us;
 	u8 i2c_slave_addr;
-	u8 pmic_reg;
+	u8 volt_reg_addr;
+	u8 cmd_reg_addr;
 	unsigned long (*vsel_to_uv) (const u8 vsel);
 	u8 (*uv_to_vsel) (unsigned long uV);
 };
-- 
1.7.6

  parent reply	other threads:[~2011-08-29 17:36 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-29 17:35 [PATCH 00/22] OMAP: voltage cleanup part A Kevin Hilman
2011-08-29 17:35 ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 01/22] OMAP2+: hwmod: remove unused voltagedomain pointer Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 02/22] OMAP2+: voltage: move PRCM mod offets into VC/VP structures Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 03/22] OMAP2+: voltage: move prm_irqst_reg from VP into voltage domain Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 04/22] OMAP2+: voltage: start towards a new voltagedomain layer Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 05/22] OMAP3: voltage: rename "mpu" voltagedomain to "mpu_iva" Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 06/22] OMAP3: voltagedomain data: add wakeup domain Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 07/22] OMAP3+: voltage: add scalable flag to voltagedomain Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 08/22] OMAP2+: powerdomain: add voltagedomain to struct powerdomain Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 09/22] OMAP2: add voltage domains and connect to powerdomains Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-09-07 10:39   ` Jean Pihet
2011-09-07 10:39     ` Jean Pihet
2011-09-09 21:41     ` Kevin Hilman
2011-09-09 21:41       ` Kevin Hilman
2011-09-09 21:46     ` Kevin Hilman
2011-09-09 21:46       ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 10/22] OMAP3: powerdomain data: add voltage domains Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 11/22] OMAP4: " Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-09-07  9:04   ` Jean Pihet
2011-09-07  9:04     ` Jean Pihet
2011-09-09 21:48     ` Kevin Hilman
2011-09-09 21:48       ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 12/22] OMAP2+: powerdomain: add voltage domain lookup during register Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 13/22] OMAP2+: voltage: keep track of powerdomains in each voltagedomain Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-09-07  9:23   ` Jean Pihet
2011-09-07  9:23     ` Jean Pihet
2011-09-09 21:52     ` Kevin Hilman
2011-09-09 21:52       ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 14/22] OMAP2+: voltage: split voltage controller (VC) code into dedicated layer Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-09-07 10:42   ` Jean Pihet
2011-09-07 10:42     ` Jean Pihet
2011-09-09 21:51     ` Kevin Hilman
2011-09-09 21:51       ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 15/22] OMAP2+: voltage: move VC into struct voltagedomain, misc. renames Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 16/22] OMAP2+: voltage: enable VC bypass scale method when VC is initialized Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 17/22] OMAP2+: voltage: split out voltage processor (VP) code into new layer Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-09-07  9:52   ` Jean Pihet
2011-09-07  9:52     ` Jean Pihet
2011-08-29 17:35 ` Kevin Hilman [this message]
2011-08-29 17:35   ` [PATCH 18/22] OMAP2+: VC: support PMICs with separate voltage and command registers Kevin Hilman
2011-08-29 17:35 ` [PATCH 19/22] OMAP2+: add PRM VP functions for checking/clearing VP TX done status Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 20/22] OMAP3+ VP: replace transaction done check/clear with VP ops Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 21/22] OMAP2+: PRM: add register access functions for VC/VP Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-08-29 17:35 ` [PATCH 22/22] OMAP3+: voltage: convert to PRM register access functions Kevin Hilman
2011-08-29 17:35   ` Kevin Hilman
2011-09-07 19:12 ` [PATCH 00/22] OMAP: voltage cleanup part A Jean Pihet
2011-09-07 19:12   ` Jean Pihet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314639355-12713-19-git-send-email-khilman@ti.com \
    --to=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.