From patchwork Sun Jul 28 21:56:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 2834729 Return-Path: X-Original-To: patchwork-linux-pm@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 14BE2C0319 for ; Sun, 28 Jul 2013 21:57:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F3152012B for ; Sun, 28 Jul 2013 21:57:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 040F720113 for ; Sun, 28 Jul 2013 21:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752194Ab3G1V5H (ORCPT ); Sun, 28 Jul 2013 17:57:07 -0400 Received: from mail-oa0-f47.google.com ([209.85.219.47]:39005 "EHLO mail-oa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752159Ab3G1V5F (ORCPT ); Sun, 28 Jul 2013 17:57:05 -0400 Received: by mail-oa0-f47.google.com with SMTP id m6so4703378oag.34 for ; Sun, 28 Jul 2013 14:57:04 -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:x-mailer:in-reply-to:references; bh=+FNJpqQvDQ4ljocX2FVkBfQ0Hd/UwGfG8be7Ul0Cfsk=; b=ctNGm87R9YC36pps3GJw/L1trm2m1KV662tlujZUT2HVbDuGdxxNYOAF9JDgOyqdbw AKrbVrOzkjKCB69WH9yFJtQLbktVVvDssh7r9X49RiGVDvpJACi2oPFpKqYKol18oA5+ X+9bKTJkUp1YXaMOmKRcu4TCJh8XT3lODNCflhBNm9WbV+3DTU4+ywnTv6XSYiNYd9Bi ncEXbikZQg8Gxh+WcBAjdDxE/6z8r0R0YPptSBsTy3Ilr++Py87f75JcBJu4tJrD+gra pOw6F6OKjSBxKjfzauxfOTukZZrS2eLFhqoBp5YvPuqmNLwKt22cyeGa9wweqCzfKbgg klkA== X-Received: by 10.182.128.68 with SMTP id nm4mr15827079obb.56.1375048624794; Sun, 28 Jul 2013 14:57:04 -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 r4sm84375587oem.3.2013.07.28.14.57.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 28 Jul 2013 14:57:04 -0700 (PDT) From: Rob Herring To: linux-arm-kernel@lists.infradead.org Cc: Rob Herring , "Rafael J. Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH 4/7] cpuidle: calxeda: add support to use PSCI calls Date: Sun, 28 Jul 2013 16:56:35 -0500 Message-Id: <1375048598-15637-5-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1375048598-15637-1-git-send-email-robherring2@gmail.com> References: <1375048598-15637-1-git-send-email-robherring2@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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/cpuidle-calxeda.c | 40 ++++++--------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c index 0e6e408..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 *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);