From patchwork Thu Apr 16 10:35:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: keita kobayashi X-Patchwork-Id: 6225171 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED844BF4A6 for ; Thu, 16 Apr 2015 10:36:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC11A201C8 for ; Thu, 16 Apr 2015 10:36:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07A9020270 for ; Thu, 16 Apr 2015 10:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757183AbbDPKgF (ORCPT ); Thu, 16 Apr 2015 06:36:05 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:13068 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757027AbbDPKgD (ORCPT ); Thu, 16 Apr 2015 06:36:03 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie3.idc.renesas.com with ESMTP; 16 Apr 2015 19:35:59 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id A4E3B50EB8; Thu, 16 Apr 2015 19:35:59 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 93F071806F; Thu, 16 Apr 2015 19:35:59 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 8D1761800A; Thu, 16 Apr 2015 19:35:59 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id VBF20484; Thu, 16 Apr 2015 19:35:59 +0900 X-IronPort-AV: E=Sophos;i="5.11,587,1422889200"; d="scan'208";a="184206445" Received: from mail-hk1lp0122.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.122]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 16 Apr 2015 19:35:58 +0900 Authentication-Results: verge.net.au; dkim=none (message not signed) header.d=none; Received: from localhost (211.11.155.147) by HK2PR06MB0561.apcprd06.prod.outlook.com (25.161.183.154) with Microsoft SMTP Server (TLS) id 15.1.136.25; Thu, 16 Apr 2015 10:35:57 +0000 From: Keita Kobayashi To: , , CC: , , , , Keita Kobayashi Subject: [RFC/PATCH v2 2/5] ARM: shmobile: Add cpuidle_ops for R-Car cpuidle Date: Thu, 16 Apr 2015 19:35:37 +0900 Message-ID: <1429180540-5692-3-git-send-email-keita.kobayashi.ym@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.2 In-Reply-To: <1429180540-5692-1-git-send-email-keita.kobayashi.ym@renesas.com> References: <1429180540-5692-1-git-send-email-keita.kobayashi.ym@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: KAWPR01CA0004.jpnprd01.prod.outlook.com (25.161.24.14) To HK2PR06MB0561.apcprd06.prod.outlook.com (25.161.183.154) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB0561; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(6069001)(42382002)(122386002)(78352002)(2201001)(76176999)(87976001)(46102003)(33646002)(42186005)(47776003)(50986999)(66066001)(40100003)(229853001)(19580395003)(2950100001)(19580405001)(36756003)(77156002)(62966003)(4001410100001)(50466002)(76506005)(50226001)(48376002)(92566002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0561; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:HK2PR06MB0561; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0561; X-Forefront-PRVS: 0548586081 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2015 10:35:57.5546 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0561 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch add Core-Standby support for R-Car cpuidle. Signed-off-by: Keita Kobayashi --- arch/arm/mach-shmobile/platsmp-apmu.c | 14 +++++++++++--- arch/arm/mach-shmobile/platsmp-apmu.h | 1 + arch/arm/mach-shmobile/pm-rcar-gen2.c | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c index f483b56..a35f97c 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.c +++ b/arch/arm/mach-shmobile/platsmp-apmu.c @@ -139,7 +139,8 @@ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle) } #endif -#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) +#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) || \ + defined(CONFIG_ARM_RCAR_CPUIDLE) /* nicked from arch/arm/mach-exynos/hotplug.c */ static inline void cpu_enter_lowpower_a15(void) { @@ -215,7 +216,7 @@ int shmobile_smp_apmu_cpu_kill(unsigned int cpu) } #endif -#if defined(CONFIG_SUSPEND) +#if defined(CONFIG_SUSPEND) || defined(CONFIG_ARM_RCAR_CPUIDLE) static int shmobile_smp_apmu_do_suspend(unsigned long cpu) { shmobile_smp_hook(cpu, virt_to_phys(cpu_resume), 0); @@ -224,10 +225,17 @@ static int shmobile_smp_apmu_do_suspend(unsigned long cpu) return 1; } -static int shmobile_smp_apmu_enter_suspend(suspend_state_t state) +void shmobile_smp_apmu_enter_corestandby(void) { cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend); cpu_leave_lowpower(); +} +#endif + +#if defined(CONFIG_SUSPEND) +static int shmobile_smp_apmu_enter_suspend(suspend_state_t state) +{ + shmobile_smp_apmu_enter_corestandby(); return 0; } diff --git a/arch/arm/mach-shmobile/platsmp-apmu.h b/arch/arm/mach-shmobile/platsmp-apmu.h index 76512c9..c7dc00a 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.h +++ b/arch/arm/mach-shmobile/platsmp-apmu.h @@ -28,5 +28,6 @@ extern int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle); extern void shmobile_smp_apmu_cpu_die(unsigned int cpu); extern int shmobile_smp_apmu_cpu_kill(unsigned int cpu); +extern void shmobile_smp_apmu_enter_corestandby(void); #endif /* PLATSMP_APMU_H */ diff --git a/arch/arm/mach-shmobile/pm-rcar-gen2.c b/arch/arm/mach-shmobile/pm-rcar-gen2.c index 6815781..846b8ae 100644 --- a/arch/arm/mach-shmobile/pm-rcar-gen2.c +++ b/arch/arm/mach-shmobile/pm-rcar-gen2.c @@ -10,11 +10,15 @@ * for more details. */ +#include +#include #include #include #include +#include #include #include "common.h" +#include "platsmp-apmu.h" #include "pm-rcar.h" #include "rcar-gen2.h" @@ -113,3 +117,16 @@ void __init rcar_gen2_pm_init(void) rcar_gen2_sysc_init(syscier); shmobile_smp_apmu_suspend_init(); } + +#if defined(CONFIG_ARM_RCAR_CPUIDLE) +static int rcar_cpuidle_enter(int cpu, unsigned long index) +{ + shmobile_smp_apmu_enter_corestandby(); + return 0; +} + +struct cpuidle_ops rcar_cpuidle_ops __initdata = { + .suspend = rcar_cpuidle_enter, +}; +CPUIDLE_METHOD_OF_DECLARE(rcar, "renesas,rcar-idle", &rcar_cpuidle_ops); +#endif