From patchwork Wed Jul 8 12:51:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 6746871 Return-Path: X-Original-To: patchwork-linux-arm@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 DD95A9F2F0 for ; Wed, 8 Jul 2015 12:53:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10B69205DB for ; Wed, 8 Jul 2015 12:53:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A85B205D3 for ; Wed, 8 Jul 2015 12:53:54 +0000 (UTC) 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 1ZCopd-0005Q2-Al; Wed, 08 Jul 2015 12:52:09 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCopT-0005I7-AF for linux-arm-kernel@lists.infradead.org; Wed, 08 Jul 2015 12:51:59 +0000 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id t68CoF25004257; Wed, 8 Jul 2015 05:51:27 -0700 Received: from sc-owa.marvell.com ([199.233.58.135]) by mx0a-0016f401.pphosted.com with ESMTP id 1vg8wsctct-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 08 Jul 2015 05:51:27 -0700 Received: from maili.marvell.com (10.93.76.83) by SC-OWA.marvell.com (10.93.76.28) with Microsoft SMTP Server id 8.3.327.1; Wed, 8 Jul 2015 05:51:26 -0700 Received: from xhacker.marvell.com (unknown [10.37.135.134]) by maili.marvell.com (Postfix) with ESMTP id 6C8ED3F703F; Wed, 8 Jul 2015 05:51:25 -0700 (PDT) From: Jisheng Zhang To: , , , , , Subject: [PATCH v2 2/2] arm: kernel: implement cpuidle_ops with psci backend Date: Wed, 8 Jul 2015 20:51:08 +0800 Message-ID: <1436359868-6176-3-git-send-email-jszhang@marvell.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436359868-6176-1-git-send-email-jszhang@marvell.com> References: <1436359868-6176-1-git-send-email-jszhang@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2015-07-08_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 kscore.is_bulkscore=0 kscore.compositescore=1 compositescore=0.9 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.9 spamscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1506180000 definitions=main-1507080205 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150708_055159_366760_54C97E2D X-CRM114-Status: GOOD ( 12.91 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jisheng Zhang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 implements cpuidle_ops using psci. After this patch, we can use cpuidle-arm.c with psci backend for both arm and arm64. Signed-off-by: Jisheng Zhang --- arch/arm/kernel/Makefile | 1 + arch/arm/kernel/psci_cpuidle.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 arch/arm/kernel/psci_cpuidle.c diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 3b995f5..96383d8 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -91,6 +91,7 @@ obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o ifeq ($(CONFIG_ARM_PSCI),y) obj-y += psci-call.o obj-$(CONFIG_SMP) += psci_smp.o +obj-$(CONFIG_CPU_IDLE) += psci_cpuidle.o endif extra-y := $(head-y) vmlinux.lds diff --git a/arch/arm/kernel/psci_cpuidle.c b/arch/arm/kernel/psci_cpuidle.c new file mode 100644 index 0000000..ae85d97 --- /dev/null +++ b/arch/arm/kernel/psci_cpuidle.c @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2015 Marvell Technology Group Ltd. + * Author: Jisheng Zhang + * + * 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 + +static int psci_cpuidle_suspend(int cpu, unsigned long arg) +{ + return cpu_psci_cpu_suspend(arg); +} + +static int psci_cpuidle_init(struct device_node *node, int cpu) +{ + return cpu_psci_cpu_init_idle(cpu); +} + +static struct cpuidle_ops psci_cpuidle_ops __initdata = { + .suspend = psci_cpuidle_suspend, + .init = psci_cpuidle_init, +}; +CPUIDLE_METHOD_OF_DECLARE(psci_cpuidle, "psci", &psci_cpuidle_ops);