diff options
author | Kevin Hilman <khilman@ti.com> | 2011-06-09 14:01:55 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-09-15 15:02:56 -0400 |
commit | e4e021c5491537783f5f65a6defa92e6098a3658 (patch) | |
tree | 01f6736da2d7584f6740401b6f297d80f8565dc6 /arch/arm/mach-omap2 | |
parent | ba112a4e86ba8f0f9546bd953374cde064b507ca (diff) |
OMAP3+: VC: cleanup PMIC register address configuration
- support both voltage register address and command register address
for each VC channel
- add fields for voltage register address (volra) and command register
address (cmdra) to struct omap_vc_channel
- use VC/VP register access read/modify/write helper
- remove volra_shift field (use __ffs(mask) for shift value)
- I2C addresses 10-bit, change size to u16
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/vc.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-omap2/vc.h | 14 | ||||
-rw-r--r-- | arch/arm/mach-omap2/vc3xxx_data.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap2/vc44xx_data.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-omap2/voltage.h | 8 |
5 files changed, 32 insertions, 19 deletions
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c index d5e792f20f16..22db6e6764d7 100644 --- a/arch/arm/mach-omap2/vc.c +++ b/arch/arm/mach-omap2/vc.c | |||
@@ -243,17 +243,24 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) | |||
243 | 243 | ||
244 | /* get PMIC/board specific settings */ | 244 | /* get PMIC/board specific settings */ |
245 | vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr; | 245 | vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr; |
246 | vc->volt_reg_addr = vdd->pmic_info->volt_reg_addr; | ||
247 | vc->cmd_reg_addr = vdd->pmic_info->cmd_reg_addr; | ||
246 | 248 | ||
247 | /* Configure the i2c slave address for this VC */ | 249 | /* Configure the i2c slave address for this VC */ |
248 | voltdm->rmw(vc->smps_sa_mask, | 250 | voltdm->rmw(vc->smps_sa_mask, |
249 | vc->i2c_slave_addr << __ffs(vc->smps_sa_mask), | 251 | vc->i2c_slave_addr << __ffs(vc->smps_sa_mask), |
250 | vc->common->smps_sa_reg); | 252 | vc->common->smps_sa_reg); |
251 | 253 | ||
252 | /* Setup the VOLRA(pmic reg addr) in VC */ | 254 | /* |
253 | vc_val = voltdm->read(vc->common->smps_volra_reg); | 255 | * Configure the PMIC register addresses. |
254 | vc_val &= ~vc->smps_volra_mask; | 256 | */ |
255 | vc_val |= vdd->pmic_info->volt_reg_addr << vc->smps_volra_shift; | 257 | voltdm->rmw(vc->smps_volra_mask, |
256 | voltdm->write(vc_val, vc->common->smps_volra_reg); | 258 | vc->volt_reg_addr << __ffs(vc->smps_volra_mask), |
259 | vc->common->smps_volra_reg); | ||
260 | if (vc->cmd_reg_addr) | ||
261 | voltdm->rmw(vc->smps_cmdra_mask, | ||
262 | vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask), | ||
263 | vc->common->smps_cmdra_reg); | ||
257 | 264 | ||
258 | /* Configure the setup times */ | 265 | /* Configure the setup times */ |
259 | vc_val = voltdm->read(vdd->vfsm->voltsetup_reg); | 266 | vc_val = voltdm->read(vdd->vfsm->voltsetup_reg); |
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h index 69ca900aff0b..43a0c5c2b07a 100644 --- a/arch/arm/mach-omap2/vc.h +++ b/arch/arm/mach-omap2/vc.h | |||
@@ -27,6 +27,7 @@ struct voltagedomain; | |||
27 | * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register | 27 | * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register |
28 | * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start | 28 | * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start |
29 | * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start | 29 | * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start |
30 | * @smps_cmdra_reg: Offset of PRM_VC_SMPS_CMD_RA reg from PRM start | ||
30 | * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start | 31 | * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start |
31 | * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register | 32 | * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register |
32 | * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register | 33 | * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register |
@@ -44,6 +45,7 @@ struct omap_vc_common { | |||
44 | u32 valid; | 45 | u32 valid; |
45 | u8 smps_sa_reg; | 46 | u8 smps_sa_reg; |
46 | u8 smps_volra_reg; | 47 | u8 smps_volra_reg; |
48 | u8 smps_cmdra_reg; | ||
47 | u8 bypass_val_reg; | 49 | u8 bypass_val_reg; |
48 | u8 data_shift; | 50 | u8 data_shift; |
49 | u8 slaveaddr_shift; | 51 | u8 slaveaddr_shift; |
@@ -57,24 +59,26 @@ struct omap_vc_common { | |||
57 | /** | 59 | /** |
58 | * struct omap_vc_channel - VC per-instance data | 60 | * struct omap_vc_channel - VC per-instance data |
59 | * @i2c_slave_addr: I2C slave address of PMIC for this VC channel | 61 | * @i2c_slave_addr: I2C slave address of PMIC for this VC channel |
62 | * @volt_reg_addr: voltage configuration register address | ||
63 | * @cmd_reg_addr: command configuration register address | ||
60 | * @common: pointer to VC common data for this platform | 64 | * @common: pointer to VC common data for this platform |
61 | * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register | 65 | * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register |
62 | * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register | 66 | * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register |
63 | * @smps_volra_shift: VOLRA* field shift in the PRM_VC_VOL_RA register | 67 | * @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register |
64 | * | 68 | * @cmdval_reg: register for on/ret/off voltage level values for this channel |
65 | * XXX It is not necessary to have both a *_mask and a *_shift - | ||
66 | * remove one | ||
67 | */ | 69 | */ |
68 | struct omap_vc_channel { | 70 | struct omap_vc_channel { |
69 | /* channel state */ | 71 | /* channel state */ |
70 | u16 i2c_slave_addr; | 72 | u16 i2c_slave_addr; |
73 | u16 volt_reg_addr; | ||
74 | u16 cmd_reg_addr; | ||
71 | 75 | ||
72 | /* register access data */ | 76 | /* register access data */ |
73 | const struct omap_vc_common *common; | 77 | const struct omap_vc_common *common; |
74 | u32 smps_sa_mask; | 78 | u32 smps_sa_mask; |
75 | u32 smps_volra_mask; | 79 | u32 smps_volra_mask; |
80 | u32 smps_cmdra_mask; | ||
76 | u8 cmdval_reg; | 81 | u8 cmdval_reg; |
77 | u8 smps_volra_shift; | ||
78 | }; | 82 | }; |
79 | 83 | ||
80 | extern struct omap_vc_channel omap3_vc_mpu; | 84 | extern struct omap_vc_channel omap3_vc_mpu; |
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c index 86be50c263ac..df8bd5ead7e4 100644 --- a/arch/arm/mach-omap2/vc3xxx_data.c +++ b/arch/arm/mach-omap2/vc3xxx_data.c | |||
@@ -32,6 +32,7 @@ | |||
32 | static struct omap_vc_common omap3_vc_common = { | 32 | static struct omap_vc_common omap3_vc_common = { |
33 | .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET, | 33 | .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET, |
34 | .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET, | 34 | .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET, |
35 | .smps_cmdra_reg = OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET, | ||
35 | .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET, | 36 | .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET, |
36 | .data_shift = OMAP3430_DATA_SHIFT, | 37 | .data_shift = OMAP3430_DATA_SHIFT, |
37 | .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT, | 38 | .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT, |
@@ -48,14 +49,14 @@ struct omap_vc_channel omap3_vc_mpu = { | |||
48 | .common = &omap3_vc_common, | 49 | .common = &omap3_vc_common, |
49 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET, | 50 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET, |
50 | .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK, | 51 | .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK, |
51 | .smps_volra_shift = OMAP3430_VOLRA0_SHIFT, | ||
52 | .smps_volra_mask = OMAP3430_VOLRA0_MASK, | 52 | .smps_volra_mask = OMAP3430_VOLRA0_MASK, |
53 | .smps_cmdra_mask = OMAP3430_CMDRA0_MASK, | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | struct omap_vc_channel omap3_vc_core = { | 56 | struct omap_vc_channel omap3_vc_core = { |
56 | .common = &omap3_vc_common, | 57 | .common = &omap3_vc_common, |
57 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET, | 58 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET, |
58 | .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK, | 59 | .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK, |
59 | .smps_volra_shift = OMAP3430_VOLRA1_SHIFT, | ||
60 | .smps_volra_mask = OMAP3430_VOLRA1_MASK, | 60 | .smps_volra_mask = OMAP3430_VOLRA1_MASK, |
61 | .smps_cmdra_mask = OMAP3430_CMDRA1_MASK, | ||
61 | }; | 62 | }; |
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c index af922b440e96..5d104ff662b3 100644 --- a/arch/arm/mach-omap2/vc44xx_data.c +++ b/arch/arm/mach-omap2/vc44xx_data.c | |||
@@ -33,6 +33,7 @@ | |||
33 | static const struct omap_vc_common omap4_vc_common = { | 33 | static const struct omap_vc_common omap4_vc_common = { |
34 | .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, | 34 | .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, |
35 | .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, | 35 | .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, |
36 | .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET, | ||
36 | .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET, | 37 | .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET, |
37 | .data_shift = OMAP4430_DATA_SHIFT, | 38 | .data_shift = OMAP4430_DATA_SHIFT, |
38 | .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT, | 39 | .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT, |
@@ -50,23 +51,23 @@ struct omap_vc_channel omap4_vc_mpu = { | |||
50 | .common = &omap4_vc_common, | 51 | .common = &omap4_vc_common, |
51 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET, | 52 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET, |
52 | .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK, | 53 | .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK, |
53 | .smps_volra_shift = OMAP4430_VOLRA_VDD_MPU_L_SHIFT, | ||
54 | .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK, | 54 | .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK, |
55 | .smps_cmdra_mask = OMAP4430_CMDRA_VDD_MPU_L_MASK, | ||
55 | }; | 56 | }; |
56 | 57 | ||
57 | struct omap_vc_channel omap4_vc_iva = { | 58 | struct omap_vc_channel omap4_vc_iva = { |
58 | .common = &omap4_vc_common, | 59 | .common = &omap4_vc_common, |
59 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET, | 60 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET, |
60 | .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK, | 61 | .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK, |
61 | .smps_volra_shift = OMAP4430_VOLRA_VDD_IVA_L_SHIFT, | ||
62 | .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK, | 62 | .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK, |
63 | .smps_cmdra_mask = OMAP4430_CMDRA_VDD_IVA_L_MASK, | ||
63 | }; | 64 | }; |
64 | 65 | ||
65 | struct omap_vc_channel omap4_vc_core = { | 66 | struct omap_vc_channel omap4_vc_core = { |
66 | .common = &omap4_vc_common, | 67 | .common = &omap4_vc_common, |
67 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET, | 68 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET, |
68 | .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK, | 69 | .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK, |
69 | .smps_volra_shift = OMAP4430_VOLRA_VDD_CORE_L_SHIFT, | ||
70 | .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK, | 70 | .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK, |
71 | .smps_cmdra_mask = OMAP4430_CMDRA_VDD_CORE_L_MASK, | ||
71 | }; | 72 | }; |
72 | 73 | ||
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h index 590384978279..3f49807a36e8 100644 --- a/arch/arm/mach-omap2/voltage.h +++ b/arch/arm/mach-omap2/voltage.h | |||
@@ -103,10 +103,10 @@ struct omap_volt_data { | |||
103 | * @slew_rate: PMIC slew rate (in uv/us) | 103 | * @slew_rate: PMIC slew rate (in uv/us) |
104 | * @step_size: PMIC voltage step size (in uv) | 104 | * @step_size: PMIC voltage step size (in uv) |
105 | * @i2c_slave_addr: I2C slave address of PMIC | 105 | * @i2c_slave_addr: I2C slave address of PMIC |
106 | * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV. | ||
107 | * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value. | ||
108 | * @volt_reg_addr: voltage configuration register address | 106 | * @volt_reg_addr: voltage configuration register address |
109 | * @cmd_reg_addr: command (on, on-LP, ret, off) configuration register address | 107 | * @cmd_reg_addr: command (on, on-LP, ret, off) configuration register address |
108 | * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV. | ||
109 | * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value. | ||
110 | */ | 110 | */ |
111 | struct omap_volt_pmic_info { | 111 | struct omap_volt_pmic_info { |
112 | int slew_rate; | 112 | int slew_rate; |
@@ -117,14 +117,14 @@ struct omap_volt_pmic_info { | |||
117 | u32 off_volt; | 117 | u32 off_volt; |
118 | u16 volt_setup_time; | 118 | u16 volt_setup_time; |
119 | u16 i2c_slave_addr; | 119 | u16 i2c_slave_addr; |
120 | u16 volt_reg_addr; | ||
121 | u16 cmd_reg_addr; | ||
120 | u8 vp_erroroffset; | 122 | u8 vp_erroroffset; |
121 | u8 vp_vstepmin; | 123 | u8 vp_vstepmin; |
122 | u8 vp_vstepmax; | 124 | u8 vp_vstepmax; |
123 | u8 vp_vddmin; | 125 | u8 vp_vddmin; |
124 | u8 vp_vddmax; | 126 | u8 vp_vddmax; |
125 | u8 vp_timeout_us; | 127 | u8 vp_timeout_us; |
126 | u8 volt_reg_addr; | ||
127 | u8 cmd_reg_addr; | ||
128 | unsigned long (*vsel_to_uv) (const u8 vsel); | 128 | unsigned long (*vsel_to_uv) (const u8 vsel); |
129 | u8 (*uv_to_vsel) (unsigned long uV); | 129 | u8 (*uv_to_vsel) (unsigned long uV); |
130 | }; | 130 | }; |