From patchwork Wed Oct 1 11:36:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5011341 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 1CAA69F327 for ; Wed, 1 Oct 2014 11:42:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D78702014A for ; Wed, 1 Oct 2014 11:42:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B048F2012F for ; Wed, 1 Oct 2014 11:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751136AbaJALmZ (ORCPT ); Wed, 1 Oct 2014 07:42:25 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:11846 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750959AbaJALmY (ORCPT ); Wed, 1 Oct 2014 07:42:24 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NCR00BYZKIMNRC0@mailout2.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 01 Oct 2014 20:42:22 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id B6.11.17016.E98EB245; Wed, 01 Oct 2014 20:42:22 +0900 (KST) X-AuditID: cbfee68d-f79296d000004278-37-542be89ebcf0 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AC.4F.09430.E98EB245; Wed, 01 Oct 2014 20:42:22 +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:42:22 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: kgene.kim@samsung.com, tomasz.figa@gmail.com, linux@arm.linux.org.uk, thomas.ab@samsung.com, vikas.sajjan@samsung.com, linux@roeck-us.net, naushad@samsung.com, Pankaj Dubey Subject: [PATCH v2 2/2] ARM: EXYNOS: PMU: move restart code into pmu driver Date: Wed, 01 Oct 2014 17:06:08 +0530 Message-id: <1412163368-13496-3-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+NgFnrNLMWRmVeSWpSXmKPExsWyRsSkTnfeC+0Qg5dTNS16F1xls9j0+Bqr xYzz+5gsbl/mtXiy8AyTxaej/1ktFm39wm7RsYzRYtWuP4wWN59tZ3Lg8mhp7mHz2DnrLrvH 5iX1Hju/N7B79G1ZxejxeZNcAFsUl01Kak5mWWqRvl0CV8aHn8eZCr5KV/zpmMbawLhavIuR k0NCwESi7/ZWVghbTOLCvfVsILaQwFJGiQenE2FqtrXfY+xi5AKKT2eUmLL8FDuEM4FJ4tKy vUwgVWwCuhJP3s9l7mLk4BAR8JZYfk0RpIZZ4DyjxPIpU8E2CAPFL0z8BlbPIqAqMfX/djCb V8BDYvW6PewgvRICChJzJtmAhDkFPCVe7GhkhDjIQ6L1xhJWkJkSAtvYJda3nGWFmCMg8W3y IRaIXlmJTQeYIY6WlDi44gbLBEbhBYwMqxhFUw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X7+Tsa2z2sD6x43kPwWX ma18ovStWpIOi8i9OdD/eG/wWdd/D4s+T73E7+D55uSdpvWzNUR1Vrw79+7O1RmSAntbRW/0 /ds/V8tI+n9wwu76lQEPJP663BFbs31pTtPPU9ser14bcn/HjbjAbJWz87fdsgxmO37yQ/Ox PCWW4oxEQy3mouJEABMeUCrJAgAA 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=-7.5 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 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 | 6 ------ arch/arm/mach-exynos/pmu.c | 25 +++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 7 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 aa394cb..3aa75b8e 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -137,11 +137,6 @@ static struct map_desc exynos5_iodesc[] __initdata = { }, }; -static void exynos_restart(enum reboot_mode mode, const char *cmd) -{ - __raw_writel(0x1, pmu_base_addr + EXYNOS_SWRESET); -} - static struct platform_device exynos_cpuidle = { .name = "exynos_cpuidle", #ifdef CONFIG_ARM_EXYNOS_CPUIDLE @@ -365,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..c0855a5 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,15 @@ 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) + pmu_raw_writel(0x1, EXYNOS_SWRESET); + + return NOTIFY_DONE; +} + static const struct exynos_pmu_data exynos4210_pmu_data = { .pmu_config = exynos4210_pmu_config, }; @@ -478,11 +490,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 +528,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; }