From patchwork Mon Nov 17 11:21:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5318091 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C35FCC11AC for ; Mon, 17 Nov 2014 11:29:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E11862012B for ; Mon, 17 Nov 2014 11:29:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E571A20120 for ; Mon, 17 Nov 2014 11:29:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752147AbaKQL3s (ORCPT ); Mon, 17 Nov 2014 06:29:48 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:27081 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbaKQL3q (ORCPT ); Mon, 17 Nov 2014 06:29:46 -0500 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NF600BLSL9L8NC0@mailout1.samsung.com> for linux-samsung-soc@vger.kernel.org; Mon, 17 Nov 2014 20:29:45 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id FC.3B.17016.92CD9645; Mon, 17 Nov 2014 20:29:45 +0900 (KST) X-AuditID: cbfee68d-f79296d000004278-04-5469dc2985cb Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 5F.C8.09430.82CD9645; Mon, 17 Nov 2014 20:29:45 +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 <0NF600647L5DLG00@mmp1.samsung.com>; Mon, 17 Nov 2014 20:29:44 +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, linux@roeck-us.net, Pankaj Dubey Subject: [PATCH v4 2/2] ARM: EXYNOS: PMU: move restart code into pmu driver Date: Mon, 17 Nov 2014 16:51:13 +0530 Message-id: <1416223273-1279-3-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416223273-1279-1-git-send-email-pankaj.dubey@samsung.com> References: <1416223273-1279-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsWyRsSkWlfzTmaIwdyDfBa9C66yWWx6fI3V Ysb5fUwWty/zWjxZeIbJYtHWL+wWHcsYLVbt+sPowOHR0tzD5rFz1l12j81L6j12fm9g9+jb sorR4/MmuQC2KC6blNSczLLUIn27BK6M9p+KBTulKzrXHGZtYPws1sXIySEhYCLxf/FjZghb TOLCvfVsXYxcHEICSxklWuZ8ZOxi5AArWrUnDSK+iFHiwO4NUEUTmCR2f/zOAtLNJqAr8eT9 XGaQBhEBb4nl1xRBapgFFjBKzD/XD1YjDBSfMm8N2DYWAVWJ91POMILYvALuEk0r+pkglilI zJlkAxLmFPCQ6F7TDNYqBFTy8+RDJpCZEgKL2CU+/ZrAAjFHQOLb5EMsEL2yEpsOQD0jKXFw xQ2WCYzCCxgZVjGKphYkFxQnpRcZ6hUn5haX5qXrJefnbmIEBvzpf896dzDePmB9iFGAg1GJ h/d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kuixS/++WB8b2wGzzc+8WybB7uPB/99jqX6yEb sWCWJ8wGN1g+h1ib/DFbpBL7WM253O1uHsvLZ13e9nF7NnUs4GFRYinOSDTUYi4qTgQAo8dd R70CAAA= 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, 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 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 Acked-by: Guenter Roeck --- arch/arm/mach-exynos/common.h | 1 - arch/arm/mach-exynos/exynos.c | 6 ------ arch/arm/mach-exynos/pmu.c | 23 +++++++++++++++++++++++ 3 files changed, 23 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 8f995b7..c13d083 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -87,11 +87,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 @@ -316,7 +311,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 6c8a76d..35f4062 100644 --- a/arch/arm/mach-exynos/pmu.c +++ b/arch/arm/mach-exynos/pmu.c @@ -11,8 +11,11 @@ #include #include +#include #include #include +#include +#include #include "exynos-pmu.h" @@ -716,6 +719,13 @@ static void exynos5420_pmu_init(void) pr_info("EXYNOS5420 PMU initialized\n"); } +static int pmu_restart_notify(struct notifier_block *this, + unsigned long code, void *unused) +{ + pmu_raw_writel(0x1, EXYNOS_SWRESET); + + return NOTIFY_DONE; +} static const struct exynos_pmu_data exynos4210_pmu_data = { .pmu_config = exynos4210_pmu_config, @@ -765,11 +775,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_restart_handler = { + .notifier_call = pmu_restart_notify, + .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); @@ -794,6 +813,10 @@ static int exynos_pmu_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pmu_context); + ret = register_restart_handler(&pmu_restart_handler); + if (ret) + dev_err(dev, "can't register restart handler err=%d\n", ret); + dev_dbg(dev, "Exynos PMU Driver probe done\n"); return 0; }