Commit 24d3194a2c9bc4d2315117915d4d22c395c07fd5
1 parent
08d1c9a3e2
Exists in
master
and in
4 other branches
OMAP3+: VC: abstract out channel configuration
VC channel configuration is programmed based on settings coming from the PMIC configuration. Currently, the VC channel to PMIC mapping is a simple one-to-one mapping. Whenever a VC channel parameter is configured (i2c slave addres, PMIC register address, on/ret/off command), the corresponding bits are enabled in the VC channel configuration register. If necessary, the programmability of channel configuration settings could be extended to board/PMIC files, however, because this patch changes the channel configuration to be programmed based on existing values from the PMIC settings, it may not be required. Also note that starting with OMAP4, where there are more than 2 channels, one channel is identified as the "default" channel. When any of the bits in the channel config for the other channels are zero, it means to use the default channel. The OMAP4 TRM (at least through NDA version Q) is wrong in describing which is the default channel. The default channel on OMAP4 is MPU, not CORE as decribed in the TRM. Signed-off-by: Kevin Hilman <khilman@ti.com>
Showing 4 changed files with 74 additions and 12 deletions Inline Diff
arch/arm/mach-omap2/vc.c
| 1 | /* | 1 | /* |
| 2 | * OMAP Voltage Controller (VC) interface | 2 | * OMAP Voltage Controller (VC) interface |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2011 Texas Instruments, Inc. | 4 | * Copyright (C) 2011 Texas Instruments, Inc. |
| 5 | * | 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public | 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any | 7 | * License version 2. This program is licensed "as is" without any |
| 8 | * warranty of any kind, whether express or implied. | 8 | * warranty of any kind, whether express or implied. |
| 9 | */ | 9 | */ |
| 10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
| 11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
| 12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 13 | 13 | ||
| 14 | #include <plat/cpu.h> | 14 | #include <plat/cpu.h> |
| 15 | 15 | ||
| 16 | #include "voltage.h" | 16 | #include "voltage.h" |
| 17 | #include "vc.h" | 17 | #include "vc.h" |
| 18 | #include "prm-regbits-34xx.h" | 18 | #include "prm-regbits-34xx.h" |
| 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 | */ | ||
| 50 | static 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 */ |
| 23 | int omap_vc_pre_scale(struct voltagedomain *voltdm, | 69 | int omap_vc_pre_scale(struct voltagedomain *voltdm, |
| 24 | unsigned long target_volt, | 70 | unsigned long target_volt, |
| 25 | u8 *target_vsel, u8 *current_vsel) | 71 | u8 *target_vsel, u8 *current_vsel) |
| 26 | { | 72 | { |
| 27 | struct omap_vc_channel *vc = voltdm->vc; | 73 | struct omap_vc_channel *vc = voltdm->vc; |
| 28 | struct omap_vdd_info *vdd = voltdm->vdd; | 74 | struct omap_vdd_info *vdd = voltdm->vdd; |
| 29 | struct omap_volt_data *volt_data; | 75 | struct omap_volt_data *volt_data; |
| 30 | const struct omap_vp_common_data *vp_common; | 76 | const struct omap_vp_common_data *vp_common; |
| 31 | u32 vc_cmdval, vp_errgain_val; | 77 | u32 vc_cmdval, vp_errgain_val; |
| 32 | 78 | ||
| 33 | vp_common = vdd->vp_data->vp_common; | 79 | vp_common = vdd->vp_data->vp_common; |
| 34 | 80 | ||
| 35 | /* Check if sufficient pmic info is available for this vdd */ | 81 | /* Check if sufficient pmic info is available for this vdd */ |
| 36 | if (!vdd->pmic_info) { | 82 | if (!vdd->pmic_info) { |
| 37 | pr_err("%s: Insufficient pmic info to scale the vdd_%s\n", | 83 | pr_err("%s: Insufficient pmic info to scale the vdd_%s\n", |
| 38 | __func__, voltdm->name); | 84 | __func__, voltdm->name); |
| 39 | return -EINVAL; | 85 | return -EINVAL; |
| 40 | } | 86 | } |
| 41 | 87 | ||
| 42 | if (!vdd->pmic_info->uv_to_vsel) { | 88 | if (!vdd->pmic_info->uv_to_vsel) { |
| 43 | pr_err("%s: PMIC function to convert voltage in uV to" | 89 | pr_err("%s: PMIC function to convert voltage in uV to" |
| 44 | "vsel not registered. Hence unable to scale voltage" | 90 | "vsel not registered. Hence unable to scale voltage" |
| 45 | "for vdd_%s\n", __func__, voltdm->name); | 91 | "for vdd_%s\n", __func__, voltdm->name); |
| 46 | return -ENODATA; | 92 | return -ENODATA; |
| 47 | } | 93 | } |
| 48 | 94 | ||
| 49 | if (!voltdm->read || !voltdm->write) { | 95 | if (!voltdm->read || !voltdm->write) { |
| 50 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", | 96 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", |
| 51 | __func__, voltdm->name); | 97 | __func__, voltdm->name); |
| 52 | return -EINVAL; | 98 | return -EINVAL; |
| 53 | } | 99 | } |
| 54 | 100 | ||
| 55 | /* Get volt_data corresponding to target_volt */ | 101 | /* Get volt_data corresponding to target_volt */ |
| 56 | volt_data = omap_voltage_get_voltdata(voltdm, target_volt); | 102 | volt_data = omap_voltage_get_voltdata(voltdm, target_volt); |
| 57 | if (IS_ERR(volt_data)) | 103 | if (IS_ERR(volt_data)) |
| 58 | volt_data = NULL; | 104 | volt_data = NULL; |
| 59 | 105 | ||
| 60 | *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt); | 106 | *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt); |
| 61 | *current_vsel = voltdm->read(vdd->vp_data->voltage); | 107 | *current_vsel = voltdm->read(vdd->vp_data->voltage); |
| 62 | 108 | ||
| 63 | /* Setting the ON voltage to the new target voltage */ | 109 | /* Setting the ON voltage to the new target voltage */ |
| 64 | vc_cmdval = voltdm->read(vc->cmdval_reg); | 110 | vc_cmdval = voltdm->read(vc->cmdval_reg); |
| 65 | vc_cmdval &= ~vc->common->cmd_on_mask; | 111 | vc_cmdval &= ~vc->common->cmd_on_mask; |
| 66 | vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift); | 112 | vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift); |
| 67 | voltdm->write(vc_cmdval, vc->cmdval_reg); | 113 | voltdm->write(vc_cmdval, vc->cmdval_reg); |
| 68 | 114 | ||
| 69 | /* Setting vp errorgain based on the voltage */ | 115 | /* Setting vp errorgain based on the voltage */ |
| 70 | if (volt_data) { | 116 | if (volt_data) { |
| 71 | vp_errgain_val = voltdm->read(vdd->vp_data->vpconfig); | 117 | vp_errgain_val = voltdm->read(vdd->vp_data->vpconfig); |
| 72 | vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain; | 118 | vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain; |
| 73 | vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask; | 119 | vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask; |
| 74 | vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain << | 120 | vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain << |
| 75 | vp_common->vpconfig_errorgain_shift; | 121 | vp_common->vpconfig_errorgain_shift; |
| 76 | voltdm->write(vp_errgain_val, vdd->vp_data->vpconfig); | 122 | voltdm->write(vp_errgain_val, vdd->vp_data->vpconfig); |
| 77 | } | 123 | } |
| 78 | 124 | ||
| 79 | return 0; | 125 | return 0; |
| 80 | } | 126 | } |
| 81 | 127 | ||
| 82 | void omap_vc_post_scale(struct voltagedomain *voltdm, | 128 | void omap_vc_post_scale(struct voltagedomain *voltdm, |
| 83 | unsigned long target_volt, | 129 | unsigned long target_volt, |
| 84 | u8 target_vsel, u8 current_vsel) | 130 | u8 target_vsel, u8 current_vsel) |
| 85 | { | 131 | { |
| 86 | struct omap_vdd_info *vdd = voltdm->vdd; | 132 | struct omap_vdd_info *vdd = voltdm->vdd; |
| 87 | u32 smps_steps = 0, smps_delay = 0; | 133 | u32 smps_steps = 0, smps_delay = 0; |
| 88 | 134 | ||
| 89 | smps_steps = abs(target_vsel - current_vsel); | 135 | smps_steps = abs(target_vsel - current_vsel); |
| 90 | /* SMPS slew rate / step size. 2us added as buffer. */ | 136 | /* SMPS slew rate / step size. 2us added as buffer. */ |
| 91 | smps_delay = ((smps_steps * vdd->pmic_info->step_size) / | 137 | smps_delay = ((smps_steps * vdd->pmic_info->step_size) / |
| 92 | vdd->pmic_info->slew_rate) + 2; | 138 | vdd->pmic_info->slew_rate) + 2; |
| 93 | udelay(smps_delay); | 139 | udelay(smps_delay); |
| 94 | 140 | ||
| 95 | vdd->curr_volt = target_volt; | 141 | vdd->curr_volt = target_volt; |
| 96 | } | 142 | } |
| 97 | 143 | ||
| 98 | /* vc_bypass_scale - VC bypass method of voltage scaling */ | 144 | /* vc_bypass_scale - VC bypass method of voltage scaling */ |
| 99 | int omap_vc_bypass_scale(struct voltagedomain *voltdm, | 145 | int omap_vc_bypass_scale(struct voltagedomain *voltdm, |
| 100 | unsigned long target_volt) | 146 | unsigned long target_volt) |
| 101 | { | 147 | { |
| 102 | struct omap_vc_channel *vc = voltdm->vc; | 148 | struct omap_vc_channel *vc = voltdm->vc; |
| 103 | u32 loop_cnt = 0, retries_cnt = 0; | 149 | u32 loop_cnt = 0, retries_cnt = 0; |
| 104 | u32 vc_valid, vc_bypass_val_reg, vc_bypass_value; | 150 | u32 vc_valid, vc_bypass_val_reg, vc_bypass_value; |
| 105 | u8 target_vsel, current_vsel; | 151 | u8 target_vsel, current_vsel; |
| 106 | int ret; | 152 | int ret; |
| 107 | 153 | ||
| 108 | ret = omap_vc_pre_scale(voltdm, target_volt, &target_vsel, ¤t_vsel); | 154 | ret = omap_vc_pre_scale(voltdm, target_volt, &target_vsel, ¤t_vsel); |
| 109 | if (ret) | 155 | if (ret) |
| 110 | return ret; | 156 | return ret; |
| 111 | 157 | ||
| 112 | vc_valid = vc->common->valid; | 158 | vc_valid = vc->common->valid; |
| 113 | vc_bypass_val_reg = vc->common->bypass_val_reg; | 159 | vc_bypass_val_reg = vc->common->bypass_val_reg; |
| 114 | vc_bypass_value = (target_vsel << vc->common->data_shift) | | 160 | vc_bypass_value = (target_vsel << vc->common->data_shift) | |
| 115 | (vc->volt_reg_addr << vc->common->regaddr_shift) | | 161 | (vc->volt_reg_addr << vc->common->regaddr_shift) | |
| 116 | (vc->i2c_slave_addr << vc->common->slaveaddr_shift); | 162 | (vc->i2c_slave_addr << vc->common->slaveaddr_shift); |
| 117 | 163 | ||
| 118 | voltdm->write(vc_bypass_value, vc_bypass_val_reg); | 164 | voltdm->write(vc_bypass_value, vc_bypass_val_reg); |
| 119 | voltdm->write(vc_bypass_value | vc_valid, vc_bypass_val_reg); | 165 | voltdm->write(vc_bypass_value | vc_valid, vc_bypass_val_reg); |
| 120 | 166 | ||
| 121 | vc_bypass_value = voltdm->read(vc_bypass_val_reg); | 167 | vc_bypass_value = voltdm->read(vc_bypass_val_reg); |
| 122 | /* | 168 | /* |
| 123 | * Loop till the bypass command is acknowledged from the SMPS. | 169 | * Loop till the bypass command is acknowledged from the SMPS. |
| 124 | * NOTE: This is legacy code. The loop count and retry count needs | 170 | * NOTE: This is legacy code. The loop count and retry count needs |
| 125 | * to be revisited. | 171 | * to be revisited. |
| 126 | */ | 172 | */ |
| 127 | while (!(vc_bypass_value & vc_valid)) { | 173 | while (!(vc_bypass_value & vc_valid)) { |
| 128 | loop_cnt++; | 174 | loop_cnt++; |
| 129 | 175 | ||
| 130 | if (retries_cnt > 10) { | 176 | if (retries_cnt > 10) { |
| 131 | pr_warning("%s: Retry count exceeded\n", __func__); | 177 | pr_warning("%s: Retry count exceeded\n", __func__); |
| 132 | return -ETIMEDOUT; | 178 | return -ETIMEDOUT; |
| 133 | } | 179 | } |
| 134 | 180 | ||
| 135 | if (loop_cnt > 50) { | 181 | if (loop_cnt > 50) { |
| 136 | retries_cnt++; | 182 | retries_cnt++; |
| 137 | loop_cnt = 0; | 183 | loop_cnt = 0; |
| 138 | udelay(10); | 184 | udelay(10); |
| 139 | } | 185 | } |
| 140 | vc_bypass_value = voltdm->read(vc_bypass_val_reg); | 186 | vc_bypass_value = voltdm->read(vc_bypass_val_reg); |
| 141 | } | 187 | } |
| 142 | 188 | ||
| 143 | omap_vc_post_scale(voltdm, target_volt, target_vsel, current_vsel); | 189 | omap_vc_post_scale(voltdm, target_volt, target_vsel, current_vsel); |
| 144 | return 0; | 190 | return 0; |
| 145 | } | 191 | } |
| 146 | 192 | ||
| 147 | static void __init omap3_vfsm_init(struct voltagedomain *voltdm) | 193 | static void __init omap3_vfsm_init(struct voltagedomain *voltdm) |
| 148 | { | 194 | { |
| 149 | /* | 195 | /* |
| 150 | * Voltage Manager FSM parameters init | 196 | * Voltage Manager FSM parameters init |
| 151 | * XXX This data should be passed in from the board file | 197 | * XXX This data should be passed in from the board file |
| 152 | */ | 198 | */ |
| 153 | voltdm->write(OMAP3_CLKSETUP, OMAP3_PRM_CLKSETUP_OFFSET); | 199 | voltdm->write(OMAP3_CLKSETUP, OMAP3_PRM_CLKSETUP_OFFSET); |
| 154 | voltdm->write(OMAP3_VOLTOFFSET, OMAP3_PRM_VOLTOFFSET_OFFSET); | 200 | voltdm->write(OMAP3_VOLTOFFSET, OMAP3_PRM_VOLTOFFSET_OFFSET); |
| 155 | voltdm->write(OMAP3_VOLTSETUP2, OMAP3_PRM_VOLTSETUP2_OFFSET); | 201 | voltdm->write(OMAP3_VOLTSETUP2, OMAP3_PRM_VOLTSETUP2_OFFSET); |
| 156 | } | 202 | } |
| 157 | 203 | ||
| 158 | static void __init omap3_vc_init_channel(struct voltagedomain *voltdm) | 204 | static void __init omap3_vc_init_channel(struct voltagedomain *voltdm) |
| 159 | { | 205 | { |
| 160 | static bool is_initialized; | 206 | static bool is_initialized; |
| 161 | 207 | ||
| 162 | if (is_initialized) | 208 | if (is_initialized) |
| 163 | return; | 209 | return; |
| 164 | 210 | ||
| 165 | /* | 211 | /* |
| 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 | ||
| 174 | omap3_vfsm_init(voltdm); | 218 | omap3_vfsm_init(voltdm); |
| 175 | 219 | ||
| 176 | is_initialized = true; | 220 | is_initialized = true; |
| 177 | } | 221 | } |
| 178 | 222 | ||
| 179 | 223 | ||
| 180 | /* OMAP4 specific voltage init functions */ | 224 | /* OMAP4 specific voltage init functions */ |
| 181 | static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) | 225 | static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) |
| 182 | { | 226 | { |
| 183 | static bool is_initialized; | 227 | static bool is_initialized; |
| 184 | u32 vc_val; | 228 | u32 vc_val; |
| 185 | 229 | ||
| 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); |
| 201 | 236 | ||
| 202 | is_initialized = true; | 237 | is_initialized = true; |
| 203 | } | 238 | } |
| 204 | 239 | ||
| 205 | void __init omap_vc_init_channel(struct voltagedomain *voltdm) | 240 | void __init omap_vc_init_channel(struct voltagedomain *voltdm) |
| 206 | { | 241 | { |
| 207 | struct omap_vc_channel *vc = voltdm->vc; | 242 | struct omap_vc_channel *vc = voltdm->vc; |
| 208 | struct omap_vdd_info *vdd = voltdm->vdd; | 243 | struct omap_vdd_info *vdd = voltdm->vdd; |
| 209 | u8 on_vsel, onlp_vsel, ret_vsel, off_vsel; | 244 | u8 on_vsel, onlp_vsel, ret_vsel, off_vsel; |
| 210 | u32 val; | 245 | u32 val; |
| 211 | 246 | ||
| 212 | if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { | 247 | if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { |
| 213 | pr_err("%s: PMIC info requried to configure vc for" | 248 | pr_err("%s: PMIC info requried to configure vc for" |
| 214 | "vdd_%s not populated.Hence cannot initialize vc\n", | 249 | "vdd_%s not populated.Hence cannot initialize vc\n", |
| 215 | __func__, voltdm->name); | 250 | __func__, voltdm->name); |
| 216 | return; | 251 | return; |
| 217 | } | 252 | } |
| 218 | 253 | ||
| 219 | if (!voltdm->read || !voltdm->write) { | 254 | if (!voltdm->read || !voltdm->write) { |
| 220 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", | 255 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", |
| 221 | __func__, voltdm->name); | 256 | __func__, voltdm->name); |
| 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; |
| 228 | vc->cmd_reg_addr = vdd->pmic_info->cmd_reg_addr; | 265 | vc->cmd_reg_addr = vdd->pmic_info->cmd_reg_addr; |
| 229 | vc->setup_time = vdd->pmic_info->volt_setup_time; | 266 | vc->setup_time = vdd->pmic_info->volt_setup_time; |
| 230 | 267 | ||
| 231 | /* Configure the i2c slave address for this VC */ | 268 | /* Configure the i2c slave address for this VC */ |
| 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. |
| 238 | */ | 276 | */ |
| 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); |
| 249 | onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt); | 291 | onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt); |
| 250 | ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt); | 292 | ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt); |
| 251 | off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt); | 293 | off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt); |
| 252 | val = ((on_vsel << vc->common->cmd_on_shift) | | 294 | val = ((on_vsel << vc->common->cmd_on_shift) | |
| 253 | (onlp_vsel << vc->common->cmd_onlp_shift) | | 295 | (onlp_vsel << vc->common->cmd_onlp_shift) | |
| 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 */ |
arch/arm/mach-omap2/vc.h
| 1 | /* | 1 | /* |
| 2 | * OMAP3/4 Voltage Controller (VC) structure and macro definitions | 2 | * OMAP3/4 Voltage Controller (VC) structure and macro definitions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | 4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. |
| 5 | * Rajendra Nayak <rnayak@ti.com> | 5 | * Rajendra Nayak <rnayak@ti.com> |
| 6 | * Lesly A M <x0080970@ti.com> | 6 | * Lesly A M <x0080970@ti.com> |
| 7 | * Thara Gopinath <thara@ti.com> | 7 | * Thara Gopinath <thara@ti.com> |
| 8 | * | 8 | * |
| 9 | * Copyright (C) 2008, 2011 Nokia Corporation | 9 | * Copyright (C) 2008, 2011 Nokia Corporation |
| 10 | * Kalle Jokiniemi | 10 | * Kalle Jokiniemi |
| 11 | * Paul Walmsley | 11 | * Paul Walmsley |
| 12 | * | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU General Public License version | 14 | * modify it under the terms of the GNU General Public License version |
| 15 | * 2 as published by the Free Software Foundation. | 15 | * 2 as published by the Free Software Foundation. |
| 16 | */ | 16 | */ |
| 17 | #ifndef __ARCH_ARM_MACH_OMAP2_VC_H | 17 | #ifndef __ARCH_ARM_MACH_OMAP2_VC_H |
| 18 | #define __ARCH_ARM_MACH_OMAP2_VC_H | 18 | #define __ARCH_ARM_MACH_OMAP2_VC_H |
| 19 | 19 | ||
| 20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 21 | 21 | ||
| 22 | struct voltagedomain; | 22 | struct voltagedomain; |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * struct omap_vc_common - per-VC register/bitfield data | 25 | * struct omap_vc_common - per-VC register/bitfield data |
| 26 | * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register | 26 | * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register |
| 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 | * @smps_cmdra_reg: Offset of PRM_VC_SMPS_CMD_RA reg from PRM start |
| 31 | * @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 |
| 32 | * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register | 32 | * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register |
| 33 | * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register | 33 | * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register |
| 34 | * @regaddr_shift: REGADDR field shift in PRM_VC_BYPASS_VAL register | 34 | * @regaddr_shift: REGADDR field shift in PRM_VC_BYPASS_VAL register |
| 35 | * @cmd_on_shift: ON field shift in PRM_VC_CMD_VAL_* register | 35 | * @cmd_on_shift: ON field shift in PRM_VC_CMD_VAL_* register |
| 36 | * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register | 36 | * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register |
| 37 | * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register | 37 | * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register |
| 38 | * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register | 38 | * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register |
| 39 | * | 39 | * |
| 40 | * XXX One of cmd_on_mask and cmd_on_shift are not needed | 40 | * XXX One of cmd_on_mask and cmd_on_shift are not needed |
| 41 | * XXX VALID should probably be a shift, not a mask | 41 | * XXX VALID should probably be a shift, not a mask |
| 42 | */ | 42 | */ |
| 43 | struct omap_vc_common { | 43 | struct omap_vc_common { |
| 44 | u32 cmd_on_mask; | 44 | u32 cmd_on_mask; |
| 45 | u32 valid; | 45 | u32 valid; |
| 46 | u8 smps_sa_reg; | 46 | u8 smps_sa_reg; |
| 47 | u8 smps_volra_reg; | 47 | u8 smps_volra_reg; |
| 48 | u8 smps_cmdra_reg; | 48 | u8 smps_cmdra_reg; |
| 49 | u8 bypass_val_reg; | 49 | u8 bypass_val_reg; |
| 50 | u8 data_shift; | 50 | u8 data_shift; |
| 51 | u8 slaveaddr_shift; | 51 | u8 slaveaddr_shift; |
| 52 | u8 regaddr_shift; | 52 | u8 regaddr_shift; |
| 53 | u8 cmd_on_shift; | 53 | u8 cmd_on_shift; |
| 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 |
| 62 | * @volt_reg_addr: voltage configuration register address | 66 | * @volt_reg_addr: voltage configuration register address |
| 63 | * @cmd_reg_addr: command configuration register address | 67 | * @cmd_reg_addr: command configuration register address |
| 64 | * @setup_time: setup time (in sys_clk cycles) of regulator for this channel | 68 | * @setup_time: setup time (in sys_clk cycles) of regulator for this channel |
| 65 | * @common: pointer to VC common data for this platform | 69 | * @common: pointer to VC common data for this platform |
| 66 | * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register | 70 | * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register |
| 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 | */ |
| 71 | struct omap_vc_channel { | 76 | struct omap_vc_channel { |
| 72 | /* channel state */ | 77 | /* channel state */ |
| 73 | u16 i2c_slave_addr; | 78 | u16 i2c_slave_addr; |
| 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; |
| 80 | u32 smps_sa_mask; | 86 | u32 smps_sa_mask; |
| 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 | ||
| 86 | extern struct omap_vc_channel omap3_vc_mpu; | 94 | extern struct omap_vc_channel omap3_vc_mpu; |
| 87 | extern struct omap_vc_channel omap3_vc_core; | 95 | extern struct omap_vc_channel omap3_vc_core; |
| 88 | 96 | ||
| 89 | extern struct omap_vc_channel omap4_vc_mpu; | 97 | extern struct omap_vc_channel omap4_vc_mpu; |
| 90 | extern struct omap_vc_channel omap4_vc_iva; | 98 | extern struct omap_vc_channel omap4_vc_iva; |
| 91 | extern struct omap_vc_channel omap4_vc_core; | 99 | extern struct omap_vc_channel omap4_vc_core; |
| 92 | 100 | ||
| 93 | void omap_vc_init_channel(struct voltagedomain *voltdm); | 101 | void omap_vc_init_channel(struct voltagedomain *voltdm); |
| 94 | int omap_vc_pre_scale(struct voltagedomain *voltdm, | 102 | int omap_vc_pre_scale(struct voltagedomain *voltdm, |
| 95 | unsigned long target_volt, | 103 | unsigned long target_volt, |
| 96 | u8 *target_vsel, u8 *current_vsel); | 104 | u8 *target_vsel, u8 *current_vsel); |
| 97 | void omap_vc_post_scale(struct voltagedomain *voltdm, | 105 | void omap_vc_post_scale(struct voltagedomain *voltdm, |
| 98 | unsigned long target_volt, | 106 | unsigned long target_volt, |
| 99 | u8 target_vsel, u8 current_vsel); | 107 | u8 target_vsel, u8 current_vsel); |
| 100 | int omap_vc_bypass_scale(struct voltagedomain *voltdm, | 108 | int omap_vc_bypass_scale(struct voltagedomain *voltdm, |
| 101 | unsigned long target_volt); | 109 | unsigned long target_volt); |
| 102 | 110 | ||
| 103 | #endif | 111 | #endif |
| 104 | 112 | ||
| 105 | 113 |
arch/arm/mach-omap2/vc3xxx_data.c
| 1 | /* | 1 | /* |
| 2 | * OMAP3 Voltage Controller (VC) data | 2 | * OMAP3 Voltage Controller (VC) data |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | 4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. |
| 5 | * Rajendra Nayak <rnayak@ti.com> | 5 | * Rajendra Nayak <rnayak@ti.com> |
| 6 | * Lesly A M <x0080970@ti.com> | 6 | * Lesly A M <x0080970@ti.com> |
| 7 | * Thara Gopinath <thara@ti.com> | 7 | * Thara Gopinath <thara@ti.com> |
| 8 | * | 8 | * |
| 9 | * Copyright (C) 2008, 2011 Nokia Corporation | 9 | * Copyright (C) 2008, 2011 Nokia Corporation |
| 10 | * Kalle Jokiniemi | 10 | * Kalle Jokiniemi |
| 11 | * Paul Walmsley | 11 | * Paul Walmsley |
| 12 | * | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License version 2 as | 14 | * it under the terms of the GNU General Public License version 2 as |
| 15 | * published by the Free Software Foundation. | 15 | * published by the Free Software Foundation. |
| 16 | */ | 16 | */ |
| 17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
| 18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
| 19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 20 | 20 | ||
| 21 | #include <plat/common.h> | 21 | #include <plat/common.h> |
| 22 | 22 | ||
| 23 | #include "prm-regbits-34xx.h" | 23 | #include "prm-regbits-34xx.h" |
| 24 | #include "voltage.h" | 24 | #include "voltage.h" |
| 25 | 25 | ||
| 26 | #include "vc.h" | 26 | #include "vc.h" |
| 27 | 27 | ||
| 28 | /* | 28 | /* |
| 29 | * VC data common to 34xx/36xx chips | 29 | * VC data common to 34xx/36xx chips |
| 30 | * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. | 30 | * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. |
| 31 | */ | 31 | */ |
| 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 | .smps_cmdra_reg = OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET, |
| 36 | .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET, | 36 | .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET, |
| 37 | .data_shift = OMAP3430_DATA_SHIFT, | 37 | .data_shift = OMAP3430_DATA_SHIFT, |
| 38 | .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT, | 38 | .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT, |
| 39 | .regaddr_shift = OMAP3430_REGADDR_SHIFT, | 39 | .regaddr_shift = OMAP3430_REGADDR_SHIFT, |
| 40 | .valid = OMAP3430_VALID_MASK, | 40 | .valid = OMAP3430_VALID_MASK, |
| 41 | .cmd_on_shift = OMAP3430_VC_CMD_ON_SHIFT, | 41 | .cmd_on_shift = OMAP3430_VC_CMD_ON_SHIFT, |
| 42 | .cmd_on_mask = OMAP3430_VC_CMD_ON_MASK, | 42 | .cmd_on_mask = OMAP3430_VC_CMD_ON_MASK, |
| 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 | ||
| 48 | struct omap_vc_channel omap3_vc_mpu = { | 49 | struct omap_vc_channel omap3_vc_mpu = { |
| 49 | .common = &omap3_vc_common, | 50 | .common = &omap3_vc_common, |
| 50 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET, | 51 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET, |
| 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 | ||
| 56 | struct omap_vc_channel omap3_vc_core = { | 58 | struct omap_vc_channel omap3_vc_core = { |
| 57 | .common = &omap3_vc_common, | 59 | .common = &omap3_vc_common, |
| 58 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET, | 60 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET, |
| 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 | }; |
| 63 | 66 |
arch/arm/mach-omap2/vc44xx_data.c
| 1 | /* | 1 | /* |
| 2 | * OMAP4 Voltage Controller (VC) data | 2 | * OMAP4 Voltage Controller (VC) data |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | 4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. |
| 5 | * Rajendra Nayak <rnayak@ti.com> | 5 | * Rajendra Nayak <rnayak@ti.com> |
| 6 | * Lesly A M <x0080970@ti.com> | 6 | * Lesly A M <x0080970@ti.com> |
| 7 | * Thara Gopinath <thara@ti.com> | 7 | * Thara Gopinath <thara@ti.com> |
| 8 | * | 8 | * |
| 9 | * Copyright (C) 2008, 2011 Nokia Corporation | 9 | * Copyright (C) 2008, 2011 Nokia Corporation |
| 10 | * Kalle Jokiniemi | 10 | * Kalle Jokiniemi |
| 11 | * Paul Walmsley | 11 | * Paul Walmsley |
| 12 | * | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License version 2 as | 14 | * it under the terms of the GNU General Public License version 2 as |
| 15 | * published by the Free Software Foundation. | 15 | * published by the Free Software Foundation. |
| 16 | */ | 16 | */ |
| 17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
| 18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
| 19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 20 | 20 | ||
| 21 | #include <plat/common.h> | 21 | #include <plat/common.h> |
| 22 | 22 | ||
| 23 | #include "prm44xx.h" | 23 | #include "prm44xx.h" |
| 24 | #include "prm-regbits-44xx.h" | 24 | #include "prm-regbits-44xx.h" |
| 25 | #include "voltage.h" | 25 | #include "voltage.h" |
| 26 | 26 | ||
| 27 | #include "vc.h" | 27 | #include "vc.h" |
| 28 | 28 | ||
| 29 | /* | 29 | /* |
| 30 | * VC data common to 44xx chips | 30 | * VC data common to 44xx chips |
| 31 | * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. | 31 | * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. |
| 32 | */ | 32 | */ |
| 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 | .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET, |
| 37 | .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET, | 37 | .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET, |
| 38 | .data_shift = OMAP4430_DATA_SHIFT, | 38 | .data_shift = OMAP4430_DATA_SHIFT, |
| 39 | .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT, | 39 | .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT, |
| 40 | .regaddr_shift = OMAP4430_REGADDR_SHIFT, | 40 | .regaddr_shift = OMAP4430_REGADDR_SHIFT, |
| 41 | .valid = OMAP4430_VALID_MASK, | 41 | .valid = OMAP4430_VALID_MASK, |
| 42 | .cmd_on_shift = OMAP4430_ON_SHIFT, | 42 | .cmd_on_shift = OMAP4430_ON_SHIFT, |
| 43 | .cmd_on_mask = OMAP4430_ON_MASK, | 43 | .cmd_on_mask = OMAP4430_ON_MASK, |
| 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 */ |
| 50 | struct omap_vc_channel omap4_vc_mpu = { | 51 | struct 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 | ||
| 58 | struct omap_vc_channel omap4_vc_iva = { | 61 | struct omap_vc_channel omap4_vc_iva = { |
| 59 | .common = &omap4_vc_common, | 62 | .common = &omap4_vc_common, |
| 60 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET, | 63 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET, |
| 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 | ||
| 66 | struct omap_vc_channel omap4_vc_core = { | 70 | struct omap_vc_channel omap4_vc_core = { |
| 67 | .common = &omap4_vc_common, | 71 | .common = &omap4_vc_common, |
| 68 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET, | 72 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET, |
| 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 | ||
| 74 | 79 |