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: 4434981 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C46019F383 for ; Fri, 27 Jun 2014 13:24:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0B9A20384 for ; Fri, 27 Jun 2014 13:23:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2FC820397 for ; Fri, 27 Jun 2014 13:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753285AbaF0NX5 (ORCPT ); Fri, 27 Jun 2014 09:23:57 -0400 Received: from top.free-electrons.com ([176.31.233.9]:42073 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753276AbaF0NX5 (ORCPT ); Fri, 27 Jun 2014 09:23:57 -0400 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Cc: Thomas Petazzoni , Ezequiel Garcia , linux-arm-kernel@lists.infradead.org, Lior Amsalem , Tawfik Bayouk , Nadav Haklai 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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);