From patchwork Thu Mar 26 10:18:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenhui zhao X-Patchwork-Id: 454942 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EC00F140142 for ; Thu, 26 Mar 2015 21:52:15 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id B17631A09E2 for ; Thu, 26 Mar 2015 21:52:15 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org X-Greylist: delayed 1106 seconds by postgrey-1.35 at bilbo; Thu, 26 Mar 2015 21:51:19 AEDT Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0114.outbound.protection.outlook.com [157.56.111.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 90BD01A0144 for ; Thu, 26 Mar 2015 21:51:19 +1100 (AEDT) Received: from CO2PR03CA0035.namprd03.prod.outlook.com (10.141.194.162) by BY2PR0301MB0726.namprd03.prod.outlook.com (25.160.63.16) with Microsoft SMTP Server (TLS) id 15.1.118.21; Thu, 26 Mar 2015 10:18:00 +0000 Received: from BL2FFO11FD009.protection.gbl (2a01:111:f400:7c09::166) by CO2PR03CA0035.outlook.office365.com (2a01:111:e400:1414::34) with Microsoft SMTP Server (TLS) id 15.1.118.21 via Frontend Transport; Thu, 26 Mar 2015 10:17:59 +0000 Received: from tx30smr01.am.freescale.net ([192.88.168.50]) by BL2FFO11FD009.mail.protection.outlook.com ([10.173.161.15]) with Microsoft SMTP Server (TLS) id 15.1.130.10 via Frontend Transport; Thu, 26 Mar 2015 10:17:59 +0000 Received: from localhost.localdomain ([10.193.20.174]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t2QAHjCH005860; Thu, 26 Mar 2015 03:17:55 -0700 From: Chenhui Zhao To: , Subject: [PATCH 4/4] powerpc/85xx: support sleep feature on QorIQ SoCs with RCPM Date: Thu, 26 Mar 2015 18:18:15 +0800 Message-ID: <1427365095-26396-4-git-send-email-chenhui.zhao@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427365095-26396-1-git-send-email-chenhui.zhao@freescale.com> References: <1427365095-26396-1-git-send-email-chenhui.zhao@freescale.com> X-EOPAttributedMessage: 0 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=chenhui.zhao@freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10019020)(6029001)(6009001)(339900001)(199003)(189002)(49486002)(50226001)(77096005)(48376002)(50466002)(36756003)(92566002)(106466001)(19580405001)(19580395003)(86362001)(105606002)(87936001)(47776003)(85426001)(50986999)(76176999)(229853001)(2950100001)(77156002)(62966003)(33646002)(46102003)(2004002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR0301MB0726; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0726; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5002010)(5005006); SRVR:BY2PR0301MB0726; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB0726; X-Forefront-PRVS: 0527DFA348 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2015 10:17:59.0663 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB0726 Cc: scottwood@freescale.com, linux-kernel@vger.kernel.org, Jason.Jin@freescale.com X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In sleep mode, the clocks of e500 cores and unused IP blocks is turned off. The IP blocks which are allowed to wake up the processor are still running. The sleep mode is equal to the Standby state in Linux. Use the command to enter sleep mode: echo standby > /sys/power/state Signed-off-by: Chenhui Zhao --- arch/powerpc/Kconfig | 3 +- arch/powerpc/platforms/85xx/Kconfig | 5 +++ arch/powerpc/platforms/85xx/Makefile | 1 + arch/powerpc/platforms/85xx/qoriq_pm.c | 59 ++++++++++++++++++++++++++++++++++ arch/powerpc/platforms/86xx/Kconfig | 1 + 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/platforms/85xx/qoriq_pm.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 9846c83..162eb53 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -233,7 +233,7 @@ config ARCH_HIBERNATION_POSSIBLE config ARCH_SUSPEND_POSSIBLE def_bool y depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \ - (PPC_85xx && !PPC_E500MC) || PPC_86xx || PPC_PSERIES \ + FSL_SOC_BOOKE || PPC_86xx || PPC_PSERIES \ || 44x || 40x config PPC_DCR_NATIVE @@ -747,7 +747,6 @@ config FSL_PCI config FSL_PMC bool - default y depends on SUSPEND && (PPC_85xx || PPC_86xx) help Freescale MPC85xx/MPC86xx power management controller support diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index ae1b8a2..b7c762e 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig @@ -9,6 +9,8 @@ menuconfig FSL_SOC_BOOKE select SERIAL_8250_EXTENDED if SERIAL_8250 select SERIAL_8250_SHARE_IRQ if SERIAL_8250 select FSL_CORENET_RCPM if PPC_E500MC + select FSL_QORIQ_PM if SUSPEND && PPC_E500MC + select FSL_PMC if SUSPEND && !PPC_E500MC default y if FSL_SOC_BOOKE @@ -289,3 +291,6 @@ endif # FSL_SOC_BOOKE config TQM85xx bool + +config FSL_QORIQ_PM + bool diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile index 1fe7fb9..65dfb60 100644 --- a/arch/powerpc/platforms/85xx/Makefile +++ b/arch/powerpc/platforms/85xx/Makefile @@ -2,6 +2,7 @@ # Makefile for the PowerPC 85xx linux kernel. # obj-$(CONFIG_SMP) += smp.o +obj-$(CONFIG_FSL_QORIQ_PM) += qoriq_pm.o obj-y += common.o diff --git a/arch/powerpc/platforms/85xx/qoriq_pm.c b/arch/powerpc/platforms/85xx/qoriq_pm.c new file mode 100644 index 0000000..7594f08 --- /dev/null +++ b/arch/powerpc/platforms/85xx/qoriq_pm.c @@ -0,0 +1,59 @@ +/* + * Support Power Management feature + * + * Copyright 2014-2015 Freescale Semiconductor Inc. + * + * Author: Chenhui Zhao + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include + +#include + +static int qoriq_suspend_enter(suspend_state_t state) +{ + int ret = 0; + + switch (state) { + case PM_SUSPEND_STANDBY: + cur_cpu_spec->cpu_flush_caches(); + ret = qoriq_pm_ops->plat_enter_sleep(); + break; + default: + ret = -EINVAL; + } + + return ret; +} + +static int qoriq_suspend_valid(suspend_state_t state) +{ + unsigned int pm_modes; + + pm_modes = qoriq_pm_ops->get_pm_modes(); + + if ((state == PM_SUSPEND_STANDBY) && (pm_modes & FSL_PM_SLEEP)) + return 1; + + return 0; +} + +static const struct platform_suspend_ops qoriq_suspend_ops = { + .valid = qoriq_suspend_valid, + .enter = qoriq_suspend_enter, +}; + +static int __init qoriq_suspend_init(void) +{ + suspend_set_ops(&qoriq_suspend_ops); + + return 0; +} +arch_initcall(qoriq_suspend_init); diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig index 1afd1e4..09638e0 100644 --- a/arch/powerpc/platforms/86xx/Kconfig +++ b/arch/powerpc/platforms/86xx/Kconfig @@ -5,6 +5,7 @@ menuconfig PPC_86xx select FSL_SOC select ALTIVEC select ARCH_WANT_OPTIONAL_GPIOLIB + select FSL_PMC if SUSPEND help The Freescale E600 SoCs have 74xx cores.