From patchwork Thu Oct 22 23:09:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 55484 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 n9MNAiI5019501 for ; Thu, 22 Oct 2009 23:10:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754913AbZJVXKi (ORCPT ); Thu, 22 Oct 2009 19:10:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754879AbZJVXKi (ORCPT ); Thu, 22 Oct 2009 19:10:38 -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 S1754774AbZJVXKh (ORCPT ); Thu, 22 Oct 2009 19:10:37 -0400 Received: by mail-qy0-f194.google.com with SMTP id 32so5544712qyk.4 for ; Thu, 22 Oct 2009 16:10:42 -0700 (PDT) Received: by 10.224.109.83 with SMTP id i19mr4966067qap.309.1256253042572; Thu, 22 Oct 2009 16:10:42 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id 26sm9880655qwa.43.2009.10.22.16.10.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Oct 2009 16:10:41 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Tero Kristo Subject: [PATCH v2 12/32] OMAP: PM: DMA context save/restore for off-mode support Date: Thu, 22 Oct 2009 16:09:33 -0700 Message-Id: <1256252993-24328-13-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1256252993-24328-12-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> 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 bab9b48..54fea79 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -95,6 +96,7 @@ static void omap3_core_save_context(void) omap3_gpmc_save_context(); /* Save the system control module context, padconf already save above*/ omap3_control_save_context(); + omap_dma_global_context_save(); } static void omap3_core_restore_context(void) @@ -105,6 +107,7 @@ static void omap3_core_restore_context(void) omap3_gpmc_restore_context(); /* Restore the interrupt controller context */ omap_intc_restore_context(); + omap_dma_global_context_restore(); } /* diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index 3edffde..c0a6060 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c @@ -54,6 +54,12 @@ enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED }; static int enable_1510_mode; +static struct omap_dma_global_context_registers { + u32 dma_irqenable_l0; + u32 dma_ocp_sysconfig; + u32 dma_gcr; +} omap_dma_global_context; + struct omap_dma_lch { int next_lch; int dev_id; @@ -2341,6 +2347,41 @@ void omap_stop_lcd_dma(void) } EXPORT_SYMBOL(omap_stop_lcd_dma); +void omap_dma_global_context_save(void) +{ + omap_dma_global_context.dma_irqenable_l0 = + dma_read(IRQENABLE_L0); + omap_dma_global_context.dma_ocp_sysconfig = + dma_read(OCP_SYSCONFIG); + omap_dma_global_context.dma_gcr = dma_read(GCR); +} +EXPORT_SYMBOL(omap_dma_global_context_save); + +void omap_dma_global_context_restore(void) +{ + dma_write(0x2, OCP_SYSCONFIG); + while (!__raw_readl(omap_dma_base + OMAP_DMA4_SYSSTATUS)) + ; + dma_write(omap_dma_global_context.dma_gcr, GCR); + dma_write(omap_dma_global_context.dma_ocp_sysconfig, + OCP_SYSCONFIG); + dma_write(omap_dma_global_context.dma_irqenable_l0, + IRQENABLE_L0); +} +EXPORT_SYMBOL(omap_dma_global_context_restore); + +void omap_dma_disable_irq(int lch) +{ + u32 val; + + if (cpu_class_is_omap2()) { + /* Disable interrupts */ + val = dma_read(IRQENABLE_L0); + val &= ~(1 << lch); + dma_write(val, IRQENABLE_L0); + } +} + /*----------------------------------------------------------------------------*/ static int __init omap_init_dma(void) diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h old mode 100644 new mode 100755 index 72f680b..1c017b2 --- a/arch/arm/plat-omap/include/plat/dma.h +++ b/arch/arm/plat-omap/include/plat/dma.h @@ -633,6 +633,11 @@ extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype); extern void omap_set_dma_src_endian_type(int lch, enum end_type etype); extern int omap_get_dma_index(int lch, int *ei, int *fi); +void omap_dma_global_context_save(void); +void omap_dma_global_context_restore(void); + +extern void omap_dma_disable_irq(int lch); + /* Chaining APIs */ #ifndef CONFIG_ARCH_OMAP1 extern int omap_request_dma_chain(int dev_id, const char *dev_name,