From patchwork Fri Apr 25 05:44:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 4057551 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 B3FF2BFF02 for ; Fri, 25 Apr 2014 05:44:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E05A92038D for ; Fri, 25 Apr 2014 05:44:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B3C420394 for ; Fri, 25 Apr 2014 05:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751802AbaDYFod (ORCPT ); Fri, 25 Apr 2014 01:44:33 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:38392 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807AbaDYFob (ORCPT ); Fri, 25 Apr 2014 01:44:31 -0400 Received: by mail-pb0-f52.google.com with SMTP id rq2so2784446pbb.25 for ; Thu, 24 Apr 2014 22:44:30 -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; bh=g69UW1sbBQNcT+vWgcYYFov+UaZlXRONkAVupKGhZxU=; b=G+PE2uWzu5p4IqYom+DYjMQJzpcqmHwtptB/i6MQg3QgcDS+7ReixdtbgX1zO7k7kA HT14slT19wJhfGqnDRu4baI+w1Y5FH/CM7g/VQpaLYMQ2Ca51xPIKp0h/zNKiLYLEC/H c9591j2oazgujRpoXGTrhDn55p2cjU49W57eFagDfh4tZBLVVbW+fF/1ZrzSziVd2Mmh o3NnPTFwbcuBz2n6Px8ZWx750P5u0LFx8fYJ2ew26tqu6sukyv+GKdwmHNcmV6ZkuuRb 7V+VB0amAuGkeNv8EX5CUzXLHvwRTydPQeFe7o+OEd1YjUvePA68IjtiyH+G1ofGghW1 kEPQ== X-Gm-Message-State: ALoCoQnE60L5pWO6x0QxSL4/QJc8ZDQOfgD8VvAgSHLLJ7iPh/3WfsJ2C8lNc9LiKxNTlQu7d0HY X-Received: by 10.68.234.2 with SMTP id ua2mr5209491pbc.81.1398404669939; Thu, 24 Apr 2014 22:44:29 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id vg1sm13134641pbc.44.2014.04.24.22.44.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 22:44:29 -0700 (PDT) From: Chander Kashyap To: linux-samsung-soc@vger.kernel.org Cc: kgene.kim@samsung.com, tomasz.figa@gmail.com, Chander Kashyap , Chander Kashyap Subject: [PATCH] arm: exynos: add generic function to calculate cpu number Date: Fri, 25 Apr 2014 11:14:13 +0530 Message-Id: <1398404653-14407-1-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 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 multicluster 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 4f6a256..217da2e 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -313,4 +313,13 @@ #define EXYNOS5_OPTION_USE_RETENTION (1 << 4) +#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 */