diff options
Diffstat (limited to 'arch/arm/mach-omap2/vp.h')
-rw-r--r-- | arch/arm/mach-omap2/vp.h | 133 |
1 files changed, 59 insertions, 74 deletions
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h index 7ce134f7de79..7c155d248aa3 100644 --- a/arch/arm/mach-omap2/vp.h +++ b/arch/arm/mach-omap2/vp.h | |||
@@ -19,44 +19,60 @@ | |||
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | 21 | ||
22 | struct voltagedomain; | ||
23 | |||
24 | /* | ||
25 | * Voltage Processor (VP) identifiers | ||
26 | */ | ||
27 | #define OMAP3_VP_VDD_MPU_ID 0 | ||
28 | #define OMAP3_VP_VDD_CORE_ID 1 | ||
29 | #define OMAP4_VP_VDD_CORE_ID 0 | ||
30 | #define OMAP4_VP_VDD_IVA_ID 1 | ||
31 | #define OMAP4_VP_VDD_MPU_ID 2 | ||
32 | |||
22 | /* XXX document */ | 33 | /* XXX document */ |
23 | #define VP_IDLE_TIMEOUT 200 | 34 | #define VP_IDLE_TIMEOUT 200 |
24 | #define VP_TRANXDONE_TIMEOUT 300 | 35 | #define VP_TRANXDONE_TIMEOUT 300 |
25 | 36 | ||
37 | /** | ||
38 | * struct omap_vp_ops - per-VP operations | ||
39 | * @check_txdone: check for VP transaction done | ||
40 | * @clear_txdone: clear VP transaction done status | ||
41 | */ | ||
42 | struct omap_vp_ops { | ||
43 | u32 (*check_txdone)(u8 vp_id); | ||
44 | void (*clear_txdone)(u8 vp_id); | ||
45 | }; | ||
26 | 46 | ||
27 | /** | 47 | /** |
28 | * struct omap_vp_common_data - register data common to all VDDs | 48 | * struct omap_vp_common - register data common to all VDDs |
49 | * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg | ||
29 | * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg | 50 | * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg |
30 | * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg | 51 | * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg |
31 | * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg | 52 | * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg |
32 | * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg | 53 | * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg |
33 | * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg | 54 | * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg |
34 | * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg | 55 | * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg |
35 | * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg | 56 | * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg |
36 | * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg | 57 | * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg |
37 | * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg | 58 | * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg |
38 | * @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg | 59 | * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg |
39 | * @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg | 60 | * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg |
40 | * @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg | 61 | * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg |
41 | * @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg | 62 | * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg |
42 | * @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg | 63 | * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg |
43 | * @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg | 64 | * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg |
44 | * @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg | 65 | * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg |
45 | * | 66 | * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg |
46 | * XXX It it not necessary to have both a mask and a shift for the same | ||
47 | * bitfield - remove one | ||
48 | * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix! | ||
49 | */ | 67 | */ |
50 | struct omap_vp_common_data { | 68 | struct omap_vp_common { |
69 | u32 vpconfig_erroroffset_mask; | ||
51 | u32 vpconfig_errorgain_mask; | 70 | u32 vpconfig_errorgain_mask; |
52 | u32 vpconfig_initvoltage_mask; | 71 | u32 vpconfig_initvoltage_mask; |
53 | u32 vpconfig_timeouten; | 72 | u8 vpconfig_timeouten; |
54 | u32 vpconfig_initvdd; | 73 | u8 vpconfig_initvdd; |
55 | u32 vpconfig_forceupdate; | 74 | u8 vpconfig_forceupdate; |
56 | u32 vpconfig_vpenable; | 75 | u8 vpconfig_vpenable; |
57 | u8 vpconfig_erroroffset_shift; | ||
58 | u8 vpconfig_errorgain_shift; | ||
59 | u8 vpconfig_initvoltage_shift; | ||
60 | u8 vstepmin_stepmin_shift; | 76 | u8 vstepmin_stepmin_shift; |
61 | u8 vstepmin_smpswaittimemin_shift; | 77 | u8 vstepmin_smpswaittimemin_shift; |
62 | u8 vstepmax_stepmax_shift; | 78 | u8 vstepmax_stepmax_shift; |
@@ -64,80 +80,49 @@ struct omap_vp_common_data { | |||
64 | u8 vlimitto_vddmin_shift; | 80 | u8 vlimitto_vddmin_shift; |
65 | u8 vlimitto_vddmax_shift; | 81 | u8 vlimitto_vddmax_shift; |
66 | u8 vlimitto_timeout_shift; | 82 | u8 vlimitto_timeout_shift; |
67 | }; | 83 | u8 vpvoltage_mask; |
68 | 84 | ||
69 | /** | 85 | const struct omap_vp_ops *ops; |
70 | * struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data | ||
71 | * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM | ||
72 | * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg | ||
73 | * | ||
74 | * XXX prm_irqst_reg does not belong here | ||
75 | * XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a | ||
76 | * hardware bug | ||
77 | * XXX This structure is probably not needed | ||
78 | */ | ||
79 | struct omap_vp_prm_irqst_data { | ||
80 | u8 prm_irqst_reg; | ||
81 | u32 tranxdone_status; | ||
82 | }; | 86 | }; |
83 | 87 | ||
84 | /** | 88 | /** |
85 | * struct omap_vp_instance_data - VP register offsets (per-VDD) | 89 | * struct omap_vp_instance - VP register offsets (per-VDD) |
86 | * @vp_common: pointer to struct omap_vp_common_data * for this SoC | 90 | * @common: pointer to struct omap_vp_common * for this SoC |
87 | * @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD | ||
88 | * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start | 91 | * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start |
89 | * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start | 92 | * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start |
90 | * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start | 93 | * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start |
91 | * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start | 94 | * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start |
92 | * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start | 95 | * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start |
96 | * @id: Unique identifier for VP instance. | ||
97 | * @enabled: flag to keep track of whether vp is enabled or not | ||
93 | * | 98 | * |
94 | * XXX vp_common is probably not needed since it is per-SoC | 99 | * XXX vp_common is probably not needed since it is per-SoC |
95 | */ | 100 | */ |
96 | struct omap_vp_instance_data { | 101 | struct omap_vp_instance { |
97 | const struct omap_vp_common_data *vp_common; | 102 | const struct omap_vp_common *common; |
98 | const struct omap_vp_prm_irqst_data *prm_irqst_data; | ||
99 | u8 vpconfig; | 103 | u8 vpconfig; |
100 | u8 vstepmin; | 104 | u8 vstepmin; |
101 | u8 vstepmax; | 105 | u8 vstepmax; |
102 | u8 vlimitto; | 106 | u8 vlimitto; |
103 | u8 vstatus; | 107 | u8 vstatus; |
104 | u8 voltage; | 108 | u8 voltage; |
109 | u8 id; | ||
110 | bool enabled; | ||
105 | }; | 111 | }; |
106 | 112 | ||
107 | /** | 113 | extern struct omap_vp_instance omap3_vp_mpu; |
108 | * struct omap_vp_runtime_data - VP data populated at runtime by code | 114 | extern struct omap_vp_instance omap3_vp_core; |
109 | * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG | ||
110 | * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG | ||
111 | * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN | ||
112 | * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX | ||
113 | * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO | ||
114 | * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN | ||
115 | * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX | ||
116 | * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO | ||
117 | * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO | ||
118 | * | ||
119 | * XXX Is this structure really needed? Why not just program the | ||
120 | * device directly? They are in PRM space, therefore in the WKUP | ||
121 | * powerdomain, so register contents should not be lost in off-mode. | ||
122 | * XXX Some of these fields are incorrectly named, e.g., vstep* | ||
123 | */ | ||
124 | struct omap_vp_runtime_data { | ||
125 | u32 vpconfig_erroroffset; | ||
126 | u16 vpconfig_errorgain; | ||
127 | u16 vstepmin_smpswaittimemin; | ||
128 | u16 vstepmax_smpswaittimemax; | ||
129 | u16 vlimitto_timeout; | ||
130 | u8 vstepmin_stepmin; | ||
131 | u8 vstepmax_stepmax; | ||
132 | u8 vlimitto_vddmin; | ||
133 | u8 vlimitto_vddmax; | ||
134 | }; | ||
135 | 115 | ||
136 | extern struct omap_vp_instance_data omap3_vp1_data; | 116 | extern struct omap_vp_instance omap4_vp_mpu; |
137 | extern struct omap_vp_instance_data omap3_vp2_data; | 117 | extern struct omap_vp_instance omap4_vp_iva; |
118 | extern struct omap_vp_instance omap4_vp_core; | ||
138 | 119 | ||
139 | extern struct omap_vp_instance_data omap4_vp_mpu_data; | 120 | void omap_vp_init(struct voltagedomain *voltdm); |
140 | extern struct omap_vp_instance_data omap4_vp_iva_data; | 121 | void omap_vp_enable(struct voltagedomain *voltdm); |
141 | extern struct omap_vp_instance_data omap4_vp_core_data; | 122 | void omap_vp_disable(struct voltagedomain *voltdm); |
123 | int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | ||
124 | unsigned long target_volt); | ||
125 | int omap_vp_update_errorgain(struct voltagedomain *voltdm, | ||
126 | unsigned long target_volt); | ||
142 | 127 | ||
143 | #endif | 128 | #endif |