From patchwork Fri May 16 08:03: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: 30304 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f70.google.com (mail-qg0-f70.google.com [209.85.192.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB96320A25 for ; Fri, 16 May 2014 08:04:35 +0000 (UTC) Received: by mail-qg0-f70.google.com with SMTP id i50sf5063451qgf.9 for ; Fri, 16 May 2014 01:04:35 -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=nfHKPGrs5+X5LQ+Z89mQlUim7ooCIGogY4HZirxWpdQ=; b=DnPgKHKbTu1DTI99JgbT+aMnAR/0+h+eUyUWd/qhP3w9AtDiB0KAEXdaeYJkVXlntu 1S/AUP9LlVoJOF2oP0C00f2Pe8r1/OqtsgKjqAHqyXvVeo1KRgL7DgUaEzK7ouTxkmmV nL18RUhmuxOaSmgw5Wah8p2kq5MaxOZVTesJPYiCcu64pfRWk6njyPzMtny/A97WzFp7 of1IVlmDsO5cQVjnQ76a5QCb9XQ5kzJrNodC5G/pX9LLBZv4XNvH+sy34cnClO5MDnju f0vWDYhPXoGnSDRWvalYOFNNW7JTTzt7fv2uROXMuNIYHJziTN9+Tqcau6Zg80MDOIxO mzEg== X-Gm-Message-State: ALoCoQk6aiybEGQerp9634uNMJgtK7kM7eVp6j6f4q6fk0pfUkY7OZdJgsHKGrA3sJrFNy97iBSH X-Received: by 10.58.30.108 with SMTP id r12mr3774030veh.17.1400227475048; Fri, 16 May 2014 01:04:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.195 with SMTP id f61ls482725qgf.59.gmail; Fri, 16 May 2014 01:04:35 -0700 (PDT) X-Received: by 10.58.161.101 with SMTP id xr5mr12100veb.36.1400227474972; Fri, 16 May 2014 01:04:34 -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 j5si1404508veb.183.2014.05.16.01.04.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 01:04:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id pa12so2706134veb.12 for ; Fri, 16 May 2014 01:04:34 -0700 (PDT) X-Received: by 10.58.179.115 with SMTP id df19mr6393vec.41.1400227474861; Fri, 16 May 2014 01:04:34 -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 ib8csp32057vcb; Fri, 16 May 2014 01:04:34 -0700 (PDT) X-Received: by 10.66.148.134 with SMTP id ts6mr18633902pab.113.1400227473843; Fri, 16 May 2014 01:04:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qh4si2456245pbb.94.2014.05.16.01.04.33; Fri, 16 May 2014 01:04:33 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-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 S1756447AbaEPIEc (ORCPT + 9 others); Fri, 16 May 2014 04:04:32 -0400 Received: from mail-pb0-f41.google.com ([209.85.160.41]:33088 "EHLO mail-pb0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756434AbaEPIEa (ORCPT ); Fri, 16 May 2014 04:04:30 -0400 Received: by mail-pb0-f41.google.com with SMTP id uo5so2297477pbc.0 for ; Fri, 16 May 2014 01:04:28 -0700 (PDT) X-Received: by 10.67.13.134 with SMTP id ey6mr18827245pad.44.1400227468355; Fri, 16 May 2014 01:04:28 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id gu1sm13108466pbd.0.2014.05.16.01.04.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 01:04:27 -0700 (PDT) From: Chander Kashyap To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, daniel.lezcano@linaro.org, lorenzo.pieralisi@arm.com, rjw@rjwysocki.net, kgene.kim@samsung.com, tomasz.figa@gmail.com, Chander Kashyap , Chander Kashyap Subject: [PATCH v6 2/6] arm: exynos: add generic function to calculate cpu number Date: Fri, 16 May 2014 13:33:54 +0530 Message-Id: <1400227438-27155-3-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400227438-27155-1-git-send-email-chander.kashyap@linaro.org> References: <1400227438-27155-1-git-send-email-chander.kashyap@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) 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: , The address of cpu power registers in pmu is based on cpu number offsets. This function calculate the same. This is essentially required in case of multi-cluster SoC's e.g Exynos5420. Signed-off-by: Chander Kashyap Signed-off-by: Chander Kashyap --- arch/arm/mach-exynos/regs-pmu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index 4179f6a..485aefd 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -325,4 +325,13 @@ #define EXYNOS5420_SWRESET_KFC_SEL 0x3 +#include +#define MAX_CPUS_IN_CLUSTER 4 + +static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr) +{ + return ((MPIDR_AFFINITY_LEVEL(mpidr, 1) * MAX_CPUS_IN_CLUSTER) + + MPIDR_AFFINITY_LEVEL(mpidr, 0)); +} + #endif /* __ASM_ARCH_REGS_PMU_H */