From patchwork Fri Jul 4 14:10:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 33097 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5F8EB203AC for ; Fri, 4 Jul 2014 14:10:45 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id jz11sf5569728veb.4 for ; Fri, 04 Jul 2014 07:10:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=tJ4EG2/mcrUsBSCr8pEeHY1KxQKm29MG8sbC8ddpIas=; b=NqT2GflvNv+GuiKS5aVlfpEQPXwkAB+A8eIRocx8IDd3U1AqSDj4dak/uAeHY2xI3l m//gp/8rzT+tYSneFT0FYODRFZcNZtVOs4mXx3Omt00/tnoR2zQVmFCf0P/1naezczDL LKycld/dDPNJUuprf2ybMPuFI3rseQ1b7L+H/9OcyPuT4dZozYp+3NTbZIhwQ/RaB1p6 qq+WK9OSubFXgIHZcEvHQqEmd3jA4RrO9W1Ic50aIWfZniCA3uv8E1ZNB5TMZS2QP2cz ccoQDhXvEIOCxwY20N82OW1P53kxDELkam+1gDIc/IUpKDspTf9d48wuAUyLjb6VcBqb aiQQ== X-Gm-Message-State: ALoCoQk6WG2UcSR4NAG5Q9q/0hMyaRwtKLOzVpGQW82B2JDvuE8ljacXnLwNhhBfw9dStcHH2Xu7 X-Received: by 10.236.184.72 with SMTP id r48mr4900157yhm.13.1404483045189; Fri, 04 Jul 2014 07:10:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.169 with SMTP id f38ls478038qgd.24.gmail; Fri, 04 Jul 2014 07:10:45 -0700 (PDT) X-Received: by 10.58.100.168 with SMTP id ez8mr31078veb.79.1404483045069; Fri, 04 Jul 2014 07:10:45 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id u4si15575420vcs.52.2014.07.04.07.10.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Jul 2014 07:10:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so1637468vcb.16 for ; Fri, 04 Jul 2014 07:10:45 -0700 (PDT) X-Received: by 10.52.252.4 with SMTP id zo4mr8452252vdc.20.1404483044992; Fri, 04 Jul 2014 07:10:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp468945vcb; Fri, 4 Jul 2014 07:10:44 -0700 (PDT) X-Received: by 10.70.44.145 with SMTP id e17mr10396617pdm.101.1404483043304; Fri, 04 Jul 2014 07:10:43 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ci1si2000775pdb.431.2014.07.04.07.10.42; Fri, 04 Jul 2014 07:10:42 -0700 (PDT) Received-SPF: none (google.com: linux-omap-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757240AbaGDOKl (ORCPT + 6 others); Fri, 4 Jul 2014 10:10:41 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:55048 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756085AbaGDOKj (ORCPT ); Fri, 4 Jul 2014 10:10:39 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s64EAIFh007264; Fri, 4 Jul 2014 09:10:18 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s64EAIl9031728; Fri, 4 Jul 2014 09:10:18 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 4 Jul 2014 09:10:18 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s64EA8Ek016874; Fri, 4 Jul 2014 09:10:17 -0500 From: Tero Kristo To: , , CC: Subject: [PATCH 04/10] ARM: OMAP3: PRM: add API for checking and clearing cold reset status Date: Fri, 4 Jul 2014 17:10:29 +0300 Message-ID: <1404483035-21666-5-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404483035-21666-1-git-send-email-t-kristo@ti.com> References: <1404483035-21666-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: t-kristo@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This isolates the PRM register access within the PRM driver. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/control.c | 6 +----- arch/arm/mach-omap2/prm3xxx.c | 20 ++++++++++++++++++++ arch/arm/mach-omap2/prm3xxx.h | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index 751f354..f8eb3e4 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c @@ -282,13 +282,9 @@ void omap3_clear_scratchpad_contents(void) void __iomem *v_addr; u32 offset = 0; v_addr = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD_ROM); - if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) & - OMAP3430_GLOBAL_COLD_RST_MASK) { + if (omap3xxx_prm_clear_global_cold_reset()) { for ( ; offset <= max_offset; offset += 0x4) writel_relaxed(0x0, (v_addr + offset)); - omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK, - OMAP3430_GR_MOD, - OMAP3_PRM_RSTST_OFFSET); } } diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index e46ff71..4733c28 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c @@ -389,6 +389,26 @@ void omap3xxx_prm_iva_idle(void) OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL); } +/** + * omap3xxx_prm_clear_global_cold_reset - checks the global cold reset status + * and clears it if asserted + * + * Checks if cold-reset has occurred and clears the status bit if yes. Returns + * 1 if cold-reset has occurred, 0 otherwise. + */ +int omap3xxx_prm_clear_global_cold_reset(void) +{ + if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) & + OMAP3430_GLOBAL_COLD_RST_MASK) { + omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK, + OMAP3430_GR_MOD, + OMAP3_PRM_RSTST_OFFSET); + return 1; + } + + return 0; +} + /* Powerdomain low-level functions */ static int omap3_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h index 21eb1d5..7548ae0 100644 --- a/arch/arm/mach-omap2/prm3xxx.h +++ b/arch/arm/mach-omap2/prm3xxx.h @@ -165,6 +165,7 @@ extern u32 omap3xxx_prm_get_reset_sources(void); int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits); void omap3xxx_prm_iva_idle(void); void omap3_prm_reset_modem(void); +int omap3xxx_prm_clear_global_cold_reset(void); #endif /* __ASSEMBLER */