From patchwork Mon Apr 21 11:49:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 28693 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C416E2032B for ; Mon, 21 Apr 2014 11:50:23 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf27045383oag.6 for ; Mon, 21 Apr 2014 04:50: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=Fi4SqQFRr6s0PlsOOfloZQYix2cHT2APNGPqfyCpmDw=; b=lqkD+PpIeJO2Tp/hdKDTMm6wAlN2/+vikg8XFCpZaNGjFDo5BQRh/f3WSuAJjoQNIA uJDbmud0cysQAHH3ft8DuhFSbLYs3PuRheLcuhFzTwTsltirqFLCiaYsqidIFkPzayBB AUyy/I5CIn3swWtuH288FtaJ1L2pl2dEsb0WMGrvp7b97T5jC8mSTECCZzUSr348uhzj io5J/xGNFC5zjAi8BSZkDQlBrPeMYUB4dnAb6rqJZ4Y+uk8Fkf8daxfljuOqyJFJSsZS GTC7JzEOWrt1OPtxVZnLt5skoeg3rVOn3nNBkvglWnBd04v7vZ5XazSp30S5LcYbwKT6 5Imw== X-Gm-Message-State: ALoCoQlSXUGqrBdmhuKcgxXJE86uTjzkCMwX0Hwzx7OyWqevpKmE8oRXWrX5CkOpPasDM8tUTadG X-Received: by 10.43.103.136 with SMTP id di8mr14922019icc.14.1398081023253; Mon, 21 Apr 2014 04:50:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.87 with SMTP id v81ls2334599qge.0.gmail; Mon, 21 Apr 2014 04:50:23 -0700 (PDT) X-Received: by 10.58.207.74 with SMTP id lu10mr33584062vec.15.1398081023158; Mon, 21 Apr 2014 04:50:23 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id ui2si6192742vdc.118.2014.04.21.04.50.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 04:50:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id sa20so7584859veb.8 for ; Mon, 21 Apr 2014 04:50:23 -0700 (PDT) X-Received: by 10.52.144.42 with SMTP id sj10mr24755530vdb.19.1398081022981; Mon, 21 Apr 2014 04:50:22 -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 ib8csp285842vcb; Mon, 21 Apr 2014 04:50:21 -0700 (PDT) X-Received: by 10.66.193.161 with SMTP id hp1mr37573336pac.20.1398081021129; Mon, 21 Apr 2014 04:50:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yz5si1423976pbb.78.2014.04.21.04.50.20; Mon, 21 Apr 2014 04:50:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751743AbaDULuP (ORCPT + 26 others); Mon, 21 Apr 2014 07:50:15 -0400 Received: from mail-pb0-f44.google.com ([209.85.160.44]:36570 "EHLO mail-pb0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbaDULtt (ORCPT ); Mon, 21 Apr 2014 07:49:49 -0400 Received: by mail-pb0-f44.google.com with SMTP id rp16so3651460pbb.17 for ; Mon, 21 Apr 2014 04:49:48 -0700 (PDT) X-Received: by 10.69.21.106 with SMTP id hj10mr37507518pbd.87.1398080988839; Mon, 21 Apr 2014 04:49:48 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id ir10sm77592553pbc.59.2014.04.21.04.49.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 04:49:48 -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 4/4] mcpm: exynos: populate suspend and powered_up callbacks Date: Mon, 21 Apr 2014 17:19:18 +0530 Message-Id: <1398080958-21677-5-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398080958-21677-1-git-send-email-chander.kashyap@linaro.org> References: <1398080958-21677-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: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 --- 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 46d4968..16af0bd 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -318,10 +318,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(&bl_lock); + if (cpu_use_count[cpu][cluster] == 0) + cpu_use_count[cpu][cluster] = 1; + arch_spin_unlock(&bl_lock); +} + +static void exynos_suspend(u64 residency) +{ + unsigned int mpidr, cpunr; + + mpidr = read_cpuid_mpidr(); + cpunr = enynos_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)