aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c137
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h2
2 files changed, 55 insertions, 84 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 81c109774b31..298fc3b779ec 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1418,60 +1418,8 @@ static int _setup(struct omap_hwmod *oh, void *data)
1418 return 0; 1418 return 0;
1419} 1419}
1420 1420
1421
1422
1423/* Public functions */
1424
1425u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs)
1426{
1427 if (oh->flags & HWMOD_16BIT_REG)
1428 return __raw_readw(oh->_mpu_rt_va + reg_offs);
1429 else
1430 return __raw_readl(oh->_mpu_rt_va + reg_offs);
1431}
1432
1433void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
1434{
1435 if (oh->flags & HWMOD_16BIT_REG)
1436 __raw_writew(v, oh->_mpu_rt_va + reg_offs);
1437 else
1438 __raw_writel(v, oh->_mpu_rt_va + reg_offs);
1439}
1440
1441/**
1442 * omap_hwmod_set_slave_idlemode - set the hwmod's OCP slave idlemode
1443 * @oh: struct omap_hwmod *
1444 * @idlemode: SIDLEMODE field bits (shifted to bit 0)
1445 *
1446 * Sets the IP block's OCP slave idlemode in hardware, and updates our
1447 * local copy. Intended to be used by drivers that have some erratum
1448 * that requires direct manipulation of the SIDLEMODE bits. Returns
1449 * -EINVAL if @oh is null, or passes along the return value from
1450 * _set_slave_idlemode().
1451 *
1452 * XXX Does this function have any current users? If not, we should
1453 * remove it; it is better to let the rest of the hwmod code handle this.
1454 * Any users of this function should be scrutinized carefully.
1455 */
1456int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode)
1457{
1458 u32 v;
1459 int retval = 0;
1460
1461 if (!oh)
1462 return -EINVAL;
1463
1464 v = oh->_sysc_cache;
1465
1466 retval = _set_slave_idlemode(oh, idlemode, &v);
1467 if (!retval)
1468 _write_sysconfig(v, oh);
1469
1470 return retval;
1471}
1472
1473/** 1421/**
1474 * omap_hwmod_register - register a struct omap_hwmod 1422 * _register - register a struct omap_hwmod
1475 * @oh: struct omap_hwmod * 1423 * @oh: struct omap_hwmod *
1476 * 1424 *
1477 * Registers the omap_hwmod @oh. Returns -EEXIST if an omap_hwmod 1425 * Registers the omap_hwmod @oh. Returns -EEXIST if an omap_hwmod
@@ -1487,7 +1435,7 @@ int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode)
1487 * that the copy process would be relatively complex due to the large number 1435 * that the copy process would be relatively complex due to the large number
1488 * of substructures. 1436 * of substructures.
1489 */ 1437 */
1490int omap_hwmod_register(struct omap_hwmod *oh) 1438static int _register(struct omap_hwmod *oh)
1491{ 1439{
1492 int ret, ms_id; 1440 int ret, ms_id;
1493 1441
@@ -1525,6 +1473,57 @@ ohr_unlock:
1525 return ret; 1473 return ret;
1526} 1474}
1527 1475
1476
1477/* Public functions */
1478
1479u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs)
1480{
1481 if (oh->flags & HWMOD_16BIT_REG)
1482 return __raw_readw(oh->_mpu_rt_va + reg_offs);
1483 else
1484 return __raw_readl(oh->_mpu_rt_va + reg_offs);
1485}
1486
1487void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
1488{
1489 if (oh->flags & HWMOD_16BIT_REG)
1490 __raw_writew(v, oh->_mpu_rt_va + reg_offs);
1491 else
1492 __raw_writel(v, oh->_mpu_rt_va + reg_offs);
1493}
1494
1495/**
1496 * omap_hwmod_set_slave_idlemode - set the hwmod's OCP slave idlemode
1497 * @oh: struct omap_hwmod *
1498 * @idlemode: SIDLEMODE field bits (shifted to bit 0)
1499 *
1500 * Sets the IP block's OCP slave idlemode in hardware, and updates our
1501 * local copy. Intended to be used by drivers that have some erratum
1502 * that requires direct manipulation of the SIDLEMODE bits. Returns
1503 * -EINVAL if @oh is null, or passes along the return value from
1504 * _set_slave_idlemode().
1505 *
1506 * XXX Does this function have any current users? If not, we should
1507 * remove it; it is better to let the rest of the hwmod code handle this.
1508 * Any users of this function should be scrutinized carefully.
1509 */
1510int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode)
1511{
1512 u32 v;
1513 int retval = 0;
1514
1515 if (!oh)
1516 return -EINVAL;
1517
1518 v = oh->_sysc_cache;
1519
1520 retval = _set_slave_idlemode(oh, idlemode, &v);
1521 if (!retval)
1522 _write_sysconfig(v, oh);
1523
1524 return retval;
1525}
1526
1528/** 1527/**
1529 * omap_hwmod_lookup - look up a registered omap_hwmod by name 1528 * omap_hwmod_lookup - look up a registered omap_hwmod by name
1530 * @name: name of the omap_hwmod to look up 1529 * @name: name of the omap_hwmod to look up
@@ -1604,8 +1603,8 @@ int omap_hwmod_init(struct omap_hwmod **ohs)
1604 oh = *ohs; 1603 oh = *ohs;
1605 while (oh) { 1604 while (oh) {
1606 if (omap_chip_is(oh->omap_chip)) { 1605 if (omap_chip_is(oh->omap_chip)) {
1607 r = omap_hwmod_register(oh); 1606 r = _register(oh);
1608 WARN(r, "omap_hwmod: %s: omap_hwmod_register returned " 1607 WARN(r, "omap_hwmod: %s: _register returned "
1609 "%d\n", oh->name, r); 1608 "%d\n", oh->name, r);
1610 } 1609 }
1611 oh = *++ohs; 1610 oh = *++ohs;
@@ -1639,32 +1638,6 @@ int omap_hwmod_late_init(void)
1639} 1638}
1640 1639
1641/** 1640/**
1642 * omap_hwmod_unregister - unregister an omap_hwmod
1643 * @oh: struct omap_hwmod *
1644 *
1645 * Unregisters a previously-registered omap_hwmod @oh. There's probably
1646 * no use case for this, so it is likely to be removed in a later version.
1647 *
1648 * XXX Free all of the bootmem-allocated structures here when that is
1649 * implemented. Make it clear that core code is the only code that is
1650 * expected to unregister modules.
1651 */
1652int omap_hwmod_unregister(struct omap_hwmod *oh)
1653{
1654 if (!oh)
1655 return -EINVAL;
1656
1657 pr_debug("omap_hwmod: %s: unregistering\n", oh->name);
1658
1659 mutex_lock(&omap_hwmod_mutex);
1660 iounmap(oh->_mpu_rt_va);
1661 list_del(&oh->node);
1662 mutex_unlock(&omap_hwmod_mutex);
1663
1664 return 0;
1665}
1666
1667/**
1668 * omap_hwmod_enable - enable an omap_hwmod 1641 * omap_hwmod_enable - enable an omap_hwmod
1669 * @oh: struct omap_hwmod * 1642 * @oh: struct omap_hwmod *
1670 * 1643 *
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 62bdb23c95c9..ab99b8cca6ad 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -515,8 +515,6 @@ struct omap_hwmod {
515}; 515};
516 516
517int omap_hwmod_init(struct omap_hwmod **ohs); 517int omap_hwmod_init(struct omap_hwmod **ohs);
518int omap_hwmod_register(struct omap_hwmod *oh);
519int omap_hwmod_unregister(struct omap_hwmod *oh);
520struct omap_hwmod *omap_hwmod_lookup(const char *name); 518struct omap_hwmod *omap_hwmod_lookup(const char *name);
521int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), 519int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
522 void *data); 520 void *data);