From patchwork Fri Nov 27 15:26:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 63383 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nARFQIv1023466 for ; Fri, 27 Nov 2009 15:26:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751112AbZK0P0L (ORCPT ); Fri, 27 Nov 2009 10:26:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751191AbZK0P0L (ORCPT ); Fri, 27 Nov 2009 10:26:11 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:51380 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750949AbZK0P0K (ORCPT ); Fri, 27 Nov 2009 10:26:10 -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 nARFQD01025642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 27 Nov 2009 09:26:16 -0600 Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id nARFQB0N008822; Fri, 27 Nov 2009 20:56:12 +0530 (IST) Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by linfarm476.india.ti.com (8.12.11/8.12.11) with ESMTP id nARFQBiK013251; Fri, 27 Nov 2009 20:56:11 +0530 Received: (from a0393109@localhost) by linfarm476.india.ti.com (8.12.11/8.12.11/Submit) id nARFQBH5013249; Fri, 27 Nov 2009 20:56:11 +0530 From: Thara Gopinath To: linux-omap@vger.kernel.org Cc: Thara Gopinath Subject: [PATCH] OMAP3: hwmod: support to specify the bit position of clockactivity bits Date: Fri, 27 Nov 2009 20:56:11 +0530 Message-Id: <1259335571-13183-1-git-send-email-thara@ti.com> X-Mailer: git-send-email 1.5.5 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org different bit position than the usual bit positions 8 and 9. This patch introduces a flag SYSC_CHANGE_CLKACT_OFFSET which if specified the hwmod driver takes the bit position of clockactivity bits from clockact_offs specified as part of omap_hwmod_sysconfig. Else the default positions are used. Signed-off-by: Thara Gopinath --- arch/arm/mach-omap2/omap_hwmod.c | 14 ++++++++++++-- arch/arm/plat-omap/include/plat/omap_hwmod.h | 26 +++++++++++++++++--------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 633b216..bef725b 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -180,12 +180,22 @@ static int _set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode, u32 *v) */ static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v) { + u32 clkact_mask; + u8 clkact_shift; + if (!oh->sysconfig || !(oh->sysconfig->sysc_flags & SYSC_HAS_CLOCKACTIVITY)) return -EINVAL; - *v &= ~SYSC_CLOCKACTIVITY_MASK; - *v |= clockact << SYSC_CLOCKACTIVITY_SHIFT; + if (oh->sysconfig->sysc_flags & SYSC_CHANGE_CLKACT_OFFSET) { + clkact_shift = oh->sysconfig->clockact_offs; + clkact_mask = (0x3 << clkact_shift); + } else { + clkact_shift = SYSC_CLOCKACTIVITY_SHIFT; + clkact_mask = SYSC_CLOCKACTIVITY_MASK; + } + *v &= ~clkact_mask; + *v |= clockact << clkact_shift; return 0; } diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index dbdd123..d85d184 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -203,14 +203,15 @@ struct omap_hwmod_ocp_if { #define MSTANDBY_SMART (HWMOD_IDLEMODE_SMART << MASTER_STANDBY_SHIFT) /* omap_hwmod_sysconfig.sysc_flags capability flags */ -#define SYSC_HAS_AUTOIDLE (1 << 0) -#define SYSC_HAS_SOFTRESET (1 << 1) -#define SYSC_HAS_ENAWAKEUP (1 << 2) -#define SYSC_HAS_EMUFREE (1 << 3) -#define SYSC_HAS_CLOCKACTIVITY (1 << 4) -#define SYSC_HAS_SIDLEMODE (1 << 5) -#define SYSC_HAS_MIDLEMODE (1 << 6) -#define SYSS_MISSING (1 << 7) +#define SYSC_HAS_AUTOIDLE (1 << 0) +#define SYSC_HAS_SOFTRESET (1 << 1) +#define SYSC_HAS_ENAWAKEUP (1 << 2) +#define SYSC_HAS_EMUFREE (1 << 3) +#define SYSC_HAS_CLOCKACTIVITY (1 << 4) +#define SYSC_HAS_SIDLEMODE (1 << 5) +#define SYSC_HAS_MIDLEMODE (1 << 6) +#define SYSS_MISSING (1 << 7) +#define SYSC_CHANGE_CLKACT_OFFSET (1 << 8) /* omap_hwmod_sysconfig.clockact flags */ #define CLOCKACT_TEST_BOTH 0x0 @@ -235,14 +236,21 @@ struct omap_hwmod_ocp_if { * been associated with the clocks marked in @clockact. This field is * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below) * + * @clockact_offs: the position of clock activity bits in this register. + * @clockact_offs defines the position of clockactivity bits in the sysconfig + * register. Some modules like Smartreflex in 3430 has a different position for + * clockactivity bit than the default. This field will be used only if + * SYSC_CHANGE_CLKACT_OFFSET is set. Else the default position is assumed for + * these bits */ struct omap_hwmod_sysconfig { u16 rev_offs; u16 sysc_offs; u16 syss_offs; u8 idlemodes; - u8 sysc_flags; + u16 sysc_flags; u8 clockact; + u8 clockact_offs; }; /**