From patchwork Tue Oct 7 07:53:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5043811 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 0E0719F30B for ; Tue, 7 Oct 2014 07:59:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 29AF420148 for ; Tue, 7 Oct 2014 07:59:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 347A620172 for ; Tue, 7 Oct 2014 07:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753317AbaJGH7c (ORCPT ); Tue, 7 Oct 2014 03:59:32 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:38856 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758AbaJGH7c (ORCPT ); Tue, 7 Oct 2014 03:59:32 -0400 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 <0ND200A9LE76MK10@mailout4.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 07 Oct 2014 16:59:30 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.123]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 2E.FC.19034.26D93345; Tue, 07 Oct 2014 16:59:30 +0900 (KST) X-AuditID: cbfee691-f79b86d000004a5a-04-54339d62000b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id DC.64.20081.26D93345; Tue, 07 Oct 2014 16:59:30 +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 <0ND200HJ7E530NE0@mmp2.samsung.com>; Tue, 07 Oct 2014 16:59:30 +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 v3 2/2] ARM: EXYNOS: PMU: move restart code into pmu driver Date: Tue, 07 Oct 2014 13:23:21 +0530 Message-id: <1412668401-21837-3-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1412668401-21837-1-git-send-email-pankaj.dubey@samsung.com> References: <1412668401-21837-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRmVeSWpSXmKPExsWyRsSkWjdprnGIwelWPYveBVfZLDY9vsZq MeP8PiaL25d5LZ4sPMNk8enof1aLRVu/sFt0LGO0WLXrD6PFzWfbmRy4PFqae9g8ds66y+6x eUm9x87vDewefVtWMXp83iQXwBbFZZOSmpNZllqkb5fAlTF94VGmghPSFVPuXWJvYGwR72Lk 5JAQMJGYP6uDDcIWk7hwbz2QzcUhJLCUUeLh5E52mKLWAx+ZIRLTGSV+bFnGCuFMYJI4+uUG E0gVm4CuxJP3c4GqODhEBLwlll9TBKlhFjjPKLF8ylRWkBphoHjbjWVg61gEVCXmTG9iBLF5 BTwkzjf+ZgLplRBQkJgzyQYkzCngKTFj43dmEFsIqGT5kSYmkJkSAtvYJZaf2cwEMUdA4tvk QywQvbISmw4wQxwtKXFwxQ2WCYzCCxgZVjGKphYkFxQnpReZ6hUn5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sxDQrEVpr7moe5S 9Z97v3RsPycwrzds1fa42Qbbjr6SaHC8nHz2z+utlmZ+8zZ6rfr9dNet98uuXMvO48jg/7rn po0G4zuRjIBYl0MGPlol04/vcf68vehe2UGd90+diyb6W80wu2r/MeZgXezc4mnXNoRfUum7 qsRSnJFoqMVcVJwIAO9Lf9LJAgAA 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 --- arch/arm/mach-exynos/common.h | 1 - arch/arm/mach-exynos/exynos.c | 6 ------ arch/arm/mach-exynos/pmu.c | 24 ++++++++++++++++++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 9019d86..e8afbe6 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 e9ddf69..0e0101b 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 @@ -361,7 +356,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..0b84998 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,14 @@ static void exynos5250_pmu_init(void) pmu_raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST); } +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, }; @@ -478,11 +489,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); @@ -507,6 +527,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; }