diff options
author | Kevin Hilman <khilman@deeprootsystems.com> | 2010-07-26 18:34:31 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-07-26 18:34:31 -0400 |
commit | 6f88e9bc21746be9b15f1d8dcacf7595807e8828 (patch) | |
tree | d4b2845d41516ad4fa81acd2429278b75595d89d /arch/arm/mach-omap2 | |
parent | 0656358159d7e26205bb9360840759c7c3c0725f (diff) |
OMAP: PM: create omap_devices for MPU, DSP, L3
Create simple omap_devices for the main processors and busses.
This is required to support the forth-coming device-based OPP
approach, where OPPs are managed and tracked at the device level.
Also, move these common PM init functions into a common_pm_init call
that is called as a device_initcall(). The PM init is done at this level
to ensure that the driver core is initialized before initialized.
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
[paul@pwsan.com: sparse warnings cleaned up; newly-created functions moved
from mach-omap2/io.c to mach-omap2/pm.c; newly-created functions renamed
to start with "omap2" rather than "omap"]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/io.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.c | 84 |
3 files changed, 86 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 3b5d184b30b7..d54389674486 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o | 6 | obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o |
7 | 7 | ||
8 | omap-2-3-common = irq.o sdrc.o | 8 | omap-2-3-common = irq.o sdrc.o |
9 | hwmod-common = omap_hwmod.o \ | 9 | hwmod-common = omap_hwmod.o \ |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index e95b47b3bfd3..d1906c73aec1 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -45,6 +45,7 @@ | |||
45 | 45 | ||
46 | #include <plat/clockdomain.h> | 46 | #include <plat/clockdomain.h> |
47 | #include "clockdomains.h" | 47 | #include "clockdomains.h" |
48 | |||
48 | #include <plat/omap_hwmod.h> | 49 | #include <plat/omap_hwmod.h> |
49 | 50 | ||
50 | /* | 51 | /* |
@@ -349,7 +350,6 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0, | |||
349 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) /* FIXME: OMAP4 */ | 350 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) /* FIXME: OMAP4 */ |
350 | omap_hwmod_late_init(skip_setup_idle); | 351 | omap_hwmod_late_init(skip_setup_idle); |
351 | 352 | ||
352 | omap_pm_if_init(); | ||
353 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { | 353 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { |
354 | omap2_sdrc_init(sdrc_cs0, sdrc_cs1); | 354 | omap2_sdrc_init(sdrc_cs0, sdrc_cs1); |
355 | _omap2_init_reprogram_sdrc(); | 355 | _omap2_init_reprogram_sdrc(); |
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c new file mode 100644 index 000000000000..68f9f2e95891 --- /dev/null +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * pm.c - Common OMAP2+ power management-related code | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments, Inc. | ||
5 | * Copyright (C) 2010 Nokia Corporation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/err.h> | ||
16 | |||
17 | #include <plat/omap-pm.h> | ||
18 | #include <plat/omap_device.h> | ||
19 | #include <plat/common.h> | ||
20 | |||
21 | static struct omap_device_pm_latency *pm_lats; | ||
22 | |||
23 | static struct device *mpu_dev; | ||
24 | static struct device *dsp_dev; | ||
25 | static struct device *l3_dev; | ||
26 | |||
27 | struct device *omap2_get_mpuss_device(void) | ||
28 | { | ||
29 | WARN_ON_ONCE(!mpu_dev); | ||
30 | return mpu_dev; | ||
31 | } | ||
32 | |||
33 | struct device *omap2_get_dsp_device(void) | ||
34 | { | ||
35 | WARN_ON_ONCE(!dsp_dev); | ||
36 | return dsp_dev; | ||
37 | } | ||
38 | |||
39 | struct device *omap2_get_l3_device(void) | ||
40 | { | ||
41 | WARN_ON_ONCE(!l3_dev); | ||
42 | return l3_dev; | ||
43 | } | ||
44 | |||
45 | /* static int _init_omap_device(struct omap_hwmod *oh, void *user) */ | ||
46 | static int _init_omap_device(char *name, struct device **new_dev) | ||
47 | { | ||
48 | struct omap_hwmod *oh; | ||
49 | struct omap_device *od; | ||
50 | |||
51 | oh = omap_hwmod_lookup(name); | ||
52 | if (WARN(!oh, "%s: could not find omap_hwmod for %s\n", | ||
53 | __func__, name)) | ||
54 | return -ENODEV; | ||
55 | |||
56 | od = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false); | ||
57 | if (WARN(IS_ERR(od), "%s: could not build omap_device for %s\n", | ||
58 | __func__, name)) | ||
59 | return -ENODEV; | ||
60 | |||
61 | *new_dev = &od->pdev.dev; | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * Build omap_devices for processors and bus. | ||
68 | */ | ||
69 | static void omap2_init_processor_devices(void) | ||
70 | { | ||
71 | _init_omap_device("mpu", &mpu_dev); | ||
72 | _init_omap_device("iva", &dsp_dev); | ||
73 | _init_omap_device("l3_main", &l3_dev); | ||
74 | } | ||
75 | |||
76 | static int __init omap2_common_pm_init(void) | ||
77 | { | ||
78 | omap2_init_processor_devices(); | ||
79 | omap_pm_if_init(); | ||
80 | |||
81 | return 0; | ||
82 | } | ||
83 | device_initcall(omap2_common_pm_init); | ||
84 | |||