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: 4187991 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7C5129F1C0 for ; Fri, 16 May 2014 08:04:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A4DB320253 for ; Fri, 16 May 2014 08:04:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 615052035D for ; Fri, 16 May 2014 08:04:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756447AbaEPIEc (ORCPT ); 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-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=N1Hzr4RVElVJ7T3fyXIVFl4JCvbGCshPffDrCW5qbq8=; b=Nnenqt4f76V2XbhiKHm0pBnyj9js38i7Eziw+3UXuHSsvObsAu3qd80Ejc1Sp60jy+ rUHGE0Xc9+ESgkhytL+umMsBd3GvRw5RpCsZHC+0sRmIGzO61HJpb7UYGmLbZihY4fbZ sB3fwiZnDFMrqhmurMaPKQrshVe1cvNpPBx2cm+HYhDEVvuMPCj+gXcRnv4P0FA4qtZZ UWrUEn1jvASY8IsH1XzhpbdCWFq239tFrIweNEd8feI22UN4VPtIM8kBkBYpO34bCHFg V7HryIRIMU0ZACDLf1Ikan+5NisUHv3vMvLmjEbUGCwQ5GX20r2fGWFfV/li88damgCW t+ig== X-Gm-Message-State: ALoCoQkHrV0brQ8Hf6MydEmSDejgebUJisFg+D6c6Kf4rhxVMbxliiuSejoS5woahpjpJcjGTZuf 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: 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=ham 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 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 */