From patchwork Wed Dec 5 12:13:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastian Hecht X-Patchwork-Id: 1841181 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C4A55DF266 for ; Wed, 5 Dec 2012 12:13:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119Ab2LEMNM (ORCPT ); Wed, 5 Dec 2012 07:13:12 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:35633 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751243Ab2LEMNL (ORCPT ); Wed, 5 Dec 2012 07:13:11 -0500 Received: by mail-ee0-f46.google.com with SMTP id e53so2863781eek.19 for ; Wed, 05 Dec 2012 04:13:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=Mj1+7hg01neu0yTws354unFO3OsQn7w2fxAVqkfD4Mo=; b=gt6/DnRxqsohXonZg+gK3FfLbsgpNZE1KkADWF6U1QTP3qc7evE6P5MA4OqFgXsEnh gouhKmEY1MqGqlHtJ4Gi8LsJTbQlnWzfDOFITPcizuR6abDkocKqJnaPC9nYusfoQ8AV 2k5am3oO1sNJxemGunu7+cPpR5xJswnW2iUy1Jvk6vtM1r+HgFWOi5PnrNmOo0JvUQ+F LN/GVFcMuL/deJtYOKfZptQw9NmcJajS/rZI+lGJM6rO18eq9AlnQhhGFOJ0fZhTsJA4 iw8JxbAg5Ew5q07z13CCoPJxvxKeITfMtvQWla308/NpKT6f87ZkWH2JwUcvFl+lKK5y 7csA== Received: by 10.14.178.70 with SMTP id e46mr40461811eem.1.1354709590179; Wed, 05 Dec 2012 04:13:10 -0800 (PST) Received: from localhost.localdomain (p4FD26911.dip.t-dialin.net. [79.210.105.17]) by mx.google.com with ESMTPS id y44sm8865119eel.14.2012.12.05.04.13.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Dec 2012 04:13:09 -0800 (PST) From: Bastian Hecht To: linux-sh@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] ARM: shmobile: sh73a0: Add CPU sleep suspend Date: Wed, 5 Dec 2012 13:13:06 +0100 Message-Id: <1354709587-25288-1-git-send-email-hechtb+renesas@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Bastian Hecht Add the lighest possible sleep mode on Cortex-A9 cores: CPU sleep. It is entered by a simple dsb and wfi instruction via cpu_do_idle(). As just clocks are stopped there is no need to save or restore any state of the system. Signed-off-by: Bastian Hecht Acked-by: Magnus Damm --- arch/arm/mach-shmobile/Makefile | 1 + arch/arm/mach-shmobile/board-kzm9g.c | 2 ++ arch/arm/mach-shmobile/include/mach/common.h | 1 + arch/arm/mach-shmobile/pm-sh73a0.c | 32 ++++++++++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 arch/arm/mach-shmobile/pm-sh73a0.c diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index fe2c97c..d0d06f2 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile @@ -43,6 +43,7 @@ obj-$(CONFIG_ARCH_SHMOBILE) += pm-rmobile.o obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o +obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o # Board objects obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 0a43f31..dc8c0f8 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c @@ -760,6 +760,8 @@ static void __init kzm_init(void) sh73a0_add_standard_devices(); platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices)); + + sh73a0_pm_init(); } static void kzm9g_restart(char mode, const char *cmd) diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index d47e215..318551b3 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h @@ -54,6 +54,7 @@ extern void sh73a0_add_early_devices(void); extern void sh73a0_add_standard_devices(void); extern void sh73a0_clock_init(void); extern void sh73a0_pinmux_init(void); +extern void sh73a0_pm_init(void); extern struct clk sh73a0_extal1_clk; extern struct clk sh73a0_extal2_clk; extern struct clk sh73a0_extcki_clk; diff --git a/arch/arm/mach-shmobile/pm-sh73a0.c b/arch/arm/mach-shmobile/pm-sh73a0.c new file mode 100644 index 0000000..9cf67bb --- /dev/null +++ b/arch/arm/mach-shmobile/pm-sh73a0.c @@ -0,0 +1,32 @@ +/* + * sh73a0 Power management support + * + * Copyright (C) 2012 Bastian Hecht + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include +#include + +#ifdef CONFIG_SUSPEND +static int sh73a0_enter_suspend(suspend_state_t suspend_state) +{ + cpu_do_idle(); + return 0; +} + +static void sh73a0_suspend_init(void) +{ + shmobile_suspend_ops.enter = sh73a0_enter_suspend; +} +#else +static void sh73a0_suspend_init(void) {} +#endif + +void __init sh73a0_pm_init(void) +{ + sh73a0_suspend_init(); +}