@@ -23,6 +23,7 @@
#include <plat/opp.h>
#include <plat/cpu.h>
+#include <plat/omap_device.h>
static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
/* MPU OPP1 */
@@ -114,7 +115,22 @@ int __init omap3_pm_init_opp_table(void)
opp_def = omap3_opp_def_list;
for (i = 0; i < omap3_opp_def_size; i++) {
- r = opp_add(opp_def++);
+ struct omap_hwmod *oh;
+ struct device *dev;
+
+ if (!opp_def->hwmod_name) {
+ pr_err("%s: missing name of omap_hwmod, ignoring.\n", __func__);
+ return -EINVAL;
+ }
+ oh = omap_hwmod_lookup(opp_def->hwmod_name);
+ if (!oh || !oh->od) {
+ pr_warn("%s: no hwmod or odev for %s, cannot add OPPs.\n",
+ __func__, opp_def->hwmod_name);
+ return -EINVAL;
+ }
+ dev = &oh->od->pdev.dev;
+
+ r = opp_add(dev, opp_def++);
if (r)
pr_err("unable to add OPP %ld Hz for %s\n",
opp_def->freq, opp_def->hwmod_name);
@@ -75,7 +75,7 @@ struct omap_opp *opp_find_freq_floor(struct device *dev, unsigned long *freq);
struct omap_opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq);
-int opp_add(const struct omap_opp_def *opp_def);
+int opp_add(struct device *dev, const struct omap_opp_def *opp_def);
int opp_enable(struct omap_opp *opp);
@@ -21,7 +21,6 @@
#include <linux/list.h>
#include <plat/opp.h>
-#include <plat/omap_device.h>
/**
* struct omap_opp - OMAP OPP description structure
@@ -58,7 +57,6 @@ struct omap_opp {
struct device_opp {
struct list_head node;
- struct omap_hwmod *oh;
struct device *dev;
struct list_head opp_list;
@@ -291,29 +289,12 @@ static void omap_opp_populate(struct omap_opp *opp,
*
* This function adds an opp definition to the opp list and returns status.
*/
-int opp_add(const struct omap_opp_def *opp_def)
+int opp_add(struct device *dev, const struct omap_opp_def *opp_def)
{
- struct omap_hwmod *oh;
- struct device *dev = NULL;
struct device_opp *tmp_dev_opp, *dev_opp = NULL;
struct omap_opp *opp, *new_opp;
- struct platform_device *pdev;
struct list_head *head;
- /* find the correct hwmod, and device */
- if (!opp_def->hwmod_name) {
- pr_err("%s: missing name of omap_hwmod, ignoring.\n", __func__);
- return -EINVAL;
- }
- oh = omap_hwmod_lookup(opp_def->hwmod_name);
- if (!oh || !oh->od) {
- pr_warn("%s: no hwmod or odev for %s, cannot add OPPs.\n",
- __func__, opp_def->hwmod_name);
- return -EINVAL;
- }
- pdev = &oh->od->pdev;
- dev = &oh->od->pdev.dev;
-
/* Check for existing list for 'dev' */
list_for_each_entry(tmp_dev_opp, &dev_opp_list, node) {
if (dev == tmp_dev_opp->dev) {
@@ -331,8 +312,7 @@ int opp_add(const struct omap_opp_def *opp_def)
return -ENOMEM;
}
- dev_opp->oh = oh;
- dev_opp->dev = &oh->od->pdev.dev;
+ dev_opp->dev = dev;
INIT_LIST_HEAD(&dev_opp->opp_list);
list_add(&dev_opp->node, &dev_opp_list);