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>
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index d5e792f..22db6e6 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -243,17 +243,24 @@
/* get PMIC/board specific settings */
vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr;
+ vc->volt_reg_addr = vdd->pmic_info->volt_reg_addr;
+ vc->cmd_reg_addr = vdd->pmic_info->cmd_reg_addr;
/* Configure the i2c slave address for this VC */
voltdm->rmw(vc->smps_sa_mask,
vc->i2c_slave_addr << __ffs(vc->smps_sa_mask),
vc->common->smps_sa_reg);
- /* Setup the VOLRA(pmic reg addr) in VC */
- vc_val = voltdm->read(vc->common->smps_volra_reg);
- vc_val &= ~vc->smps_volra_mask;
- vc_val |= vdd->pmic_info->volt_reg_addr << vc->smps_volra_shift;
- voltdm->write(vc_val, vc->common->smps_volra_reg);
+ /*
+ * 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);
+ if (vc->cmd_reg_addr)
+ voltdm->rmw(vc->smps_cmdra_mask,
+ vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask),
+ vc->common->smps_cmdra_reg);
/* Configure the setup times */
vc_val = voltdm->read(vdd->vfsm->voltsetup_reg);