From patchwork Sun Dec 9 17:53:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 1854111 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 8A038DF230 for ; Sun, 9 Dec 2012 18:00:29 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Thl7R-0003zv-Ei; Sun, 09 Dec 2012 17:56:49 +0000 Received: from utopia.booyaka.com ([74.50.51.50]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Thl5T-0003AF-Bn for linux-arm-kernel@lists.infradead.org; Sun, 09 Dec 2012 17:55:03 +0000 Received: (qmail 2399 invoked by uid 1019); 9 Dec 2012 17:54:45 -0000 MBOX-Line: From nobody Sun Dec 9 10:53:37 2012 Subject: [PATCH 11/12] ARM: OMAP2+: powerdomain: program memory bank next-power-state upon init To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Paul Walmsley Date: Sun, 09 Dec 2012 10:53:37 -0700 Message-ID: <20121209175335.6933.37266.stgit@dusk.lan> In-Reply-To: <20121209174545.6933.59371.stgit@dusk.lan> References: <20121209174545.6933.59371.stgit@dusk.lan> User-Agent: StGit/0.16-37-g27ac3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121209_125447_594053_979494BF X-CRM114-Status: GOOD ( 11.58 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 During powerdomain init, we were previously programming a reasonable default for the powerdomain and logic next-power-state fields, but not touching the memory bank next-power-state fields. To ensure that the previous OS or bootloader didn't leave the system in a bad state, program the memory bank next-power-state bitfields to reasonable defaults. Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/powerdomain.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index fdeabbf..a70e3f6 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -563,21 +563,28 @@ int pwrdm_register_pwrdms(struct powerdomain **ps) * * Do whatever is necessary to initialize registered powerdomains and * powerdomain code. Currently, this programs the next power state - * for each powerdomain to ON. This prevents powerdomains from - * unexpectedly losing context or entering high wakeup latency modes - * with non-power-management-enabled kernels. Must be called after - * pwrdm_register_pwrdms(). Returns -EACCES if called before - * pwrdm_register_pwrdms(), or 0 upon success. + * for each powerdomain to ON, and programs the memory bank power + * states to follow the powerdomain power states. This prevents + * powerdomains from unexpectedly losing context or entering high + * wakeup latency modes with non-power-management-enabled kernels. + * Must be called after pwrdm_register_pwrdms(). Returns -EACCES if + * called before pwrdm_register_pwrdms(), or 0 upon success. */ int pwrdm_complete_init(void) { struct powerdomain *temp_p; + int i; if (list_empty(&pwrdm_list)) return -EACCES; - list_for_each_entry(temp_p, &pwrdm_list, node) - pwrdm_set_next_fpwrst(temp_p, PWRDM_FUNC_PWRST_ON); + list_for_each_entry(temp_p, &pwrdm_list, node) { + for (i = 0; i < temp_p->banks; i++) { + pwrdm_set_mem_onst(temp_p, i, PWRDM_POWER_ON); + pwrdm_set_mem_retst(temp_p, i, PWRDM_POWER_RET); + } + WARN_ON(pwrdm_set_next_fpwrst(temp_p, PWRDM_FUNC_PWRST_ON)); + } return 0; }