diff options
author | Olof Johansson <olof@lixom.net> | 2012-11-05 18:52:03 (GMT) |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-11-05 18:52:03 (GMT) |
commit | 976669971ff7d2d668ee3d9e92d0d9db5aae847c (patch) | |
tree | e696fcf3eb3b9c6311fc4fa51aa8c89a29aad9c2 /arch/arm/mach-omap2/cm33xx.c | |
parent | 9237b5aa447dce55913b61f435c5140410bf5310 (diff) | |
parent | 7fc54fd3084457c7f11b9e2e1e3fcd19a3badc33 (diff) | |
download | linux-fsl-qoriq-976669971ff7d2d668ee3d9e92d0d9db5aae847c.tar.xz |
Merge tag 'omap-for-v3.8/cleanup-prcm-part1-take2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/headers
From Paul Walmsley <paul@pwsan.com> via Tony Lindgren:
The first set of OMAP PRM/CM-related cleanup patches for 3.8.
Prepares for the future move of the PRM/CM code to drivers/. Also
includes some prcm.[ch] cleanup patches from the WDTIMER cleanup
series that don't need external acks.
* tag 'omap-for-v3.8/cleanup-prcm-part1-take2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
ARM: OMAP2+: PRM: create PRM reset source API for the watchdog timer driver
ARM: OMAP1: create read_reset_sources() function (for initial use by watchdog)
ARM: OMAP2+: CM: prepare for use of cm_ll_data function pointers
ARM: OMAP2+: PRM: prepare for use of prm_ll_data function pointers
ARM: OMAP2/3: clockdomain/PRM/CM: move the low-level clockdomain functions into PRM/CM
ARM: OMAP2+: CM/hwmod: split CM functions into OMAP2, OMAP3-specific files
ARM: OMAP2+: powerdomain/PRM: move the low-level powerdomain functions into PRM
ARM: OMAP2+: PRM: split PRM functions into OMAP2, OMAP3-specific files
ARM: OMAP2+: PRM: remove PRM weak functions
Diffstat (limited to 'arch/arm/mach-omap2/cm33xx.c')
-rw-r--r-- | arch/arm/mach-omap2/cm33xx.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c index b4938ab..b2dfcd7 100644 --- a/arch/arm/mach-omap2/cm33xx.c +++ b/arch/arm/mach-omap2/cm33xx.c @@ -24,6 +24,7 @@ #include "../plat-omap/common.h" +#include "clockdomain.h" #include "cm.h" #include "cm33xx.h" #include "cm-regbits-34xx.h" @@ -311,3 +312,58 @@ void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs) v &= ~AM33XX_MODULEMODE_MASK; am33xx_cm_write_reg(v, inst, clkctrl_offs); } + +/* + * Clockdomain low-level functions + */ + +static int am33xx_clkdm_sleep(struct clockdomain *clkdm) +{ + am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs); + return 0; +} + +static int am33xx_clkdm_wakeup(struct clockdomain *clkdm) +{ + am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs); + return 0; +} + +static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm) +{ + am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); +} + +static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm) +{ + am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); +} + +static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm) +{ + if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) + return am33xx_clkdm_wakeup(clkdm); + + return 0; +} + +static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm) +{ + bool hwsup = false; + + hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); + + if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) + am33xx_clkdm_sleep(clkdm); + + return 0; +} + +struct clkdm_ops am33xx_clkdm_operations = { + .clkdm_sleep = am33xx_clkdm_sleep, + .clkdm_wakeup = am33xx_clkdm_wakeup, + .clkdm_allow_idle = am33xx_clkdm_allow_idle, + .clkdm_deny_idle = am33xx_clkdm_deny_idle, + .clkdm_clk_enable = am33xx_clkdm_clk_enable, + .clkdm_clk_disable = am33xx_clkdm_clk_disable, +}; |