aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/pm.c')
-rw-r--r--arch/arm/mach-omap2/pm.c72
1 files changed, 24 insertions, 48 deletions
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 0844e2ecfb4a..2ab7a9e17fe2 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -26,38 +26,7 @@
26 26
27static struct omap_device_pm_latency *pm_lats; 27static struct omap_device_pm_latency *pm_lats;
28 28
29static struct device *mpu_dev; 29static int _init_omap_device(char *name)
30static struct device *iva_dev;
31static struct device *l3_dev;
32static struct device *dsp_dev;
33
34struct device *omap2_get_mpuss_device(void)
35{
36 WARN_ON_ONCE(!mpu_dev);
37 return mpu_dev;
38}
39
40struct device *omap2_get_iva_device(void)
41{
42 WARN_ON_ONCE(!iva_dev);
43 return iva_dev;
44}
45
46struct device *omap2_get_l3_device(void)
47{
48 WARN_ON_ONCE(!l3_dev);
49 return l3_dev;
50}
51
52struct device *omap4_get_dsp_device(void)
53{
54 WARN_ON_ONCE(!dsp_dev);
55 return dsp_dev;
56}
57EXPORT_SYMBOL(omap4_get_dsp_device);
58
59/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
60static int _init_omap_device(char *name, struct device **new_dev)
61{ 30{
62 struct omap_hwmod *oh; 31 struct omap_hwmod *oh;
63 struct platform_device *pdev; 32 struct platform_device *pdev;
@@ -72,8 +41,6 @@ static int _init_omap_device(char *name, struct device **new_dev)
72 __func__, name)) 41 __func__, name))
73 return -ENODEV; 42 return -ENODEV;
74 43
75 *new_dev = &pdev->dev;
76
77 return 0; 44 return 0;
78} 45}
79 46
@@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
82 */ 49 */
83static void omap2_init_processor_devices(void) 50static void omap2_init_processor_devices(void)
84{ 51{
85 _init_omap_device("mpu", &mpu_dev); 52 _init_omap_device("mpu");
86 if (omap3_has_iva()) 53 if (omap3_has_iva())
87 _init_omap_device("iva", &iva_dev); 54 _init_omap_device("iva");
88 55
89 if (cpu_is_omap44xx()) { 56 if (cpu_is_omap44xx()) {
90 _init_omap_device("l3_main_1", &l3_dev); 57 _init_omap_device("l3_main_1");
91 _init_omap_device("dsp", &dsp_dev); 58 _init_omap_device("dsp");
92 _init_omap_device("iva", &iva_dev); 59 _init_omap_device("iva");
93 } else { 60 } else {
94 _init_omap_device("l3_main", &l3_dev); 61 _init_omap_device("l3_main");
95 } 62 }
96} 63}
97 64
@@ -169,18 +136,26 @@ err:
169 * in the opp entry 136 * in the opp entry
170 */ 137 */
171static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, 138static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
172 struct device *dev) 139 const char *oh_name)
173{ 140{
174 struct voltagedomain *voltdm; 141 struct voltagedomain *voltdm;
175 struct clk *clk; 142 struct clk *clk;
176 struct opp *opp; 143 struct opp *opp;
177 unsigned long freq, bootup_volt; 144 unsigned long freq, bootup_volt;
145 struct device *dev;
178 146
179 if (!vdd_name || !clk_name || !dev) { 147 if (!vdd_name || !clk_name || !oh_name) {
180 pr_err("%s: invalid parameters\n", __func__); 148 pr_err("%s: invalid parameters\n", __func__);
181 goto exit; 149 goto exit;
182 } 150 }
183 151
152 dev = omap_device_get_by_hwmod_name(oh_name);
153 if (IS_ERR(dev)) {
154 pr_err("%s: Unable to get dev pointer for hwmod %s\n",
155 __func__, oh_name);
156 goto exit;
157 }
158
184 voltdm = voltdm_lookup(vdd_name); 159 voltdm = voltdm_lookup(vdd_name);
185 if (IS_ERR(voltdm)) { 160 if (IS_ERR(voltdm)) {
186 pr_err("%s: unable to get vdd pointer for vdd_%s\n", 161 pr_err("%s: unable to get vdd pointer for vdd_%s\n",
@@ -224,8 +199,8 @@ static void __init omap3_init_voltages(void)
224 if (!cpu_is_omap34xx()) 199 if (!cpu_is_omap34xx())
225 return; 200 return;
226 201
227 omap2_set_init_voltage("mpu_iva", "dpll1_ck", mpu_dev); 202 omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu");
228 omap2_set_init_voltage("core", "l3_ick", l3_dev); 203 omap2_set_init_voltage("core", "l3_ick", "l3_main");
229} 204}
230 205
231static void __init omap4_init_voltages(void) 206static void __init omap4_init_voltages(void)
@@ -233,14 +208,15 @@ static void __init omap4_init_voltages(void)
233 if (!cpu_is_omap44xx()) 208 if (!cpu_is_omap44xx())
234 return; 209 return;
235 210
236 omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev); 211 omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
237 omap2_set_init_voltage("core", "l3_div_ck", l3_dev); 212 omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
238 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev); 213 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
239} 214}
240 215
241static int __init omap2_common_pm_init(void) 216static int __init omap2_common_pm_init(void)
242{ 217{
243 omap2_init_processor_devices(); 218 if (!of_have_populated_dt())
219 omap2_init_processor_devices();
244 omap_pm_if_init(); 220 omap_pm_if_init();
245 221
246 return 0; 222 return 0;