From patchwork Wed May 14 08:03:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 4173371 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 2D43E9F3AE for ; Wed, 14 May 2014 08:04:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56F802035C for ; Wed, 14 May 2014 08:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 550072034E for ; Wed, 14 May 2014 08:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753203AbaENIEa (ORCPT ); Wed, 14 May 2014 04:04:30 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:57224 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356AbaENIEY (ORCPT ); Wed, 14 May 2014 04:04:24 -0400 Received: by mail-pa0-f43.google.com with SMTP id hz1so1379586pad.2 for ; Wed, 14 May 2014 01:04: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:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N1Hzr4RVElVJ7T3fyXIVFl4JCvbGCshPffDrCW5qbq8=; b=PEm0pxh/G40xF9xdYBmiVxnZw9e6oGSX6FqLy0yjKgGIMG2bjrxbzQmH45jTQ5uBsf CAC+MiMaLFye3AXzpbb86+hfLd/utARZtLejac3PGqxOTxUhfvb1N6/n6JCiMxALwRL1 Q5eA8YLHnt5SQFCYeYkYKFeXEOgVRavXeYeBL+5Ff0dMpci/Kpu1EQLAeIjyDoGkYRPr IOWvrOkNwMvMcLSBFtCZ9ZiXL0wuyieYIZSizC2trkV7GPrfk5H/yNICVNwnlRwQ9QL3 yANVwjCG7cadZtwaKbe3Zf/41ZcBP92AzEFM3RAoDhPijaDrh3NESkBTVzxaGtnrAD/T T45w== X-Gm-Message-State: ALoCoQn4i5f2DRkeF0GSFIgWxHVjv+Ff13MtaKbCH11vGOrR1ubq/T0g751hDAlS9z2e8wKERBqe X-Received: by 10.66.164.70 with SMTP id yo6mr2444476pab.85.1400054663615; Wed, 14 May 2014 01:04:23 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id as12sm4807422pac.43.2014.05.14.01.04.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 May 2014 01:04:23 -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: daniel.lezcano@linaro.org, lorenzo.pieralisi@arm.com, rjw@rjwysocki.net, kgene.kim@samsung.com, Chander Kashyap , Chander Kashyap Subject: [PATCH v5 2/6] arm: exynos: add generic function to calculate cpu number Date: Wed, 14 May 2014 13:33:53 +0530 Message-Id: <1400054637-21505-3-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400054637-21505-1-git-send-email-chander.kashyap@linaro.org> References: <1400054637-21505-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 */