From patchwork Mon May 5 08:27:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 29615 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BB163202E6 for ; Mon, 5 May 2014 08:28:23 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id hw13sf14453690qab.11 for ; Mon, 05 May 2014 01:28:23 -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=XHKVm1VgvZZI5sGcBU0KoK3mDq0Yb2DIM9raX2mpRc4=; b=f3bGbgXoyLqNf4q9tNOfO2iyGzS8EjrmUQ5cdfvjDbxKogvCt8OfLpi6ugqmmXiPNv FNgy/OgaP2lOXNQzUucs4YFNRXmNxtQrma43rV9EIEGIXbHu8qk/mwFa/2Osn2DPtJoU RsFt+4Nvko8+SbtkdHC/xAYa1SoolcAJJIXoiNtVpIdUlMG49pNjalPOcZq2gBiE0fuJ 4sUZiXOxLcj1dDwtPxgG5AKpEj1c1c1iXeLCJMz9cXqD2HRx6HXbkh5df5TWj2Go6ZaS c76ECLuvnHDPYoxI39oDDa+wEaSriqDqqiOox3YSXy+gDp+/fS/AF2l9TsSd3aldFlIy lCRA== X-Gm-Message-State: ALoCoQlFV9X96VNceUW1WR9G/tojr5QSXzLmRXhphJQRb0JkOx5XFgduiUoXUTkJaCHdl0xP3ql3 X-Received: by 10.58.30.78 with SMTP id q14mr15986972veh.10.1399278503495; Mon, 05 May 2014 01:28:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.233 with SMTP id l96ls2386772qgl.90.gmail; Mon, 05 May 2014 01:28:23 -0700 (PDT) X-Received: by 10.58.185.145 with SMTP id fc17mr28135043vec.14.1399278503401; Mon, 05 May 2014 01:28:23 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id qr10si1404474vcb.81.2014.05.05.01.28.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 01:28:23 -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.169; Received: by mail-ve0-f169.google.com with SMTP id jx11so8560801veb.28 for ; Mon, 05 May 2014 01:28:23 -0700 (PDT) X-Received: by 10.221.42.135 with SMTP id ty7mr9664803vcb.14.1399278503320; Mon, 05 May 2014 01:28:23 -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 ib8csp122389vcb; Mon, 5 May 2014 01:28:22 -0700 (PDT) X-Received: by 10.67.22.105 with SMTP id hr9mr21714306pad.57.1399278500153; Mon, 05 May 2014 01:28:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id uu2si7717207pac.118.2014.05.05.01.28.18; Mon, 05 May 2014 01:28:18 -0700 (PDT) Received-SPF: none (google.com: linux-pm-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 S1755137AbaEEI2I (ORCPT + 12 others); Mon, 5 May 2014 04:28:08 -0400 Received: from mail-ie0-f169.google.com ([209.85.223.169]:36534 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755177AbaEEI2B (ORCPT ); Mon, 5 May 2014 04:28:01 -0400 Received: by mail-ie0-f169.google.com with SMTP id rl12so7866637iec.28 for ; Mon, 05 May 2014 01:28:00 -0700 (PDT) X-Received: by 10.42.90.11 with SMTP id i11mr30900992icm.26.1399278480145; Mon, 05 May 2014 01:28:00 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id d10sm25050399igc.8.2014.05.05.01.27.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 01:27:59 -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 v3 5/5] mcpm: exynos: populate suspend and powered_up callbacks Date: Mon, 5 May 2014 13:57:24 +0530 Message-Id: <1399278444-8312-6-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1399278444-8312-1-git-send-email-chander.kashyap@linaro.org> References: <1398245154-18771-1-git-send-email-chander.kashyap@linaro.org> <1399278444-8312-1-git-send-email-chander.kashyap@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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 v3: 1. Removed coherance 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)