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: 4188191 Return-Path: X-Original-To: patchwork-linux-arm@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 A08B09F1C0 for ; Fri, 16 May 2014 08:08:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E026620386 for ; Fri, 16 May 2014 08:07:59 +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 133FC20165 for ; Fri, 16 May 2014 08:07:59 +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 1WlD8X-0000zX-9i; Fri, 16 May 2014 08:05:01 +0000 Received: from mail-pb0-f47.google.com ([209.85.160.47]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WlD8M-0000mq-DT for linux-arm-kernel@lists.infradead.org; Fri, 16 May 2014 08:04:50 +0000 Received: by mail-pb0-f47.google.com with SMTP id rp16so2279479pbb.34 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=bNOj4Eh1quEmtsvIyRmrhTfnyy0tKSLT8VSfaivWEnKRBD2nn6htxYqxqtHYjPZjQ6 USgUFboSuYThHsefTzw/rE942eY6MajWHEmJb+GrJfFxdHyd7kxm5GA3/dNSC7LfBm8G mOHiBv0geb9c4eH82JvkhCJ8y41V8i+FRXW+7vg3KpfXicpoIfiJG5P19pbmeNc38gMr YLkUHtFELOnJAE0PMq3nHRHEOZLIo176hKW8f2nfT9uUjl8NkwkHFOpRUj0Sd+PR9ury l549FCc8O1rY0++B7hYKe/NZofIlBg+sa0YJ5+ZWnpdZs8qqpigTtFfBKpIO7/AkutIF 60EQ== X-Gm-Message-State: ALoCoQkWgXsT7uHxapAzwZ1eaKfujiiZEQDCaFZOnzWWQ1qWLWQkfA+WTMMGljhs6VjeO0fCEtDq 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140516_010450_468246_EE54579B X-CRM114-Status: GOOD ( 10.32 ) X-Spam-Score: -0.7 (/) Cc: Chander Kashyap , lorenzo.pieralisi@arm.com, daniel.lezcano@linaro.org, rjw@rjwysocki.net, tomasz.figa@gmail.com, Chander Kashyap , kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org 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 */