From patchwork Fri Sep 5 21:15:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 36899 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B8D3F202E4 for ; Fri, 5 Sep 2014 21:16:30 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id le20sf34625296vcb.0 for ; Fri, 05 Sep 2014 14:16:30 -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:date:from:to:cc:subject:message-id :references:mime-version:in-reply-to:user-agent:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-disposition; bh=JNj7iEHUcK5CQxID1VvBDxWeNGlgtGx25LSGpABPBbY=; b=X4SnY2+JIyUCRMVJ2D2zKekMjLeKvlgx+YoTl8OW5s6/XzqBPf4wZTgryYk37kHsrL +qDE6FGvP12u0gXxAI+TjzeDXbQnYzqWzq9OonMImQU9lUbEtlszNDMHBX0BBEKaq063 I/+0QpipHEBMI7aBtL4PMnF9xMrOeb9QCz6ICGz+ZQiIcOkO6rhJBYP6lOUxPoN1NuRA Y81nuagX3OgwHMMy4L+mXtOzO4/j/ehKGl47S6OikdMvtHc554nMd1F8uIroGnSyGRDQ 9/FEYcFQp2BxQoV93BhR6qyUmAtz/IPRJLlIXavcOvrAc3XST33xR5RGDph7fF/a2xFt XBDA== X-Gm-Message-State: ALoCoQllV0DUUBvdVIlgIsL75cgvtOQQjEpFYsLjBBKt0OcoMyZZGu18RjnFnhvDOQrE8BnxpfEB X-Received: by 10.236.16.165 with SMTP id h25mr8328825yhh.30.1409951790522; Fri, 05 Sep 2014 14:16:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.87 with SMTP id b81ls894184qga.19.gmail; Fri, 05 Sep 2014 14:16:30 -0700 (PDT) X-Received: by 10.53.2.10 with SMTP id bk10mr2533342vdd.48.1409951790390; Fri, 05 Sep 2014 14:16:30 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id dh2si1435974vdc.71.2014.09.05.14.16.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 14:16:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id la4so13158614vcb.29 for ; Fri, 05 Sep 2014 14:16:30 -0700 (PDT) X-Received: by 10.220.110.77 with SMTP id m13mr3464632vcp.35.1409951790249; Fri, 05 Sep 2014 14:16:30 -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.45.67 with SMTP id uj3csp139420vcb; Fri, 5 Sep 2014 14:16:29 -0700 (PDT) X-Received: by 10.70.15.161 with SMTP id y1mr25977431pdc.61.1409951789132; Fri, 05 Sep 2014 14:16:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ib4si5799480pbc.249.2014.09.05.14.16.28 for ; Fri, 05 Sep 2014 14:16:29 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S1753302AbaIEVQ1 (ORCPT + 26 others); Fri, 5 Sep 2014 17:16:27 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:46763 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751078AbaIEVQZ (ORCPT ); Fri, 5 Sep 2014 17:16:25 -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 s85LFxGh031995; Fri, 5 Sep 2014 16:15:59 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s85LFxh0019281; Fri, 5 Sep 2014 16:15:59 -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, 5 Sep 2014 16:15:58 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s85LFwaZ016868; Fri, 5 Sep 2014 16:15:58 -0500 Date: Fri, 5 Sep 2014 16:15:58 -0500 From: Nishanth Menon To: Santosh Shilimkar , Tony Lindgren CC: Kevin Hilman , Tero Kristo , Paul Walmsley , , , , Keerthy , =?iso-8859-1?Q?Beno=EEt?= Cousson Subject: Re: [PATCH 07/10] ARM: OMAP5 / DRA7: Enable CPU RET on suspend Message-ID: <20140905211558.GA31011@kahuna> References: <1408716154-26101-1-git-send-email-nm@ti.com> <1408716154-26101-8-git-send-email-nm@ti.com> <7hbnr5dake.fsf@paris.lan> <53FE2BF2.3020006@ti.com> <20140827194156.GE16006@atomide.com> <53FE34D7.7040004@ti.com> <53FE3551.2080806@ti.com> MIME-Version: 1.0 In-Reply-To: <53FE3551.2080806@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nm@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.170 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: , Content-Disposition: inline On 14:45-20140827, Nishanth Menon wrote: > On 08/27/2014 02:43 PM, Santosh Shilimkar wrote: > > On Wednesday 27 August 2014 03:41 PM, Tony Lindgren wrote: > >> * Nishanth Menon [140827 12:05]: > >>> On 08/27/2014 01:58 PM, Kevin Hilman wrote: > >>>> Nishanth Menon writes: > >>>> > >>>>> From: Rajendra Nayak > >>>>> > >>>>> On OMAP5 / DRA7, prevent a CPU powerdomain OFF and resulting MPU OSWR > >>>>> and instead attempt a CPU RET and side effect, MPU RET in suspend. > >>>>> > >>>>> Signed-off-by: Rajendra Nayak > >>>>> [nm@ti.com: update to do save_state only on DRA7] > >>>>> Signed-off-by: Nishanth Menon > >>>>> --- > >>>>> arch/arm/mach-omap2/omap-mpuss-lowpower.c | 4 ++++ > >>>>> arch/arm/mach-omap2/omap-wakeupgen.c | 2 +- > >>>>> arch/arm/mach-omap2/pm44xx.c | 9 +++++++-- > >>>>> 3 files changed, 12 insertions(+), 3 deletions(-) > >>>>> > >>>>> diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c > >>>>> index 207fce2..0d640eb 100644 > >>>>> --- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c > >>>>> +++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c > >>>>> @@ -242,6 +242,10 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state) > >>>>> save_state = 1; > >>>>> break; > >>>>> case PWRDM_POWER_RET: > >>>>> + if (soc_is_omap54xx() || soc_is_dra7xx()) { > >>>> > >>>> Aren't we trying to get away from these soc_* checks for anything other > >>>> than init code? > >>> > >>> I would expect that to take place in stages as part of which the next > >>> level of cleanup is to move PRM into drivers. Currently our wakeupgen, > >>> prm code does have quiet a few needs of dealing with soc_is checks > >>> primarily from having to re-architect code in two different directions > >>> - we want to move into just one direction eventually - to prm drivers > >>> and as less code in mach-omap2 which is already in the works. > >> > >> Why don't you just set some flag at init time based on the > >> soc_is check and then test that here? That limits the use of > >> soc_is to init code only which makes it easier to phase it > >> out completely eventually. > >> > > Indeed. Infact the version of the code I tried posting last year was > > using a flag which was initialised during init. Same can be > > done her. > > OK. will try something along that line in the next rev. Hi, Updated patch below: Do let me know if this is ok with folks. ---8<---- >From 1b9e11834dac2bd75c396aa7495c806b027653fe Mon Sep 17 00:00:00 2001 From: Rajendra Nayak Date: Mon, 27 May 2013 15:46:44 +0530 Subject: [PATCH V2 7/10] ARM: OMAP5 / DRA7: Enable CPU RET on suspend On OMAP5 / DRA7, prevent a CPU powerdomain OFF and resulting MPU OSWR and instead attempt a CPU RET and side effect, MPU RET in suspend. NOTE: the hardware was originally designed to be capable of achieving deep power states such as OFF and OSWR, however due to various issues and risks, deepest valid state was determined to be CSWR - hence we use the errata framework to handle this case. Signed-off-by: Rajendra Nayak [nm@ti.com: updates] Signed-off-by: Nishanth Menon --- arch/arm/mach-omap2/omap-mpuss-lowpower.c | 4 ++++ arch/arm/mach-omap2/omap-wakeupgen.c | 3 ++- arch/arm/mach-omap2/pm.h | 1 + arch/arm/mach-omap2/pm44xx.c | 12 ++++++++++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c index 207fce2..297352f 100644 --- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c +++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c @@ -242,6 +242,10 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state) save_state = 1; break; case PWRDM_POWER_RET: + if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) { + save_state = 0; + break; + } default: /* * CPUx CSWR is invalid hardware state. Also CPUx OSWR diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c index e844e16..f961c46 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.c +++ b/arch/arm/mach-omap2/omap-wakeupgen.c @@ -32,6 +32,7 @@ #include "soc.h" #include "omap4-sar-layout.h" #include "common.h" +#include "pm.h" #define AM43XX_NR_REG_BANKS 7 #define AM43XX_IRQS 224 @@ -381,7 +382,7 @@ static struct notifier_block irq_notifier_block = { static void __init irq_pm_init(void) { /* FIXME: Remove this when MPU OSWR support is added */ - if (!soc_is_omap54xx()) + if (!IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) cpu_pm_register_notifier(&irq_notifier_block); } #else diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index e150102..425bfcd 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -101,6 +101,7 @@ static inline void enable_omap3630_toggle_l2_on_restore(void) { } #endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */ #define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0) +#define PM_OMAP4_CPU_OSWR_DISABLE (1 << 1) #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) extern u16 pm44xx_errata; diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c index b6f243d..64df620 100644 --- a/arch/arm/mach-omap2/pm44xx.c +++ b/arch/arm/mach-omap2/pm44xx.c @@ -36,6 +36,8 @@ struct power_state { struct list_head node; }; +static u32 cpu_suspend_state = PWRDM_POWER_OFF; + static LIST_HEAD(pwrst_list); #ifdef CONFIG_SUSPEND @@ -66,7 +68,7 @@ static int omap4_pm_suspend(void) * domain CSWR is not supported by hardware. * More details can be found in OMAP4430 TRM section 4.3.4.2. */ - omap4_enter_lowpower(cpu_id, PWRDM_POWER_OFF); + omap4_enter_lowpower(cpu_id, cpu_suspend_state); /* Restore next powerdomain state */ list_for_each_entry(pwrst, &pwrst_list, node) { @@ -112,8 +114,11 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) * through hotplug path and CPU0 explicitly programmed * further down in the code path */ - if (!strncmp(pwrdm->name, "cpu", 3)) + if (!strncmp(pwrdm->name, "cpu", 3)) { + if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) + cpu_suspend_state = PWRDM_POWER_RET; return 0; + } pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC); if (!pwrst) @@ -238,6 +243,9 @@ int __init omap4_pm_init_early(void) if (cpu_is_omap446x()) pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD; + if (soc_is_omap54xx() || soc_is_dra7xx()) + pm44xx_errata |= PM_OMAP4_CPU_OSWR_DISABLE; + return 0; }