From patchwork Wed Feb 27 03:42:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 2192071 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 23DE8DF2F2 for ; Wed, 27 Feb 2013 03:46:36 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UAXv8-0001V0-Sz; Wed, 27 Feb 2013 03:43:06 +0000 Received: from mail-oa0-f53.google.com ([209.85.219.53]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UAXuU-0001PX-Oa for linux-arm-kernel@lists.infradead.org; Wed, 27 Feb 2013 03:42:29 +0000 Received: by mail-oa0-f53.google.com with SMTP id m1so247694oag.40 for ; Tue, 26 Feb 2013 19:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=Qcd1p3/wLkVtWn0ckXeqN3ABVZQI6f/kx/kS+z8KHWw=; b=aBYhlBpyzROR0Xyga/Xn+ocqI685sROW55bvtDUlZlPFi0ya82L6vDqv9/vBwm4ePm bhi8BD5L98O5fmHfOmEk81LMFnCLY4YQyHgDQ69PxX0wKGLkrVDfEMbAS12zbAONXbF+ GOTk0xysIJYmOoMwEMDVpMpL49+EtxdwqjtphZ0TdTii6J/kB//P8gQ+NW34TOVeNAEj BnchTn6IfJDwLLfNEkxl6eX0ZUD1WrhKxUmbhXk5D/rD7HL1WtaN3yW2JQFOMrF7LArY 5hdaZsuXOruhOgajnWUfZ9w9JPpjiixDhalo7Nu/zgJTfmioYfOIwhqmatOMD4eeA79k IWyA== X-Received: by 10.182.119.72 with SMTP id ks8mr728388obb.23.1361936545736; Tue, 26 Feb 2013 19:42:25 -0800 (PST) Received: from rob-laptop.grandenetworks.net (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPS id d10sm5778153oeh.7.2013.02.26.19.42.24 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Feb 2013 19:42:25 -0800 (PST) From: Rob Herring To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/4] cpuidle: calxeda: add support to use PSCI calls Date: Tue, 26 Feb 2013 21:42:07 -0600 Message-Id: <1361936528-25998-4-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1361936528-25998-1-git-send-email-robherring2@gmail.com> References: <1361936528-25998-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130226_224227_008760_31AAB98D X-CRM114-Status: GOOD ( 14.98 ) X-Spam-Score: -1.3 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.219.53 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (robherring2[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (robherring2[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: arm@kernel.org, Will Deacon , Rob Herring 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 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 --- drivers/cpuidle/cpuidle-calxeda.c | 54 +++++-------------------------------- 1 file changed, 6 insertions(+), 48 deletions(-) diff --git a/drivers/cpuidle/cpuidle-calxeda.c b/drivers/cpuidle/cpuidle-calxeda.c index e1aab38..eee8074 100644 --- a/drivers/cpuidle/cpuidle-calxeda.c +++ b/drivers/cpuidle/cpuidle-calxeda.c @@ -20,67 +20,25 @@ #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; +#include static struct cpuidle_device __percpu *calxeda_idle_cpuidle_devices; -static inline unsigned int get_auxcr(void) -{ - unsigned int val; - asm("mrc p15, 0, %0, c1, c0, 1 @ get AUXCR" : "=r" (val) : : "cc"); - return val; -} - -static inline void set_auxcr(unsigned int val) -{ - asm volatile("mcr p15, 0, %0, c1, c0, 1 @ set AUXCR" - : : "r" (val) : "cc"); - isb(); -} - -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); -} - 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; } @@ -123,7 +81,7 @@ static int __init calxeda_cpuidle_init(void) struct cpuidle_device *dev; struct cpuidle_driver *drv = &calxeda_idle_driver; - if (!of_machine_is_compatible("calxeda,highbank")) + if (!of_machine_is_compatible("calxeda,highbank") || !psci_ops.cpu_suspend) return -ENODEV; ret = cpuidle_register_driver(drv);