From patchwork Thu Jul 19 13:26:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 1216911 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 4A4ACDF24C for ; Thu, 19 Jul 2012 13:48:31 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SrqwV-0003u6-9h; Thu, 19 Jul 2012 13:38:59 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Srql2-0001Eq-2o for linux-arm-kernel@lists.infradead.org; Thu, 19 Jul 2012 13:27:23 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q6JDR78Q010414; Thu, 19 Jul 2012 08:27:07 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6JDR7Bp012160; Thu, 19 Jul 2012 08:27:07 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Thu, 19 Jul 2012 08:27:06 -0500 Received: from localhost.localdomain (h64-4.vpn.ti.com [172.24.64.4]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6JDQliQ019992; Thu, 19 Jul 2012 08:27:05 -0500 From: Tero Kristo To: , , , , Subject: [PATCHv7 10/12] ARM: OMAP4: HWMOD: add support for lostcontext_mask Date: Thu, 19 Jul 2012 16:26:30 +0300 Message-ID: <1342704392-23657-11-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1342704392-23657-1-git-send-email-t-kristo@ti.com> References: <1342704392-23657-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.94.94.41 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Currently hwmod only provides the offset for the context lose register, and if we attempt to share the same register between two or more hwmods, the resulting context loss counts get wrong. Thus, we need a way to specify which bits are used for the context loss information for each. This is accomplished by adding a new field to the omap4 prcm struct, 'lostcontext_mask', which specifies a bit-mask to use for filtering the register. Only the specified bits are read and cleared by the context lose counter update code. If a hwmod doesn't specify 'lostcontext_mask' (default behavior), the whole contents of the context register are used without any filtering. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/omap_hwmod.c | 8 ++++++++ arch/arm/plat-omap/include/plat/omap_hwmod.h | 6 ++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index a60dfd2..3ebf93e 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1810,11 +1810,19 @@ static void _omap4_update_context_lost(struct omap_hwmod *oh) oh->clkdm->pwrdm.ptr->prcm_offs, oh->prcm.omap4.context_offs); + /* + * If lostcontext_mask is defined, only check these bits for + * losing context. Otherwise check whole register. + */ + if (oh->prcm.omap4.lostcontext_mask) + r &= oh->prcm.omap4.lostcontext_mask; + if (!r) return; oh->prcm.omap4.context_lost_counter++; + /* Clear selected bits */ omap4_prminst_write_inst_reg(r, oh->clkdm->pwrdm.ptr->prcm_partition, oh->clkdm->pwrdm.ptr->prcm_offs, oh->prcm.omap4.context_offs); diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 75d59f5..ebe3048 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -375,14 +375,20 @@ struct omap_hwmod_omap2_prcm { * @clkctrl_offs: offset of the PRCM clock control register * @rstctrl_offs: offset of the XXX_RSTCTRL register located in the PRM * @context_offs: offset of the RM_*_CONTEXT register + * @lostcontext_mask: bitmask for selecting bits from RM_*_CONTEXT register * @submodule_wkdep_bit: bit shift of the WKDEP range * @modulemode: allowable modulemodes * @context_lost_counter: Count of module level context lost + * + * If @lostcontext_mask is not defined, context loss check code uses + * whole register without masking. @lostcontext_mask should only be defined + * in cases where @context_offs register is shared by two or more hwmods. */ struct omap_hwmod_omap4_prcm { u16 clkctrl_offs; u16 rstctrl_offs; u16 context_offs; + u32 lostcontext_mask; u8 submodule_wkdep_bit; u8 modulemode; unsigned context_lost_counter;