RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / arm / mach-omap2 / pm.c
blob9e2114c88956bb0c9bb70495e284ba403b4bef6d
1 /*
2 * pm.c - Common OMAP2+ power management-related code
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
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.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/io.h>
15 #include <linux/err.h>
17 #include <plat/omap-pm.h>
18 #include <plat/omap_device.h>
19 #include <plat/common.h>
21 static struct omap_device_pm_latency *pm_lats;
23 static struct device *mpu_dev;
24 static struct device *dsp_dev;
25 static struct device *l3_dev;
27 struct device *omap2_get_mpuss_device(void)
29 WARN_ON_ONCE(!mpu_dev);
30 return mpu_dev;
33 struct device *omap2_get_dsp_device(void)
35 WARN_ON_ONCE(!dsp_dev);
36 return dsp_dev;
39 struct device *omap2_get_l3_device(void)
41 WARN_ON_ONCE(!l3_dev);
42 return l3_dev;
45 /* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
46 static int _init_omap_device(char *name, struct device **new_dev)
48 struct omap_hwmod *oh;
49 struct omap_device *od;
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;
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;
61 *new_dev = &od->pdev.dev;
63 return 0;
67 * Build omap_devices for processors and bus.
69 static void omap2_init_processor_devices(void)
71 _init_omap_device("mpu", &mpu_dev);
72 _init_omap_device("iva", &dsp_dev);
73 _init_omap_device("l3_main", &l3_dev);
76 static int __init omap2_common_pm_init(void)
78 omap2_init_processor_devices();
79 omap_pm_if_init();
81 return 0;
83 device_initcall(omap2_common_pm_init);