diff options
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 62 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap_hwmod.h | 3 |
2 files changed, 58 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 43aa894174fa..f76f133780c8 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -901,7 +901,7 @@ static struct omap_hwmod *_lookup(const char *name) | |||
901 | * @oh: struct omap_hwmod * | 901 | * @oh: struct omap_hwmod * |
902 | * @data: not used; pass NULL | 902 | * @data: not used; pass NULL |
903 | * | 903 | * |
904 | * Called by omap_hwmod_setup_all() (after omap2_clk_init()). | 904 | * Called by omap_hwmod_setup_*() (after omap2_clk_init()). |
905 | * Resolves all clock names embedded in the hwmod. Returns 0 on | 905 | * Resolves all clock names embedded in the hwmod. Returns 0 on |
906 | * success, or a negative error code on failure. | 906 | * success, or a negative error code on failure. |
907 | */ | 907 | */ |
@@ -1616,7 +1616,7 @@ int __init omap_hwmod_register(struct omap_hwmod **ohs) | |||
1616 | /* | 1616 | /* |
1617 | * _populate_mpu_rt_base - populate the virtual address for a hwmod | 1617 | * _populate_mpu_rt_base - populate the virtual address for a hwmod |
1618 | * | 1618 | * |
1619 | * Must be called only from omap_hwmod_setup_all() so ioremap works properly. | 1619 | * Must be called only from omap_hwmod_setup_*() so ioremap works properly. |
1620 | * Assumes the caller takes care of locking if needed. | 1620 | * Assumes the caller takes care of locking if needed. |
1621 | */ | 1621 | */ |
1622 | static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) | 1622 | static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) |
@@ -1636,11 +1636,59 @@ static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) | |||
1636 | } | 1636 | } |
1637 | 1637 | ||
1638 | /** | 1638 | /** |
1639 | * omap_hwmod_setup_one - set up a single hwmod | ||
1640 | * @oh_name: const char * name of the already-registered hwmod to set up | ||
1641 | * | ||
1642 | * Must be called after omap2_clk_init(). Resolves the struct clk | ||
1643 | * names to struct clk pointers for each registered omap_hwmod. Also | ||
1644 | * calls _setup() on each hwmod. Returns -EINVAL upon error or 0 upon | ||
1645 | * success. | ||
1646 | */ | ||
1647 | int __init omap_hwmod_setup_one(const char *oh_name) | ||
1648 | { | ||
1649 | struct omap_hwmod *oh; | ||
1650 | int r; | ||
1651 | |||
1652 | pr_debug("omap_hwmod: %s: %s\n", oh_name, __func__); | ||
1653 | |||
1654 | if (!mpu_oh) { | ||
1655 | pr_err("omap_hwmod: %s: cannot setup_one: MPU initiator hwmod %s not yet registered\n", | ||
1656 | oh_name, MPU_INITIATOR_NAME); | ||
1657 | return -EINVAL; | ||
1658 | } | ||
1659 | |||
1660 | oh = _lookup(oh_name); | ||
1661 | if (!oh) { | ||
1662 | WARN(1, "omap_hwmod: %s: hwmod not yet registered\n", oh_name); | ||
1663 | return -EINVAL; | ||
1664 | } | ||
1665 | |||
1666 | if (mpu_oh->_state == _HWMOD_STATE_REGISTERED && oh != mpu_oh) | ||
1667 | omap_hwmod_setup_one(MPU_INITIATOR_NAME); | ||
1668 | |||
1669 | r = _populate_mpu_rt_base(oh, NULL); | ||
1670 | if (IS_ERR_VALUE(r)) { | ||
1671 | WARN(1, "omap_hwmod: %s: couldn't set mpu_rt_base\n", oh_name); | ||
1672 | return -EINVAL; | ||
1673 | } | ||
1674 | |||
1675 | r = _init_clocks(oh, NULL); | ||
1676 | if (IS_ERR_VALUE(r)) { | ||
1677 | WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh_name); | ||
1678 | return -EINVAL; | ||
1679 | } | ||
1680 | |||
1681 | _setup(oh, NULL); | ||
1682 | |||
1683 | return 0; | ||
1684 | } | ||
1685 | |||
1686 | /** | ||
1639 | * omap_hwmod_setup - do some post-clock framework initialization | 1687 | * omap_hwmod_setup - do some post-clock framework initialization |
1640 | * | 1688 | * |
1641 | * Must be called after omap2_clk_init(). Resolves the struct clk names | 1689 | * Must be called after omap2_clk_init(). Resolves the struct clk names |
1642 | * to struct clk pointers for each registered omap_hwmod. Also calls | 1690 | * to struct clk pointers for each registered omap_hwmod. Also calls |
1643 | * _setup() on each hwmod. Returns 0 upon success or -EINVAL upon error. | 1691 | * _setup() on each hwmod. Returns 0 upon success. |
1644 | */ | 1692 | */ |
1645 | static int __init omap_hwmod_setup_all(void) | 1693 | static int __init omap_hwmod_setup_all(void) |
1646 | { | 1694 | { |
@@ -1654,9 +1702,9 @@ static int __init omap_hwmod_setup_all(void) | |||
1654 | 1702 | ||
1655 | r = omap_hwmod_for_each(_populate_mpu_rt_base, NULL); | 1703 | r = omap_hwmod_for_each(_populate_mpu_rt_base, NULL); |
1656 | 1704 | ||
1657 | /* XXX check return value */ | ||
1658 | r = omap_hwmod_for_each(_init_clocks, NULL); | 1705 | r = omap_hwmod_for_each(_init_clocks, NULL); |
1659 | WARN(r, "omap_hwmod: %s: _init_clocks failed\n", __func__); | 1706 | WARN(IS_ERR_VALUE(r), |
1707 | "omap_hwmod: %s: _init_clocks failed\n", __func__); | ||
1660 | 1708 | ||
1661 | omap_hwmod_for_each(_setup, NULL); | 1709 | omap_hwmod_for_each(_setup, NULL); |
1662 | 1710 | ||
@@ -2182,8 +2230,8 @@ int omap_hwmod_for_each_by_class(const char *classname, | |||
2182 | * @state: state that _setup() should leave the hwmod in | 2230 | * @state: state that _setup() should leave the hwmod in |
2183 | * | 2231 | * |
2184 | * Sets the hwmod state that @oh will enter at the end of _setup() | 2232 | * Sets the hwmod state that @oh will enter at the end of _setup() |
2185 | * (called by omap_hwmod_setup_all()). Only valid to call between | 2233 | * (called by omap_hwmod_setup_*()). Only valid to call between |
2186 | * calling omap_hwmod_register() and omap_hwmod_setup_all(). Returns | 2234 | * calling omap_hwmod_register() and omap_hwmod_setup_*(). Returns |
2187 | * 0 upon success or -EINVAL if there is a problem with the arguments | 2235 | * 0 upon success or -EINVAL if there is a problem with the arguments |
2188 | * or if the hwmod is in the wrong state. | 2236 | * or if the hwmod is in the wrong state. |
2189 | */ | 2237 | */ |
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index afdf1971c51c..f96e72ed4db1 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H | 30 | #define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H |
31 | 31 | ||
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/init.h> | ||
33 | #include <linux/list.h> | 34 | #include <linux/list.h> |
34 | #include <linux/ioport.h> | 35 | #include <linux/ioport.h> |
35 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
@@ -542,6 +543,8 @@ struct omap_hwmod *omap_hwmod_lookup(const char *name); | |||
542 | int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), | 543 | int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), |
543 | void *data); | 544 | void *data); |
544 | 545 | ||
546 | int __init omap_hwmod_setup_one(const char *name); | ||
547 | |||
545 | int omap_hwmod_enable(struct omap_hwmod *oh); | 548 | int omap_hwmod_enable(struct omap_hwmod *oh); |
546 | int _omap_hwmod_enable(struct omap_hwmod *oh); | 549 | int _omap_hwmod_enable(struct omap_hwmod *oh); |
547 | int omap_hwmod_idle(struct omap_hwmod *oh); | 550 | int omap_hwmod_idle(struct omap_hwmod *oh); |