From patchwork Sat Apr 26 16:05:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Kesavan X-Patchwork-Id: 4069261 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 85795BFF02 for ; Sat, 26 Apr 2014 16:09:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B981B20225 for ; Sat, 26 Apr 2014 16:09:47 +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 C2E4120254 for ; Sat, 26 Apr 2014 16:09:46 +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 1We58H-0002X9-Jk; Sat, 26 Apr 2014 16:07:17 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1We584-0001rK-Pz for linux-arm-kernel@lists.infradead.org; Sat, 26 Apr 2014 16:07:05 +0000 Received: by mail-pa0-f53.google.com with SMTP id ld10so4219045pab.40 for ; Sat, 26 Apr 2014 09:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=00IiHA9xwxk2jJAUjHY5VfkEF9CC03GH0lLcJVxcr38=; b=ieHTjlJqLxskMLawDuAzmGUN1ySImNFPn9VE9YOHhNVgxy9faQLB0VnLaAR5Wr7RWt 7eCfiFfJs/hufOoV97vMhP2PgHZafS2cimGPoubUuxup1qe0Fs6G6pskgoAMK+Gt/TUO M9nNhhjfSkjTN4fwEwl2JsQ+4g+Jp4tTC7faUE5uLyxiKpqbP8s4i33t6hrXP/j3EVm8 EdX5jJbOHqhc1HigI2UxApCBh0UUZoTadFH3/Q2GWuztjNGcAR436Ey3o8V+olR7rS5j U80X87FgrX03gyV328AspN+6wQUQv5NDhyOZevWoF0N8dBK2gxp4A8zdVnaXruuRkrpW cNuw== X-Received: by 10.66.139.38 with SMTP id qv6mr15031855pab.123.1398528400633; Sat, 26 Apr 2014 09:06:40 -0700 (PDT) Received: from localhost.localdomain ([122.171.91.187]) by mx.google.com with ESMTPSA id ha11sm23458195pbd.17.2014.04.26.09.06.35 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 26 Apr 2014 09:06:39 -0700 (PDT) From: Abhilash Kesavan To: nicolas.pitre@linaro.org, Dave.Martin@arm.com, lorenzo.pieralisi@arm.com, daniel.lezcano@linaro.org, linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com, t.figa@samsung.com, abrestic@chromium.org, thomas.ab@samsung.com, inderpal.s@samsung.com Subject: [PATCH v3 6/6] arm: exynos: Add /dev/bL_status user interface on Exynos5420 Date: Sat, 26 Apr 2014 21:35:48 +0530 Message-Id: <1398528348-21214-7-git-send-email-a.kesavan@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1398528348-21214-1-git-send-email-a.kesavan@samsung.com> References: <1398528348-21214-1-git-send-email-a.kesavan@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140426_090704_874488_7BC7EAA9 X-CRM114-Status: GOOD ( 15.80 ) X-Spam-Score: 0.0 (/) Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, kesavan.abhilash@gmail.com, arnd@arndb.de, will.deacon@arm.com, 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 f9977bf..83428b0 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -269,6 +269,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. */ @@ -319,3 +366,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);