From patchwork Wed Apr 23 09:25:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 28854 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 75842203AC for ; Wed, 23 Apr 2014 09:27:05 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id m5sf2158843qaj.5 for ; Wed, 23 Apr 2014 02:27:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=0Eiv6jXj/XIkn3WoTJNmsdLqytRtu6JUo+/08jz67HE=; b=F6anzBf2ivFYjzvWA1Ba6gzsH6xYrCSDpnxsm+UGkYRmaBLlgnrxY9xUAfy1cu0Ole cyMK6yt9vQs/lO82+o6u3ZGa1qqExXGSgLpQdIE7QfSqZ0EFBEWOf5Txc1btxinJr6ZL MZk59z69EGc5RNoVQZxCHdKD0/avbU0ol5s45ykF60VqN1NMFo5sCVAucH1+WAT0NNm3 1TQSivdOrDfV58xlqDEiL8A8EWLleHjKqYOcC/RU8y0Oxh+CN42Bk21YH4KlsZ8hNfm+ IxOJ/JNH1bb8R8P5seHSkDrJ5ZeUsiTo7+vmJnzGctFStxjA8uYfaB8iM3+LkIAHRB3B 8l+g== X-Gm-Message-State: ALoCoQl8PqCA/EJUZ1SZdY0R4Y4fq6I9RmJ7YCkcdCtbmes9jgFmW4LYEl8OYFyhm88oTVLLaQRz X-Received: by 10.236.85.131 with SMTP id u3mr18053736yhe.40.1398245225269; Wed, 23 Apr 2014 02:27:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.209 with SMTP id x75ls510188qgx.46.gmail; Wed, 23 Apr 2014 02:27:05 -0700 (PDT) X-Received: by 10.58.195.202 with SMTP id ig10mr60742vec.33.1398245225194; Wed, 23 Apr 2014 02:27:05 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id sn5si60750vdc.209.2014.04.23.02.27.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 02:27:05 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so779867veb.26 for ; Wed, 23 Apr 2014 02:27:05 -0700 (PDT) X-Received: by 10.221.27.8 with SMTP id ro8mr563964vcb.30.1398245225124; Wed, 23 Apr 2014 02:27:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp89237vcb; Wed, 23 Apr 2014 02:27:04 -0700 (PDT) X-Received: by 10.68.218.3 with SMTP id pc3mr18150093pbc.71.1398245224455; Wed, 23 Apr 2014 02:27:04 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cg4si247596pbb.498.2014.04.23.02.27.03; Wed, 23 Apr 2014 02:27:03 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755954AbaDWJ0f (ORCPT + 27 others); Wed, 23 Apr 2014 05:26:35 -0400 Received: from mail-pb0-f50.google.com ([209.85.160.50]:55293 "EHLO mail-pb0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755748AbaDWJ02 (ORCPT ); Wed, 23 Apr 2014 05:26:28 -0400 Received: by mail-pb0-f50.google.com with SMTP id md12so598828pbc.37 for ; Wed, 23 Apr 2014 02:26:27 -0700 (PDT) X-Received: by 10.68.233.99 with SMTP id tv3mr10731912pbc.163.1398245187183; Wed, 23 Apr 2014 02:26:27 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id vg1sm1119481pbc.44.2014.04.23.02.26.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Apr 2014 02:26:26 -0700 (PDT) From: Chander Kashyap To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: lorenzo.pieralisi@arm.com, daniel.lezcano@linaro.org, rjw@rjwysocki.net, kgene.kim@samsung.com, Chander Kashyap , Chander Kashyap Subject: [Patch v2 4/4] mcpm: exynos: populate suspend and powered_up callbacks Date: Wed, 23 Apr 2014 14:55:54 +0530 Message-Id: <1398245154-18771-5-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398245154-18771-1-git-send-email-chander.kashyap@linaro.org> References: <1398080958-21677-5-git-send-email-chander.kashyap@linaro.org> <1398245154-18771-1-git-send-email-chander.kashyap@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: chander.kashyap@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In order to support cpuidle through mcpm, suspend and powered-up callbacks are required in mcpm platform code. Hence populate the same callbacks. Signed-off-by: Chander Kashyap Signed-off-by: Chander Kashyap --- changes in v2: 1. Fixed typo: enynos_pmu_cpunr to exynos_pmu_cpunr arch/arm/mach-exynos/mcpm-exynos.c | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index 6c74c82..d53f597 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -272,10 +272,63 @@ static int exynos_power_down_finish(unsigned int cpu, unsigned int cluster) return 0; /* success: the CPU is halted */ } +static void enable_coherency(void) +{ + unsigned long v, u; + + asm volatile( + "mrc p15, 0, %0, c1, c0, 1\n" + "orr %0, %0, %2\n" + "ldr %1, [%3]\n" + "and %1, %1, #0\n" + "orr %0, %0, %1\n" + "mcr p15, 0, %0, c1, c0, 1\n" + : "=&r" (v), "=&r" (u) + : "Ir" (0x40), "Ir" (S5P_INFORM0) + : "cc"); +} + +void exynos_powered_up(void) +{ + unsigned int mpidr, cpu, cluster; + + mpidr = read_cpuid_mpidr(); + cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); + cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); + + arch_spin_lock(&exynos_mcpm_lock); + if (cpu_use_count[cpu][cluster] == 0) + cpu_use_count[cpu][cluster] = 1; + arch_spin_unlock(&exynos_mcpm_lock); +} + +static void exynos_suspend(u64 residency) +{ + unsigned int mpidr, cpunr; + + mpidr = read_cpuid_mpidr(); + cpunr = exynos_pmu_cpunr(mpidr); + + __raw_writel(virt_to_phys(mcpm_entry_point), REG_ENTRY_ADDR); + + exynos_power_down(); + + /* + * Execution reaches here only if cpu did not power down. + * Hence roll back the changes done in exynos_power_down function. + */ + __raw_writel(EXYNOS_CORE_LOCAL_PWR_EN, + EXYNOS_ARM_CORE_CONFIGURATION(cpunr)); + set_cr(get_cr() | CR_C); + enable_coherency(); +} + static const struct mcpm_platform_ops exynos_power_ops = { .power_up = exynos_power_up, .power_down = exynos_power_down, .power_down_finish = exynos_power_down_finish, + .suspend = exynos_suspend, + .powered_up = exynos_powered_up, }; static void __init exynos_mcpm_usage_count_init(void)