From patchwork Tue Oct 7 07:53:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5043831 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 3A2E59F30B for ; Tue, 7 Oct 2014 08:01:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 58EFC2015E for ; Tue, 7 Oct 2014 08:01: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 6C34F2013D for ; Tue, 7 Oct 2014 08:01: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 1XbPgQ-0008Vl-F5; Tue, 07 Oct 2014 07:59:46 +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 1XbPgN-0008LU-FZ for linux-arm-kernel@lists.infradead.org; Tue, 07 Oct 2014 07:59:44 +0000 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0ND200DNYE6X9HC0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 07 Oct 2014 16:59:21 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.122]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 28.40.17016.95D93345; Tue, 07 Oct 2014 16:59:21 +0900 (KST) X-AuditID: cbfee68d-f79296d000004278-7d-54339d591b4d Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 73.07.09430.85D93345; Tue, 07 Oct 2014 16:59:21 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0ND200HJ7E530NE0@mmp2.samsung.com>; Tue, 07 Oct 2014 16:59:20 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v3 1/2] clk: samsung: exynos5440: move restart code into clock driver Date: Tue, 07 Oct 2014 13:23:20 +0530 Message-id: <1412668401-21837-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1412668401-21837-1-git-send-email-pankaj.dubey@samsung.com> References: <1412668401-21837-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRmVeSWpSXmKPExsWyRsSkSjdyrnGIwYtf3Ba9C66yWWx6fI3V Ysb5fUwWty/zWjxZeIbJ4umEi2wWn47+Z7VYtPULu8XhN+2sFh3LGC1W7frDaHHz2XYmBx6P luYeNo+ds+6ye9y5tofNY/OSeo+d3xvYPfq2rGL0+LxJLoA9issmJTUnsyy1SN8ugSvjx5bL zAXbpSrWfdzF1sDYLNbFyMkhIWAisevqTEYIW0ziwr31bF2MXBxCAksZJc4c7GTpYuQAK2q4 IAURnw4Uv/OBEcKZwCSxauNeFpBuNgFdiSfv5zKDNIgIeEssv6YIUsMssIJJ4tOa6awgNcIC 4RKTvq9iArFZBFQlVr1rZwOxeQU8JLZ2z2KHWKYgMWeSDUiYU8BTYsbG78wgthBQyfIjTUwg MyUEzrFL3F56lA1ijoDEt8mHoA6Vldh0gBniGUmJgytusExgFF7AyLCKU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A9sSQ1OzW1ILUIpo+Jg1OqgdGrOu5I//ejLlss 4/M32Nh1TzvAF3os0bx+1oV/TR9SQpdoZIYf3shXf6hmUimvmvHT1ETLPtYcnheTn6488689 ceHEHdqaT9UXlS6QWL5BmCHE9sDj/zm2Wvdk/n7vklo/O/G82D8JvYqrE48K5S99Khu18fQ9 4WKdly9n59QcnX1u8/70hcuVWIozEg21mIuKEwEPFe4q1wIAAA== 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-20141007_005943_681724_E96FDB3C X-CRM114-Status: GOOD ( 13.76 ) X-Spam-Score: -5.0 (-----) 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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_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 restart handler 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 | 19 +------------------ drivers/clk/samsung/clk-exynos5440.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 6b283eb..e9ddf69 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -139,24 +139,7 @@ static struct map_desc exynos5_iodesc[] __initdata = { static void exynos_restart(enum reboot_mode mode, const char *cmd) { - struct device_node *np; - 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); + __raw_writel(0x1, pmu_base_addr + EXYNOS_SWRESET); } static struct platform_device exynos_cpuidle = { diff --git a/drivers/clk/samsung/clk-exynos5440.c b/drivers/clk/samsung/clk-exynos5440.c index 00d1d00..f43b925 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" @@ -23,6 +25,8 @@ #define CPU_CLK_STATUS 0xfc #define MISC_DOUT1 0x558 +static void __iomem *reg_base; + /* parent clock name list */ PNAME(mout_armclk_p) = { "cplla", "cpllb" }; PNAME(mout_spi_p) = { "div125", "div200" }; @@ -89,10 +93,30 @@ static const struct of_device_id ext_clk_match[] __initconst = { {}, }; +static int exynos5440_clk_restart_notify(struct notifier_block *this, + unsigned long code, void *unused) +{ + u32 val, status; + + status = readl_relaxed(reg_base + 0xbc); + val = readl_relaxed(reg_base + 0xcc); + val = (val & 0xffff0000) | (status & 0xffff); + writel_relaxed(val, reg_base + 0xcc); + + return NOTIFY_DONE; +} + +/* + * Exynos5440 Clock reboot notifier, handles reboot functionality + */ +static struct notifier_block exynos5440_clk_restart_handler = { + .notifier_call = exynos5440_clk_restart_notify, + .priority = 128, +}; + /* register exynos5440 clocks */ static void __init exynos5440_clk_init(struct device_node *np) { - void __iomem *reg_base; struct samsung_clk_provider *ctx; reg_base = of_iomap(np, 0); @@ -125,6 +149,9 @@ static void __init exynos5440_clk_init(struct device_node *np) samsung_clk_of_add_provider(np, ctx); + if (register_restart_handler(&exynos5440_clk_restart_handler)) + pr_err("exynos5440 clock can't register restart handler\n"); + pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("arm_clk")); pr_info("exynos5440 clock initialization complete\n"); }