From patchwork Mon Apr 6 03:50:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: keita kobayashi X-Patchwork-Id: 6162791 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 171189F2E9 for ; Mon, 6 Apr 2015 03:51:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A3912044C for ; Mon, 6 Apr 2015 03:51:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CA6520439 for ; Mon, 6 Apr 2015 03:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752683AbbDFDvW (ORCPT ); Sun, 5 Apr 2015 23:51:22 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:35241 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752670AbbDFDvW (ORCPT ); Sun, 5 Apr 2015 23:51:22 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 06 Apr 2015 12:51:20 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 7BCC647BF0; Mon, 6 Apr 2015 12:51:20 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 618271806F; Mon, 6 Apr 2015 12:51:20 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 5B4851800A; Mon, 6 Apr 2015 12:51:20 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id NAA19806; Mon, 6 Apr 2015 12:51:20 +0900 X-IronPort-AV: E=Sophos;i="5.11,530,1422889200"; d="scan'208";a="183441529" Received: from mail-sg1lp0093.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.93]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 06 Apr 2015 12:51:19 +0900 Received: from localhost (211.11.155.147) by HKXPR06MB0567.apcprd06.prod.outlook.com (25.161.177.145) with Microsoft SMTP Server (TLS) id 15.1.130.23; Mon, 6 Apr 2015 03:51:18 +0000 From: Keita Kobayashi To: , , CC: , , , Keita Kobayashi Subject: [RFC/PATCH 2/4] ARM: shmobile: Add cpuidle_ops for R-Car cpuidle Date: Mon, 6 Apr 2015 12:50:42 +0900 Message-ID: <1428292244-2160-3-git-send-email-keita.kobayashi.ym@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.2 In-Reply-To: <1428292244-2160-1-git-send-email-keita.kobayashi.ym@renesas.com> References: <1428292244-2160-1-git-send-email-keita.kobayashi.ym@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: TY1PR0201CA0010.apcprd02.prod.outlook.com (25.164.90.148) To HKXPR06MB0567.apcprd06.prod.outlook.com (25.161.177.145) Authentication-Results: verge.net.au; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB0567; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6069001)(6009001)(2950100001)(50226001)(122386002)(92566002)(62966003)(77156002)(76506005)(42186005)(229853001)(50986999)(46102003)(33646002)(78352002)(42382002)(36756003)(48376002)(47776003)(2201001)(76176999)(50466002)(87976001)(66066001)(19580405001)(19580395003); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB0567; 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:HKXPR06MB0567; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB0567; X-Forefront-PRVS: 0538A71254 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2015 03:51:18.1512 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB0567 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=ham 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 | 11 +++++++++-- arch/arm/mach-shmobile/platsmp-apmu.h | 1 + arch/arm/mach-shmobile/pm-rcar-gen2.c | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c index f483b56..c8de95d 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.c +++ b/arch/arm/mach-shmobile/platsmp-apmu.c @@ -215,7 +215,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 +224,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