From patchwork Tue Dec 21 07:12:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 423641 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBL7EAWd025996 for ; Tue, 21 Dec 2010 07:14:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752836Ab0LUHOQ (ORCPT ); Tue, 21 Dec 2010 02:14:16 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:42034 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752481Ab0LUHOP (ORCPT ); Tue, 21 Dec 2010 02:14:15 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id oBL7EACJ025276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 Dec 2010 01:14:13 -0600 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id oBL7Dxrs027940; Tue, 21 Dec 2010 12:44:09 +0530 (IST) From: Kishon Vijay Abraham I To: linux-omap@vger.kernel.org Cc: paul@pwsan.com, khilman@deeprootsystems.com, p-basak2@ti.com, b-cousson@ti.com, kishon@ti.com Subject: [PATCH v1 1/2] OMAP: hwmod: API to handle autoidle mode Date: Tue, 21 Dec 2010 12:42:39 +0530 Message-Id: <1292915560-13601-2-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1292915560-13601-1-git-send-email-kishon@ti.com> References: <1292915560-13601-1-git-send-email-kishon@ti.com> 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 (demeter1.kernel.org [140.211.167.41]); Tue, 21 Dec 2010 07:14:17 +0000 (UTC) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 5a30658..e016cd9 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1251,6 +1251,41 @@ int _omap_hwmod_idle(struct omap_hwmod *oh) } /** + * omap_hwmod_set_slave_autoidle - set the hwmod's OCP slave autoidle + * @oh: struct omap_hwmod * + * @autoidle: desired AUTOIDLE bitfield value (0 or 1) + * + * Sets the IP block's OCP slave autoidle in hardware, and updates our + * local copy. Intended to be used by drivers that requires + * direct manipulation of the AUTOIDLE bits. + * Returns -EINVAL if @oh is null, or passes along the return value + * from _set_module_autoidle(). + * + * Any users of this function should be scrutinized carefully. + */ +int omap_hwmod_set_slave_autoidle(struct omap_hwmod *oh, u8 autoidle) +{ + u32 v; + int retval = 0; + + if (!oh) + return -EINVAL; + + mutex_lock(&omap_hwmod_mutex); + + v = oh->_sysc_cache; + + retval = _set_module_autoidle(oh, autoidle, &v); + + if (!retval) + _write_sysconfig(v, oh); + + mutex_unlock(&omap_hwmod_mutex); + + return retval; +} + +/** * _shutdown - shutdown an omap_hwmod * @oh: struct omap_hwmod * * diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 7eaa8ed..1871b5a 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -525,6 +525,7 @@ int omap_hwmod_enable_clocks(struct omap_hwmod *oh); int omap_hwmod_disable_clocks(struct omap_hwmod *oh); int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode); +int omap_hwmod_set_slave_autoidle(struct omap_hwmod *oh, u8 autoidle); int omap_hwmod_reset(struct omap_hwmod *oh); void omap_hwmod_ocp_barrier(struct omap_hwmod *oh);