aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/vc.c70
-rw-r--r--arch/arm/mach-omap2/vc.h8
-rw-r--r--arch/arm/mach-omap2/vc3xxx_data.c3
-rw-r--r--arch/arm/mach-omap2/vc44xx_data.c5
4 files changed, 74 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 72c9cb64a42b..1791f79112bf 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -19,6 +19,52 @@
19#include "prm-regbits-44xx.h" 19#include "prm-regbits-44xx.h"
20#include "prm44xx.h" 20#include "prm44xx.h"
21 21
22/*
23 * Channel configuration bits, common for OMAP3 & 4
24 * OMAP3 register: PRM_VC_CH_CONF
25 * OMAP4 register: PRM_VC_CFG_CHANNEL
26 */
27#define CFG_CHANNEL_SA BIT(0)
28#define CFG_CHANNEL_RAV BIT(1)
29#define CFG_CHANNEL_RAC BIT(2)
30#define CFG_CHANNEL_RACEN BIT(3)
31#define CFG_CHANNEL_CMD BIT(4)
32#define CFG_CHANNEL_MASK 0x3f
33
34/**
35 * omap_vc_config_channel - configure VC channel to PMIC mappings
36 * @voltdm: pointer to voltagdomain defining the desired VC channel
37 *
38 * Configures the VC channel to PMIC mappings for the following
39 * PMIC settings
40 * - i2c slave address (SA)
41 * - voltage configuration address (RAV)
42 * - command configuration address (RAC) and enable bit (RACEN)
43 * - command values for ON, ONLP, RET and OFF (CMD)
44 *
45 * This function currently only allows flexible configuration of the
46 * non-default channel. Starting with OMAP4, there are more than 2
47 * channels, with one defined as the default (on OMAP4, it's MPU.)
48 * Only the non-default channel can be configured.
49 */
50static int omap_vc_config_channel(struct voltagedomain *voltdm)
51{
52 struct omap_vc_channel *vc = voltdm->vc;
53
54 /*
55 * For default channel, the only configurable bit is RACEN.
56 * All others must stay at zero (see function comment above.)
57 */
58 if (vc->flags & OMAP_VC_CHANNEL_DEFAULT)
59 vc->cfg_channel &= CFG_CHANNEL_RACEN;
60
61 voltdm->rmw(CFG_CHANNEL_MASK << vc->cfg_channel_sa_shift,
62 vc->cfg_channel << vc->cfg_channel_sa_shift,
63 vc->common->cfg_channel_reg);
64
65 return 0;
66}
67
22/* Voltage scale and accessory APIs */ 68/* Voltage scale and accessory APIs */
23int omap_vc_pre_scale(struct voltagedomain *voltdm, 69int omap_vc_pre_scale(struct voltagedomain *voltdm,
24 unsigned long target_volt, 70 unsigned long target_volt,
@@ -166,8 +212,6 @@ static void __init omap3_vc_init_channel(struct voltagedomain *voltdm)
166 * Generic VC parameters init 212 * Generic VC parameters init
167 * XXX This data should be abstracted out 213 * XXX This data should be abstracted out
168 */ 214 */
169 voltdm->write(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK,
170 OMAP3_PRM_VC_CH_CONF_OFFSET);
171 voltdm->write(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, 215 voltdm->write(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK,
172 OMAP3_PRM_VC_I2C_CFG_OFFSET); 216 OMAP3_PRM_VC_I2C_CFG_OFFSET);
173 217
@@ -186,15 +230,6 @@ static void __init omap4_vc_init_channel(struct voltagedomain *voltdm)
186 if (is_initialized) 230 if (is_initialized)
187 return; 231 return;
188 232
189 /*
190 * Generic VC parameters init
191 * XXX This data should be abstracted out
192 */
193 vc_val = (OMAP4430_RAV_VDD_MPU_L_MASK | OMAP4430_CMD_VDD_MPU_L_MASK |
194 OMAP4430_RAV_VDD_IVA_L_MASK | OMAP4430_CMD_VDD_IVA_L_MASK |
195 OMAP4430_RAV_VDD_CORE_L_MASK | OMAP4430_CMD_VDD_CORE_L_MASK);
196 voltdm->write(vc_val, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET);
197
198 /* XXX These are magic numbers and do not belong! */ 233 /* XXX These are magic numbers and do not belong! */
199 vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT); 234 vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
200 voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET); 235 voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
@@ -222,6 +257,8 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
222 return; 257 return;
223 } 258 }
224 259
260 vc->cfg_channel = 0;
261
225 /* get PMIC/board specific settings */ 262 /* get PMIC/board specific settings */
226 vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr; 263 vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr;
227 vc->volt_reg_addr = vdd->pmic_info->volt_reg_addr; 264 vc->volt_reg_addr = vdd->pmic_info->volt_reg_addr;
@@ -232,6 +269,7 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
232 voltdm->rmw(vc->smps_sa_mask, 269 voltdm->rmw(vc->smps_sa_mask,
233 vc->i2c_slave_addr << __ffs(vc->smps_sa_mask), 270 vc->i2c_slave_addr << __ffs(vc->smps_sa_mask),
234 vc->common->smps_sa_reg); 271 vc->common->smps_sa_reg);
272 vc->cfg_channel |= CFG_CHANNEL_SA;
235 273
236 /* 274 /*
237 * Configure the PMIC register addresses. 275 * Configure the PMIC register addresses.
@@ -239,10 +277,14 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
239 voltdm->rmw(vc->smps_volra_mask, 277 voltdm->rmw(vc->smps_volra_mask,
240 vc->volt_reg_addr << __ffs(vc->smps_volra_mask), 278 vc->volt_reg_addr << __ffs(vc->smps_volra_mask),
241 vc->common->smps_volra_reg); 279 vc->common->smps_volra_reg);
242 if (vc->cmd_reg_addr) 280 vc->cfg_channel |= CFG_CHANNEL_RAV;
281
282 if (vc->cmd_reg_addr) {
243 voltdm->rmw(vc->smps_cmdra_mask, 283 voltdm->rmw(vc->smps_cmdra_mask,
244 vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask), 284 vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask),
245 vc->common->smps_cmdra_reg); 285 vc->common->smps_cmdra_reg);
286 vc->cfg_channel |= CFG_CHANNEL_RAC | CFG_CHANNEL_RACEN;
287 }
246 288
247 /* Set up the on, inactive, retention and off voltage */ 289 /* Set up the on, inactive, retention and off voltage */
248 on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt); 290 on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
@@ -254,6 +296,10 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
254 (ret_vsel << vc->common->cmd_ret_shift) | 296 (ret_vsel << vc->common->cmd_ret_shift) |
255 (off_vsel << vc->common->cmd_off_shift)); 297 (off_vsel << vc->common->cmd_off_shift));
256 voltdm->write(val, vc->cmdval_reg); 298 voltdm->write(val, vc->cmdval_reg);
299 vc->cfg_channel |= CFG_CHANNEL_CMD;
300
301 /* Channel configuration */
302 omap_vc_config_channel(voltdm);
257 303
258 /* Configure the setup times */ 304 /* Configure the setup times */
259 voltdm->rmw(voltdm->vfsm->voltsetup_mask, 305 voltdm->rmw(voltdm->vfsm->voltsetup_mask,
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 6e8806b59823..4e1913748d2a 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -54,8 +54,12 @@ struct omap_vc_common {
54 u8 cmd_onlp_shift; 54 u8 cmd_onlp_shift;
55 u8 cmd_ret_shift; 55 u8 cmd_ret_shift;
56 u8 cmd_off_shift; 56 u8 cmd_off_shift;
57 u8 cfg_channel_reg;
57}; 58};
58 59
60/* omap_vc_channel.flags values */
61#define OMAP_VC_CHANNEL_DEFAULT BIT(0)
62
59/** 63/**
60 * struct omap_vc_channel - VC per-instance data 64 * struct omap_vc_channel - VC per-instance data
61 * @i2c_slave_addr: I2C slave address of PMIC for this VC channel 65 * @i2c_slave_addr: I2C slave address of PMIC for this VC channel
@@ -67,6 +71,7 @@ struct omap_vc_common {
67 * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register 71 * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
68 * @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register 72 * @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register
69 * @cmdval_reg: register for on/ret/off voltage level values for this channel 73 * @cmdval_reg: register for on/ret/off voltage level values for this channel
74 * @flags: VC channel-specific flags (optional)
70 */ 75 */
71struct omap_vc_channel { 76struct omap_vc_channel {
72 /* channel state */ 77 /* channel state */
@@ -74,6 +79,7 @@ struct omap_vc_channel {
74 u16 volt_reg_addr; 79 u16 volt_reg_addr;
75 u16 cmd_reg_addr; 80 u16 cmd_reg_addr;
76 u16 setup_time; 81 u16 setup_time;
82 u8 cfg_channel;
77 83
78 /* register access data */ 84 /* register access data */
79 const struct omap_vc_common *common; 85 const struct omap_vc_common *common;
@@ -81,6 +87,8 @@ struct omap_vc_channel {
81 u32 smps_volra_mask; 87 u32 smps_volra_mask;
82 u32 smps_cmdra_mask; 88 u32 smps_cmdra_mask;
83 u8 cmdval_reg; 89 u8 cmdval_reg;
90 u8 cfg_channel_sa_shift;
91 u8 flags;
84}; 92};
85 93
86extern struct omap_vc_channel omap3_vc_mpu; 94extern 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 df8bd5ead7e4..f4449eb59841 100644
--- a/arch/arm/mach-omap2/vc3xxx_data.c
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -43,6 +43,7 @@ static struct omap_vc_common omap3_vc_common = {
43 .cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT, 43 .cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT,
44 .cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT, 44 .cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT,
45 .cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT, 45 .cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT,
46 .cfg_channel_reg = OMAP3_PRM_VC_CH_CONF_OFFSET,
46}; 47};
47 48
48struct omap_vc_channel omap3_vc_mpu = { 49struct omap_vc_channel omap3_vc_mpu = {
@@ -51,6 +52,7 @@ struct omap_vc_channel omap3_vc_mpu = {
51 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK, 52 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK,
52 .smps_volra_mask = OMAP3430_VOLRA0_MASK, 53 .smps_volra_mask = OMAP3430_VOLRA0_MASK,
53 .smps_cmdra_mask = OMAP3430_CMDRA0_MASK, 54 .smps_cmdra_mask = OMAP3430_CMDRA0_MASK,
55 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT,
54}; 56};
55 57
56struct omap_vc_channel omap3_vc_core = { 58struct omap_vc_channel omap3_vc_core = {
@@ -59,4 +61,5 @@ struct omap_vc_channel omap3_vc_core = {
59 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK, 61 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK,
60 .smps_volra_mask = OMAP3430_VOLRA1_MASK, 62 .smps_volra_mask = OMAP3430_VOLRA1_MASK,
61 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK, 63 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK,
64 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
62}; 65};
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c
index 5d104ff662b3..1610bdedee6b 100644
--- a/arch/arm/mach-omap2/vc44xx_data.c
+++ b/arch/arm/mach-omap2/vc44xx_data.c
@@ -44,15 +44,18 @@ static const struct omap_vc_common omap4_vc_common = {
44 .cmd_onlp_shift = OMAP4430_ONLP_SHIFT, 44 .cmd_onlp_shift = OMAP4430_ONLP_SHIFT,
45 .cmd_ret_shift = OMAP4430_RET_SHIFT, 45 .cmd_ret_shift = OMAP4430_RET_SHIFT,
46 .cmd_off_shift = OMAP4430_OFF_SHIFT, 46 .cmd_off_shift = OMAP4430_OFF_SHIFT,
47 .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET,
47}; 48};
48 49
49/* VC instance data for each controllable voltage line */ 50/* VC instance data for each controllable voltage line */
50struct omap_vc_channel omap4_vc_mpu = { 51struct omap_vc_channel omap4_vc_mpu = {
52 .flags = OMAP_VC_CHANNEL_DEFAULT,
51 .common = &omap4_vc_common, 53 .common = &omap4_vc_common,
52 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET, 54 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET,
53 .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK, 55 .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK,
54 .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK, 56 .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK,
55 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_MPU_L_MASK, 57 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_MPU_L_MASK,
58 .cfg_channel_sa_shift = OMAP4430_SA_VDD_MPU_L_SHIFT,
56}; 59};
57 60
58struct omap_vc_channel omap4_vc_iva = { 61struct omap_vc_channel omap4_vc_iva = {
@@ -61,6 +64,7 @@ struct omap_vc_channel omap4_vc_iva = {
61 .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK, 64 .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK,
62 .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK, 65 .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK,
63 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_IVA_L_MASK, 66 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_IVA_L_MASK,
67 .cfg_channel_sa_shift = OMAP4430_SA_VDD_IVA_L_SHIFT,
64}; 68};
65 69
66struct omap_vc_channel omap4_vc_core = { 70struct omap_vc_channel omap4_vc_core = {
@@ -69,5 +73,6 @@ struct omap_vc_channel omap4_vc_core = {
69 .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK, 73 .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK,
70 .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK, 74 .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK,
71 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_CORE_L_MASK, 75 .smps_cmdra_mask = OMAP4430_CMDRA_VDD_CORE_L_MASK,
76 .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT,
72}; 77};
73 78