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: 4113121 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 D0984BFF02 for ; Mon, 5 May 2014 09:28:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 102492024C for ; Mon, 5 May 2014 09:28:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 336AF2024F for ; Mon, 5 May 2014 09:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755979AbaEEJ16 (ORCPT ); Mon, 5 May 2014 05:27:58 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:59989 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755619AbaEEJ14 (ORCPT ); Mon, 5 May 2014 05:27:56 -0400 Received: by mail-pa0-f45.google.com with SMTP id ey11so3745769pad.4 for ; Mon, 05 May 2014 02:27:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8Vj7OeEi1sp9v7MRWUtWBWzJ6QUBmSBqxNm9ZU7T34k=; b=UxIq8aWWUKNZWuhc2QhlA3icu0ylfB4+Sxg1VInAW+4QYQmgv3YKx/6UOKhoROTECH pxhkylq9tQifdHRYNuov2JG5YhgRIMvM98Yvzd4u0GaYOnchiVI6DUpokqCpNqyXHi/q sFGDRiaQMA7CwnR6YAbzw7CC9QBTBtCQaKFZGbXN53E6ETGgk/z5j6RVuGmf1kSOJGDr xwRl8TKeX+7GB/JrI4tk14pgAGLj/bUGK764HnzncOtT++08o722vAPGvZjebbzzwUR0 M5/rlDKXaIPcxIJ/tuQ3TW1rWGXbgfQzNKRqdvj7ZqaIk7XyDZ4+v52KG9mWz6sOTGOJ rKhw== X-Gm-Message-State: ALoCoQkVxPGFB9kWzHsZ747646P9OP8/RgjBl9jtCNbRasit7idhBz7UXUR5wZgV4nlPf3P/38dd 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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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)