From patchwork Wed Jun 25 19:19:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 364126 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3EE351400AA for ; Thu, 26 Jun 2014 05:22:36 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wzsjj-0005W3-8d; Wed, 25 Jun 2014 19:20:03 +0000 Received: from mail-qc0-x22b.google.com ([2607:f8b0:400d:c01::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wzsjg-0005HX-2Q for linux-arm-kernel@lists.infradead.org; Wed, 25 Jun 2014 19:20:00 +0000 Received: by mail-qc0-f171.google.com with SMTP id w7so2205278qcr.30 for ; Wed, 25 Jun 2014 12:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=FJzpZLfIipBr2pz2mIlSghF6y+duXmffXoBKvF4Vorc=; b=oFqaB/17/DCuo4npDVAwzOmfSknJUmiOAHTHbjt+GiTPIPqwQIuYFdIdn4QryGujcu 8JTONRYeNDY111LnjvufALNnOcOhGcuxX0Br7eO8C91usHr3vMDOXYcud4OMyyhPyKth tOn9xpo6OcEHrCuHKQRVAQ7KbrZHrzhkoYXQDjKnnEFXnoJM8DC0d3sKw+49UVBZV2Ok ZImdPJHWnYHfpbkCG1ThuI7ezArDur8jbQU90w0aWELdY1K7+p8qrXH/8N3XmLXxvs/S dKTLPR5AvDn9YP5kco/zuToHBepdni2kDsZ1EMdfe5EquuspyO1ZpePBv+K+1IX4f5Md vveA== X-Received: by 10.140.50.167 with SMTP id s36mr14561500qga.36.1403723976823; Wed, 25 Jun 2014 12:19:36 -0700 (PDT) Received: from localhost.localdomain ([201.82.192.174]) by mx.google.com with ESMTPSA id r90sm2755599qgr.31.2014.06.25.12.19.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Jun 2014 12:19:35 -0700 (PDT) From: Fabio Estevam To: shawn.guo@freescale.com Subject: [PATCH] ARM: mx25: Add basic suspend/resume support Date: Wed, 25 Jun 2014 16:19:09 -0300 Message-Id: <1403723949-9183-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140625_122000_215264_7F2B05B4 X-CRM114-Status: GOOD ( 17.52 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Cc: Fabio Estevam , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org From: Fabio Estevam Tested basic suspend/resume on a mx25pdk: root@freescale /$ echo mem > /sys/power/state PM: Syncing filesystems ... done. Freezing user space processes ... (elapsed 0.001 seconds) done. Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. Suspending console(s) (use no_console_suspend to debug) (Press the keypad) PM: suspend of devices complete after 5.637 msecs PM: late suspend of devices complete after 1.649 msecs PM: noirq suspend of devices complete after 1.874 msecs PM: noirq resume of devices complete after 1.643 msecs PM: early resume of devices complete after 1.923 msecs PM: resume of devices complete after 62.884 msecs Restarting tasks ... done. fec 50038000.ethernet eth0: Link is Down fec 50038000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx root@freescale /$ Signed-off-by: Fabio Estevam --- arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/imx25-dt.c | 2 ++ arch/arm/mach-imx/pm-imx25.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/mach-imx/pm-imx25.h | 13 +++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-imx/pm-imx25.c create mode 100644 arch/arm/mach-imx/pm-imx25.h diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index a364e20..ddc28d4 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -3,7 +3,7 @@ obj-y := time.o cpu.o system.o irq-common.o obj-$(CONFIG_SOC_IMX1) += clk-imx1.o mm-imx1.o obj-$(CONFIG_SOC_IMX21) += clk-imx21.o mm-imx21.o -obj-$(CONFIG_SOC_IMX25) += clk-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o +obj-$(CONFIG_SOC_IMX25) += clk-imx25.o mm-imx25.o ehci-imx25.o cpu-imx25.o pm-imx25.o obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o obj-$(CONFIG_SOC_IMX27) += clk-imx27.o mm-imx27.o ehci-imx27.o diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c index 42a65e0..39babdf 100644 --- a/arch/arm/mach-imx/imx25-dt.c +++ b/arch/arm/mach-imx/imx25-dt.c @@ -16,6 +16,7 @@ #include #include "common.h" #include "mx25.h" +#include "pm-imx25.h" static void __init imx25_dt_init(void) { @@ -38,6 +39,7 @@ DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") .map_io = mx25_map_io, .init_early = imx25_init_early, .init_irq = mx25_init_irq, + .init_late = mx25_pm_init, .init_time = imx25_timer_init, .init_machine = imx25_dt_init, .dt_compat = imx25_dt_board_compat, diff --git a/arch/arm/mach-imx/pm-imx25.c b/arch/arm/mach-imx/pm-imx25.c new file mode 100644 index 0000000..2463548 --- /dev/null +++ b/arch/arm/mach-imx/pm-imx25.c @@ -0,0 +1,35 @@ +/* + * Copyright 2014 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include "pm-imx25.h" + +static int mx25_suspend_enter(suspend_state_t state) +{ + switch (state) { + case PM_SUSPEND_MEM: + cpu_do_idle(); + break; + + default: + return -EINVAL; + } + return 0; +} + +static const struct platform_suspend_ops mx25_suspend_ops = { + .enter = mx25_suspend_enter, + .valid = suspend_valid_only_mem, +}; + +void __init mx25_pm_init(void) +{ + suspend_set_ops(&mx25_suspend_ops); +} diff --git a/arch/arm/mach-imx/pm-imx25.h b/arch/arm/mach-imx/pm-imx25.h new file mode 100644 index 0000000..41da794 --- /dev/null +++ b/arch/arm/mach-imx/pm-imx25.h @@ -0,0 +1,13 @@ +/* + * Copyright 2014 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifdef CONFIG_PM +void mx25_pm_init(void); +#else +#define mx25_pm_init NULL +#endif