All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: linux-omap <linux-omap@vger.kernel.org>
Cc: kevin <khilman@ti.com>, Nishanth Menon <nm@ti.com>
Subject: [pm-wip/voltdm_nm][PATCH 04/10] OMAP4: PM: VC: allow channels use of default channel volt_reg_addr
Date: Mon,  6 Jun 2011 21:16:07 -0500	[thread overview]
Message-ID: <1307412972-25854-5-git-send-email-nm@ti.com> (raw)
In-Reply-To: <1307412972-25854-1-git-send-email-nm@ti.com>

OMAP4's PRM_VC_CFG_CHANNEL register allows for flexibility of configuring
for various PMIC configurations. In combinations where we'd like to
use the default VC channel's voltage_reg address in a particular non-default
VC channel, we allow the use of USE_DEFAULT_CHANNEL_I2C_PARAM.

Since 0 is a valid register address, we need to increase the size of
reg storage for the flag. Depending on the PMIC and platform used,
this can be populated on the PMIC's datastructure and percolates to
VC's configuration.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/vc.c      |   17 ++++++++++-------
 arch/arm/mach-omap2/vc.h      |    2 +-
 arch/arm/mach-omap2/voltage.h |    4 ++--
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 6017c70..53a16cc 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -310,10 +310,11 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
 	vc->setup_time = voltdm->pmic->volt_setup_time;
 
 	if ((vc->flags & OMAP_VC_CHANNEL_DEFAULT) &&
-		(vc->i2c_slave_addr == USE_DEFAULT_CHANNEL_I2C_PARAM)) {
+		((vc->i2c_slave_addr == USE_DEFAULT_CHANNEL_I2C_PARAM) ||
+		(vc->volt_reg_addr == USE_DEFAULT_CHANNEL_I2C_PARAM))) {
 		pr_err("%s: voltdm %s: default channel "
-			"bad config-sa=%2x ?\n", __func__, voltdm->name,
-			vc->i2c_slave_addr);
+			"bad config-sa=%2x vol=%2x?\n", __func__, voltdm->name,
+			vc->i2c_slave_addr, vc->volt_reg_addr);
 		return;
 	}
 
@@ -328,10 +329,12 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
 	/*
 	 * Configure the PMIC register addresses.
 	 */
-	voltdm->rmw(vc->smps_volra_mask,
-		    vc->volt_reg_addr << __ffs(vc->smps_volra_mask),
-		    vc->common->smps_volra_reg);
-	vc->cfg_channel |= vc_cfg_bits->rav;
+	if (vc->volt_reg_addr != USE_DEFAULT_CHANNEL_I2C_PARAM) {
+		voltdm->rmw(vc->smps_volra_mask,
+			    vc->volt_reg_addr << __ffs(vc->smps_volra_mask),
+			    vc->common->smps_volra_reg);
+		vc->cfg_channel |= vc_cfg_bits->rav;
+	}
 
 	if (vc->cmd_reg_addr) {
 		voltdm->rmw(vc->smps_cmdra_mask,
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 22c0060..310368f 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -78,7 +78,7 @@ struct omap_vc_channel {
 
 	/* channel state */
 	u16 i2c_slave_addr;
-	u8 volt_reg_addr;
+	u16 volt_reg_addr;
 	u8 cmd_reg_addr;
 	u8 cfg_channel;
 	u16 setup_time;
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 1732258..75f3557 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -114,7 +114,7 @@ struct omap_volt_data {
  * channel is MPU, all other domains such as IVA/CORE, could optionally
  * link their i2c reg configuration to use MPU channel's configuration if
  * required. To do this, mark in the PMIC structure's
- * i2c_slave_addr with this macro.
+ * i2c_slave_addr, volt_reg_addr with this macro.
  */
 #define USE_DEFAULT_CHANNEL_I2C_PARAM  0x8000
 
@@ -142,7 +142,7 @@ struct omap_voltdm_pmic {
 	u8 vp_vddmax;
 	u8 vp_timeout_us;
 	u16 i2c_slave_addr;
-	u8 volt_reg_addr;
+	u16 volt_reg_addr;
 	u8 cmd_reg_addr;
 	bool i2c_high_speed;
 	u8 i2c_mcode;
-- 
1.7.1


  parent reply	other threads:[~2011-06-07  2:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07  2:16 [pm-wip/voltdm_nm][PATCH 00/10] OMAP2+: voltage: fixes Nishanth Menon
2011-06-07  2:16 ` [pm-wip/voltdm_nm][PATCH 01/10] OMAP3+: VC: fix mutant channel handling Nishanth Menon
2011-06-09 17:21   ` Kevin Hilman
2011-06-07  2:16 ` [pm-wip/voltdm_nm][PATCH 02/10] OMAP4: PM: VC: allow channels use of default channel i2c_slaveaddr Nishanth Menon
2011-06-09 18:07   ` Kevin Hilman
2011-06-09 18:17     ` Kevin Hilman
2011-06-07  2:16 ` [pm-wip/voltdm_nm][PATCH 03/10] OMAP4: PM: VC: allow channels to use cmdra reg Nishanth Menon
2011-06-09 17:48   ` Kevin Hilman
2011-06-07  2:16 ` Nishanth Menon [this message]
2011-06-09 18:32   ` [pm-wip/voltdm_nm][PATCH 04/10] OMAP4: PM: VC: allow channels use of default channel volt_reg_addr Kevin Hilman
2011-06-07  2:16 ` [pm-wip/voltdm_nm][PATCH 05/10] OMAP4: PM: VC: allow channels use of default channel cmd_reg_addr Nishanth Menon
2011-06-07  2:16 ` [pm-wip/voltdm_nm][PATCH 06/10] OMAP3+: PM: VC: support configuring PMIC over I2C_SR Nishanth Menon
2011-06-07  2:16 ` [pm-wip/voltdm_nm][PATCH 07/10] OMAP3+: PM: VP: use uV for max and min voltage limits Nishanth Menon
2011-06-16 20:45   ` Kevin Hilman
2011-06-17  0:28     ` Menon, Nishanth
2011-06-17 15:48       ` Kevin Hilman
2011-06-07  2:16 ` [pm-wip/voltdm_nm][PATCH 08/10] OMAP3+: PM: introduce a central pmic control Nishanth Menon
2011-06-07  2:16 ` [pm-wip/voltdm_nm][PATCH 09/10] OMAP2+: PM: secure OPP access using rcu locks Nishanth Menon
2011-06-16 20:47   ` Kevin Hilman
2011-06-17  0:39     ` Menon, Nishanth

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=1307412972-25854-5-git-send-email-nm@ti.com \
    --to=nm@ti.com \
    --cc=khilman@ti.com \
    --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.