diff options
author | Kevin Hilman <khilman@ti.com> | 2011-03-29 17:36:04 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-09-15 15:08:19 -0400 |
commit | 5892bb1fc6430d086f5c2a4216f9ed00070e31ad (patch) | |
tree | 6a64fdd3e6d4e80cae63c1fa3c947383b1024d7e | |
parent | 78614e0f8f32dca52beebaadfb53c2a3acf1604a (diff) |
OMAP3+: VC: cleanup voltage setup time configuration
- add setup_time field to struct omap_vc_channel (init'd from PMIC data)
- use VC/VP register access helper for read/modify/write
- move VFSM structure from omap_vdd_info into struct voltagedomain
- remove redunant _data suffix from VFSM structures and variables
- remove voltsetup_shift, use ffs() on the mask value to find the shift
Signed-off-by: Kevin Hilman <khilman@ti.com>
-rw-r--r-- | arch/arm/mach-omap2/vc.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/vc.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/voltage.h | 11 | ||||
-rw-r--r-- | arch/arm/mach-omap2/voltagedomains3xxx_data.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/voltagedomains44xx_data.c | 12 |
5 files changed, 19 insertions, 26 deletions
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c index 8f0105a7bb4b..f78e62abe720 100644 --- a/arch/arm/mach-omap2/vc.c +++ b/arch/arm/mach-omap2/vc.c | |||
@@ -223,7 +223,6 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) | |||
223 | { | 223 | { |
224 | struct omap_vc_channel *vc = voltdm->vc; | 224 | struct omap_vc_channel *vc = voltdm->vc; |
225 | struct omap_vdd_info *vdd = voltdm->vdd; | 225 | struct omap_vdd_info *vdd = voltdm->vdd; |
226 | u32 vc_val; | ||
227 | 226 | ||
228 | if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { | 227 | if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { |
229 | pr_err("%s: PMIC info requried to configure vc for" | 228 | pr_err("%s: PMIC info requried to configure vc for" |
@@ -242,6 +241,7 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) | |||
242 | vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr; | 241 | vc->i2c_slave_addr = vdd->pmic_info->i2c_slave_addr; |
243 | vc->volt_reg_addr = vdd->pmic_info->volt_reg_addr; | 242 | vc->volt_reg_addr = vdd->pmic_info->volt_reg_addr; |
244 | vc->cmd_reg_addr = vdd->pmic_info->cmd_reg_addr; | 243 | vc->cmd_reg_addr = vdd->pmic_info->cmd_reg_addr; |
244 | vc->setup_time = vdd->pmic_info->volt_setup_time; | ||
245 | 245 | ||
246 | /* Configure the i2c slave address for this VC */ | 246 | /* Configure the i2c slave address for this VC */ |
247 | voltdm->rmw(vc->smps_sa_mask, | 247 | voltdm->rmw(vc->smps_sa_mask, |
@@ -260,11 +260,9 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) | |||
260 | vc->common->smps_cmdra_reg); | 260 | vc->common->smps_cmdra_reg); |
261 | 261 | ||
262 | /* Configure the setup times */ | 262 | /* Configure the setup times */ |
263 | vc_val = voltdm->read(vdd->vfsm->voltsetup_reg); | 263 | voltdm->rmw(voltdm->vfsm->voltsetup_mask, |
264 | vc_val &= ~vdd->vfsm->voltsetup_mask; | 264 | vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask), |
265 | vc_val |= vdd->pmic_info->volt_setup_time << | 265 | voltdm->vfsm->voltsetup_reg); |
266 | vdd->vfsm->voltsetup_shift; | ||
267 | voltdm->write(vc_val, vdd->vfsm->voltsetup_reg); | ||
268 | 266 | ||
269 | if (cpu_is_omap34xx()) | 267 | if (cpu_is_omap34xx()) |
270 | omap3_vc_init_channel(voltdm); | 268 | omap3_vc_init_channel(voltdm); |
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h index 43a0c5c2b07a..6e8806b59823 100644 --- a/arch/arm/mach-omap2/vc.h +++ b/arch/arm/mach-omap2/vc.h | |||
@@ -61,6 +61,7 @@ struct omap_vc_common { | |||
61 | * @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 | 62 | * @volt_reg_addr: voltage configuration register address |
63 | * @cmd_reg_addr: command configuration register address | 63 | * @cmd_reg_addr: command configuration register address |
64 | * @setup_time: setup time (in sys_clk cycles) of regulator for this channel | ||
64 | * @common: pointer to VC common data for this platform | 65 | * @common: pointer to VC common data for this platform |
65 | * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register | 66 | * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register |
66 | * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register | 67 | * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register |
@@ -72,6 +73,7 @@ struct omap_vc_channel { | |||
72 | u16 i2c_slave_addr; | 73 | u16 i2c_slave_addr; |
73 | u16 volt_reg_addr; | 74 | u16 volt_reg_addr; |
74 | u16 cmd_reg_addr; | 75 | u16 cmd_reg_addr; |
76 | u16 setup_time; | ||
75 | 77 | ||
76 | /* register access data */ | 78 | /* register access data */ |
77 | const struct omap_vc_common *common; | 79 | const struct omap_vc_common *common; |
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h index 3f49807a36e8..99df2d13e42e 100644 --- a/arch/arm/mach-omap2/voltage.h +++ b/arch/arm/mach-omap2/voltage.h | |||
@@ -36,20 +36,16 @@ struct powerdomain; | |||
36 | struct omap_vdd_info; | 36 | struct omap_vdd_info; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield | 39 | * struct omap_vfsm_instance - per-voltage manager FSM register/bitfield |
40 | * data | 40 | * data |
41 | * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register | 41 | * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register |
42 | * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base | 42 | * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base |
43 | * @voltsetup_shift: SETUP_TIME* field shift in the PRM_VOLTSETUP* register | ||
44 | * | 43 | * |
45 | * XXX What about VOLTOFFSET/VOLTCTRL? | 44 | * XXX What about VOLTOFFSET/VOLTCTRL? |
46 | * XXX It is not necessary to have both a _mask and a _shift for the same | ||
47 | * bitfield - remove one! | ||
48 | */ | 45 | */ |
49 | struct omap_vfsm_instance_data { | 46 | struct omap_vfsm_instance { |
50 | u32 voltsetup_mask; | 47 | u32 voltsetup_mask; |
51 | u8 voltsetup_reg; | 48 | u8 voltsetup_reg; |
52 | u8 voltsetup_shift; | ||
53 | }; | 49 | }; |
54 | 50 | ||
55 | /** | 51 | /** |
@@ -70,6 +66,7 @@ struct voltagedomain { | |||
70 | struct list_head node; | 66 | struct list_head node; |
71 | struct list_head pwrdm_list; | 67 | struct list_head pwrdm_list; |
72 | struct omap_vc_channel *vc; | 68 | struct omap_vc_channel *vc; |
69 | const struct omap_vfsm_instance *vfsm; | ||
73 | 70 | ||
74 | /* VC/VP register access functions: SoC specific */ | 71 | /* VC/VP register access functions: SoC specific */ |
75 | u32 (*read) (u8 offset); | 72 | u32 (*read) (u8 offset); |
@@ -139,7 +136,6 @@ struct omap_volt_pmic_info { | |||
139 | * @vp_data : the register values, shifts, masks for various | 136 | * @vp_data : the register values, shifts, masks for various |
140 | * vp registers | 137 | * vp registers |
141 | * @vp_rt_data : VP data derived at runtime, not predefined | 138 | * @vp_rt_data : VP data derived at runtime, not predefined |
142 | * @vfsm : voltage manager FSM data | ||
143 | * @debug_dir : debug directory for this voltage domain. | 139 | * @debug_dir : debug directory for this voltage domain. |
144 | * @curr_volt : current voltage for this vdd. | 140 | * @curr_volt : current voltage for this vdd. |
145 | * @vp_enabled : flag to keep track of whether vp is enabled or not | 141 | * @vp_enabled : flag to keep track of whether vp is enabled or not |
@@ -150,7 +146,6 @@ struct omap_vdd_info { | |||
150 | struct omap_volt_pmic_info *pmic_info; | 146 | struct omap_volt_pmic_info *pmic_info; |
151 | struct omap_vp_instance_data *vp_data; | 147 | struct omap_vp_instance_data *vp_data; |
152 | struct omap_vp_runtime_data vp_rt_data; | 148 | struct omap_vp_runtime_data vp_rt_data; |
153 | const struct omap_vfsm_instance_data *vfsm; | ||
154 | struct dentry *debug_dir; | 149 | struct dentry *debug_dir; |
155 | u32 curr_volt; | 150 | u32 curr_volt; |
156 | bool vp_enabled; | 151 | bool vp_enabled; |
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c index 1d667490bc95..ce5a7971addf 100644 --- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c +++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c | |||
@@ -31,26 +31,22 @@ | |||
31 | * VDD data | 31 | * VDD data |
32 | */ | 32 | */ |
33 | 33 | ||
34 | static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = { | 34 | static const struct omap_vfsm_instance omap3_vdd1_vfsm = { |
35 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, | 35 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, |
36 | .voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT, | ||
37 | .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, | 36 | .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, |
38 | }; | 37 | }; |
39 | 38 | ||
40 | static struct omap_vdd_info omap3_vdd1_info = { | 39 | static struct omap_vdd_info omap3_vdd1_info = { |
41 | .vp_data = &omap3_vp1_data, | 40 | .vp_data = &omap3_vp1_data, |
42 | .vfsm = &omap3_vdd1_vfsm_data, | ||
43 | }; | 41 | }; |
44 | 42 | ||
45 | static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = { | 43 | static const struct omap_vfsm_instance omap3_vdd2_vfsm = { |
46 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, | 44 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, |
47 | .voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT, | ||
48 | .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, | 45 | .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, |
49 | }; | 46 | }; |
50 | 47 | ||
51 | static struct omap_vdd_info omap3_vdd2_info = { | 48 | static struct omap_vdd_info omap3_vdd2_info = { |
52 | .vp_data = &omap3_vp2_data, | 49 | .vp_data = &omap3_vp2_data, |
53 | .vfsm = &omap3_vdd2_vfsm_data, | ||
54 | }; | 50 | }; |
55 | 51 | ||
56 | static struct voltagedomain omap3_voltdm_mpu = { | 52 | static struct voltagedomain omap3_voltdm_mpu = { |
@@ -60,6 +56,7 @@ static struct voltagedomain omap3_voltdm_mpu = { | |||
60 | .write = omap3_prm_vcvp_write, | 56 | .write = omap3_prm_vcvp_write, |
61 | .rmw = omap3_prm_vcvp_rmw, | 57 | .rmw = omap3_prm_vcvp_rmw, |
62 | .vc = &omap3_vc_mpu, | 58 | .vc = &omap3_vc_mpu, |
59 | .vfsm = &omap3_vdd1_vfsm, | ||
63 | .vdd = &omap3_vdd1_info, | 60 | .vdd = &omap3_vdd1_info, |
64 | }; | 61 | }; |
65 | 62 | ||
@@ -70,6 +67,7 @@ static struct voltagedomain omap3_voltdm_core = { | |||
70 | .write = omap3_prm_vcvp_write, | 67 | .write = omap3_prm_vcvp_write, |
71 | .rmw = omap3_prm_vcvp_rmw, | 68 | .rmw = omap3_prm_vcvp_rmw, |
72 | .vc = &omap3_vc_core, | 69 | .vc = &omap3_vc_core, |
70 | .vfsm = &omap3_vdd2_vfsm, | ||
73 | .vdd = &omap3_vdd2_info, | 71 | .vdd = &omap3_vdd2_info, |
74 | }; | 72 | }; |
75 | 73 | ||
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c index e435795d61b7..dd4bd222739a 100644 --- a/arch/arm/mach-omap2/voltagedomains44xx_data.c +++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c | |||
@@ -32,31 +32,28 @@ | |||
32 | #include "vc.h" | 32 | #include "vc.h" |
33 | #include "vp.h" | 33 | #include "vp.h" |
34 | 34 | ||
35 | static const struct omap_vfsm_instance_data omap4_vdd_mpu_vfsm_data = { | 35 | 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 | ||
39 | static struct omap_vdd_info omap4_vdd_mpu_info = { | 39 | static struct omap_vdd_info omap4_vdd_mpu_info = { |
40 | .vp_data = &omap4_vp_mpu_data, | 40 | .vp_data = &omap4_vp_mpu_data, |
41 | .vfsm = &omap4_vdd_mpu_vfsm_data, | ||
42 | }; | 41 | }; |
43 | 42 | ||
44 | static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = { | 43 | static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = { |
45 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, | 44 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, |
46 | }; | 45 | }; |
47 | 46 | ||
48 | static struct omap_vdd_info omap4_vdd_iva_info = { | 47 | static struct omap_vdd_info omap4_vdd_iva_info = { |
49 | .vp_data = &omap4_vp_iva_data, | 48 | .vp_data = &omap4_vp_iva_data, |
50 | .vfsm = &omap4_vdd_iva_vfsm_data, | ||
51 | }; | 49 | }; |
52 | 50 | ||
53 | static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = { | 51 | static const struct omap_vfsm_instance omap4_vdd_core_vfsm = { |
54 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, | 52 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, |
55 | }; | 53 | }; |
56 | 54 | ||
57 | static struct omap_vdd_info omap4_vdd_core_info = { | 55 | static struct omap_vdd_info omap4_vdd_core_info = { |
58 | .vp_data = &omap4_vp_core_data, | 56 | .vp_data = &omap4_vp_core_data, |
59 | .vfsm = &omap4_vdd_core_vfsm_data, | ||
60 | }; | 57 | }; |
61 | 58 | ||
62 | static struct voltagedomain omap4_voltdm_mpu = { | 59 | static struct voltagedomain omap4_voltdm_mpu = { |
@@ -66,6 +63,7 @@ static struct voltagedomain omap4_voltdm_mpu = { | |||
66 | .write = omap4_prm_vcvp_write, | 63 | .write = omap4_prm_vcvp_write, |
67 | .rmw = omap4_prm_vcvp_rmw, | 64 | .rmw = omap4_prm_vcvp_rmw, |
68 | .vc = &omap4_vc_mpu, | 65 | .vc = &omap4_vc_mpu, |
66 | .vfsm = &omap4_vdd_mpu_vfsm, | ||
69 | .vdd = &omap4_vdd_mpu_info, | 67 | .vdd = &omap4_vdd_mpu_info, |
70 | }; | 68 | }; |
71 | 69 | ||
@@ -76,6 +74,7 @@ static struct voltagedomain omap4_voltdm_iva = { | |||
76 | .write = omap4_prm_vcvp_write, | 74 | .write = omap4_prm_vcvp_write, |
77 | .rmw = omap4_prm_vcvp_rmw, | 75 | .rmw = omap4_prm_vcvp_rmw, |
78 | .vc = &omap4_vc_iva, | 76 | .vc = &omap4_vc_iva, |
77 | .vfsm = &omap4_vdd_iva_vfsm, | ||
79 | .vdd = &omap4_vdd_iva_info, | 78 | .vdd = &omap4_vdd_iva_info, |
80 | }; | 79 | }; |
81 | 80 | ||
@@ -86,6 +85,7 @@ static struct voltagedomain omap4_voltdm_core = { | |||
86 | .write = omap4_prm_vcvp_write, | 85 | .write = omap4_prm_vcvp_write, |
87 | .rmw = omap4_prm_vcvp_rmw, | 86 | .rmw = omap4_prm_vcvp_rmw, |
88 | .vc = &omap4_vc_core, | 87 | .vc = &omap4_vc_core, |
88 | .vfsm = &omap4_vdd_core_vfsm, | ||
89 | .vdd = &omap4_vdd_core_info, | 89 | .vdd = &omap4_vdd_core_info, |
90 | }; | 90 | }; |
91 | 91 | ||