aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2011-04-04 18:25:07 -0400
committerKevin Hilman <khilman@ti.com>2011-09-15 15:09:07 -0400
commitb7ea803e55769768d1eff3b32e4f99837fa6ddb5 (patch)
treeefe5022fab4248d5f5fe33284d91b4743121115d
parentd7b0de2b46803062148345ae6a976c1e44a457b6 (diff)
OMAP3+: VP: cleanup: move VP instance into voltdm, misc. renames
- move VP instance struct from vdd_info into struct voltage domain - remove _data suffix from structure name - rename vp_ prefix from vp_common field: accesses are now vp->common - move vp_enabled bool from vdd_info into VP instance - remove remaining references to omap_vdd_info No functional changes. Signed-off-by: Kevin Hilman <khilman@ti.com>
-rw-r--r--arch/arm/mach-omap2/vc.c11
-rw-r--r--arch/arm/mach-omap2/voltage.c4
-rw-r--r--arch/arm/mach-omap2/voltage.h7
-rw-r--r--arch/arm/mach-omap2/voltagedomains3xxx_data.c10
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c15
-rw-r--r--arch/arm/mach-omap2/vp.c88
-rw-r--r--arch/arm/mach-omap2/vp.h24
-rw-r--r--arch/arm/mach-omap2/vp3xxx_data.c10
-rw-r--r--arch/arm/mach-omap2/vp44xx_data.c14
9 files changed, 84 insertions, 99 deletions
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 21ffde86ad83..e872a0369afb 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -107,11 +107,8 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
107 struct omap_vc_channel *vc = voltdm->vc; 107 struct omap_vc_channel *vc = voltdm->vc;
108 struct omap_vdd_info *vdd = voltdm->vdd; 108 struct omap_vdd_info *vdd = voltdm->vdd;
109 struct omap_volt_data *volt_data; 109 struct omap_volt_data *volt_data;
110 const struct omap_vp_common_data *vp_common;
111 u32 vc_cmdval, vp_errgain_val; 110 u32 vc_cmdval, vp_errgain_val;
112 111
113 vp_common = vdd->vp_data->vp_common;
114
115 /* Check if sufficient pmic info is available for this vdd */ 112 /* Check if sufficient pmic info is available for this vdd */
116 if (!voltdm->pmic) { 113 if (!voltdm->pmic) {
117 pr_err("%s: Insufficient pmic info to scale the vdd_%s\n", 114 pr_err("%s: Insufficient pmic info to scale the vdd_%s\n",
@@ -148,12 +145,12 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
148 145
149 /* Setting vp errorgain based on the voltage */ 146 /* Setting vp errorgain based on the voltage */
150 if (volt_data) { 147 if (volt_data) {
151 vp_errgain_val = voltdm->read(vdd->vp_data->vpconfig); 148 vp_errgain_val = voltdm->read(voltdm->vp->vpconfig);
152 vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain; 149 vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
153 vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask; 150 vp_errgain_val &= voltdm->vp->common->vpconfig_errorgain_mask;
154 vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain << 151 vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
155 vp_common->vpconfig_errorgain_shift; 152 voltdm->vp->common->vpconfig_errorgain_shift;
156 voltdm->write(vp_errgain_val, vdd->vp_data->vpconfig); 153 voltdm->write(vp_errgain_val, voltdm->vp->vpconfig);
157 } 154 }
158 155
159 return 0; 156 return 0;
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 94f7fc41c27c..c22b53c42193 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -81,11 +81,11 @@ static int __init _config_common_vdd_data(struct voltagedomain *voltdm)
81 81
82 /* Generic voltage parameters */ 82 /* Generic voltage parameters */
83 vdd->volt_scale = omap_vp_forceupdate_scale; 83 vdd->volt_scale = omap_vp_forceupdate_scale;
84 vdd->vp_enabled = false; 84 voltdm->vp->enabled = false;
85 85
86 vdd->vp_rt_data.vpconfig_erroroffset = 86 vdd->vp_rt_data.vpconfig_erroroffset =
87 (voltdm->pmic->vp_erroroffset << 87 (voltdm->pmic->vp_erroroffset <<
88 vdd->vp_data->vp_common->vpconfig_erroroffset_shift); 88 voltdm->vp->common->vpconfig_erroroffset_shift);
89 89
90 timeout_val = (sys_clk_speed * voltdm->pmic->vp_timeout_us) / 1000; 90 timeout_val = (sys_clk_speed * voltdm->pmic->vp_timeout_us) / 1000;
91 vdd->vp_rt_data.vlimitto_timeout = timeout_val; 91 vdd->vp_rt_data.vlimitto_timeout = timeout_val;
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index a36d2cfa5ca7..1ea735431ee0 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -55,6 +55,7 @@ struct omap_vfsm_instance {
55 * @node: list_head linking all voltage domains 55 * @node: list_head linking all voltage domains
56 * @pwrdm_list: list_head linking all powerdomains in this voltagedomain 56 * @pwrdm_list: list_head linking all powerdomains in this voltagedomain
57 * @vc: pointer to VC channel associated with this voltagedomain 57 * @vc: pointer to VC channel associated with this voltagedomain
58 * @vp: pointer to VP associated with this voltagedomain
58 * @read: read a VC/VP register 59 * @read: read a VC/VP register
59 * @write: write a VC/VP register 60 * @write: write a VC/VP register
60 * @read: read-modify-write a VC/VP register 61 * @read: read-modify-write a VC/VP register
@@ -67,6 +68,7 @@ struct voltagedomain {
67 struct list_head pwrdm_list; 68 struct list_head pwrdm_list;
68 struct omap_vc_channel *vc; 69 struct omap_vc_channel *vc;
69 const struct omap_vfsm_instance *vfsm; 70 const struct omap_vfsm_instance *vfsm;
71 struct omap_vp_instance *vp;
70 struct omap_voltdm_pmic *pmic; 72 struct omap_voltdm_pmic *pmic;
71 73
72 /* VC/VP register access functions: SoC specific */ 74 /* VC/VP register access functions: SoC specific */
@@ -136,21 +138,16 @@ struct omap_voltdm_pmic {
136 * 138 *
137 * @volt_data : voltage table having the distinct voltages supported 139 * @volt_data : voltage table having the distinct voltages supported
138 * by the domain and other associated per voltage data. 140 * by the domain and other associated per voltage data.
139 * @vp_data : the register values, shifts, masks for various
140 * vp registers
141 * @vp_rt_data : VP data derived at runtime, not predefined 141 * @vp_rt_data : VP data derived at runtime, not predefined
142 * @debug_dir : debug directory for this voltage domain. 142 * @debug_dir : debug directory for this voltage domain.
143 * @curr_volt : current voltage for this vdd. 143 * @curr_volt : current voltage for this vdd.
144 * @vp_enabled : flag to keep track of whether vp is enabled or not
145 * @volt_scale : API to scale the voltage of the vdd. 144 * @volt_scale : API to scale the voltage of the vdd.
146 */ 145 */
147struct omap_vdd_info { 146struct omap_vdd_info {
148 struct omap_volt_data *volt_data; 147 struct omap_volt_data *volt_data;
149 struct omap_vp_instance_data *vp_data;
150 struct omap_vp_runtime_data vp_rt_data; 148 struct omap_vp_runtime_data vp_rt_data;
151 struct dentry *debug_dir; 149 struct dentry *debug_dir;
152 u32 curr_volt; 150 u32 curr_volt;
153 bool vp_enabled;
154 151
155 int (*volt_scale) (struct voltagedomain *voltdm, 152 int (*volt_scale) (struct voltagedomain *voltdm,
156 unsigned long target_volt); 153 unsigned long target_volt);
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index ce5a7971addf..35117fcd55cf 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -36,18 +36,14 @@ static const struct omap_vfsm_instance omap3_vdd1_vfsm = {
36 .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, 36 .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
37}; 37};
38 38
39static struct omap_vdd_info omap3_vdd1_info = { 39static struct omap_vdd_info omap3_vdd1_info;
40 .vp_data = &omap3_vp1_data,
41};
42 40
43static const struct omap_vfsm_instance omap3_vdd2_vfsm = { 41static const struct omap_vfsm_instance omap3_vdd2_vfsm = {
44 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, 42 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
45 .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, 43 .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
46}; 44};
47 45
48static struct omap_vdd_info omap3_vdd2_info = { 46static struct omap_vdd_info omap3_vdd2_info;
49 .vp_data = &omap3_vp2_data,
50};
51 47
52static struct voltagedomain omap3_voltdm_mpu = { 48static struct voltagedomain omap3_voltdm_mpu = {
53 .name = "mpu_iva", 49 .name = "mpu_iva",
@@ -57,6 +53,7 @@ static struct voltagedomain omap3_voltdm_mpu = {
57 .rmw = omap3_prm_vcvp_rmw, 53 .rmw = omap3_prm_vcvp_rmw,
58 .vc = &omap3_vc_mpu, 54 .vc = &omap3_vc_mpu,
59 .vfsm = &omap3_vdd1_vfsm, 55 .vfsm = &omap3_vdd1_vfsm,
56 .vp = &omap3_vp_mpu,
60 .vdd = &omap3_vdd1_info, 57 .vdd = &omap3_vdd1_info,
61}; 58};
62 59
@@ -68,6 +65,7 @@ static struct voltagedomain omap3_voltdm_core = {
68 .rmw = omap3_prm_vcvp_rmw, 65 .rmw = omap3_prm_vcvp_rmw,
69 .vc = &omap3_vc_core, 66 .vc = &omap3_vc_core,
70 .vfsm = &omap3_vdd2_vfsm, 67 .vfsm = &omap3_vdd2_vfsm,
68 .vp = &omap3_vp_core,
71 .vdd = &omap3_vdd2_info, 69 .vdd = &omap3_vdd2_info,
72}; 70};
73 71
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index dd4bd222739a..3e7cb4e0a63a 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -36,25 +36,19 @@ static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, 36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
37}; 37};
38 38
39static struct omap_vdd_info omap4_vdd_mpu_info = { 39static struct omap_vdd_info omap4_vdd_mpu_info;
40 .vp_data = &omap4_vp_mpu_data,
41};
42 40
43static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = { 41static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
44 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, 42 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
45}; 43};
46 44
47static struct omap_vdd_info omap4_vdd_iva_info = { 45static struct omap_vdd_info omap4_vdd_iva_info;
48 .vp_data = &omap4_vp_iva_data,
49};
50 46
51static const struct omap_vfsm_instance omap4_vdd_core_vfsm = { 47static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
52 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, 48 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
53}; 49};
54 50
55static struct omap_vdd_info omap4_vdd_core_info = { 51static struct omap_vdd_info omap4_vdd_core_info;
56 .vp_data = &omap4_vp_core_data,
57};
58 52
59static struct voltagedomain omap4_voltdm_mpu = { 53static struct voltagedomain omap4_voltdm_mpu = {
60 .name = "mpu", 54 .name = "mpu",
@@ -64,6 +58,7 @@ static struct voltagedomain omap4_voltdm_mpu = {
64 .rmw = omap4_prm_vcvp_rmw, 58 .rmw = omap4_prm_vcvp_rmw,
65 .vc = &omap4_vc_mpu, 59 .vc = &omap4_vc_mpu,
66 .vfsm = &omap4_vdd_mpu_vfsm, 60 .vfsm = &omap4_vdd_mpu_vfsm,
61 .vp = &omap4_vp_mpu,
67 .vdd = &omap4_vdd_mpu_info, 62 .vdd = &omap4_vdd_mpu_info,
68}; 63};
69 64
@@ -75,6 +70,7 @@ static struct voltagedomain omap4_voltdm_iva = {
75 .rmw = omap4_prm_vcvp_rmw, 70 .rmw = omap4_prm_vcvp_rmw,
76 .vc = &omap4_vc_iva, 71 .vc = &omap4_vc_iva,
77 .vfsm = &omap4_vdd_iva_vfsm, 72 .vfsm = &omap4_vdd_iva_vfsm,
73 .vp = &omap4_vp_iva,
78 .vdd = &omap4_vdd_iva_info, 74 .vdd = &omap4_vdd_iva_info,
79}; 75};
80 76
@@ -86,6 +82,7 @@ static struct voltagedomain omap4_voltdm_core = {
86 .rmw = omap4_prm_vcvp_rmw, 82 .rmw = omap4_prm_vcvp_rmw,
87 .vc = &omap4_vc_core, 83 .vc = &omap4_vc_core,
88 .vfsm = &omap4_vdd_core_vfsm, 84 .vfsm = &omap4_vdd_core_vfsm,
85 .vp = &omap4_vp_core,
89 .vdd = &omap4_vdd_core_info, 86 .vdd = &omap4_vdd_core_info,
90}; 87};
91 88
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index a3afcbe741e3..53d6018fa678 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -14,7 +14,7 @@ static void __init vp_debugfs_init(struct voltagedomain *voltdm);
14 14
15static void vp_latch_vsel(struct voltagedomain *voltdm) 15static void vp_latch_vsel(struct voltagedomain *voltdm)
16{ 16{
17 struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; 17 struct omap_vp_instance *vp = voltdm->vp;
18 u32 vpconfig; 18 u32 vpconfig;
19 unsigned long uvdc; 19 unsigned long uvdc;
20 char vsel; 20 char vsel;
@@ -35,14 +35,14 @@ static void vp_latch_vsel(struct voltagedomain *voltdm)
35 vsel = voltdm->pmic->uv_to_vsel(uvdc); 35 vsel = voltdm->pmic->uv_to_vsel(uvdc);
36 36
37 vpconfig = voltdm->read(vp->vpconfig); 37 vpconfig = voltdm->read(vp->vpconfig);
38 vpconfig &= ~(vp->vp_common->vpconfig_initvoltage_mask | 38 vpconfig &= ~(vp->common->vpconfig_initvoltage_mask |
39 vp->vp_common->vpconfig_initvdd); 39 vp->common->vpconfig_initvdd);
40 vpconfig |= vsel << vp->vp_common->vpconfig_initvoltage_shift; 40 vpconfig |= vsel << vp->common->vpconfig_initvoltage_shift;
41 41
42 voltdm->write(vpconfig, vp->vpconfig); 42 voltdm->write(vpconfig, vp->vpconfig);
43 43
44 /* Trigger initVDD value copy to voltage processor */ 44 /* Trigger initVDD value copy to voltage processor */
45 voltdm->write((vpconfig | vp->vp_common->vpconfig_initvdd), 45 voltdm->write((vpconfig | vp->common->vpconfig_initvdd),
46 vp->vpconfig); 46 vp->vpconfig);
47 47
48 /* Clear initVDD copy trigger bit */ 48 /* Clear initVDD copy trigger bit */
@@ -52,7 +52,7 @@ static void vp_latch_vsel(struct voltagedomain *voltdm)
52/* Generic voltage init functions */ 52/* Generic voltage init functions */
53void __init omap_vp_init(struct voltagedomain *voltdm) 53void __init omap_vp_init(struct voltagedomain *voltdm)
54{ 54{
55 struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; 55 struct omap_vp_instance *vp = voltdm->vp;
56 struct omap_vdd_info *vdd = voltdm->vdd; 56 struct omap_vdd_info *vdd = voltdm->vdd;
57 u32 vp_val; 57 u32 vp_val;
58 58
@@ -64,28 +64,28 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
64 64
65 vp_val = vdd->vp_rt_data.vpconfig_erroroffset | 65 vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
66 (vdd->vp_rt_data.vpconfig_errorgain << 66 (vdd->vp_rt_data.vpconfig_errorgain <<
67 vp->vp_common->vpconfig_errorgain_shift) | 67 vp->common->vpconfig_errorgain_shift) |
68 vp->vp_common->vpconfig_timeouten; 68 vp->common->vpconfig_timeouten;
69 voltdm->write(vp_val, vp->vpconfig); 69 voltdm->write(vp_val, vp->vpconfig);
70 70
71 vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin << 71 vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin <<
72 vp->vp_common->vstepmin_smpswaittimemin_shift) | 72 vp->common->vstepmin_smpswaittimemin_shift) |
73 (vdd->vp_rt_data.vstepmin_stepmin << 73 (vdd->vp_rt_data.vstepmin_stepmin <<
74 vp->vp_common->vstepmin_stepmin_shift)); 74 vp->common->vstepmin_stepmin_shift));
75 voltdm->write(vp_val, vp->vstepmin); 75 voltdm->write(vp_val, vp->vstepmin);
76 76
77 vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax << 77 vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax <<
78 vp->vp_common->vstepmax_smpswaittimemax_shift) | 78 vp->common->vstepmax_smpswaittimemax_shift) |
79 (vdd->vp_rt_data.vstepmax_stepmax << 79 (vdd->vp_rt_data.vstepmax_stepmax <<
80 vp->vp_common->vstepmax_stepmax_shift)); 80 vp->common->vstepmax_stepmax_shift));
81 voltdm->write(vp_val, vp->vstepmax); 81 voltdm->write(vp_val, vp->vstepmax);
82 82
83 vp_val = ((vdd->vp_rt_data.vlimitto_vddmax << 83 vp_val = ((vdd->vp_rt_data.vlimitto_vddmax <<
84 vp->vp_common->vlimitto_vddmax_shift) | 84 vp->common->vlimitto_vddmax_shift) |
85 (vdd->vp_rt_data.vlimitto_vddmin << 85 (vdd->vp_rt_data.vlimitto_vddmin <<
86 vp->vp_common->vlimitto_vddmin_shift) | 86 vp->common->vlimitto_vddmin_shift) |
87 (vdd->vp_rt_data.vlimitto_timeout << 87 (vdd->vp_rt_data.vlimitto_timeout <<
88 vp->vp_common->vlimitto_timeout_shift)); 88 vp->common->vlimitto_timeout_shift));
89 voltdm->write(vp_val, vp->vlimitto); 89 voltdm->write(vp_val, vp->vlimitto);
90 90
91 vp_debugfs_init(voltdm); 91 vp_debugfs_init(voltdm);
@@ -95,7 +95,7 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
95int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, 95int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
96 unsigned long target_volt) 96 unsigned long target_volt)
97{ 97{
98 struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; 98 struct omap_vp_instance *vp = voltdm->vp;
99 u32 vpconfig; 99 u32 vpconfig;
100 u8 target_vsel, current_vsel; 100 u8 target_vsel, current_vsel;
101 int ret, timeout = 0; 101 int ret, timeout = 0;
@@ -109,8 +109,8 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
109 * is <3us 109 * is <3us
110 */ 110 */
111 while (timeout++ < VP_TRANXDONE_TIMEOUT) { 111 while (timeout++ < VP_TRANXDONE_TIMEOUT) {
112 vp->vp_common->ops->clear_txdone(vp->id); 112 vp->common->ops->clear_txdone(vp->id);
113 if (!vp->vp_common->ops->check_txdone(vp->id)) 113 if (!vp->common->ops->check_txdone(vp->id))
114 break; 114 break;
115 udelay(1); 115 udelay(1);
116 } 116 }
@@ -122,19 +122,19 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
122 122
123 /* Configure for VP-Force Update */ 123 /* Configure for VP-Force Update */
124 vpconfig = voltdm->read(vp->vpconfig); 124 vpconfig = voltdm->read(vp->vpconfig);
125 vpconfig &= ~(vp->vp_common->vpconfig_initvdd | 125 vpconfig &= ~(vp->common->vpconfig_initvdd |
126 vp->vp_common->vpconfig_forceupdate | 126 vp->common->vpconfig_forceupdate |
127 vp->vp_common->vpconfig_initvoltage_mask); 127 vp->common->vpconfig_initvoltage_mask);
128 vpconfig |= ((target_vsel << 128 vpconfig |= ((target_vsel <<
129 vp->vp_common->vpconfig_initvoltage_shift)); 129 vp->common->vpconfig_initvoltage_shift));
130 voltdm->write(vpconfig, vp->vpconfig); 130 voltdm->write(vpconfig, vp->vpconfig);
131 131
132 /* Trigger initVDD value copy to voltage processor */ 132 /* Trigger initVDD value copy to voltage processor */
133 vpconfig |= vp->vp_common->vpconfig_initvdd; 133 vpconfig |= vp->common->vpconfig_initvdd;
134 voltdm->write(vpconfig, vp->vpconfig); 134 voltdm->write(vpconfig, vp->vpconfig);
135 135
136 /* Force update of voltage */ 136 /* Force update of voltage */
137 vpconfig |= vp->vp_common->vpconfig_forceupdate; 137 vpconfig |= vp->common->vpconfig_forceupdate;
138 voltdm->write(vpconfig, vp->vpconfig); 138 voltdm->write(vpconfig, vp->vpconfig);
139 139
140 /* 140 /*
@@ -142,7 +142,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
142 * Depends on SMPSWAITTIMEMIN/MAX and voltage change 142 * Depends on SMPSWAITTIMEMIN/MAX and voltage change
143 */ 143 */
144 timeout = 0; 144 timeout = 0;
145 omap_test_timeout(vp->vp_common->ops->check_txdone(vp->id), 145 omap_test_timeout(vp->common->ops->check_txdone(vp->id),
146 VP_TRANXDONE_TIMEOUT, timeout); 146 VP_TRANXDONE_TIMEOUT, timeout);
147 if (timeout >= VP_TRANXDONE_TIMEOUT) 147 if (timeout >= VP_TRANXDONE_TIMEOUT)
148 pr_err("%s: vdd_%s TRANXDONE timeout exceeded." 148 pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
@@ -157,8 +157,8 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
157 */ 157 */
158 timeout = 0; 158 timeout = 0;
159 while (timeout++ < VP_TRANXDONE_TIMEOUT) { 159 while (timeout++ < VP_TRANXDONE_TIMEOUT) {
160 vp->vp_common->ops->clear_txdone(vp->id); 160 vp->common->ops->clear_txdone(vp->id);
161 if (!vp->vp_common->ops->check_txdone(vp->id)) 161 if (!vp->common->ops->check_txdone(vp->id))
162 break; 162 break;
163 udelay(1); 163 udelay(1);
164 } 164 }
@@ -170,10 +170,10 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
170 170
171 vpconfig = voltdm->read(vp->vpconfig); 171 vpconfig = voltdm->read(vp->vpconfig);
172 /* Clear initVDD copy trigger bit */ 172 /* Clear initVDD copy trigger bit */
173 vpconfig &= ~vp->vp_common->vpconfig_initvdd; 173 vpconfig &= ~vp->common->vpconfig_initvdd;
174 voltdm->write(vpconfig, vp->vpconfig); 174 voltdm->write(vpconfig, vp->vpconfig);
175 /* Clear force bit */ 175 /* Clear force bit */
176 vpconfig &= ~vp->vp_common->vpconfig_forceupdate; 176 vpconfig &= ~vp->common->vpconfig_forceupdate;
177 voltdm->write(vpconfig, vp->vpconfig); 177 voltdm->write(vpconfig, vp->vpconfig);
178 178
179 return 0; 179 return 0;
@@ -187,8 +187,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
187 */ 187 */
188unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm) 188unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
189{ 189{
190 struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; 190 struct omap_vp_instance *vp = voltdm->vp;
191 struct omap_vdd_info *vdd;
192 u8 curr_vsel; 191 u8 curr_vsel;
193 192
194 if (!voltdm || IS_ERR(voltdm)) { 193 if (!voltdm || IS_ERR(voltdm)) {
@@ -196,7 +195,6 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
196 return 0; 195 return 0;
197 } 196 }
198 197
199 vdd = voltdm->vdd;
200 if (!voltdm->read) { 198 if (!voltdm->read) {
201 pr_err("%s: No read API for reading vdd_%s regs\n", 199 pr_err("%s: No read API for reading vdd_%s regs\n",
202 __func__, voltdm->name); 200 __func__, voltdm->name);
@@ -223,8 +221,7 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
223 */ 221 */
224void omap_vp_enable(struct voltagedomain *voltdm) 222void omap_vp_enable(struct voltagedomain *voltdm)
225{ 223{
226 struct omap_vp_instance_data *vp; 224 struct omap_vp_instance *vp;
227 struct omap_vdd_info *vdd;
228 u32 vpconfig; 225 u32 vpconfig;
229 226
230 if (!voltdm || IS_ERR(voltdm)) { 227 if (!voltdm || IS_ERR(voltdm)) {
@@ -232,8 +229,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
232 return; 229 return;
233 } 230 }
234 231
235 vdd = voltdm->vdd; 232 vp = voltdm->vp;
236 vp = voltdm->vdd->vp_data;
237 if (!voltdm->read || !voltdm->write) { 233 if (!voltdm->read || !voltdm->write) {
238 pr_err("%s: No read/write API for accessing vdd_%s regs\n", 234 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
239 __func__, voltdm->name); 235 __func__, voltdm->name);
@@ -241,16 +237,16 @@ void omap_vp_enable(struct voltagedomain *voltdm)
241 } 237 }
242 238
243 /* If VP is already enabled, do nothing. Return */ 239 /* If VP is already enabled, do nothing. Return */
244 if (vdd->vp_enabled) 240 if (vp->enabled)
245 return; 241 return;
246 242
247 vp_latch_vsel(voltdm); 243 vp_latch_vsel(voltdm);
248 244
249 /* Enable VP */ 245 /* Enable VP */
250 vpconfig = voltdm->read(vp->vpconfig); 246 vpconfig = voltdm->read(vp->vpconfig);
251 vpconfig |= vp->vp_common->vpconfig_vpenable; 247 vpconfig |= vp->common->vpconfig_vpenable;
252 voltdm->write(vpconfig, vp->vpconfig); 248 voltdm->write(vpconfig, vp->vpconfig);
253 vdd->vp_enabled = true; 249 vp->enabled = true;
254} 250}
255 251
256/** 252/**
@@ -262,8 +258,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
262 */ 258 */
263void omap_vp_disable(struct voltagedomain *voltdm) 259void omap_vp_disable(struct voltagedomain *voltdm)
264{ 260{
265 struct omap_vp_instance_data *vp; 261 struct omap_vp_instance *vp;
266 struct omap_vdd_info *vdd;
267 u32 vpconfig; 262 u32 vpconfig;
268 int timeout; 263 int timeout;
269 264
@@ -272,8 +267,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
272 return; 267 return;
273 } 268 }
274 269
275 vdd = voltdm->vdd; 270 vp = voltdm->vp;
276 vp = voltdm->vdd->vp_data;
277 if (!voltdm->read || !voltdm->write) { 271 if (!voltdm->read || !voltdm->write) {
278 pr_err("%s: No read/write API for accessing vdd_%s regs\n", 272 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
279 __func__, voltdm->name); 273 __func__, voltdm->name);
@@ -281,7 +275,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
281 } 275 }
282 276
283 /* If VP is already disabled, do nothing. Return */ 277 /* If VP is already disabled, do nothing. Return */
284 if (!vdd->vp_enabled) { 278 if (!vp->enabled) {
285 pr_warning("%s: Trying to disable VP for vdd_%s when" 279 pr_warning("%s: Trying to disable VP for vdd_%s when"
286 "it is already disabled\n", __func__, voltdm->name); 280 "it is already disabled\n", __func__, voltdm->name);
287 return; 281 return;
@@ -289,7 +283,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
289 283
290 /* Disable VP */ 284 /* Disable VP */
291 vpconfig = voltdm->read(vp->vpconfig); 285 vpconfig = voltdm->read(vp->vpconfig);
292 vpconfig &= ~vp->vp_common->vpconfig_vpenable; 286 vpconfig &= ~vp->common->vpconfig_vpenable;
293 voltdm->write(vpconfig, vp->vpconfig); 287 voltdm->write(vpconfig, vp->vpconfig);
294 288
295 /* 289 /*
@@ -302,7 +296,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
302 pr_warning("%s: vdd_%s idle timedout\n", 296 pr_warning("%s: vdd_%s idle timedout\n",
303 __func__, voltdm->name); 297 __func__, voltdm->name);
304 298
305 vdd->vp_enabled = false; 299 vp->enabled = false;
306 300
307 return; 301 return;
308} 302}
@@ -311,7 +305,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
311static int vp_volt_debug_get(void *data, u64 *val) 305static int vp_volt_debug_get(void *data, u64 *val)
312{ 306{
313 struct voltagedomain *voltdm = (struct voltagedomain *)data; 307 struct voltagedomain *voltdm = (struct voltagedomain *)data;
314 struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; 308 struct omap_vp_instance *vp = voltdm->vp;
315 struct omap_vdd_info *vdd = voltdm->vdd; 309 struct omap_vdd_info *vdd = voltdm->vdd;
316 u8 vsel; 310 u8 vsel;
317 311
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
index 382fef13dbc4..b50ca91fef24 100644
--- a/arch/arm/mach-omap2/vp.h
+++ b/arch/arm/mach-omap2/vp.h
@@ -45,7 +45,7 @@ struct omap_vp_ops {
45}; 45};
46 46
47/** 47/**
48 * struct omap_vp_common_data - register data common to all VDDs 48 * struct omap_vp_common - register data common to all VDDs
49 * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg 49 * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
50 * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg 50 * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
51 * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg 51 * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
@@ -67,7 +67,7 @@ struct omap_vp_ops {
67 * bitfield - remove one 67 * bitfield - remove one
68 * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix! 68 * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
69 */ 69 */
70struct omap_vp_common_data { 70struct omap_vp_common {
71 u32 vpconfig_errorgain_mask; 71 u32 vpconfig_errorgain_mask;
72 u32 vpconfig_initvoltage_mask; 72 u32 vpconfig_initvoltage_mask;
73 u32 vpconfig_timeouten; 73 u32 vpconfig_timeouten;
@@ -89,19 +89,20 @@ struct omap_vp_common_data {
89}; 89};
90 90
91/** 91/**
92 * struct omap_vp_instance_data - VP register offsets (per-VDD) 92 * struct omap_vp_instance - VP register offsets (per-VDD)
93 * @vp_common: pointer to struct omap_vp_common_data * for this SoC 93 * @common: pointer to struct omap_vp_common * for this SoC
94 * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start 94 * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
95 * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start 95 * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
96 * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start 96 * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
97 * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start 97 * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
98 * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start 98 * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
99 * @id: Unique identifier for VP instance. 99 * @id: Unique identifier for VP instance.
100 * @enabled: flag to keep track of whether vp is enabled or not
100 * 101 *
101 * XXX vp_common is probably not needed since it is per-SoC 102 * XXX vp_common is probably not needed since it is per-SoC
102 */ 103 */
103struct omap_vp_instance_data { 104struct omap_vp_instance {
104 const struct omap_vp_common_data *vp_common; 105 const struct omap_vp_common *common;
105 u8 vpconfig; 106 u8 vpconfig;
106 u8 vstepmin; 107 u8 vstepmin;
107 u8 vstepmax; 108 u8 vstepmax;
@@ -109,6 +110,7 @@ struct omap_vp_instance_data {
109 u8 vstatus; 110 u8 vstatus;
110 u8 voltage; 111 u8 voltage;
111 u8 id; 112 u8 id;
113 bool enabled;
112}; 114};
113 115
114/** 116/**
@@ -140,12 +142,12 @@ struct omap_vp_runtime_data {
140 u8 vlimitto_vddmax; 142 u8 vlimitto_vddmax;
141}; 143};
142 144
143extern struct omap_vp_instance_data omap3_vp1_data; 145extern struct omap_vp_instance omap3_vp_mpu;
144extern struct omap_vp_instance_data omap3_vp2_data; 146extern struct omap_vp_instance omap3_vp_core;
145 147
146extern struct omap_vp_instance_data omap4_vp_mpu_data; 148extern struct omap_vp_instance omap4_vp_mpu;
147extern struct omap_vp_instance_data omap4_vp_iva_data; 149extern struct omap_vp_instance omap4_vp_iva;
148extern struct omap_vp_instance_data omap4_vp_core_data; 150extern struct omap_vp_instance omap4_vp_core;
149 151
150void omap_vp_init(struct voltagedomain *voltdm); 152void omap_vp_init(struct voltagedomain *voltdm);
151void omap_vp_enable(struct voltagedomain *voltdm); 153void omap_vp_enable(struct voltagedomain *voltdm);
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c
index b01d33325d52..79c3df94f500 100644
--- a/arch/arm/mach-omap2/vp3xxx_data.c
+++ b/arch/arm/mach-omap2/vp3xxx_data.c
@@ -36,7 +36,7 @@ static const struct omap_vp_ops omap3_vp_ops = {
36 * VP data common to 34xx/36xx chips 36 * VP data common to 34xx/36xx chips
37 * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file. 37 * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
38 */ 38 */
39static const struct omap_vp_common_data omap3_vp_common = { 39static const struct omap_vp_common omap3_vp_common = {
40 .vpconfig_erroroffset_shift = OMAP3430_ERROROFFSET_SHIFT, 40 .vpconfig_erroroffset_shift = OMAP3430_ERROROFFSET_SHIFT,
41 .vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK, 41 .vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK,
42 .vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT, 42 .vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT,
@@ -56,9 +56,9 @@ static const struct omap_vp_common_data omap3_vp_common = {
56 .ops = &omap3_vp_ops, 56 .ops = &omap3_vp_ops,
57}; 57};
58 58
59struct omap_vp_instance_data omap3_vp1_data = { 59struct omap_vp_instance omap3_vp_mpu = {
60 .id = OMAP3_VP_VDD_MPU_ID, 60 .id = OMAP3_VP_VDD_MPU_ID,
61 .vp_common = &omap3_vp_common, 61 .common = &omap3_vp_common,
62 .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET, 62 .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET,
63 .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET, 63 .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
64 .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET, 64 .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET,
@@ -67,9 +67,9 @@ struct omap_vp_instance_data omap3_vp1_data = {
67 .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET, 67 .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET,
68}; 68};
69 69
70struct omap_vp_instance_data omap3_vp2_data = { 70struct omap_vp_instance omap3_vp_core = {
71 .id = OMAP3_VP_VDD_CORE_ID, 71 .id = OMAP3_VP_VDD_CORE_ID,
72 .vp_common = &omap3_vp_common, 72 .common = &omap3_vp_common,
73 .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET, 73 .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET,
74 .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET, 74 .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET,
75 .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET, 75 .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET,
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c
index 9704c7ba9e99..8f75cd9e7e66 100644
--- a/arch/arm/mach-omap2/vp44xx_data.c
+++ b/arch/arm/mach-omap2/vp44xx_data.c
@@ -36,7 +36,7 @@ static const struct omap_vp_ops omap4_vp_ops = {
36 * VP data common to 44xx chips 36 * VP data common to 44xx chips
37 * XXX This stuff presumably belongs in the vp44xx.c or vp.c file. 37 * XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
38 */ 38 */
39static const struct omap_vp_common_data omap4_vp_common = { 39static const struct omap_vp_common omap4_vp_common = {
40 .vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT, 40 .vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT,
41 .vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK, 41 .vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK,
42 .vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT, 42 .vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT,
@@ -56,9 +56,9 @@ static const struct omap_vp_common_data omap4_vp_common = {
56 .ops = &omap4_vp_ops, 56 .ops = &omap4_vp_ops,
57}; 57};
58 58
59struct omap_vp_instance_data omap4_vp_mpu_data = { 59struct omap_vp_instance omap4_vp_mpu = {
60 .id = OMAP4_VP_VDD_MPU_ID, 60 .id = OMAP4_VP_VDD_MPU_ID,
61 .vp_common = &omap4_vp_common, 61 .common = &omap4_vp_common,
62 .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET, 62 .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
63 .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET, 63 .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
64 .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET, 64 .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
@@ -67,9 +67,9 @@ struct omap_vp_instance_data omap4_vp_mpu_data = {
67 .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET, 67 .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
68}; 68};
69 69
70struct omap_vp_instance_data omap4_vp_iva_data = { 70struct omap_vp_instance omap4_vp_iva = {
71 .id = OMAP4_VP_VDD_IVA_ID, 71 .id = OMAP4_VP_VDD_IVA_ID,
72 .vp_common = &omap4_vp_common, 72 .common = &omap4_vp_common,
73 .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET, 73 .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
74 .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET, 74 .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
75 .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET, 75 .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
@@ -78,9 +78,9 @@ struct omap_vp_instance_data omap4_vp_iva_data = {
78 .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET, 78 .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
79}; 79};
80 80
81struct omap_vp_instance_data omap4_vp_core_data = { 81struct omap_vp_instance omap4_vp_core = {
82 .id = OMAP4_VP_VDD_CORE_ID, 82 .id = OMAP4_VP_VDD_CORE_ID,
83 .vp_common = &omap4_vp_common, 83 .common = &omap4_vp_common,
84 .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET, 84 .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
85 .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET, 85 .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
86 .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET, 86 .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,