From patchwork Tue Nov 18 10:47:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5327191 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 406D09F1E1 for ; Tue, 18 Nov 2014 10:57:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5151820176 for ; Tue, 18 Nov 2014 10:57:32 +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 688E220115 for ; Tue, 18 Nov 2014 10:57:31 +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 1XqgRm-0007LD-2Y; Tue, 18 Nov 2014 10:55:46 +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 1XqgRX-00077B-0f for linux-arm-kernel@lists.infradead.org; Tue, 18 Nov 2014 10:55:31 +0000 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NF8002QZEBX9H90@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 18 Nov 2014 19:55:09 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id B4.8F.18167.D852B645; Tue, 18 Nov 2014 19:55:09 +0900 (KST) X-AuditID: cbfee690-f79ab6d0000046f7-4f-546b258d41b5 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id CC.86.20081.D852B645; Tue, 18 Nov 2014 19:55:09 +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 <0NF800BWPE97XT70@mmp2.samsung.com>; Tue, 18 Nov 2014 19:55:08 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v5 1/2] clk: samsung: exynos5440: move restart code into clock driver Date: Tue, 18 Nov 2014 16:17:29 +0530 Message-id: <1416307650-15162-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416307650-15162-1-git-send-email-pankaj.dubey@samsung.com> References: <1416307650-15162-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGLMWRmVeSWpSXmKPExsWyRsSkVrdXNTvE4OwkDYveBVfZLDY9vsZq MeP8PiaL25d5LZ4sPMNksWjrF3aLw2/aWS06ljFarNr1h9GB06OluYfNY+esu+wem5fUe+z8 3sDu0bdlFaPH501yAWxRXDYpqTmZZalF+nYJXBnLrvWyFzyRqjjfOp+lgXG1WBcjJ4eEgInE u++7WCFsMYkL99azdTFycQgJLGWUuHz+NStM0YXtU5ghEtMZJT7N7oRyJjBJnLr7mgmkik1A V+LJ+7lACQ4OEQFvieXXFEFqmAXOM0qsX/KXEaRGWCBc4vfm/+wgNouAqsTCh+fB4rwCHhJN x86zgPRKCChIzJlkA2JyCnhKTPlXBlIhBFSx+tF/FpCREgLr2CWaHvxihBgjIPFt8iGoVlmJ TQeYIW6WlDi44gbLBEbhBYwMqxhFUwuSC4qT0otM9IoTc4tL89L1kvNzNzECg//0v2cT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2PXq902jj1Z6p6b+iegycbTnVoJSww3nC2RmiJhY3IuufzO86Vfm2cbnLrxBym fIaF97tSODrveVoks5SWN3o+5Xx+7tnmO/v/ijN+e9Vi7s7wJpCrv+Hfz6bLW30blViKMxIN tZiLihMBptNb8cMCAAA= 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-20141118_025531_215107_5BEE2F60 X-CRM114-Status: GOOD ( 13.13 ) 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 restart 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 Acked-by: Sylwester Nawrocki Acked-by: Sylwester Nawrocki --- 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..979e813 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 restart notifier, handles restart 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_warn("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"); }