From patchwork Fri Sep 27 02:24:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 2952011 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 31E64BFF0B for ; Fri, 27 Sep 2013 02:26:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B08B20279 for ; Fri, 27 Sep 2013 02:26:02 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41507201B7 for ; Fri, 27 Sep 2013 02:26:01 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VPNkk-00066V-0L; Fri, 27 Sep 2013 02:25:58 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VPNkg-0002rl-7l; Fri, 27 Sep 2013 02:25:54 +0000 Received: from mail-ob0-x230.google.com ([2607:f8b0:4003:c01::230]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VPNkc-0002py-IE for linux-arm-kernel@lists.infradead.org; Fri, 27 Sep 2013 02:25:51 +0000 Received: by mail-ob0-f176.google.com with SMTP id uy5so2791730obc.35 for ; Thu, 26 Sep 2013 19:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/nK454PuglPL/JtgpuYYU85nEaECJIVIGtOkIhtfjsI=; b=JZkHoL+JydC7KnVgXzn9CCnOuZGGzzhkJvzzJ6/5VkI+DbHaz0EtcruyUmdgjVej1J PXjZmCp13AD4rEY/8GnyghuFp7DzAtobt08XNXGQjye4ZkX5BRnql0bUvjLM4vUyIDEz BdjRHI1OIUwLv/4NtjsyD2OLY7fmb2D6ddK1Exs14sAMSai4BAauP5VlJFiWUcnfnpch CaunIVeI7UkLZG/L4/WD3vQVGDHKcVdEJgbSGVXjPupOHuvnVnTqClK7ith+JwPLLJYf nZuYVaIkNPGPXRyAnG3ld/mHs4Fxe5Yz1tRx6QGOxJMbbh9/mhIL9fqlrC04nuw8S17F pmZA== X-Received: by 10.182.246.39 with SMTP id xt7mr3654402obc.16.1380248728858; Thu, 26 Sep 2013 19:25:28 -0700 (PDT) Received: from rob-laptop.grandenetworks.net (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPSA id b5sm7615423obj.8.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 19:25:28 -0700 (PDT) From: Rob Herring To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/6] cpuidle: calxeda: add support to use PSCI calls Date: Thu, 26 Sep 2013 21:24:49 -0500 Message-Id: <1380248694-13388-2-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380248694-13388-1-git-send-email-robherring2@gmail.com> References: <1380248694-13388-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130926_222550_642287_11347059 X-CRM114-Status: GOOD ( 17.28 ) X-Spam-Score: -1.8 (-) Cc: "Rafael J. Wysocki" , Daniel Lezcano , Rob Herring , linux-pm@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Rob Herring This updates the Calxeda cpuidle driver to use PSCI calls to powergate cores. This is needed to enable cpuidle for the ECX-2000. This could possibly become a generic PSCI driver, but there are no other PSCI users in the kernel other than mach-virt. Signed-off-by: Rob Herring Cc: "Rafael J. Wysocki" Cc: Daniel Lezcano Cc: linux-pm@vger.kernel.org Acked-by: Daniel Lezcano --- drivers/cpuidle/Kconfig.arm | 2 +- drivers/cpuidle/cpuidle-calxeda.c | 40 ++++++--------------------------------- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index 8e36603..d6f57d5 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -4,7 +4,7 @@ config ARM_HIGHBANK_CPUIDLE bool "CPU Idle Driver for Calxeda processors" - depends on ARCH_HIGHBANK + depends on ARM_PSCI select ARM_CPU_SUSPEND help Select this to enable cpuidle on Calxeda processors. diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c index 3460584..01cfecf3 100644 --- a/drivers/cpuidle/cpuidle-calxeda.c +++ b/drivers/cpuidle/cpuidle-calxeda.c @@ -22,51 +22,23 @@ #include #include -#include #include -#include -#include -#include #include -#include -#include #include -#include -#include - -extern void highbank_set_cpu_jump(int cpu, void *jump_addr); -extern void __iomem *scu_base_addr; - -static noinline void calxeda_idle_restore(void) -{ - set_cr(get_cr() | CR_C); - set_auxcr(get_auxcr() | 0x40); - scu_power_mode(scu_base_addr, SCU_PM_NORMAL); -} +#include static int calxeda_idle_finish(unsigned long val) { - /* Already flushed cache, but do it again as the outer cache functions - * dirty the cache with spinlocks */ - flush_cache_all(); - - set_auxcr(get_auxcr() & ~0x40); - set_cr(get_cr() & ~CR_C); - - scu_power_mode(scu_base_addr, SCU_PM_DORMANT); - - cpu_do_idle(); - - /* Restore things if we didn't enter power-gating */ - calxeda_idle_restore(); - return 1; + const struct psci_power_state ps = { + .type = PSCI_POWER_STATE_TYPE_POWER_DOWN, + }; + return psci_ops.cpu_suspend(ps, __pa(cpu_resume)); } static int calxeda_pwrdown_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - highbank_set_cpu_jump(smp_processor_id(), cpu_resume); cpu_suspend(0, calxeda_idle_finish); return index; } @@ -90,7 +62,7 @@ static struct cpuidle_driver calxeda_idle_driver = { static int __init calxeda_cpuidle_init(void) { - if (!of_machine_is_compatible("calxeda,highbank")) + if (!of_machine_is_compatible("calxeda,highbank") || !psci_ops.cpu_suspend) return -ENODEV; return cpuidle_register(&calxeda_idle_driver, NULL);