aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2009-12-08 18:34:17 -0500
committerpaul <paul@twilight.(none)>2009-12-11 19:00:43 -0500
commita16b1f7f8692163e0c6b4741d8980837dfca75f1 (patch)
tree334aeebcfc645152ffa0745e478d48e2837ac246 /arch
parent718bfd76932c566f79eb55083693ef0b68071bf8 (diff)
OMAP3 hwmod: drop most of the OCP_SYSCONFIG.CLOCKACTIVITY code
Earlier, the hwmod code had considered the OCP_SYSCONFIG.CLOCKACTIVITY bits to be incremental power saving bits, controlling internal IP block clock gates. This was a misapprehension. The CLOCKACTIVITY bits are used to indicate, in advance, which clocks will be cut when the module acknowledges an idle request. This enables the IP block to take whatever action is necessary to complete any in-progress work before asserting its IdleAck. In the current Linux-OMAP code, this implies that the clock framework should be changing module CLOCKACTIVITY bits as module clocks are enabled and disabled. We don't do that yet, but in the future, we should. This must wait until the clock tree is annotated with omap_hwmod pointers (or vice-versa). In the meantime, drop most of the hwmod code that controls CLOCKACTIVITY bits to avoid confusion. This patch has benefited from many illuminating discussions with (in alphabetical order) Benoît Cousson <b-cousson@ti.com>, Rajendra Nayak <rnayak@ti.com>, and Sebastien Sabatier <s-sabatier1@ti.com>. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Rajendra Nayak <rnayak@ti.com> Cc: Sebastien Sabatier <s-sabatier1@ti.com> Cc: Benoît Cousson <b-cousson@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c88
1 files changed, 5 insertions, 83 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 61d220c5d488..bfbd34142b37 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -592,6 +592,11 @@ static void _sysc_enable(struct omap_hwmod *oh)
592 592
593 /* XXX OCP ENAWAKEUP bit? */ 593 /* XXX OCP ENAWAKEUP bit? */
594 594
595 /*
596 * XXX The clock framework should handle this, by
597 * calling into this code. But this must wait until the
598 * clock structures are tagged with omap_hwmod entries
599 */
595 if (oh->flags & HWMOD_SET_DEFAULT_CLOCKACT && 600 if (oh->flags & HWMOD_SET_DEFAULT_CLOCKACT &&
596 oh->sysconfig->sysc_flags & SYSC_HAS_CLOCKACTIVITY) 601 oh->sysconfig->sysc_flags & SYSC_HAS_CLOCKACTIVITY)
597 _set_clockactivity(oh, oh->sysconfig->clockact, &v); 602 _set_clockactivity(oh, oh->sysconfig->clockact, &v);
@@ -914,33 +919,6 @@ static int _shutdown(struct omap_hwmod *oh)
914} 919}
915 920
916/** 921/**
917 * _write_clockact_lock - set the module's clockactivity bits
918 * @oh: struct omap_hwmod *
919 * @clockact: CLOCKACTIVITY field bits
920 *
921 * Writes the CLOCKACTIVITY bits @clockact to the hwmod @oh
922 * OCP_SYSCONFIG register. Returns -EINVAL if the hwmod is in the
923 * wrong state or returns 0.
924 */
925static int _write_clockact_lock(struct omap_hwmod *oh, u8 clockact)
926{
927 u32 v;
928
929 if (!oh->sysconfig ||
930 !(oh->sysconfig->sysc_flags & SYSC_HAS_CLOCKACTIVITY))
931 return -EINVAL;
932
933 mutex_lock(&omap_hwmod_mutex);
934 v = oh->_sysc_cache;
935 _set_clockactivity(oh, clockact, &v);
936 _write_sysconfig(v, oh);
937 mutex_unlock(&omap_hwmod_mutex);
938
939 return 0;
940}
941
942
943/**
944 * _setup - do initial configuration of omap_hwmod 922 * _setup - do initial configuration of omap_hwmod
945 * @oh: struct omap_hwmod * 923 * @oh: struct omap_hwmod *
946 * 924 *
@@ -1493,62 +1471,6 @@ int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh,
1493} 1471}
1494 1472
1495/** 1473/**
1496 * omap_hwmod_set_clockact_none - set clockactivity test to BOTH
1497 * @oh: struct omap_hwmod *
1498 *
1499 * On some modules, this function can affect the wakeup latency vs.
1500 * power consumption balance. Intended to be called by the
1501 * omap_device layer. Passes along the return value from
1502 * _write_clockact_lock().
1503 */
1504int omap_hwmod_set_clockact_both(struct omap_hwmod *oh)
1505{
1506 return _write_clockact_lock(oh, CLOCKACT_TEST_BOTH);
1507}
1508
1509/**
1510 * omap_hwmod_set_clockact_none - set clockactivity test to MAIN
1511 * @oh: struct omap_hwmod *
1512 *
1513 * On some modules, this function can affect the wakeup latency vs.
1514 * power consumption balance. Intended to be called by the
1515 * omap_device layer. Passes along the return value from
1516 * _write_clockact_lock().
1517 */
1518int omap_hwmod_set_clockact_main(struct omap_hwmod *oh)
1519{
1520 return _write_clockact_lock(oh, CLOCKACT_TEST_MAIN);
1521}
1522
1523/**
1524 * omap_hwmod_set_clockact_none - set clockactivity test to ICLK
1525 * @oh: struct omap_hwmod *
1526 *
1527 * On some modules, this function can affect the wakeup latency vs.
1528 * power consumption balance. Intended to be called by the
1529 * omap_device layer. Passes along the return value from
1530 * _write_clockact_lock().
1531 */
1532int omap_hwmod_set_clockact_iclk(struct omap_hwmod *oh)
1533{
1534 return _write_clockact_lock(oh, CLOCKACT_TEST_ICLK);
1535}
1536
1537/**
1538 * omap_hwmod_set_clockact_none - set clockactivity test to NONE
1539 * @oh: struct omap_hwmod *
1540 *
1541 * On some modules, this function can affect the wakeup latency vs.
1542 * power consumption balance. Intended to be called by the
1543 * omap_device layer. Passes along the return value from
1544 * _write_clockact_lock().
1545 */
1546int omap_hwmod_set_clockact_none(struct omap_hwmod *oh)
1547{
1548 return _write_clockact_lock(oh, CLOCKACT_TEST_NONE);
1549}
1550
1551/**
1552 * omap_hwmod_enable_wakeup - allow device to wake up the system 1474 * omap_hwmod_enable_wakeup - allow device to wake up the system
1553 * @oh: struct omap_hwmod * 1475 * @oh: struct omap_hwmod *
1554 * 1476 *