From patchwork Mon May 5 09:27:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 29633 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 28C802055D for ; Mon, 5 May 2014 09:28:28 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf38773135oah.9 for ; Mon, 05 May 2014 02:28:27 -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=aYnz19axhHq2vLrk7vLVyoRHA3heUHGTvHXpHoeXj2Q=; b=Oo650/a3M6/1whRWntDmEh8Xbm87rW2TywJ2p1wFvKnifXngK2CNZDdUUnj9N42sB4 PaCVS8mhLuh6pitqBRi7aFzLs1bvVRKB0qDo4NaaRnCU2qFQttrwk7z/eAj1+1XlWQaz zd8boZp37xnxib04WGkoaq1lAM8fnH70SYCnKPX1QkaYOeuPKUNfRk6zUM7iq0FugXuC /JSmR2CwW167wJBF15oqc/bH8dr24nXEVbSV9rzBz9jOGc0ti/230EP1hcPTpROsVnyz B77EGQU3GNqZdKt0AN2Y+3qqJAlKKx8jM2CTxdoc7y6daDqdx7lCCmxZUMfrc0rwxaHf Mpqw== X-Gm-Message-State: ALoCoQnROVi1Qr7B53fMG7wgN6xeFf/WkTeDSInqMI/7L9gjEVPnV/82sDmEC2NXmun4KRt+OPYt X-Received: by 10.42.29.138 with SMTP id r10mr15466356icc.11.1399282107675; Mon, 05 May 2014 02:28:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.112 with SMTP id n103ls2336060qga.86.gmail; Mon, 05 May 2014 02:28:27 -0700 (PDT) X-Received: by 10.52.104.7 with SMTP id ga7mr1653512vdb.29.1399282107492; Mon, 05 May 2014 02:28:27 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id m14si1434567vcn.17.2014.05.05.02.28.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 02:28:27 -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.220.173; Received: by mail-vc0-f173.google.com with SMTP id ik5so8413626vcb.32 for ; Mon, 05 May 2014 02:28:27 -0700 (PDT) X-Received: by 10.58.202.133 with SMTP id ki5mr26891772vec.19.1399282107418; Mon, 05 May 2014 02:28:27 -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 ib8csp125566vcb; Mon, 5 May 2014 02:28:26 -0700 (PDT) X-Received: by 10.66.232.68 with SMTP id tm4mr69302632pac.114.1399282106642; Mon, 05 May 2014 02:28:26 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pc9si7857520pac.353.2014.05.05.02.28.25; Mon, 05 May 2014 02:28:26 -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 S1756008AbaEEJ17 (ORCPT + 27 others); Mon, 5 May 2014 05:27:59 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:42506 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755672AbaEEJ14 (ORCPT ); Mon, 5 May 2014 05:27:56 -0400 Received: by mail-pa0-f44.google.com with SMTP id ld10so3834512pab.17 for ; Mon, 05 May 2014 02:27:55 -0700 (PDT) X-Received: by 10.66.141.165 with SMTP id rp5mr70473867pab.90.1399282075736; Mon, 05 May 2014 02:27:55 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id ry10sm67210414pab.38.2014.05.05.02.27.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 02:27:55 -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 v4 5/5] mcpm: exynos: populate suspend and powered_up callbacks Date: Mon, 5 May 2014 14:57:20 +0530 Message-Id: <1399282040-8995-6-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1399282040-8995-1-git-send-email-chander.kashyap@linaro.org> References: <1399278444-8312-3-git-send-email-chander.kashyap@linaro.org> <1399282040-8995-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 v4: None Changes in v3: 1. Removed coherancy enablement after suspend failure. 2. Use generic function to poweron cpu. changes in v2: 1. Fixed typo: enynos_pmu_cpunr to exynos_pmu_cpunr arch/arm/mach-exynos/mcpm-exynos.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index d0f7461..6d4a907 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -256,10 +256,44 @@ static int exynos_power_down_finish(unsigned int cpu, unsigned int cluster) return -ETIMEDOUT; /* timeout */ } +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), ns_sram_base_addr + 0x1c); + + exynos_power_down(); + + /* + * Execution reaches here only if cpu did not power down. + * Hence roll back the changes done in exynos_power_down function. + */ + exynos_cpu_powerup(cpunr); +} + 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)