From patchwork Mon Feb 1 22:10:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 76172 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o11MBLe1031133 for ; Mon, 1 Feb 2010 22:11:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753215Ab0BAWKm (ORCPT ); Mon, 1 Feb 2010 17:10:42 -0500 Received: from utopia.booyaka.com ([72.9.107.138]:47085 "EHLO utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752711Ab0BAWKl (ORCPT ); Mon, 1 Feb 2010 17:10:41 -0500 Received: (qmail 951 invoked by uid 1019); 1 Feb 2010 22:10:40 -0000 Date: Mon, 1 Feb 2010 15:10:40 -0700 (MST) From: Paul Walmsley To: Tero Kristo cc: linux-omap@vger.kernel.org Subject: Re: [PATCHv4 1/8] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled In-Reply-To: <1264182951-9205-2-git-send-email-tero.kristo@nokia.com> Message-ID: References: <> <1264182951-9205-1-git-send-email-tero.kristo@nokia.com> <1264182951-9205-2-git-send-email-tero.kristo@nokia.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Feb 2010 22:11:21 +0000 (UTC) diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index a38a615..8dce3c9 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c @@ -868,6 +868,36 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm) } /** + * omap2_clkdm_read_hwsup - read the hwsup idle transition bit + * @clkdm: struct clockdomain * + * + * Checks whether hardware is allowed to switch the clockdomain @clkdm + * automatically into active or idle states. Returns -EINVAL if @clkdm + * is NULL; otherwise, 1 if hardware auto-idle is enabled, 0 if not. + */ +int omap2_clkdm_read_hwsup(struct clockdomain *clkdm) +{ + u32 u, v; + + if (!clkdm) + return -EINVAL; + + u = cm_read_mod_reg(clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL); + u &= clkdm->clktrctrl_mask; + + if (cpu_is_omap24xx()) + v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO; + else if (cpu_is_omap34xx() || cpu_is_omap44xx()) + v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO; + else + BUG(); + + v <<= __ffs(clkdm->clktrctrl_mask); + + return (u == v) ? 1 : 0; +} + +/** * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm * @clkdm: struct clockdomain * * diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h b/arch/arm/plat-omap/include/plat/clockdomain.h index ba0a6c0..9d25f4e 100644 --- a/arch/arm/plat-omap/include/plat/clockdomain.h +++ b/arch/arm/plat-omap/include/plat/clockdomain.h @@ -129,6 +129,7 @@ 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 omap2_clkdm_read_hwsup(struct clockdomain *clkdm); void omap2_clkdm_allow_idle(struct clockdomain *clkdm); void omap2_clkdm_deny_idle(struct clockdomain *clkdm);