From patchwork Wed Oct 1 11:36:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5011351 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 BA0509F327 for ; Wed, 1 Oct 2014 11:44:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBC9A20158 for ; Wed, 1 Oct 2014 11:44:19 +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 E4EB52014A for ; Wed, 1 Oct 2014 11:44:18 +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 1XZIIJ-0008Bp-0p; Wed, 01 Oct 2014 11:42:07 +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 1XZIIA-00089n-Sx for linux-arm-kernel@lists.infradead.org; Wed, 01 Oct 2014 11:41:59 +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 <0NCR0078OKHU3710@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 01 Oct 2014 20:41:54 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 5F.B4.18167.288EB245; Wed, 01 Oct 2014 20:41:54 +0900 (KST) X-AuditID: cbfee690-f79ab6d0000046f7-8c-542be882e193 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id D7.3F.09430.288EB245; Wed, 01 Oct 2014 20:41:54 +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 <0NCR00J54KG4ZXN0@mmp2.samsung.com>; Wed, 01 Oct 2014 20:41:54 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 1/2] clk: samsung: exynos5440: move restart code into clock driver Date: Wed, 01 Oct 2014 17:06:07 +0530 Message-id: <1412163368-13496-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1412163368-13496-1-git-send-email-pankaj.dubey@samsung.com> References: <1412163368-13496-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFLMWRmVeSWpSXmKPExsWyRsSkTrfphXaIwa27pha9C66yWWx6fI3V Ysb5fUwWty/zWjxZeIbJ4tPR/6wWi7Z+YbfoWMZosWrXH0aLm8+2MzlwebQ097B57Jx1l91j 85J6j53fG9g9+rasYvT4vEkugC2KyyYlNSezLLVI3y6BK2PNhv+sBX1SFbNe/WVvYLwh2sXI ySEhYCKx7N8WVghbTOLCvfVsXYxcHEICSxklFv48xART1P6ohwXEFhKYzijReDMRwp7AJHFt BVgzm4CuxJP3c5m7GDk4RAS8JZZfUwSZwyxwnlFi+ZSpYDXCAuESC6b3soHYLAKqEs+WfWYH sXkFPCSmXl7PCNIrIaAgMWeSDUiYU8BT4sWORkaIVR4SrTeWsILMlBDYxC5xa9dvRog5AhLf Jh9igeiVldh0gBniZEmJgytusExgFF7AyLCKUTS1ILmgOCm9yESvODG3uDQvXS85P3cT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O FldvKRbqDEkK3Cll5c58O4WpKGoxW+gb5UIF4X82VRErJ++Z/HHRqsePgmao/b8qXtGytfxE bFuv0bs5vDzzL7sVHrJkidqlxr67muHksgCtk/bTZ73y6Y24du8oe9H53Lyj7bFPTqYJK7EU ZyQaajEXFScCAJ+8lTrHAgAA 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-20141001_044159_078787_145F7643 X-CRM114-Status: GOOD ( 14.15 ) 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, vikas.sajjan@samsung.com, 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. Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/exynos.c | 19 +------------------ drivers/clk/samsung/clk-exynos5440.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 2f2f7b2..aa394cb 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..994595b 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,31 @@ 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) { + 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_reboot_notifier = { + .notifier_call = exynos5440_clk_reboot_notify_handler, + .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 +150,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"); }