From patchwork Tue Nov 18 10:47:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 5327181 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 0B46A9F1E1 for ; Tue, 18 Nov 2014 10:55:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2678A2017A for ; Tue, 18 Nov 2014 10:55:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1673D20176 for ; Tue, 18 Nov 2014 10:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752917AbaKRKzw (ORCPT ); Tue, 18 Nov 2014 05:55:52 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:46583 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751699AbaKRKzv (ORCPT ); Tue, 18 Nov 2014 05:55:51 -0500 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NF80059QED1AB60@mailout1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 18 Nov 2014 19:55:49 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id F6.0F.11124.5B52B645; Tue, 18 Nov 2014 19:55:49 +0900 (KST) X-AuditID: cbfee68e-f79b46d000002b74-a7-546b25b575c1 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 6C.FE.09430.5B52B645; Tue, 18 Nov 2014 19:55:49 +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 <0NF800BWPE97XT70@mmp2.samsung.com>; Tue, 18 Nov 2014 19:55:49 +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 v5 2/2] ARM: EXYNOS: PMU: move restart code into pmu driver Date: Tue, 18 Nov 2014 16:17:30 +0530 Message-id: <1416307650-15162-3-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416307650-15162-1-git-send-email-pankaj.dubey@samsung.com> References: <1416307650-15162-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsWyRsSkVneranaIwaerSha9C66yWWx6fI3V Ysb5fUwWty/zWjxZeIbJYtHWL+wWHcsYLVbt+sPowOHR0tzD5rFz1l12j81L6j12fm9g9+jb sorR4/MmuQC2KC6blNSczLLUIn27BK6M1xdfshW8lq7Y+OoEawPjAvEuRk4OCQETiZavZ1gh bDGJC/fWs3UxcnEICSxllNg57TBQggOsaN+KOoj4dEaJ5n37mUAahAQmMEnsvy0DYrMJ6Eo8 eT+XGaReRMBbYvk1RZB6ZoEFjBLzz/WzgNQIA8VXnFkHtoxFQFXi14o9bCA2r4CHxLn/dxgh dilIzJlkA2JyCnhKTPlXBrHJQ2L1o/8sICMlBJaxS0x/dIcNYoyAxLfJh1ggWmUlNh1ghnhF UuLgihssExiFFzAyrGIUTS1ILihOSi8y0itOzC0uzUvXS87P3cQIDPfT/5717WC8ecD6EKMA B6MSD2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blISr3o2/ZGxnUNxw/oWou482okn+W+fvuqfuPt/72P9wq/ M70cYTlBy+rk8sVvznlOyBe5WtdblZIl9vLdmrkXHxw45DXnwWO3M1NFlViKMxINtZiLihMB 8CUj2LwCAAA= 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 restart 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 Tested-by: Vivek Gautam --- 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..e4c3512 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 restart notifier, handles restart 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_warn(dev, "can't register restart handler err=%d\n", ret); + dev_dbg(dev, "Exynos PMU Driver probe done\n"); return 0; }