From patchwork Thu Nov 8 01:12:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 12726 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 094EB23E37 for ; Thu, 8 Nov 2012 01:13:34 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id AECEBA192A0 for ; Thu, 8 Nov 2012 01:13:33 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3284274iej.11 for ; Wed, 07 Nov 2012 17:13:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:x-gm-message-state; bh=FYxwvgubgaS5ylOjKByKF/fpRHWIk9cuKSSPWqbx8yU=; b=MzM8tM7821fwk7yPP0Vqpr3TEAK2emnxqh/6q8ogtXKLAgVj82nnm4IN2NLxmrRGFl vMojkcg3Fd4xRXeo4KM6+gcEbPSCCYiGRNT6AT++M1YaqhkzkdZQUr+FFHcoAsNyO/dT SqJMtLh8b2sOaK/ijF+ZlHHMc5XZorpH9KHWDGR4/uIfdDzm99MXR3wJtwrhI66jrO0i //tNVVzFpHXV51s61h0L0bM7LmHDEmWzEDyVod6+hYRQpjAtT+CMTfltvWOdhJA6fN7W TEgQXBVv3HRBJEJyK+6LARkPF+QkdDDVrEbcCtj4iPM7nwxnRf84wnhkPoqHlAkdkZyT 0fYA== Received: by 10.42.203.146 with SMTP id fi18mr5709572icb.18.1352337213483; Wed, 07 Nov 2012 17:13:33 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp304315igt; Wed, 7 Nov 2012 17:13:32 -0800 (PST) Received: by 10.182.131.100 with SMTP id ol4mr4345047obb.38.1352337212154; Wed, 07 Nov 2012 17:13:32 -0800 (PST) Received: from bear.ext.ti.com (bear.ext.ti.com. [192.94.94.41]) by mx.google.com with ESMTPS id b2si22787890oec.49.2012.11.07.17.13.31 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 07 Nov 2012 17:13:32 -0800 (PST) Received-SPF: pass (google.com: domain of mturquette@ti.com designates 192.94.94.41 as permitted sender) client-ip=192.94.94.41; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mturquette@ti.com designates 192.94.94.41 as permitted sender) smtp.mail=mturquette@ti.com Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id qA81DVNY023987; Wed, 7 Nov 2012 19:13:31 -0600 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qA81DVui003740; Wed, 7 Nov 2012 19:13:31 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Wed, 7 Nov 2012 19:13:31 -0600 Received: from nucleus.nsc.com (nucleus.nsc.com [10.188.36.112]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id qA81DPLX015450; Wed, 7 Nov 2012 19:13:30 -0600 From: Mike Turquette To: CC: , , , , Mike Turquette Subject: [PATCH 07/26] ARM: OMAP: clock: list all clk_hw_omap clks to enable/disable autoidle Date: Wed, 7 Nov 2012 17:12:42 -0800 Message-ID: <1352337181-29427-8-git-send-email-mturquette@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1352337181-29427-1-git-send-email-mturquette@ti.com> References: <1352337181-29427-1-git-send-email-mturquette@ti.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmUCdqFepJQP0YSc4MZUoEJ6cODag6+KmgtXiciIjfMNmqo+UCysgPlGQsD8ahdEarv33n1 From: Rajendra Nayak Platforms can call omap2_init_clk_hw_omap_clocks() to register a clock using clk_hw_omap. omap2_clk_enable_autoidle_all() and omap2_clk_disable_autoidle_all() can then be used to run through all the clocks which support autoidle to enable/disable them. Signed-off-by: Rajendra Nayak Signed-off-by: Mike Turquette --- arch/arm/mach-omap2/clock.c | 32 ++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock.h | 3 +++ arch/arm/mach-omap2/io.c | 27 +++++++++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod.c | 4 ++-- 4 files changed, 64 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 3a4c1c5..2b4cfae 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -57,6 +57,7 @@ static DEFINE_MUTEX(clocks_mutex); static DEFINE_SPINLOCK(clockfw_lock); #ifdef CONFIG_COMMON_CLK +LIST_HEAD(clk_hw_omap_clocks); /* * Used for clocks that have the same value as the parent clock, @@ -426,6 +427,37 @@ static int __init omap_clk_setup(char *str) } __setup("mpurate=", omap_clk_setup); +void omap2_init_clk_hw_omap_clocks(struct clk *clk) +{ + struct clk_hw_omap *c; + + if (__clk_get_flags(clk) & CLK_IS_BASIC) + return; + + c = to_clk_hw_omap(__clk_get_hw(clk)); + list_add(&c->node, &clk_hw_omap_clocks); +} + +int omap2_clk_enable_autoidle_all(void) +{ + struct clk_hw_omap *c; + + list_for_each_entry(c, &clk_hw_omap_clocks, node) + if (c->ops && c->ops->allow_idle) + c->ops->allow_idle(c); + return 0; +} + +int omap2_clk_disable_autoidle_all(void) +{ + struct clk_hw_omap *c; + + list_for_each_entry(c, &clk_hw_omap_clocks, node) + if (c->ops && c->ops->deny_idle) + c->ops->deny_idle(c); + return 0; +} + const struct clk_hw_omap_ops clkhwops_wait = { .find_idlest = omap2_clk_dflt_find_idlest, .find_companion = omap2_clk_dflt_find_companion, diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index d78f90e..b075831 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h @@ -562,6 +562,9 @@ void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk, void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk, void __iomem **idlest_reg, u8 *idlest_bit, u8 *idlest_val); +void omap2_init_clk_hw_omap_clocks(struct clk *clk); +int omap2_clk_enable_autoidle_all(void); +int omap2_clk_disable_autoidle_all(void); #else int omap2_dflt_clk_enable(struct clk *clk); void omap2_dflt_clk_disable(struct clk *clk); diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 4fadc78..a62010e 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -393,6 +393,9 @@ void __init omap2420_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap2_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } #endif @@ -415,6 +418,9 @@ void __init omap2430_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap2_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } #endif @@ -476,6 +482,9 @@ void __init omap3_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init omap3430_init_late(void) @@ -483,6 +492,9 @@ void __init omap3430_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init omap35xx_init_late(void) @@ -490,6 +502,9 @@ void __init omap35xx_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init omap3630_init_late(void) @@ -497,6 +512,9 @@ void __init omap3630_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init am35xx_init_late(void) @@ -504,6 +522,9 @@ void __init am35xx_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init ti81xx_init_late(void) @@ -511,6 +532,9 @@ void __init ti81xx_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } #endif @@ -550,6 +574,9 @@ void __init omap4430_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap4_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } #endif diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 1754d7e..ce93ec0 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -623,12 +623,12 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) struct clockdomain *_get_clkdm(struct omap_hwmod *oh) { - struct clk_hw_omap *clk; - if (oh->clkdm) { return oh->clkdm; } else if (oh->_clk) { #ifdef CONFIG_COMMON_CLK + struct clk_hw_omap *clk; + clk = to_clk_hw_omap(__clk_get_hw(oh->_clk)); return clk->clkdm; #else