From patchwork Wed Oct 1 05:48:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5009691 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 1F26F9F327 for ; Wed, 1 Oct 2014 05:57:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 32CE120220 for ; Wed, 1 Oct 2014 05:57:37 +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 4155C201F4 for ; Wed, 1 Oct 2014 05:57:36 +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 1XZCrx-0003T3-CT; Wed, 01 Oct 2014 05:54:33 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XZCrm-0003P6-CT for linux-arm-kernel@lists.infradead.org; Wed, 01 Oct 2014 05:54:23 +0000 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NCR0025Y4E2I340@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 01 Oct 2014 14:54:02 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.124]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 7C.2E.11124.AF69B245; Wed, 01 Oct 2014 14:54:02 +0900 (KST) X-AuditID: cbfee68e-f79b46d000002b74-cf-542b96fa4352 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 58.4A.09430.9F69B245; Wed, 01 Oct 2014 14:54:02 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NCR005CA4DKES20@mmp1.samsung.com>; Wed, 01 Oct 2014 14:54:01 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/2] clk: samsung: exynos5440: move restart code into clock driver Date: Wed, 01 Oct 2014 11:18:59 +0530 Message-id: <1412142540-3667-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1412142540-3667-1-git-send-email-pankaj.dubey@samsung.com> References: <1412142540-3667-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJLMWRmVeSWpSXmKPExsWyRsSkRvfXNO0Qg0nzdCx6F1xls9j0+Bqr xYzz+5gsbl/mtXiy8AyTxdMJF9ksPh39z2qxaOsXdovDb9pZLTqWMVqs2vWH0eLms+1MDjwe Lc09bB47Z91l97hzbQ+bx+Yl9R47vzewe/RtWcXo8XmTXAB7FJdNSmpOZllqkb5dAlfGu5mv 2AtaJSoO/r7E3sD4T7iLkZNDQsBEovHsLxYIW0ziwr31bF2MXBxCAksZJXquPGSBKZr36hA7 RGIRo0Tvq1tQVROYJA5u2sIMUsUmoCvx5P1cIJuDQ0TAW2L5NUWQGmaBFUwSn9ZMZwWpERYI kVh87g4jSA2LgKrE630WIGFeAXeJHQvPsYCEJQQUJOZMsgExOQU8JG6vdgSpEAKq2P20jRlk ooTAKXaJA0u6wLayCAhIfJt8CKpVVmLTAWaIkyUlDq64wTKBUX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SSZz3YKt1oJBAemJJanZqakFqEUwfEwenVANj8O2pQsKSU7qaaxs6 UyQ/LGz+Y8nTecP8dWOerHj6DqaqgNL9JqtXZq64IX1JNm9KCMv9/yE7vqg2Zx43d22RUmdw F9hzu10vi1tJ+en+hFlC796f/PPqsmRB186bX/xPzP0m1K/lw6x0NnznQZYSicmrL556U7KI Y1vNFtbZOpHt2ya+KXunxFKckWioxVxUnAgAstv0Z9YCAAA= 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-20140930_225422_566273_36BC50CB X-CRM114-Status: GOOD ( 12.97 ) X-Spam-Score: -5.7 (-----) Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk, naushad@samsung.com, Pankaj Dubey , tomasz.figa@gmail.com, thomas.ab@samsung.com, Sylwester Nawrocki , vikas.sajjan@samsung.com, Mike Turquette , linux@roeck-us.net X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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, RCVD_IN_DNSWL_NONE, 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 Let's register reboot_notifier for Exynos5440 from it's clock driver for reboot functionality. So that we can cleanup restart hooks from machine specific file. CC: Sylwester Nawrocki CC: Mike Turquette Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/exynos.c | 13 ------------ drivers/clk/samsung/clk-exynos5440.c | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 2f2f7b2..d56134a 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -143,19 +143,6 @@ static void exynos_restart(enum reboot_mode mode, const char *cmd) u32 val = 0x1; void __iomem *addr = pmu_base_addr + EXYNOS_SWRESET; - if (of_machine_is_compatible("samsung,exynos5440")) { - u32 status; - np = of_find_compatible_node(NULL, NULL, "samsung,exynos5440-clock"); - - addr = of_iomap(np, 0) + 0xbc; - status = __raw_readl(addr); - - addr = of_iomap(np, 0) + 0xcc; - val = __raw_readl(addr); - - val = (val & 0xffff0000) | (status & 0xffff); - } - __raw_writel(val, addr); } diff --git a/drivers/clk/samsung/clk-exynos5440.c b/drivers/clk/samsung/clk-exynos5440.c index 00d1d00..171d3af 100644 --- a/drivers/clk/samsung/clk-exynos5440.c +++ b/drivers/clk/samsung/clk-exynos5440.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include "clk.h" #include "clk-pll.h" @@ -89,6 +91,38 @@ static const struct of_device_id ext_clk_match[] __initconst = { {}, }; +static int exynos5440_clk_reboot_notify_handler(struct notifier_block *this, + unsigned long code, void *unused) +{ + if (code == SYS_RESTART) { + struct device_node *np; + void __iomem *addr; + u32 val, status; + + np = of_find_compatible_node(NULL, NULL, + "samsung,exynos5440-clock"); + + addr = of_iomap(np, 0) + 0xbc; + status = readl_relaxed(addr); + + addr = of_iomap(np, 0) + 0xcc; + val = readl_relaxed(addr); + + val = (val & 0xffff0000) | (status & 0xffff); + + writel_relaxed(val, addr); + } + return NOTIFY_DONE; +} + +/* + * Exynos5440 Clock reboot notifier, handles reboot functionality + */ +static struct notifier_block exynos5440_clk_reboot_notifier = { + .notifier_call = exynos5440_clk_reboot_notify_handler, + .priority = 128, +}; + /* register exynos5440 clocks */ static void __init exynos5440_clk_init(struct device_node *np) { @@ -125,6 +159,9 @@ static void __init exynos5440_clk_init(struct device_node *np) samsung_clk_of_add_provider(np, ctx); + if (register_reboot_notifier(&exynos5440_clk_reboot_notifier)) + pr_err("exynos5440 clock can't register reboot notifier\n"); + pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("arm_clk")); pr_info("exynos5440 clock initialization complete\n"); }