From patchwork Wed Oct 1 05:49:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5009701 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 362AE9F38C for ; Wed, 1 Oct 2014 05:57:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5404120259 for ; Wed, 1 Oct 2014 05:57:37 +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 6DB77201FA for ; Wed, 1 Oct 2014 05:57:36 +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 1XZCs4-0003UN-4o; Wed, 01 Oct 2014 05:54:40 +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 1XZCrn-0003P6-7R for linux-arm-kernel@lists.infradead.org; Wed, 01 Oct 2014 05:54:23 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NCR005T34E9FH00@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 01 Oct 2014 14:54:09 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id CD.6C.19034.0079B245; Wed, 01 Oct 2014 14:54:09 +0900 (KST) X-AuditID: cbfee691-f79b86d000004a5a-1f-542b97003020 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id ED.4A.09430.FF69B245; Wed, 01 Oct 2014 14:54:07 +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 <0NCR005CA4DKES20@mmp1.samsung.com>; Wed, 01 Oct 2014 14:54:07 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 2/2] ARM: EXYNOS: PMU: move restart code into pmu driver Date: Wed, 01 Oct 2014 11:19:00 +0530 Message-id: <1412142540-3667-3-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1412142540-3667-1-git-send-email-pankaj.dubey@samsung.com> References: <1412142540-3667-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFLMWRmVeSWpSXmKPExsWyRsSkTpdxunaIwaMbTBa9C66yWWx6fI3V Ysb5fUwWty/zWjxZeIbJ4tPR/6wWi7Z+YbfoWMZosWrXH0aLm8+2MzlwebQ097B57Jx1l91j 85J6j53fG9g9+rasYvT4vEkugC2KyyYlNSezLLVI3y6BK+P//1a2ghcyFRvWNbI1MP4T72Lk 5JAQMJGYunMuI4QtJnHh3nq2LkYuDiGBpYwSa3rWMXcxcoAVnV2VCxFfxCjx8PN1RghnApNE z9r/TCDdbAK6Ek/ezwVrEBHwllh+TRGkhlngPKPE8ilTWUFqhAU8JJrO7mYDsVkEVCXm3JwC ZvMKuEucvPWLCWKZgsScSTYgJidQ+e3VjiAVQkAVu5+2MYOMlBDYxC6x9t4ZVogxAhLfJh9i gWiVldh0gBniF0mJgytusExgFF7AyLCKUTS1ILmgOCm9yFSvODG3uDQvXS85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6P7KwoLgg2OfheRcFs2rdv13jXGmqzl3IfqPWvf/z63bkYVm4aYlqfV ZhlLrd4FZ/k8JvMyb7tX+vOS19r+yZeDds7ZziER+9afw3Y+k96F+s3SzKwuL/bHf51gosRS nJFoqMVcVJwIAEk3j2bHAgAA 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-20140930_225423_431727_FC86785B X-CRM114-Status: GOOD ( 15.00 ) 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 from PMU driver for reboot functionality. So that we can remove restart hooks from machine specific file, and thus moving ahead when PMU moved to driver folder, this functionality can be reused for ARM64 based Exynos SoC's. Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/common.h | 1 - arch/arm/mach-exynos/exynos.c | 10 ---------- arch/arm/mach-exynos/pmu.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 431be1b..865f878 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -12,7 +12,6 @@ #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H #define __ARCH_ARM_MACH_EXYNOS_COMMON_H -#include #include #define EXYNOS3250_SOC_ID 0xE3472000 diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index d56134a..3aa75b8e 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -137,15 +137,6 @@ 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; - - __raw_writel(val, addr); -} - static struct platform_device exynos_cpuidle = { .name = "exynos_cpuidle", #ifdef CONFIG_ARM_EXYNOS_CPUIDLE @@ -369,7 +360,6 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)") .init_machine = exynos_dt_machine_init, .init_late = exynos_init_late, .dt_compat = exynos_dt_compat, - .restart = exynos_restart, .reserve = exynos_reserve, .dt_fixup = exynos_dt_fixup, MACHINE_END diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c index 1993e08..56bb796 100644 --- a/arch/arm/mach-exynos/pmu.c +++ b/arch/arm/mach-exynos/pmu.c @@ -11,7 +11,10 @@ #include #include +#include #include +#include +#include #include "exynos-pmu.h" #include "regs-pmu.h" @@ -439,6 +442,18 @@ static void exynos5250_pmu_init(void) pmu_raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST); } +static int pmu_reboot_notify_handler(struct notifier_block *this, + unsigned long code, void *unused) +{ + if (code == SYS_RESTART) { + u32 val = 0x1; + + pmu_raw_writel(val, EXYNOS_SWRESET); + } + + return NOTIFY_DONE; +} + static const struct exynos_pmu_data exynos4210_pmu_data = { .pmu_config = exynos4210_pmu_config, }; @@ -478,11 +493,20 @@ static const struct of_device_id exynos_pmu_of_device_ids[] = { { /*sentinel*/ }, }; +/* + * Exynos PMU reboot notifier, handles reboot functionality + */ +static struct notifier_block pmu_reboot_notifier = { + .notifier_call = pmu_reboot_notify_handler, + .priority = 128, +}; + static int exynos_pmu_probe(struct platform_device *pdev) { const struct of_device_id *match; struct device *dev = &pdev->dev; struct resource *res; + int ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pmu_base_addr = devm_ioremap_resource(dev, res); @@ -507,6 +531,10 @@ static int exynos_pmu_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pmu_context); + ret = register_reboot_notifier(&pmu_reboot_notifier); + if (ret) + dev_err(dev, "can't register reboot notifier err=%d\n", ret); + dev_dbg(dev, "Exynos PMU Driver probe done\n"); return 0; }