From patchwork Tue Jan 7 12:58:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 3447881 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 A89179F1C4 for ; Tue, 7 Jan 2014 13:00:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80D8220115 for ; Tue, 7 Jan 2014 13:00:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 230B62010E for ; Tue, 7 Jan 2014 13:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750904AbaAGNAY (ORCPT ); Tue, 7 Jan 2014 08:00:24 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:28825 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbaAGNAV (ORCPT ); Tue, 7 Jan 2014 08:00:21 -0500 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MZ100JO384KSPD0@mailout4.samsung.com>; Tue, 07 Jan 2014 22:00:20 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 57.67.14803.46AFBC25; Tue, 07 Jan 2014 22:00:20 +0900 (KST) X-AuditID: cbfee691-b7efc6d0000039d3-32-52cbfa6432de Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0F.4A.29263.46AFBC25; Tue, 07 Jan 2014 22:00:20 +0900 (KST) Received: from localhost.localdomain ([107.108.83.245]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MZ10091R83QNV20@mmp2.samsung.com>; Tue, 07 Jan 2014 22:00:20 +0900 (KST) From: Rahul Sharma To: linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: mturquette@linaro.org, kgene.kim@samsung.com, thomas.ab@samsung.com, tomasz.figa@gmail.com, joshi@samsung.com, r.sh.open@gmail.com, Rahul Sharma Subject: [PATCH V2 01/10] clk/exynos5410: move suspend/resume handling to SoC driver Date: Tue, 07 Jan 2014 18:28:59 +0530 Message-id: <1389099548-14649-2-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1389099548-14649-1-git-send-email-rahul.sharma@samsung.com> References: <1389099548-14649-1-git-send-email-rahul.sharma@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeLIzCtJLcpLzFFi42JZI2JSp5vy63SQwc+3whbzj5xjtfi+6wu7 Re+Cq2wWmx5fY7WYcX4fk8XTCRfZLBa+iLeYsugwq0XHMkaLVbv+MDpweeycdZfd4861PWwe m5fUe/RtWcXo8XmTXABrFJdNSmpOZllqkb5dAlfGqicbmQp+iFf8vNLF3sDYLdLFyMkhIWAi sWfaHRYIW0ziwr31bF2MXBxCAksZJe6/+MgIU/RzyyFGiMR0RoknOx6zQjjtTBLfN28Ga2cT 0JWYffAZUBUHh4hApsTGLbkgYWaBzYwS3zargdjCAmESqxoegJWzCKhK/Fi2jA3E5hXwkPh0 5DYTSKuEgILEnEk2IGFOAU+JgzOa2UFsIaCSp08uM4OslRDYxi5x7Nxpdog5AhLfJh9igeiV ldh0gBniZkmJgytusExgFF7AyLCKUTS1ILmgOCm9yFSvODG3uDQvXS85P3cTIzD4T/97NnEH 4/0D1ocYk4H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Te/UfOqx/8/3L4d+uCbz7 7W++e5Ysd7Y2aasRH7/uoSN+nrll87dVvJ+ucPjUd9OHEk83MLWXBrJOds5Rm/LvsZxzSb4S S3FGoqEWc1FxIgBr26io8QIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Suspend/resume handling is already moved for all other Exynos SoCs other than Exynos5420 which is addressed in this patch. Signed-off-by: Rahul Sharma Acked-by: Tomasz Figa --- drivers/clk/samsung/clk-exynos5410.c | 49 ++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c index 858b3ff..f94c493 100644 --- a/drivers/clk/samsung/clk-exynos5410.c +++ b/drivers/clk/samsung/clk-exynos5410.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "clk.h" @@ -60,6 +61,11 @@ enum exynos5410_plls { nr_plls /* number of PLLs */ }; +static void __iomem *reg_base; + +#ifdef CONFIG_PM_SLEEP +static struct samsung_clk_reg_dump *exynos5410_save; + /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -89,6 +95,41 @@ static unsigned long exynos5410_clk_regs[] __initdata = { DIV_KFC0, }; +static int exynos5410_clk_suspend(void) +{ + samsung_clk_save(reg_base, exynos5410_save, + ARRAY_SIZE(exynos5410_clk_regs)); + + return 0; +} + +static void exynos5410_clk_resume(void) +{ + samsung_clk_restore(reg_base, exynos5410_save, + ARRAY_SIZE(exynos5410_clk_regs)); +} + +static struct syscore_ops exynos5410_clk_syscore_ops = { + .suspend = exynos5410_clk_suspend, + .resume = exynos5410_clk_resume, +}; + +static void exynos5410_clk_sleep_init(void) +{ + exynos5410_save = samsung_clk_alloc_reg_dump(exynos5410_clk_regs, + ARRAY_SIZE(exynos5410_clk_regs)); + if (!exynos5410_save) { + pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", + __func__); + return; + } + + register_syscore_ops(&exynos5410_clk_syscore_ops); +} +#else +static void exynos5410_clk_sleep_init(void) {} +#endif + /* list of all parent clocks */ PNAME(apll_p) = { "fin_pll", "fout_apll", }; PNAME(bpll_p) = { "fin_pll", "fout_bpll", }; @@ -214,15 +255,11 @@ static struct samsung_pll_clock exynos5410_plls[nr_plls] __initdata = { /* register exynos5410 clocks */ static void __init exynos5410_clk_init(struct device_node *np) { - void __iomem *reg_base; - reg_base = of_iomap(np, 0); if (!reg_base) panic("%s: failed to map registers\n", __func__); - samsung_clk_init(np, reg_base, CLK_NR_CLKS, - exynos5410_clk_regs, ARRAY_SIZE(exynos5410_clk_regs), - NULL, 0); + samsung_clk_init(np, reg_base, CLK_NR_CLKS); samsung_clk_register_pll(exynos5410_plls, ARRAY_SIZE(exynos5410_plls), reg_base); @@ -234,6 +271,8 @@ static void __init exynos5410_clk_init(struct device_node *np) samsung_clk_register_gate(exynos5410_gate_clks, ARRAY_SIZE(exynos5410_gate_clks)); + exynos5410_clk_sleep_init(); + pr_debug("Exynos5410: clock setup completed.\n"); } CLK_OF_DECLARE(exynos5410_clk, "samsung,exynos5410-clock", exynos5410_clk_init);