mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 09:36:40 +07:00
006c7f1844
Kevin discovered that commit c8d82ff68f
("ARM: OMAP2/3: hwmod data: Add 32k-sync timer data to hwmod
database") broke CORE idle on OMAP3. This prevents device low power
states.
The root cause is that the 32K sync timer IP block does not support
smart-idle mode[1], and so the hwmod code keeps the IP block in
no-idle mode while it is active. This in turn prevents the WKUP
clockdomain from transitioning to idle. There is a hardcoded sleep
dependency that prevents the CORE_L3 and CORE_CM clockdomains from
transitioning to idle when the WKUP clockdomain is active[2], so the
chip cannot enter any device low power states.
It turns out that there is no need to take the 32k sync timer out of
idle. The IP block itself probably does not have any native idle
handling at all, due to its simplicity. Furthermore, the PRCM will
never request target idle for this IP block while the kernel is
running, due to the sleep dependency that prevents the WKUP
clockdomain from idling while the CORE_L3 clockdomain is active. So
we can safely leave the 32k sync timer in target-force-idle mode, even
while we continue to access it.
This workaround is implemented by defining a new clockdomain flag,
CLKDM_ACTIVE_WITH_MPU, that indicates that the clockdomain is
guaranteed to be active whenever the MPU is inactive. If an IP
block's main functional clock exists inside this clockdomain, and the
IP block does not support smart-idle modes, then the hwmod code will
place the IP block into target force-idle mode even when enabled. The
WKUP clockdomains on OMAP3/4 are marked with this flag. (On OMAP2xxx,
no OCP header existed on the 32k sync timer.) Other clockdomains also
should be marked with this flag, but those changes are deferred until
a later merge window, to create a minimal fix.
Another theoretically clean fix for this problem would be to implement
PM runtime-based control for 32k sync timer accesses. These PM
runtime calls would need to located in a custom clocksource, since the
32k sync timer is currently used as an MMIO clocksource. But in
practice, there would be little benefit to doing so; and there would
be some cost, due to the addition of unnecessary lines of code and the
additional CPU overhead of the PM runtime and hwmod code - unnecessary
in this case.
Another possible fix would have been to modify the pm34xx.c code to
force the IP block idle before entering WFI. But this would not have
been an acceptable approach: we are trying to remove this type of
centralized IP block idle control from the PM code.
This patch is a collaboration between Kevin Hilman <khilman@ti.com>
and Paul Walmsley <paul@pwsan.com>.
Thanks to Vaibhav Hiremath <hvaibhav@ti.com> for providing comments on
an earlier version of this patch. Thanks to Tero Kristo
<t-kristo@ti.com> for identifying a bug in an earlier version of this
patch. Thanks to Benoît Cousson <b-cousson@ti.com> for identifying
some bugs in several versions of this patch and for implementation
comments.
References:
1. Table 16-96 "REG_32KSYNCNT_SYSCONFIG" of the OMAP34xx TRM Rev. ZU
(SWPU223U), available from:
http://www.ti.com/pdfs/wtbu/OMAP34x_ES3.1.x_PUBLIC_TRM_vzU.zip
2. Table 4-72 "Sleep Dependencies" of the OMAP34xx TRM Rev. ZU
(SWPU223U)
3. ibid.
Cc: Tony Lindgren <tony@atomide.com>
Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Cc: Benoît Cousson <b-cousson@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
93 lines
2.6 KiB
C
93 lines
2.6 KiB
C
/*
|
|
* OMAP2/3 clockdomain common data
|
|
*
|
|
* Copyright (C) 2008-2011 Texas Instruments, Inc.
|
|
* Copyright (C) 2008-2010 Nokia Corporation
|
|
*
|
|
* Paul Walmsley, Jouni Högander
|
|
*
|
|
* This file contains clockdomains and clockdomain wakeup/sleep
|
|
* dependencies for the OMAP2/3 chips. Some notes:
|
|
*
|
|
* A useful validation rule for struct clockdomain: Any clockdomain
|
|
* referenced by a wkdep_srcs or sleepdep_srcs array must have a
|
|
* dep_bit assigned. So wkdep_srcs/sleepdep_srcs are really just
|
|
* software-controllable dependencies. Non-software-controllable
|
|
* dependencies do exist, but they are not encoded below (yet).
|
|
*
|
|
* 24xx does not support programmable sleep dependencies (SLEEPDEP)
|
|
*
|
|
* The overly-specific dep_bit names are due to a bit name collision
|
|
* with CM_FCLKEN_{DSP,IVA2}. The DSP/IVA2 PM_WKDEP and CM_SLEEPDEP shift
|
|
* value are the same for all powerdomains: 2
|
|
*
|
|
* XXX should dep_bit be a mask, so we can test to see if it is 0 as a
|
|
* sanity check?
|
|
* XXX encode hardware fixed wakeup dependencies -- esp. for 3430 CORE
|
|
*/
|
|
|
|
/*
|
|
* To-Do List
|
|
* -> Port the Sleep/Wakeup dependencies for the domains
|
|
* from the Power domain framework
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/io.h>
|
|
|
|
#include "clockdomain.h"
|
|
#include "prm2xxx_3xxx.h"
|
|
#include "cm2xxx_3xxx.h"
|
|
#include "cm-regbits-24xx.h"
|
|
#include "cm-regbits-34xx.h"
|
|
#include "cm-regbits-44xx.h"
|
|
#include "prm-regbits-24xx.h"
|
|
#include "prm-regbits-34xx.h"
|
|
|
|
/*
|
|
* Clockdomain dependencies for wkdeps/sleepdeps
|
|
*
|
|
* XXX Hardware dependencies (e.g., dependencies that cannot be
|
|
* changed in software) are not included here yet, but should be.
|
|
*/
|
|
|
|
/* Wakeup dependency source arrays */
|
|
|
|
/* 2xxx-specific possible dependencies */
|
|
|
|
/* 2xxx PM_WKDEP_GFX: CORE, MPU, WKUP */
|
|
struct clkdm_dep gfx_24xx_wkdeps[] = {
|
|
{ .clkdm_name = "core_l3_clkdm" },
|
|
{ .clkdm_name = "core_l4_clkdm" },
|
|
{ .clkdm_name = "mpu_clkdm" },
|
|
{ .clkdm_name = "wkup_clkdm" },
|
|
{ NULL },
|
|
};
|
|
|
|
/* 2xxx PM_WKDEP_DSP: CORE, MPU, WKUP */
|
|
struct clkdm_dep dsp_24xx_wkdeps[] = {
|
|
{ .clkdm_name = "core_l3_clkdm" },
|
|
{ .clkdm_name = "core_l4_clkdm" },
|
|
{ .clkdm_name = "mpu_clkdm" },
|
|
{ .clkdm_name = "wkup_clkdm" },
|
|
{ NULL },
|
|
};
|
|
|
|
|
|
/*
|
|
* OMAP2/3-common clockdomains
|
|
*
|
|
* Even though the 2420 has a single PRCM module from the
|
|
* interconnect's perspective, internally it does appear to have
|
|
* separate PRM and CM clockdomains. The usual test case is
|
|
* sys_clkout/sys_clkout2.
|
|
*/
|
|
|
|
/* This is an implicit clockdomain - it is never defined as such in TRM */
|
|
struct clockdomain wkup_common_clkdm = {
|
|
.name = "wkup_clkdm",
|
|
.pwrdm = { .name = "wkup_pwrdm" },
|
|
.dep_bit = OMAP_EN_WKUP_SHIFT,
|
|
.flags = CLKDM_ACTIVE_WITH_MPU,
|
|
};
|