diff options
author | Paul Walmsley <paul@pwsan.com> | 2011-02-23 02:14:06 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2011-02-28 15:55:08 -0500 |
commit | 569edd705cc4e81a9129b5557f1fb259e21418a9 (patch) | |
tree | b85d811248b54ba6f1c279730d328668fdedb799 /arch/arm/mach-omap2/omap_hwmod.c | |
parent | 550c8092c55c22db8f843bad070fd1731292a75e (diff) |
OMAP2+: hwmod: find MPU initiator hwmod during in _register()
Move the code that looks for the MPU initiator hwmod to run during
the individual hwmod _register() function. (Previously, it ran after
all hwmods were registered in the omap_hwmod_late_init() function.)
This is done so code can late-initialize a few individual hwmods --
for example, for the system timer -- before the entire set of hwmods is
initialized later in boot via omap_hwmod_late_init().
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: BenoƮt Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 557d9eb609a6..e4c934bd25b3 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1452,7 +1452,7 @@ static int _setup(struct omap_hwmod *oh, void *data) | |||
1452 | */ | 1452 | */ |
1453 | static int __init _register(struct omap_hwmod *oh) | 1453 | static int __init _register(struct omap_hwmod *oh) |
1454 | { | 1454 | { |
1455 | int ret, ms_id; | 1455 | int ms_id; |
1456 | 1456 | ||
1457 | if (!oh || !oh->name || !oh->class || !oh->class->name || | 1457 | if (!oh || !oh->name || !oh->class || !oh->class->name || |
1458 | (oh->_state != _HWMOD_STATE_UNKNOWN)) | 1458 | (oh->_state != _HWMOD_STATE_UNKNOWN)) |
@@ -1475,9 +1475,14 @@ static int __init _register(struct omap_hwmod *oh) | |||
1475 | 1475 | ||
1476 | oh->_state = _HWMOD_STATE_REGISTERED; | 1476 | oh->_state = _HWMOD_STATE_REGISTERED; |
1477 | 1477 | ||
1478 | ret = 0; | 1478 | /* |
1479 | * XXX Rather than doing a strcmp(), this should test a flag | ||
1480 | * set in the hwmod data, inserted by the autogenerator code. | ||
1481 | */ | ||
1482 | if (!strcmp(oh->name, MPU_INITIATOR_NAME)) | ||
1483 | mpu_oh = oh; | ||
1479 | 1484 | ||
1480 | return ret; | 1485 | return 0; |
1481 | } | 1486 | } |
1482 | 1487 | ||
1483 | 1488 | ||
@@ -1632,22 +1637,24 @@ static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) | |||
1632 | * | 1637 | * |
1633 | * Must be called after omap2_clk_init(). Resolves the struct clk names | 1638 | * Must be called after omap2_clk_init(). Resolves the struct clk names |
1634 | * to struct clk pointers for each registered omap_hwmod. Also calls | 1639 | * to struct clk pointers for each registered omap_hwmod. Also calls |
1635 | * _setup() on each hwmod. Returns 0. | 1640 | * _setup() on each hwmod. Returns 0 upon success or -EINVAL upon error. |
1636 | */ | 1641 | */ |
1637 | static int __init omap_hwmod_setup_all(void) | 1642 | static int __init omap_hwmod_setup_all(void) |
1638 | { | 1643 | { |
1639 | int r; | 1644 | int r; |
1640 | 1645 | ||
1646 | if (!mpu_oh) { | ||
1647 | pr_err("omap_hwmod: %s: MPU initiator hwmod %s not yet registered\n", | ||
1648 | __func__, MPU_INITIATOR_NAME); | ||
1649 | return -EINVAL; | ||
1650 | } | ||
1651 | |||
1641 | r = omap_hwmod_for_each(_populate_mpu_rt_base, NULL); | 1652 | r = omap_hwmod_for_each(_populate_mpu_rt_base, NULL); |
1642 | 1653 | ||
1643 | /* XXX check return value */ | 1654 | /* XXX check return value */ |
1644 | r = omap_hwmod_for_each(_init_clocks, NULL); | 1655 | r = omap_hwmod_for_each(_init_clocks, NULL); |
1645 | WARN(r, "omap_hwmod: %s: _init_clocks failed\n", __func__); | 1656 | WARN(r, "omap_hwmod: %s: _init_clocks failed\n", __func__); |
1646 | 1657 | ||
1647 | mpu_oh = omap_hwmod_lookup(MPU_INITIATOR_NAME); | ||
1648 | WARN(!mpu_oh, "omap_hwmod: could not find MPU initiator hwmod %s\n", | ||
1649 | MPU_INITIATOR_NAME); | ||
1650 | |||
1651 | omap_hwmod_for_each(_setup, NULL); | 1658 | omap_hwmod_for_each(_setup, NULL); |
1652 | 1659 | ||
1653 | return 0; | 1660 | return 0; |