Clockdomain split series
Subsystems (5)
v2 cover Clockdomain split series
This patch series is an effort to split the clockdomain framework into platform independent and platform specific parts as was done for the powerdomain framework.
This certainlly helps remove the various cpu_is_* checks which exist today in the framework and makes the code more maintainable and readable.
The series is boot tested on OMAP2430/3430/4430SDP platforms. Also on OMAP3430SDP, OFF mode in suspend path is validated using the omap3_pm_defconfig.
This series is based on latest mainline kernel and can be found heregit://gitorious.org/omap-pm/linux.git clockdomain-split-v2
Version History
---------------
v2
-1- removed wrongly populated sleepdep support for OMAP2 -2- Fixed error handling in apis
Rajendra Nayak (5):
OMAP: clockdomain: Infrastructure to put arch specific code
OMAP: clockdomain: Arch specific funcs to handle deps
OMAP: clockdomain: Arch specific funcs for sleep/wakeup of clkdm
OMAP: clockdomain: Arch specific funcs for hwsup control of clkdm
OMAP: clockdomain: Arch specific funcs for clkdm_clk_enable/disable
arch/arm/mach-omap2/Makefile | 3 + arch/arm/mach-omap2/clock.c | 6 +- arch/arm/mach-omap2/clockdomain.c | 410 +++++++--------------- arch/arm/mach-omap2/clockdomain.h | 58 +++- arch/arm/mach-omap2/clockdomain2xxx_3xxx.c | 270 ++++++++++++++ arch/arm/mach-omap2/clockdomain44xx.c | 77 ++++ arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c | 9 +- arch/arm/mach-omap2/clockdomains44xx_data.c | 2 +- arch/arm/mach-omap2/cpuidle34xx.c | 4 +- arch/arm/mach-omap2/io.c | 6 +- arch/arm/mach-omap2/pm.c | 6 +- arch/arm/mach-omap2/pm24xx.c | 8 +- arch/arm/mach-omap2/pm34xx.c | 6 +- 13 files changed, 557 insertions(+), 308 deletions(-) create mode 100644 arch/arm/mach-omap2/clockdomain2xxx_3xxx.c create mode 100644 arch/arm/mach-omap2/clockdomain44xx.c
PATCH v2 1/5 OMAP: clockdomain: Infrastructure to put arch specific code
Put infrastructure in place, so arch specific func pointers can be hooked up to the platform-independent part of the framework.
This is in preparation of splitting the clockdomain framework into platform-independent part (for all omaps) and platform-specific parts.
--- arch/arm/mach-omap2/clockdomain.c | 10 +++++- arch/arm/mach-omap2/clockdomain.h | 37 +++++++++++++++++++++- arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c | 2 +- arch/arm/mach-omap2/clockdomains44xx_data.c | 2 +- 4 files changed, 47 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/clockdomain.c +9 -1
@@ -44,6 +44,7 @@ static LIST_HEAD(clkdm_list);/* array of clockdomain deps to be added/removed when clkdm in hwsup mode */ static struct clkdm_autodep *autodeps; +static struct clkdm_ops *arch_clkdm;/* Private functions */
@@ -292,6 +293,7 @@ static void _disable_hwsup(struct clockdomain *clkdm)* clkdm_init - set up the clockdomain layer * @clkdms: optional pointer to an array of clockdomains to register * @init_autodeps: optional pointer to an array of autodeps to register +* @custom_funcs: func pointers for arch specfic implementations * * Set up internal state. If a pointer to an array of clockdomains * @clkdms was supplied, loop through the list of clockdomains,
@@ -300,12 +302,18 @@ static void _disable_hwsup(struct clockdomain *clkdm)* @init_autodeps was provided, register those. No return value. */ void clkdm_init (struct clockdomain **clkdms, -struct clkdm_autodep *init_autodeps) +struct clkdm_autodep *init_autodeps, +struct clkdm_ops *custom_funcs) {struct clockdomain **c =NULL ;struct clockdomain *clkdm;struct clkdm_autodep *autodep =NULL ; +if (!custom_funcs) +WARN (1 ,"No custom clkdm functions registered\n" ); +else + arch_clkdm = custom_funcs; +if (clkdms)for (c = clkdms; *c; c++)_clkdm_register (*c);
arch/arm/mach-omap2/clockdomain.h +36 -1
@@ -116,7 +116,42 @@ struct clockdomain {struct list_head node; }; -void clkdm_init (struct clockdomain **clkdms,struct clkdm_autodep *autodeps); +/** +* struct clkdm_ops - Arch specfic function implementations +* @clkdm_add_wkdep: Add a wakeup dependency between clk domains +* @clkdm_del_wkdep: Delete a wakeup dependency between clk domains +* @clkdm_read_wkdep: Read wakeup dependency state between clk domains +* @clkdm_clear_all_wkdeps: Remove all wakeup dependencies from the clk domain +* @clkdm_add_sleepdep: Add a sleep dependency between clk domains +* @clkdm_del_sleepdep: Delete a sleep dependency between clk domains +* @clkdm_read_sleepdep: Read sleep dependency state between clk domains +* @clkdm_clear_all_sleepdeps: Remove all sleep dependencies from the clk domain +* @clkdm_sleep: Force a clockdomain to sleep +* @clkdm_wakeup: Force a clockdomain to wakeup +* @clkdm_allow_idle: Enable hw supervised idle transitions for clock domain +* @clkdm_deny_idle: Disable hw supervised idle transitions for clock domain +* @clkdm_clk_enable: Put the clkdm in right state for a clock enable +* @clkdm_clk_disable: Put the clkdm in right state for a clock disable +*/ +struct clkdm_ops { +int (*clkdm_add_wkdep)(struct clockdomain *clkdm1,struct clockdomain *clkdm2); +int (*clkdm_del_wkdep)(struct clockdomain *clkdm1,struct clockdomain *clkdm2); +int (*clkdm_read_wkdep)(struct clockdomain *clkdm1,struct clockdomain *clkdm2); +int (*clkdm_clear_all_wkdeps)(struct clockdomain *clkdm); +int (*clkdm_add_sleepdep)(struct clockdomain *clkdm1,struct clockdomain *clkdm2); +int (*clkdm_del_sleepdep)(struct clockdomain *clkdm1,struct clockdomain *clkdm2); +int (*clkdm_read_sleepdep)(struct clockdomain *clkdm1,struct clockdomain *clkdm2); +int (*clkdm_clear_all_sleepdeps)(struct clockdomain *clkdm); +int (*clkdm_sleep)(struct clockdomain *clkdm); +int (*clkdm_wakeup)(struct clockdomain *clkdm); +void (*clkdm_allow_idle)(struct clockdomain *clkdm); +void (*clkdm_deny_idle)(struct clockdomain *clkdm); +int (*clkdm_clk_enable)(struct clockdomain *clkdm); +int (*clkdm_clk_disable)(struct clockdomain *clkdm); +}; + +void clkdm_init (struct clockdomain **clkdms,struct clkdm_autodep *autodeps, +struct clkdm_ops *custom_funcs);struct clockdomain *clkdm_lookup (const char *name); int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c +1 -1
@@ -856,5 +856,5 @@ static struct clockdomain *clockdomains_omap2[] __initdata = {void __init omap2_clockdomains_init (void ) { -clkdm_init (clockdomains_omap2, clkdm_autodeps); +clkdm_init (clockdomains_omap2, clkdm_autodeps,NULL ); }
arch/arm/mach-omap2/clockdomains44xx_data.c +1 -1
@@ -307,5 +307,5 @@ static struct clockdomain *clockdomains_omap44xx[] __initdata = {void __init omap44xx_clockdomains_init (void ) { -clkdm_init (clockdomains_omap44xx,NULL ); +clkdm_init (clockdomains_omap44xx,NULL ,NULL ); }
Signature · 1 line
1.7.0.4
PATCH v2 2/5 OMAP: clockdomain: Arch specific funcs to handle deps
Define the following architecture specific funtions for omap2/3 .clkdm_add_wkdep
.clkdm_del_wkdep
.clkdm_read_wkdep
.clkdm_clear_all_wkdeps
.clkdm_add_sleepdep
.clkdm_del_sleepdep
.clkdm_read_sleepdep
.clkdm_clear_all_sleepdeps
Convert the platform-independent framework to call these functions. With this also move the clkdm lookups for all wkdep_srcs and sleepdep_srcs at clkdm_init.
--- arch/arm/mach-omap2/Makefile | 2 + arch/arm/mach-omap2/clockdomain.c | 160 +++++++++++----------- arch/arm/mach-omap2/clockdomain.h | 6 +- arch/arm/mach-omap2/clockdomain2xxx_3xxx.c | 126 +++++++++++++++++ arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c | 9 +- arch/arm/mach-omap2/io.c | 6 +- 6 files changed, 225 insertions(+), 84 deletions(-) create mode 100644 arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
arch/arm/mach-omap2/Makefile +2 -0
@@ -102,8 +102,10 @@ obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common) \ # PRCM clockdomain control obj-$(CONFIG_ARCH_OMAP2) += clockdomain.o \ + clockdomain2xxx_3xxx.o \ clockdomains2xxx_3xxx_data.o obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \ + clockdomain2xxx_3xxx.o \ clockdomains2xxx_3xxx_data.o obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \ clockdomains44xx_data.o
arch/arm/mach-omap2/clockdomain.c +82 -78
312 lines not on this page · raw message
arch/arm/mach-omap2/clockdomain.h +5 -1
@@ -176,7 +176,11 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm);int omap2_clkdm_clk_enable (struct clockdomain *clkdm,struct clk *clk);int omap2_clkdm_clk_disable (struct clockdomain *clkdm,struct clk *clk); -extern void __init omap2_clockdomains_init (void ); +extern void __init omap2xxx_clockdomains_init (void ); +extern void __init omap3xxx_clockdomains_init (void );extern void __init omap44xx_clockdomains_init (void ); +extern struct clkdm_ops omap2_clkdm_operations; +extern struct clkdm_ops omap3_clkdm_operations; +#endif
arch/arm/mach-omap2/clockdomain2xxx_3xxx.c new file +126 -0
126 lines not on this page · raw message
arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c +7 -2
@@ -854,7 +854,12 @@ static struct clockdomain *clockdomains_omap2[] __initdata = { NULL, }; -void __init omap2_clockdomains_init (void ) +void __init omap2xxx_clockdomains_init (void ) { -clkdm_init (clockdomains_omap2, clkdm_autodeps,NULL ); +clkdm_init (clockdomains_omap2, clkdm_autodeps, &omap2_clkdm_operations); +} + +void __init omap3xxx_clockdomains_init (void ) +{ +clkdm_init (clockdomains_omap2, clkdm_autodeps, &omap3_clkdm_operations); }
arch/arm/mach-omap2/io.c +3 -3
@@ -339,15 +339,15 @@ void __init omap2_init_common_infrastructure(void)if (cpu_is_omap242x ()) {omap2xxx_powerdomains_init (); -omap2_clockdomains_init (); +omap2xxx_clockdomains_init ();omap2420_hwmod_init (); }else if (cpu_is_omap243x ()) {omap2xxx_powerdomains_init (); -omap2_clockdomains_init (); +omap2xxx_clockdomains_init ();omap2430_hwmod_init (); }else if (cpu_is_omap34xx ()) {omap3xxx_powerdomains_init (); -omap2_clockdomains_init (); +omap3xxx_clockdomains_init ();omap3xxx_hwmod_init (); }else if (cpu_is_omap44xx ()) {omap44xx_powerdomains_init ();
Signature · 1 line
1.7.0.4
PATCH v2 3/5 OMAP: clockdomain: Arch specific funcs for sleep/wakeup of clkdm
Define the following architecture specific funtions for omap2/3/4 .clkdm_sleep
.clkdm_wakeup
Convert the platform-independent framework to call these functions. Also rename the api's by removing the omap2_ preamble. Hence call omap2_clkdm_wakeup as clkdm_wakeup and omap2_clkdm_sleep as clkdm_sleep.
--- arch/arm/mach-omap2/Makefile | 1 + arch/arm/mach-omap2/clockdomain.c | 64 ++++++-------------------- arch/arm/mach-omap2/clockdomain.h | 5 +- arch/arm/mach-omap2/clockdomain2xxx_3xxx.c | 35 +++++++++++++++ arch/arm/mach-omap2/clockdomain44xx.c | 35 +++++++++++++++ arch/arm/mach-omap2/clockdomains44xx_data.c | 2 +- arch/arm/mach-omap2/pm.c | 4 +- arch/arm/mach-omap2/pm24xx.c | 6 +- arch/arm/mach-omap2/pm34xx.c | 2 +- 9 files changed, 96 insertions(+), 58 deletions(-) create mode 100644 arch/arm/mach-omap2/clockdomain44xx.c
arch/arm/mach-omap2/Makefile +1 -0
@@ -108,6 +108,7 @@ obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \ clockdomain2xxx_3xxx.o \ clockdomains2xxx_3xxx_data.o obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \ + clockdomain44xx.o \ clockdomains44xx_data.o # Clock framework obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \
arch/arm/mach-omap2/clockdomain.c +15 -49
119 lines not on this page · raw message
arch/arm/mach-omap2/clockdomain.h +3 -2
@@ -170,8 +170,8 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);void omap2_clkdm_allow_idle (struct clockdomain *clkdm);void omap2_clkdm_deny_idle (struct clockdomain *clkdm); -int omap2_clkdm_wakeup (struct clockdomain *clkdm); -int omap2_clkdm_sleep (struct clockdomain *clkdm); +int clkdm_wakeup (struct clockdomain *clkdm); +int clkdm_sleep (struct clockdomain *clkdm);int omap2_clkdm_clk_enable (struct clockdomain *clkdm,struct clk *clk);int omap2_clkdm_clk_disable (struct clockdomain *clkdm,struct clk *clk);
@@ -182,5 +182,6 @@ extern void __init omap44xx_clockdomains_init(void);extern struct clkdm_ops omap2_clkdm_operations;extern struct clkdm_ops omap3_clkdm_operations; +extern struct clkdm_ops omap4_clkdm_operations;#endif
arch/arm/mach-omap2/clockdomain2xxx_3xxx.c +35 -0
@@ -20,6 +20,7 @@#include "cm2xxx_3xxx.h" #include "cm-regbits-24xx.h" #include "cm-regbits-34xx.h" +#include "prm-regbits-24xx.h" #include "clockdomain.h" static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
@@ -107,11 +108,43 @@ static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)return 0 ; } +static int omap2_clkdm_sleep (struct clockdomain *clkdm) +{ +omap2_cm_set_mod_reg_bits (OMAP24XX_FORCESTATE_MASK , + clkdm->pwrdm.ptr->prcm_offs, +OMAP2_PM_PWSTCTRL ); +return 0 ; +} + +static int omap2_clkdm_wakeup (struct clockdomain *clkdm) +{ +omap2_cm_clear_mod_reg_bits (OMAP24XX_FORCESTATE_MASK , + clkdm->pwrdm.ptr->prcm_offs, +OMAP2_PM_PWSTCTRL ); +return 0 ; +} + +static int omap3_clkdm_sleep (struct clockdomain *clkdm) +{ +omap3xxx_cm_clkdm_force_sleep (clkdm->pwrdm.ptr->prcm_offs, + clkdm->clktrctrl_mask); +return 0 ; +} + +static int omap3_clkdm_wakeup (struct clockdomain *clkdm) +{ +omap3xxx_cm_clkdm_force_wakeup (clkdm->pwrdm.ptr->prcm_offs, + clkdm->clktrctrl_mask); +return 0 ; +} +struct clkdm_ops omap2_clkdm_operations = { .clkdm_add_wkdep = omap2_clkdm_add_wkdep, .clkdm_del_wkdep = omap2_clkdm_del_wkdep, .clkdm_read_wkdep = omap2_clkdm_read_wkdep, .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, + .clkdm_sleep = omap2_clkdm_sleep, + .clkdm_wakeup = omap2_clkdm_wakeup, };struct clkdm_ops omap3_clkdm_operations = {
@@ -123,4 +156,6 @@ struct clkdm_ops omap3_clkdm_operations = { .clkdm_del_sleepdep = omap3_clkdm_del_sleepdep, .clkdm_read_sleepdep = omap3_clkdm_read_sleepdep, .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps, + .clkdm_sleep = omap3_clkdm_sleep, + .clkdm_wakeup = omap3_clkdm_wakeup, };
arch/arm/mach-omap2/clockdomain44xx.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* OMAP4 clockdomain control +* +* Copyright (C) 2008-2010 Texas Instruments, Inc. +* Copyright (C) 2008-2010 Nokia Corporation +* +* Derived from mach-omap2/clockdomain.c written by Paul Walmsley +* Rajendra Nayak <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include "clockdomain.h" +#include "cminst44xx.h" + +static int omap4_clkdm_sleep (struct clockdomain *clkdm) +{ +omap4_cminst_clkdm_force_sleep (clkdm->prcm_partition, + clkdm->cm_inst, clkdm->clkdm_offs); +return 0 ; +} + +static int omap4_clkdm_wakeup (struct clockdomain *clkdm) +{ +omap4_cminst_clkdm_force_wakeup (clkdm->prcm_partition, + clkdm->cm_inst, clkdm->clkdm_offs); +return 0 ; +} + +struct clkdm_ops omap4_clkdm_operations = { + .clkdm_sleep = omap4_clkdm_sleep, + .clkdm_wakeup = omap4_clkdm_wakeup, +};
arch/arm/mach-omap2/clockdomains44xx_data.c +1 -1
@@ -307,5 +307,5 @@ static struct clockdomain *clockdomains_omap44xx[] __initdata = {void __init omap44xx_clockdomains_init (void ) { -clkdm_init (clockdomains_omap44xx,NULL ,NULL ); +clkdm_init (clockdomains_omap44xx,NULL , &omap4_clkdm_operations); }
arch/arm/mach-omap2/pm.c +2 -2
@@ -124,7 +124,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state) (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) { sleep_switch = LOWPOWERSTATE_SWITCH; } else { -omap2_clkdm_wakeup (pwrdm->pwrdm_clkdms[0 ]); +clkdm_wakeup (pwrdm->pwrdm_clkdms[0 ]);pwrdm_wait_transition (pwrdm); sleep_switch =FORCEWAKEUP_SWITCH ; }
@@ -142,7 +142,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)if (pwrdm->pwrdm_clkdms[0 ]->flags &CLKDM_CAN_ENABLE_AUTO )omap2_clkdm_allow_idle (pwrdm->pwrdm_clkdms[0 ]);else -omap2_clkdm_sleep (pwrdm->pwrdm_clkdms[0 ]); +clkdm_sleep (pwrdm->pwrdm_clkdms[0 ]);break ;case LOWPOWERSTATE_SWITCH :pwrdm_set_lowpwrstchange (pwrdm);
arch/arm/mach-omap2/pm24xx.c +3 -3
@@ -370,7 +370,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)omap2_clkdm_allow_idle (clkdm); else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && atomic_read(&clkdm->usecount) == 0) -omap2_clkdm_sleep (clkdm); +clkdm_sleep (clkdm);return 0 ; }
@@ -405,11 +405,11 @@ static void __init prcm_setup_regs(void) pwrdm =clkdm_get_pwrdm (dsp_clkdm);pwrdm_set_next_pwrst (pwrdm,PWRDM_POWER_OFF ); -omap2_clkdm_sleep (dsp_clkdm); +clkdm_sleep (dsp_clkdm); pwrdm =clkdm_get_pwrdm (gfx_clkdm);pwrdm_set_next_pwrst (pwrdm,PWRDM_POWER_OFF ); -omap2_clkdm_sleep (gfx_clkdm); +clkdm_sleep (gfx_clkdm);/* * Clear clockdomain wakeup dependencies and enable
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -992,7 +992,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)omap2_clkdm_allow_idle (clkdm); else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && atomic_read(&clkdm->usecount) == 0) -omap2_clkdm_sleep (clkdm); +clkdm_sleep (clkdm);return 0 ; }
Signature · 1 line
1.7.0.4
PATCH v2 4/5 OMAP: clockdomain: Arch specific funcs for hwsup control of clkdm
Define the following architecture specific funtions for omap2/3/4 .clkdm_allow_idle
.clkdm_deny_idle
Convert the platform-independent framework to call these functions. Also rename the api's by removing the omap2_ preamble. Hence call omap2_clkdm_allow_idle as clkdm_allow_idle and omap2_clkdm_deny_idle as clkdm_deny_idle.
Make the _clkdm_add_autodeps and _clkdm_del_autodeps as non-static so they can be accessed from OMAP2/3 platform specific code.
--- arch/arm/mach-omap2/clockdomain.c | 49 ++++++++------------------- arch/arm/mach-omap2/clockdomain.h | 6 ++- arch/arm/mach-omap2/clockdomain2xxx_3xxx.c | 40 ++++++++++++++++++++++ arch/arm/mach-omap2/clockdomain44xx.c | 14 ++++++++ arch/arm/mach-omap2/cpuidle34xx.c | 4 +- arch/arm/mach-omap2/pm.c | 2 +- arch/arm/mach-omap2/pm24xx.c | 2 +- arch/arm/mach-omap2/pm34xx.c | 4 +- 8 files changed, 79 insertions(+), 42 deletions(-)
arch/arm/mach-omap2/clockdomain.c +15 -34
@@ -178,7 +178,7 @@ static void _autodep_lookup(struct clkdm_autodep *autodep)* XXX autodeps are deprecated and should be removed at the earliest * opportunity */ -static void _clkdm_add_autodeps (struct clockdomain *clkdm) +void _clkdm_add_autodeps (struct clockdomain *clkdm) {struct clkdm_autodep *autodep;
@@ -212,7 +212,7 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)* XXX autodeps are deprecated and should be removed at the earliest * opportunity */ -static void _clkdm_del_autodeps (struct clockdomain *clkdm) +void _clkdm_del_autodeps (struct clockdomain *clkdm) {struct clkdm_autodep *autodep;
@@ -332,7 +332,7 @@ void clkdm_init(struct clockdomain **clkdms,if (clkdm->flags &CLKDM_CAN_FORCE_WAKEUP )clkdm_wakeup (clkdm);else if (clkdm->flags &CLKDM_CAN_DISABLE_AUTO ) -omap2_clkdm_deny_idle (clkdm); +clkdm_deny_idle (clkdm);for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {if (!omap_chip_is (cd->omap_chip))
@@ -780,7 +780,7 @@ int clkdm_wakeup(struct clockdomain *clkdm) }/** -* omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm +* clkdm_allow_idle - enable hwsup idle transitions for clkdm * @clkdm: struct clockdomain * * * Allow the hardware to automatically switch the clockdomain @clkdm into
@@ -789,7 +789,7 @@ int clkdm_wakeup(struct clockdomain *clkdm)* framework, wkdep/sleepdep autodependencies are added; this is so * device drivers can read and write to the device. No return value. */ -void omap2_clkdm_allow_idle (struct clockdomain *clkdm) +void clkdm_allow_idle (struct clockdomain *clkdm) {if (!clkdm)return ;
@@ -800,28 +800,18 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)return ; } +if (!arch_clkdm || !arch_clkdm->clkdm_allow_idle) +return ; +pr_debug ("clockdomain: enabling automatic idle transitions for %s\n" , clkdm->name); -/* -* XXX This should be removed once TI adds wakeup/sleep -* dependency code and data for OMAP4. -*/ -if (cpu_is_omap44xx ()) { -WARN_ONCE (1 ,"clockdomain: OMAP4 wakeup/sleep dependency " -"support is not yet implemented\n" ); - }else { -if (atomic_read (&clkdm->usecount) >0 ) -_clkdm_add_autodeps (clkdm); - } - -_enable_hwsup (clkdm); - + arch_clkdm->clkdm_allow_idle (clkdm);pwrdm_clkdm_state_switch (clkdm); }/** -* omap2_clkdm_deny_idle - disable hwsup idle transitions for clkdm +* clkdm_deny_idle - disable hwsup idle transitions for clkdm * @clkdm: struct clockdomain * * * Prevent the hardware from automatically switching the clockdomain
@@ -829,7 +819,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)* downstream clocks enabled in the clock framework, wkdep/sleepdep * autodependencies are removed. No return value. */ -void omap2_clkdm_deny_idle (struct clockdomain *clkdm) +void clkdm_deny_idle (struct clockdomain *clkdm) {if (!clkdm)return ;
@@ -840,22 +830,13 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)return ; } +if (!arch_clkdm || !arch_clkdm->clkdm_deny_idle) +return ; +pr_debug ("clockdomain: disabling automatic idle transitions for %s\n" , clkdm->name); -_disable_hwsup (clkdm); - -/* -* XXX This should be removed once TI adds wakeup/sleep -* dependency code and data for OMAP4. -*/ -if (cpu_is_omap44xx ()) { -WARN_ONCE (1 ,"clockdomain: OMAP4 wakeup/sleep dependency " -"support is not yet implemented\n" ); - }else { -if (atomic_read (&clkdm->usecount) >0 ) -_clkdm_del_autodeps (clkdm); - } + arch_clkdm->clkdm_deny_idle (clkdm); }
arch/arm/mach-omap2/clockdomain.h +4 -2
@@ -167,8 +167,8 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);int clkdm_read_sleepdep (struct clockdomain *clkdm1,struct clockdomain *clkdm2);int clkdm_clear_all_sleepdeps (struct clockdomain *clkdm); -void omap2_clkdm_allow_idle (struct clockdomain *clkdm); -void omap2_clkdm_deny_idle (struct clockdomain *clkdm); +void clkdm_allow_idle (struct clockdomain *clkdm); +void clkdm_deny_idle (struct clockdomain *clkdm);int clkdm_wakeup (struct clockdomain *clkdm);int clkdm_sleep (struct clockdomain *clkdm);
@@ -179,6 +179,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);extern void __init omap2xxx_clockdomains_init (void );extern void __init omap3xxx_clockdomains_init (void );extern void __init omap44xx_clockdomains_init (void ); +extern void _clkdm_add_autodeps (struct clockdomain *clkdm); +extern void _clkdm_del_autodeps (struct clockdomain *clkdm);extern struct clkdm_ops omap2_clkdm_operations;extern struct clkdm_ops omap3_clkdm_operations;
arch/arm/mach-omap2/clockdomain2xxx_3xxx.c +40 -0
@@ -124,6 +124,24 @@ static int omap2_clkdm_wakeup(struct clockdomain *clkdm)return 0 ; } +static void omap2_clkdm_allow_idle (struct clockdomain *clkdm) +{ +if (atomic_read (&clkdm->usecount) >0 ) +_clkdm_add_autodeps (clkdm); + +omap2xxx_cm_clkdm_enable_hwsup (clkdm->pwrdm.ptr->prcm_offs, + clkdm->clktrctrl_mask); +} + +static void omap2_clkdm_deny_idle (struct clockdomain *clkdm) +{ +omap2xxx_cm_clkdm_disable_hwsup (clkdm->pwrdm.ptr->prcm_offs, + clkdm->clktrctrl_mask); + +if (atomic_read (&clkdm->usecount) >0 ) +_clkdm_del_autodeps (clkdm); +} +static int omap3_clkdm_sleep (struct clockdomain *clkdm) { omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
@@ -138,6 +156,24 @@ static int omap3_clkdm_wakeup(struct clockdomain *clkdm)return 0 ; } +static void omap3_clkdm_allow_idle (struct clockdomain *clkdm) +{ +if (atomic_read (&clkdm->usecount) >0 ) +_clkdm_add_autodeps (clkdm); + +omap3xxx_cm_clkdm_enable_hwsup (clkdm->pwrdm.ptr->prcm_offs, + clkdm->clktrctrl_mask); +} + +static void omap3_clkdm_deny_idle (struct clockdomain *clkdm) +{ +omap3xxx_cm_clkdm_disable_hwsup (clkdm->pwrdm.ptr->prcm_offs, + clkdm->clktrctrl_mask); + +if (atomic_read (&clkdm->usecount) >0 ) +_clkdm_del_autodeps (clkdm); +} +struct clkdm_ops omap2_clkdm_operations = { .clkdm_add_wkdep = omap2_clkdm_add_wkdep, .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
@@ -145,6 +181,8 @@ struct clkdm_ops omap2_clkdm_operations = { .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, .clkdm_sleep = omap2_clkdm_sleep, .clkdm_wakeup = omap2_clkdm_wakeup, + .clkdm_allow_idle = omap2_clkdm_allow_idle, + .clkdm_deny_idle = omap2_clkdm_deny_idle, };struct clkdm_ops omap3_clkdm_operations = {
@@ -158,4 +196,6 @@ struct clkdm_ops omap3_clkdm_operations = { .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps, .clkdm_sleep = omap3_clkdm_sleep, .clkdm_wakeup = omap3_clkdm_wakeup, + .clkdm_allow_idle = omap3_clkdm_allow_idle, + .clkdm_deny_idle = omap3_clkdm_deny_idle, };
arch/arm/mach-omap2/clockdomain44xx.c +14 -0
@@ -29,7 +29,21 @@ static int omap4_clkdm_wakeup(struct clockdomain *clkdm)return 0 ; } +static void omap4_clkdm_allow_idle (struct clockdomain *clkdm) +{ +omap4_cminst_clkdm_enable_hwsup (clkdm->prcm_partition, + clkdm->cm_inst, clkdm->clkdm_offs); +} + +static void omap4_clkdm_deny_idle (struct clockdomain *clkdm) +{ +omap4_cminst_clkdm_disable_hwsup (clkdm->prcm_partition, + clkdm->cm_inst, clkdm->clkdm_offs); +} +struct clkdm_ops omap4_clkdm_operations = { .clkdm_sleep = omap4_clkdm_sleep, .clkdm_wakeup = omap4_clkdm_wakeup, + .clkdm_allow_idle = omap4_clkdm_allow_idle, + .clkdm_deny_idle = omap4_clkdm_deny_idle, };
arch/arm/mach-omap2/cpuidle34xx.c +2 -2
@@ -99,14 +99,14 @@ static int omap3_idle_bm_check(void)static int _cpuidle_allow_idle (struct powerdomain *pwrdm,struct clockdomain *clkdm) { -omap2_clkdm_allow_idle (clkdm); +clkdm_allow_idle (clkdm);return 0 ; }static int _cpuidle_deny_idle (struct powerdomain *pwrdm,struct clockdomain *clkdm) { -omap2_clkdm_deny_idle (clkdm); +clkdm_deny_idle (clkdm);return 0 ; }
arch/arm/mach-omap2/pm.c +1 -1
@@ -140,7 +140,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)switch (sleep_switch) {case FORCEWAKEUP_SWITCH :if (pwrdm->pwrdm_clkdms[0 ]->flags &CLKDM_CAN_ENABLE_AUTO ) -omap2_clkdm_allow_idle (pwrdm->pwrdm_clkdms[0 ]); +clkdm_allow_idle (pwrdm->pwrdm_clkdms[0 ]);else clkdm_sleep (pwrdm->pwrdm_clkdms[0 ]);break ;
arch/arm/mach-omap2/pm24xx.c +1 -1
@@ -367,7 +367,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)clkdm_clear_all_sleepdeps (clkdm);if (clkdm->flags &CLKDM_CAN_ENABLE_AUTO ) -omap2_clkdm_allow_idle (clkdm); +clkdm_allow_idle (clkdm);else if (clkdm->flags &CLKDM_CAN_FORCE_SLEEP &&atomic_read (&clkdm->usecount) ==0 )clkdm_sleep (clkdm);
arch/arm/mach-omap2/pm34xx.c +2 -2
@@ -495,7 +495,7 @@ console_still_active:pwrdm_post_transition (); -omap2_clkdm_allow_idle (mpu_pwrdm->pwrdm_clkdms[0 ]); +clkdm_allow_idle (mpu_pwrdm->pwrdm_clkdms[0 ]); }int omap3_can_sleep (void )
@@ -989,7 +989,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)static int __init clkdms_setup (struct clockdomain *clkdm,void *unused) {if (clkdm->flags &CLKDM_CAN_ENABLE_AUTO ) -omap2_clkdm_allow_idle (clkdm); +clkdm_allow_idle (clkdm);else if (clkdm->flags &CLKDM_CAN_FORCE_SLEEP &&atomic_read (&clkdm->usecount) ==0 )clkdm_sleep (clkdm);
Signature · 1 line
1.7.0.4
PATCH v2 5/5 OMAP: clockdomain: Arch specific funcs for clkdm_clk_enable/disable
Define the following architecture specific funtions for omap2/3/4 .clkdm_clk_enable
.clkdm_clk_disable
Convert the platform-independent framework to call these functions. Also rename the api's by removing the omap2_ preamble. Hence call omap2_clkdm_k_enable as clkdm_clk_enable and omap2_clkdm_clk_disable as clkdm_clk_disable.a
Remove unused functions (_enable/_disable_hwsup) and unsed headers from clockdomain.c file.
--- arch/arm/mach-omap2/clock.c | 6 +- arch/arm/mach-omap2/clockdomain.c | 131 +++------------------------- arch/arm/mach-omap2/clockdomain.h | 4 +- arch/arm/mach-omap2/clockdomain2xxx_3xxx.c | 69 +++++++++++++++ arch/arm/mach-omap2/clockdomain44xx.c | 28 ++++++ 5 files changed, 114 insertions(+), 124 deletions(-)
arch/arm/mach-omap2/clock.c +3 -3
@@ -264,7 +264,7 @@ void omap2_clk_disable(struct clk *clk) clk->ops->disable (clk);if (clk->clkdm) -omap2_clkdm_clk_disable (clk->clkdm, clk); +clkdm_clk_disable (clk->clkdm, clk);if (clk->parent)omap2_clk_disable (clk->parent);
@@ -304,7 +304,7 @@ int omap2_clk_enable(struct clk *clk) }if (clk->clkdm) { - ret =omap2_clkdm_clk_enable (clk->clkdm, clk); + ret =clkdm_clk_enable (clk->clkdm, clk);if (ret) {WARN (1 ,"clock: %s: could not enable clockdomain %s: " "%d\n" , clk->name, clk->clkdm->name, ret);
@@ -322,7 +322,7 @@ int omap2_clk_enable(struct clk *clk) oce_err3:if (clk->clkdm) -omap2_clkdm_clk_disable (clk->clkdm, clk); +clkdm_clk_disable (clk->clkdm, clk); oce_err2:if (clk->parent)omap2_clk_disable (clk->parent);
arch/arm/mach-omap2/clockdomain.c +12 -119
195 lines not on this page · raw message
arch/arm/mach-omap2/clockdomain.h +2 -2
@@ -173,8 +173,8 @@ void clkdm_deny_idle(struct clockdomain *clkdm);int clkdm_wakeup (struct clockdomain *clkdm);int clkdm_sleep (struct clockdomain *clkdm); -int omap2_clkdm_clk_enable (struct clockdomain *clkdm,struct clk *clk); -int omap2_clkdm_clk_disable (struct clockdomain *clkdm,struct clk *clk); +int clkdm_clk_enable (struct clockdomain *clkdm,struct clk *clk); +int clkdm_clk_disable (struct clockdomain *clkdm,struct clk *clk);extern void __init omap2xxx_clockdomains_init (void );extern void __init omap3xxx_clockdomains_init (void );
arch/arm/mach-omap2/clockdomain2xxx_3xxx.c +69 -0
85 lines not on this page · raw message
arch/arm/mach-omap2/clockdomain44xx.c +28 -0
@@ -41,9 +41,37 @@ static void omap4_clkdm_deny_idle(struct clockdomain *clkdm) clkdm->cm_inst, clkdm->clkdm_offs); } +static int omap4_clkdm_clk_enable (struct clockdomain *clkdm) +{ +bool hwsup = false; + + hwsup =omap4_cminst_is_clkdm_in_hwsup (clkdm->prcm_partition, + clkdm->cm_inst, clkdm->clkdm_offs); + +if (!hwsup) +clkdm_wakeup (clkdm); + +return 0 ; +} + +static int omap4_clkdm_clk_disable (struct clockdomain *clkdm) +{ +bool hwsup = false; + + hwsup =omap4_cminst_is_clkdm_in_hwsup (clkdm->prcm_partition, + clkdm->cm_inst, clkdm->clkdm_offs); + +if (!hwsup) +clkdm_sleep (clkdm); + +return 0 ; +} +struct clkdm_ops omap4_clkdm_operations = { .clkdm_sleep = omap4_clkdm_sleep, .clkdm_wakeup = omap4_clkdm_wakeup, .clkdm_allow_idle = omap4_clkdm_allow_idle, .clkdm_deny_idle = omap4_clkdm_deny_idle, + .clkdm_clk_enable = omap4_clkdm_clk_enable, + .clkdm_clk_disable = omap4_clkdm_clk_disable, };
Signature · 1 line
1.7.0.4
Paul Walmsley
maintainerHi Rajendra,
Quoted 8 lines · Rajendra Nayak
This patch series is an effort to split the clockdomain framework into platform independent and platform specific parts as was done for the powerdomain framework.
This certainlly helps remove the various cpu_is_* checks which exist today in the framework and makes the code more maintainable and readable.
Quoted 7 lines
The series is boot tested on OMAP2430/3430/4430SDP platforms. Also on OMAP3430SDP, OFF mode in suspend path is validated using the
omap3_pm_defconfig.This series is based on latest mainline kernel and can be found here
git://gitorious.org/omap-pm/linux.gitclockdomain-split-v2
Thanks. I've queued these five patches, along with your powerdomain trivial header file removal fix, for 2.6.39. They are in the 'pwrdm_clkdm_a_2.6.39' branch of git://git.pwsan.com/linux-2.6 - the branch is currently based on v2.6.38-rc2.
- Paul
Quoted 23 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Tuesday, January 25, 2011 12:51 PM
To: Rajendra Nayak
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2 0/5] Clockdomain split seriesHi Rajendra,
Quoted 12 lines · Rajendra Nayak
This patch series is an effort to split the clockdomain framework into platform independent and platform specific parts as was done for the powerdomain framework.
This certainlly helps remove the various cpu_is_* checks which exist today in the framework and makes the code more maintainable and readable.
The series is boot tested on OMAP2430/3430/4430SDP platforms. Also on OMAP3430SDP, OFF mode in suspend path is validated using the
omap3_pm_defconfig.
Quoted 8 lines
Quoted 3 lines
This series is based on latest mainline kernel and can be found here
git://gitorious.org/omap-pm/linux.gitclockdomain-split-v2Thanks. I've queued these five patches, along with your powerdomain trivial header file removal fix, for 2.6.39. They are in the 'pwrdm_clkdm_a_2.6.39' branch of
git://git.pwsan.com/linux-2.6- the branch is currently based on v2.6.38-rc2.
Thanks Paul.
Quoted 3 lines
- Paul
Paul Walmsley
maintainerQuoted 1 line · Rajendra Nayak
Thanks Paul.
By the way, could you please repost these one more time with the linux-arm-kernel mailing list cc'ed? That way I won't have to do it, and any comments that others might have on that list can go to the appropriate people.
- Paul
Quoted 7 lines
-----Original Message-----
From: Paul Walmsley [mailto:[email protected]]
Sent: Tuesday, January 25, 2011 12:53 PM
To: Rajendra Nayak
Cc: [email protected]; Benoit Cousson; Kevin Hilman
Subject: RE: [PATCH v2 0/5] Clockdomain split series
Quoted 8 lines
Quoted 1 line · Rajendra Nayak
Thanks Paul.
By the way, could you please repost these one more time with the linux-arm-kernel mailing list cc'ed? That way I won't have to do it, and any comments that others might have on that list can go to the appropriate people.
Sure, will do.
Quoted 3 lines
- Paul