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: 1216741 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 6693F3FD48 for ; Thu, 19 Jul 2012 13:27:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751683Ab2GSN1Z (ORCPT ); Thu, 19 Jul 2012 09:27:25 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:33572 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751664Ab2GSN1Y (ORCPT ); Thu, 19 Jul 2012 09:27:24 -0400 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: , , , , CC: 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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;