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: 4173591 Return-Path: X-Original-To: patchwork-linux-arm@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 AD07FBFF02 for ; Wed, 14 May 2014 08:07:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBB9F20377 for ; Wed, 14 May 2014 08:07:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07F6F2034E for ; Wed, 14 May 2014 08:07:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WkUBF-0002Gd-CM; Wed, 14 May 2014 08:04:49 +0000 Received: from mail-pa0-f53.google.com ([209.85.220.53]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WkUBA-0002DA-D6 for linux-arm-kernel@lists.infradead.org; Wed, 14 May 2014 08:04:44 +0000 Received: by mail-pa0-f53.google.com with SMTP id kp14so1377864pab.40 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=ENdIFtAfXlDVFR4o/qfzuC1BY7HE8lWT50kdJipwM4q6ZIalzO9r4F6PSWQWj7pbid fKlUrliGzmUCXkc+7SpmDhGWQYLMFlpxrHKZdF2C4Y27jz+86+7SS0bfhE//rzAGd5ja 3bPYCWEK3SEa0SQcv7C23QvV2B1LqCFZU8JN4CX9z/Tyw+IbQmJ9Ob7MK/UOsS1ZWxUy HuPg6JtqWSVk2V6pnJgCJnWXvlU00jXkQOqQjFYLhTbp1blrK7a/v9c4JkW6ITBiOM9G rrOh+8uKDLMTJz6rZLIMXjT6UBYshRSpEjP9xqtFyLRcD5XM51TjVwnbaZtleERA3XJk 9hXA== X-Gm-Message-State: ALoCoQnQa6qqQGplVansilceAAG7kN469DGjWQZXW61oMho3b3VIxhLYQe3sG70KgesZT6JEMZsD 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140514_010444_477906_75A6258C X-CRM114-Status: GOOD ( 10.71 ) X-Spam-Score: -0.7 (/) Cc: Chander Kashyap , lorenzo.pieralisi@arm.com, daniel.lezcano@linaro.org, rjw@rjwysocki.net, Chander Kashyap , kgene.kim@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,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 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 */