From patchwork Mon Nov 17 11:21:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5318101 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 A9A8F9F1E1 for ; Mon, 17 Nov 2014 11:32:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C938420127 for ; Mon, 17 Nov 2014 11:31:59 +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 EC70920125 for ; Mon, 17 Nov 2014 11:31:58 +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 1XqKVH-00064j-Mi; Mon, 17 Nov 2014 11:29:55 +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 1XqKVE-0005xI-5L for linux-arm-kernel@lists.infradead.org; Mon, 17 Nov 2014 11:29:52 +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 <0NF600BKUL8I8NC0@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 17 Nov 2014 20:29:06 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id A7.0A.11124.10CD9645; Mon, 17 Nov 2014 20:29:05 +0900 (KST) X-AuditID: cbfee68e-f79b46d000002b74-c7-5469dc01d238 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 2A.82.20081.10CD9645; Mon, 17 Nov 2014 20:29:05 +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 <0NF600647L5DLG00@mmp1.samsung.com>; Mon, 17 Nov 2014 20:29:05 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v4 1/2] clk: samsung: exynos5440: move restart code into clock driver Date: Mon, 17 Nov 2014 16:51:12 +0530 Message-id: <1416223273-1279-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416223273-1279-1-git-send-email-pankaj.dubey@samsung.com> References: <1416223273-1279-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOLMWRmVeSWpSXmKPExsWyRsSkVpfxTmaIwadjNha9C66yWWx6fI3V Ysb5fUwWty/zWjxZeIbJYtHWL+wWh9+0s1p0LGO0WLXrD6MDp0dLcw+bx85Zd9k9Ni+p99j5 vYHdo2/LKkaPz5vkAtiiuGxSUnMyy1KL9O0SuDI+PfrBXLBJqmLi6XOMDYz/RLsYOTkkBEwk zk5dwghhi0lcuLeerYuRi0NIYCmjxPu3D5lgijY/uM4EkVjEKNExazeUM4FJYvesRWBVbAK6 Ek/ez2XuYuTgEBHwllh+TRGkhlngPKPE+iV/wVYIC4RLPG9vAqtnEVCV2PDvLpjNK+Ausb5p HztIr4SAgsScSTYgYU4BD4nuNc0sILYQUMnPkw/B9koIrGOXmPdpHSPEHAGJb5MPsUD0ykps OsAMcbSkxMEVN1gmMAovYGRYxSiaWpBcUJyUXmSkV5yYW1yal66Xn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vMui1qaZpbvr1T2Hyx yyxX5938+iHtGYvBe6NZz25GFYsuYC/d8tRunvo3wYMGj2eUaT9Yvvhb+R3bmRmXe0vb7r1Q Wzn/5dIVNZtLwpPWhgUHXvFb46XR9Zx70QF5fXUd1cqy3U8VDqiV89qJdGnEOK7/rsRSnJFo qMVcVJwIAIo8tjDEAgAA 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-20141117_032952_338291_53032081 X-CRM114-Status: GOOD ( 13.28 ) X-Spam-Score: -5.0 (-----) Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk, Pankaj Dubey , tomasz.figa@gmail.com, thomas.ab@samsung.com, Sylwester Nawrocki , 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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: Tomasz Figa Signed-off-by: Pankaj Dubey Acked-by: Guenter Roeck --- 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 8f638ad..8f995b7 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -89,24 +89,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"); }