From patchwork Fri Jun 27 13:22:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 4435201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 93F21BEEAA for ; Fri, 27 Jun 2014 13:28:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C12F220381 for ; Fri, 27 Jun 2014 13:28:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F2C9B2026D for ; Fri, 27 Jun 2014 13:28:05 +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 1X0W9u-0005PC-3N; Fri, 27 Jun 2014 13:25:42 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0W8e-0003CO-P3 for linux-arm-kernel@lists.infradead.org; Fri, 27 Jun 2014 13:24:26 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 1A33C940; Fri, 27 Jun 2014 15:23:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (tra42-5-83-152-246-54.fbx.proxad.net [83.152.246.54]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8257C845; Fri, 27 Jun 2014 15:23:56 +0200 (CEST) From: Gregory CLEMENT To: Daniel Lezcano , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Gregory CLEMENT Subject: [PATCH 07/16] ARM: mvebu: Make the CPU idle initialization more generic Date: Fri, 27 Jun 2014 15:22:48 +0200 Message-Id: <1403875377-940-8-git-send-email-gregory.clement@free-electrons.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1403875377-940-1-git-send-email-gregory.clement@free-electrons.com> References: <1403875377-940-1-git-send-email-gregory.clement@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140627_062425_017276_C4A92FD7 X-CRM114-Status: GOOD ( 14.20 ) X-Spam-Score: 1.0 (+) Cc: Thomas Petazzoni , Lior Amsalem , Tawfik Bayouk , Nadav Haklai , Ezequiel Garcia , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In order to support more mvebu SoCs, this patch use an initialization specific function associated to each SoCs which support CPU Idle. Then each SoC will have his own set of check and of data configuration. Signed-off-by: Gregory CLEMENT --- arch/arm/mach-mvebu/pmsu.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c index 087157c20b8a..454f0f9ede6b 100644 --- a/arch/arm/mach-mvebu/pmsu.c +++ b/arch/arm/mach-mvebu/pmsu.c @@ -293,23 +293,47 @@ static struct notifier_block mvebu_v7_cpu_pm_notifier = { .notifier_call = mvebu_v7_cpu_pm_notify, }; +static bool (*mvebu_v7_cpu_idle_init)(void); + +static __init bool armada_xp_cpuidle_init(void) +{ + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); + if (!np) + return false; + of_node_put(np); + + mvebu_v7_cpuidle_device.dev.platform_data = armada_xp_370_cpu_suspend; + return true; +} + +static struct of_device_id of_cpuidle_table[] __initdata = { + { .compatible = "marvell,armadaxp", + .data = (void *)armada_xp_cpuidle_init, + }, + { /* end of list */ }, +}; + static int __init mvebu_v7_cpu_pm_init(void) { struct device_node *np; + const struct of_device_id *match; + + np = of_find_matching_node_and_match(NULL, of_cpuidle_table, + &match); + /* * Check that all the requirements are available to enable - * cpuidle. So far, it is only supported on Armada XP, cpuidle - * needs the coherency fabric and the PMSU enabled + * cpuidle. Each SoCs comes with its own requirements and + * configuration */ - if (!of_machine_is_compatible("marvell,armadaxp")) - return 0; + mvebu_v7_cpu_idle_init = (bool (*)(void))match->data; - np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); - if (!np) + if (!mvebu_v7_cpu_idle_init()) return 0; - of_node_put(np); np = of_find_matching_node(NULL, of_pmsu_table); if (!np) @@ -329,7 +353,6 @@ static int __init mvebu_v7_cpu_pm_init(void) PMSU_BOOT_ADDR_REDIRECT_OFFSET(0)); mvebu_v7_pmsu_enable_l2_powerdown_onidle(); - mvebu_v7_cpuidle_device.dev.platform_data = armada_xp_370_cpu_suspend; platform_device_register(&mvebu_v7_cpuidle_device); cpu_pm_register_notifier(&mvebu_v7_cpu_pm_notifier);