[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / voltdm / 0113-OMAP2-VC-support-PMICs-with-separate-voltage-and-com.patch
1 From 5b8106df22b9fab4597d531500ce4bef75e14682 Mon Sep 17 00:00:00 2001
2 From: Kevin Hilman <khilman@ti.com>
3 Date: Tue, 22 Mar 2011 14:12:37 -0700
4 Subject: [PATCH 113/149] OMAP2+: VC: support PMICs with separate voltage and command registers
6 The VC layer can support PMICs with separate voltage and command
7 registers by putting the different registers in the PRM_VC_SMPS_VOL_RA
8 and PRCM_VC_SMPS_CMD_RA registers respectively.
10 The PMIC data must supply at least a voltage register address
11 (volt_reg_addr). The command register address (cmd_reg_addr) is
12 optional. If the PMIC data does not supply a separate command
13 register address, the VC will use the voltage register address for both.
15 Signed-off-by: Kevin Hilman <khilman@ti.com>
16 ---
17 arch/arm/mach-omap2/omap_twl.c | 10 +++++-----
18 arch/arm/mach-omap2/vc.c | 4 ++--
19 arch/arm/mach-omap2/voltage.h | 3 ++-
20 3 files changed, 9 insertions(+), 8 deletions(-)
22 diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
23 index 760487b..3249fe3 100644
24 --- a/arch/arm/mach-omap2/omap_twl.c
25 +++ b/arch/arm/mach-omap2/omap_twl.c
26 @@ -158,7 +158,7 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
27 .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX,
28 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
29 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
30 - .pmic_reg = OMAP3_VDD_MPU_SR_CONTROL_REG,
31 + .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG,
32 .vsel_to_uv = twl4030_vsel_to_uv,
33 .uv_to_vsel = twl4030_uv_to_vsel,
34 };
35 @@ -178,7 +178,7 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
36 .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX,
37 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
38 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
39 - .pmic_reg = OMAP3_VDD_CORE_SR_CONTROL_REG,
40 + .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG,
41 .vsel_to_uv = twl4030_vsel_to_uv,
42 .uv_to_vsel = twl4030_uv_to_vsel,
43 };
44 @@ -198,7 +198,7 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
45 .vp_vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX,
46 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
47 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
48 - .pmic_reg = OMAP4_VDD_MPU_SR_VOLT_REG,
49 + .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG,
50 .vsel_to_uv = twl6030_vsel_to_uv,
51 .uv_to_vsel = twl6030_uv_to_vsel,
52 };
53 @@ -218,7 +218,7 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
54 .vp_vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX,
55 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
56 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
57 - .pmic_reg = OMAP4_VDD_IVA_SR_VOLT_REG,
58 + .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG,
59 .vsel_to_uv = twl6030_vsel_to_uv,
60 .uv_to_vsel = twl6030_uv_to_vsel,
61 };
62 @@ -238,7 +238,7 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
63 .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX,
64 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
65 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
66 - .pmic_reg = OMAP4_VDD_CORE_SR_VOLT_REG,
67 + .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG,
68 .vsel_to_uv = twl6030_vsel_to_uv,
69 .uv_to_vsel = twl6030_uv_to_vsel,
70 };
71 diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
72 index 7643940..720c0cd 100644
73 --- a/arch/arm/mach-omap2/vc.c
74 +++ b/arch/arm/mach-omap2/vc.c
75 @@ -106,7 +106,7 @@ int omap_vc_bypass_scale(struct voltagedomain *voltdm,
76 vc_valid = vc->common->valid;
77 vc_bypass_val_reg = vc->common->bypass_val_reg;
78 vc_bypass_value = (target_vsel << vc->common->data_shift) |
79 - (vdd->pmic_info->pmic_reg <<
80 + (vdd->pmic_info->volt_reg_addr <<
81 vc->common->regaddr_shift) |
82 (vdd->pmic_info->i2c_slave_addr <<
83 vc->common->slaveaddr_shift);
84 @@ -255,7 +255,7 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
85 vc_val = vdd->read_reg(vc->common->prm_mod,
86 vc->common->smps_volra_reg);
87 vc_val &= ~vc->smps_volra_mask;
88 - vc_val |= vdd->pmic_info->pmic_reg << vc->smps_volra_shift;
89 + vc_val |= vdd->pmic_info->volt_reg_addr << vc->smps_volra_shift;
90 vdd->write_reg(vc_val, vc->common->prm_mod,
91 vc->common->smps_volra_reg);
93 diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
94 index 83fa239..641597c 100644
95 --- a/arch/arm/mach-omap2/voltage.h
96 +++ b/arch/arm/mach-omap2/voltage.h
97 @@ -112,7 +112,8 @@ struct omap_volt_pmic_info {
98 u8 vp_vddmax;
99 u8 vp_timeout_us;
100 u8 i2c_slave_addr;
101 - u8 pmic_reg;
102 + u8 volt_reg_addr;
103 + u8 cmd_reg_addr;
104 unsigned long (*vsel_to_uv) (const u8 vsel);
105 u8 (*uv_to_vsel) (unsigned long uV);
106 };
107 --
108 1.6.6.1