From patchwork Tue Apr 22 06:17:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Kesavan X-Patchwork-Id: 4028471 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 800D5BFF02 for ; Tue, 22 Apr 2014 06:20:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3EE72021F for ; Tue, 22 Apr 2014 06:20:38 +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 83F7B2021B for ; Tue, 22 Apr 2014 06:20:37 +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 1WcU0X-0002q3-7b; Tue, 22 Apr 2014 06:16:41 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WcU0V-0002jC-11 for linux-arm-kernel@lists.infradead.org; Tue, 22 Apr 2014 06:16:39 +0000 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4F00JOV5F3QZ40@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 22 Apr 2014 15:16:16 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.124]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 04.9E.11120.F2906535; Tue, 22 Apr 2014 15:16:15 +0900 (KST) X-AuditID: cbfee68f-b7eff6d000002b70-5e-5356092fa582 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 3E.C0.27725.F2906535; Tue, 22 Apr 2014 15:16:15 +0900 (KST) Received: from abhilash-ubuntu.sisodomain.com ([107.108.73.92]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N4F00KCF5EUQ540@mmp1.samsung.com>; Tue, 22 Apr 2014 15:16:15 +0900 (KST) From: Abhilash Kesavan To: abrestic@chromium.org, thomas.ab@samsung.com, inderpal.s@samsung.com, lorenzo.pieralisi@arm.com, linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com, nicolas.pitre@linaro.org, Dave.Martin@arm.com, t.figa@samsung.com Subject: [PATCH v2 3/3] arm: exynos: Add /dev/bL_status user interface on Exynos5420 Date: Tue, 22 Apr 2014 11:47:37 +0530 Message-id: <1398147457-3186-1-git-send-email-a.kesavan@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRmVeSWpSXmKPExsWyRsSkRlefMyzY4MAibYvHaxYzWax8/5fR 4u+kY+wWTXP3MFrMP3KO1eLAnx2MFrvvfWG06F1wlc1i0+NrrBZvfr9gt1h6/SKTxadn/9gt WvceYbdYP+M1i0XHMkaLlx9PsDgIeKyZt4bR4/evSYwesxsusnhsWtXJ5nHn2h42j81L6j36 tqxi9Pi8SS6AI4rLJiU1J7MstUjfLoEro++lfMEqkYrv12cyNjAeEuhi5OSQEDCR2DPnJRuE LSZx4d56MFtIYCmjRMe5GpiaHc9A4lxA8UWMEsu+bWGHcPqYJPquzGYFqWIT0JNY8O8rM0hC ROAlo8TcvndgDrPAZiBnx1eWLkYODmGBMImF+zlAGlgEVCXWHloOto5XwEXi0+xDYCUSAgoS cybZgLRKCFxil/jz5Sg7RL2AxLfJM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gLpiSWp2ampBalFMFuYODilGhjPCOva LJtuE/qpuvutYmDUFY2XfEsKZGLO83Aq2CStiQ6y3nEh+0mRQxizat27o5NX1If+TP3i7ym/ 38HldO4u11sVOx08jj+LnxykKH/uf72c5uzwTBMr9hcnJAIDpyyM31cZ6VH97INAfHdxhkj1 CVc77ubrH9U7Hz6Yd8dkupp5JoNqmhJLcUaioRZzUXEiAM52hKIIAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140421_231639_251124_A669E2DB X-CRM114-Status: GOOD ( 14.08 ) X-Spam-Score: -5.6 (-----) Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, arnd@arndb.de, will.deacon@arm.com, Abhilash Kesavan , robh+dt@kernel.org, grant.likely@linaro.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 Add a user interface to check the core and cluster status on Exynos5420. This can be utilized while debugging mcpm issues. cat /dev/bL_status will show the current power status of all the 8 cores along with the cluster. Signed-off-by: Thomas Abraham Signed-off-by: Inderpal Singh Signed-off-by: Andrew Bresticker Signed-off-by: Abhilash Kesavan --- arch/arm/mach-exynos/mcpm-exynos.c | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index 49b9031..6c74c82 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -293,6 +293,53 @@ static void __init exynos_mcpm_usage_count_init(void) cpu_use_count[cpu][cluster] = 1; } +static size_t bL_check_status(char *info) +{ + size_t len = 0; + int i; + + len += sprintf(&info[len], "\t0 1 2 3 L2\n"); + len += sprintf(&info[len], "[A15] "); + for (i = 0; i < 4; i++) { + len += sprintf(&info[len], "%d ", + (readl(EXYNOS_ARM_CORE_STATUS(i)) & 0x3) == 3 ? 1 : 0); + } + len += sprintf(&info[len], "%d\n", + (readl(EXYNOS_COMMON_STATUS(0)) & 0x3) == 3 ? 1 : 0); + + len += sprintf(&info[len], "[A7] "); + for (i = 4; i < 8; i++) + len += sprintf(&info[len], "%d ", + (readl(EXYNOS_ARM_CORE_STATUS(i)) & 0x3) == 3 ? 1 : 0); + len += sprintf(&info[len], "%d\n\n", + (readl(EXYNOS_COMMON_STATUS(1)) & 0x3) == 3 ? 1 : 0); + + return len; +} + +static ssize_t bL_status_read(struct file *file, char __user *buf, + size_t len, loff_t *pos) +{ + size_t count = 0; + char info[100]; + + count = bL_check_status(info); + if (count < 0) + return -EINVAL; + + return simple_read_from_buffer(buf, len, pos, info, count); +} + +static const struct file_operations bL_status_fops = { + .read = bL_status_read, +}; + +static struct miscdevice bL_status_device = { + MISC_DYNAMIC_MINOR, + "bL_status", + &bL_status_fops +}; + /* * Enable cluster-level coherency, in preparation for turning on the MMU. */ @@ -343,3 +390,20 @@ static int __init exynos_mcpm_init(void) } early_initcall(exynos_mcpm_init); + +static int __init exynos_bl_status_init(void) +{ + int ret; + + if (!soc_is_exynos5420()) + return -ENODEV; + + ret = misc_register(&bL_status_device); + if (ret) { + pr_info("bl_status not available\n"); + return ret; + } + return 0; +} + +late_initcall(exynos_bl_status_init);