From patchwork Thu Oct 22 23:09:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 55486 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9MNAphi019516 for ; Thu, 22 Oct 2009 23:10:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755082AbZJVXKq (ORCPT ); Thu, 22 Oct 2009 19:10:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755056AbZJVXKp (ORCPT ); Thu, 22 Oct 2009 19:10:45 -0400 Received: from mail-qy0-f194.google.com ([209.85.221.194]:37878 "EHLO mail-qy0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754960AbZJVXKp (ORCPT ); Thu, 22 Oct 2009 19:10:45 -0400 Received: by mail-qy0-f194.google.com with SMTP id 32so5544712qyk.4 for ; Thu, 22 Oct 2009 16:10:50 -0700 (PDT) Received: by 10.224.94.134 with SMTP id z6mr5062831qam.145.1256253050092; Thu, 22 Oct 2009 16:10:50 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id 5sm245190qwg.0.2009.10.22.16.10.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Oct 2009 16:10:49 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Tero Kristo , Roger Quadros Subject: [PATCH v2 14/32] OMAP3: PM: save secure RAM only during init Date: Thu, 22 Oct 2009 16:09:35 -0700 Message-Id: <1256252993-24328-15-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1256252993-24328-14-git-send-email-khilman@deeprootsystems.com> References: <1256252993-24328-1-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-2-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-3-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-4-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-5-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-6-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-7-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-8-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-9-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-10-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-11-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-12-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-13-git-send-email-khilman@deeprootsystems.com> <1256252993-24328-14-git-send-email-khilman@deeprootsystems.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index ebb88f3..310c189 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -112,6 +112,12 @@ static void omap3_core_restore_context(void) omap_dma_global_context_restore(); } +/* + * FIXME: This function should be called before entering off-mode after + * OMAP3 secure services have been accessed. Currently it is only called + * once during boot sequence, but this works as we are not using secure + * services. + */ static void omap3_save_secure_ram_context(u32 target_mpu_state) { u32 ret; @@ -337,7 +343,6 @@ static void omap_sram_idle(void) if (core_next_state == PWRDM_POWER_OFF) { omap3_core_save_context(); omap3_prcm_save_context(); - omap3_save_secure_ram_context(mpu_next_state); } /* Enable IO-PAD wakeup */ prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN); @@ -999,9 +1004,19 @@ static int __init omap3_pm_init(void) if (!omap3_secure_ram_storage) printk(KERN_ERR "Memory allocation failed when" "allocating for secure sram context\n"); + + local_irq_disable(); + local_fiq_disable(); + + omap_dma_global_context_save(); + omap3_save_secure_ram_context(PWRDM_POWER_ON); + omap_dma_global_context_restore(); + + local_irq_enable(); + local_fiq_enable(); } - omap3_save_scratchpad_contents(); + omap3_save_scratchpad_contents(); err1: return ret; err2: