From patchwork Tue Sep 6 09:58:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 3883 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B2D7123E54 for ; Tue, 6 Sep 2011 09:58:29 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id A6C01A181B6 for ; Tue, 6 Sep 2011 09:58:29 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 18so6054616fxd.11 for ; Tue, 06 Sep 2011 02:58:29 -0700 (PDT) Received: by 10.223.5.139 with SMTP id 11mr1286154fav.138.1315303109563; Tue, 06 Sep 2011 02:58:29 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.11.8 with SMTP id m8cs90992lab; Tue, 6 Sep 2011 02:58:29 -0700 (PDT) Received: by 10.68.11.9 with SMTP id m9mr8450546pbb.475.1315303108237; Tue, 06 Sep 2011 02:58:28 -0700 (PDT) Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com [209.85.210.45]) by mx.google.com with ESMTPS id l1si10628290wfe.90.2011.09.06.02.58.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Sep 2011 02:58:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.45 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=209.85.210.45; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.45 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: by mail-pz0-f45.google.com with SMTP id 33so11621675pzk.32 for ; Tue, 06 Sep 2011 02:58:27 -0700 (PDT) Received: by 10.68.199.202 with SMTP id jm10mr9746505pbc.198.1315303107248; Tue, 06 Sep 2011 02:58:27 -0700 (PDT) Received: from localhost.localdomain ([114.216.147.142]) by mx.google.com with ESMTPS id z1sm28672913pbz.6.2011.09.06.02.58.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Sep 2011 02:58:26 -0700 (PDT) From: Shawn Guo To: linux-arm-kernel@lists.infradead.org Cc: Arnd Bergmann , Sascha Hauer , patches@linaro.org, Shawn Guo , Anson Huang Subject: [PATCH 6/6] arm/imx6q: add suspend/resume support Date: Tue, 6 Sep 2011 17:58:40 +0800 Message-Id: <1315303120-24203-7-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1315303120-24203-1-git-send-email-shawn.guo@linaro.org> References: <1315303120-24203-1-git-send-email-shawn.guo@linaro.org> It adds suspend/resume support for imx6q. Signed-off-by: Anson Huang Signed-off-by: Shawn Guo --- arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/pm-imx6q.c | 63 +++++++++++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/common.h | 12 ++++++ 3 files changed, 76 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-imx/pm-imx6q.c diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 84bd18c..531da76 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -70,5 +70,5 @@ obj-$(CONFIG_CPU_V7) += head-v7.o obj-$(CONFIG_SMP) += platsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o -obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o +obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o pm-imx6q.o obj-$(CONFIG_MACH_IMX6Q) += mach-imx6q.o diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c new file mode 100644 index 0000000..cbbc3c8 --- /dev/null +++ b/arch/arm/mach-imx/pm-imx6q.c @@ -0,0 +1,63 @@ +/* + * Copyright 2011 Freescale Semiconductor, Inc. + * Copyright 2011 Linaro Ltd. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static int imx6q_suspend_finish(unsigned long val) +{ + cpu_do_idle(); + return 0; +} + +static int imx6q_pm_enter(suspend_state_t state) +{ + switch (state) { + case PM_SUSPEND_MEM: + imx_local_timer_pre_suspend(); + imx_gpc_pre_suspend(); + outer_flush_all(); + outer_disable(); + imx_set_cpu_jump(0, v7_cpu_resume); + + /* Zzz ... */ + cpu_suspend(0, imx6q_suspend_finish); + + imx_smp_prepare(); + l2x0_of_init(0, ~0UL); + imx_gpc_post_resume(); + imx_local_timer_post_resume(); + break; + default: + return -EINVAL; + } + + return 0; +} + +static const struct platform_suspend_ops imx6q_pm_ops = { + .enter = imx6q_pm_enter, + .valid = suspend_valid_only_mem, +}; + +static int __init imx6q_pm_init(void) +{ + suspend_set_ops(&imx6q_pm_ops); + return 0; +} +late_initcall(imx6q_pm_init); diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h index ff86063..7c3d078 100644 --- a/arch/arm/plat-mxc/include/mach/common.h +++ b/arch/arm/plat-mxc/include/mach/common.h @@ -80,12 +80,24 @@ extern void imx_lluart_map_io(void); #else static inline void imx_lluart_map_io(void) {} #endif +extern void v7_cpu_resume(void); #ifdef CONFIG_SMP extern void imx_scu_map_io(void); +extern void imx_smp_prepare(void); #else static inline void imx_scu_map_io(void) {} +static inline void imx_smp_prepare(void) {} #endif extern void imx_enable_cpu(int cpu, bool enable); extern void imx_set_cpu_jump(int cpu, void *jump_addr); extern void imx_gpc_init(void); +extern void imx_gpc_pre_suspend(void); +extern void imx_gpc_post_resume(void); +#ifdef CONFIG_LOCAL_TIMERS +extern void imx_local_timer_pre_suspend(void); +extern void imx_local_timer_post_resume(void); +#else +static inline void imx_local_timer_pre_suspend(void) {} +static inline void imx_local_timer_post_resume(void) {} +#endif #endif