From patchwork Mon Feb 12 17:44:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 10213753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E365960329 for ; Mon, 12 Feb 2018 17:50:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFD5328DDB for ; Mon, 12 Feb 2018 17:50:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C40D228DE2; Mon, 12 Feb 2018 17:50:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1E28B28DDB for ; Mon, 12 Feb 2018 17:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LACja25A64JnatzIXXr0Y+lRH1tupBtaq8u2MZ2A49k=; b=NDc7hu9Av25wfMF8BB7b57Fr4Q wBlhUX2N22ra1m4AQm1znr9KbQ4thHpnUjBwKHCsnStMVA4SMRZihP8ylHrthOgq8rsfkUjyn2Slx VnvG91IeZHrA0Gx2QsSskIGgw4e6CazGrD/WZcbavVplXk/f8Ra4fPUoyjrCOqnfXGRU9bdPwlgjM 6jqeEaL+Lra6a1R2lc8V8aUl8+Px0ZEESMvsx9IhVjffnmoQPGcQrC7xAupjIk6bYZW+liu2cW6QO 7f9p9we/2SXXPMN49GrUmcWWlVJB9jxkTmR71INi08iwBgajVzUu4tGo/r5hmiw779cuSq/O8JAfU n0Uy5YMw==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1elIF1-0001ir-NO for patchwork-linux-arm@patchwork.kernel.org; Mon, 12 Feb 2018 17:50:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=LACja25A64JnatzIXXr0Y+lRH1tupBtaq8u2MZ2A49k=; b=aODqifZAmoFj7NmoWXnGvZeHy5 QU/Jpe/48I0DVBJCzR4jFNObuC02hGHketUCeolPgGVmWhGmROyPSLZ0kWJqJs/BuTHrG3nj7W8iU mo/08lYmV7urZARvbnL6g4GSZLKKjnqAAtgXHMvcVwV8xiuvNztXgqVFPEEO+aVI2hpY8zZHSAADw bsC25Z8t/IWM7fiC3lT6SoCXk0IeaTFjnePjx3ZD15mvQj/npUtvEJhftotsVt4I7wWAYZ3BUl2yI cu2l5GKtwp2Rw/ysgSnwSJuKze3Z3kE28r1vLvm1b3QRDIXuAMb+KIQpYaKosRknEbikAPEH2ItYl Di8Bge1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1elIEl-0005V0-Ie; Mon, 12 Feb 2018 17:49:55 +0000 Received: from relmlor4.renesas.com ([210.160.252.174] helo=relmlie3.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1elIB2-0008B9-Rf for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2018 17:46:06 +0000 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 13 Feb 2018 02:45:54 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 07F7144ABE; Tue, 13 Feb 2018 02:45:54 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,503,1511794800"; d="scan'208";a="270960061" Received: from unknown (HELO fabrizio-dev.ree.adwin.renesas.com) ([10.226.37.88]) by relmlii1.idc.renesas.com with ESMTP; 13 Feb 2018 02:45:48 +0900 From: Fabrizio Castro To: Philipp Zabel , Rob Herring , Mark Rutland , Wim Van Sebroeck , Russell King , Catalin Marinas , Will Deacon , Michael Turquette , Stephen Boyd , Simon Horman , Magnus Damm , Geert Uytterhoeven , Wolfram Sang Subject: [PATCH v5 12/26] watchdog: renesas_wdt: Add R-Car Gen2 support Date: Mon, 12 Feb 2018 17:44:21 +0000 Message-Id: <1518457475-4480-13-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518457475-4480-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1518457475-4480-1-git-send-email-fabrizio.castro@bp.renesas.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabrizio Castro , devicetree@vger.kernel.org, Chris Paterson , linux-watchdog@vger.kernel.org, Biju Das , linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ramesh Shanmugasundaram , linux-clk@vger.kernel.org, Guenter Roeck MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Due to commits: * "ARM: shmobile: Add watchdog support", * "ARM: shmobile: rcar-gen2: Add watchdog support", and * "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1. This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA. Signed-off-by: Fabrizio Castro Signed-off-by: Ramesh Shanmugasundaram Reviewed-by: Guenter Roeck Reviewed-by: Wolfram Sang --- v4->v5: * various improvements suggested by Wolfram drivers/watchdog/renesas_wdt.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index 831ef83..e972b7b 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -203,13 +203,29 @@ static int rwdt_remove(struct platform_device *pdev) return 0; } -/* - * This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP - * to work there, one also needs a RESET (RST) driver which does not exist yet - * due to HW issues. This needs to be solved before adding compatibles here. - */ +static int __maybe_unused rwdt_suspend(struct device *dev) +{ + struct rwdt_priv *priv = dev_get_drvdata(dev); + + if (watchdog_active(&priv->wdev)) + rwdt_write(priv, priv->cks, RWTCSRA); + return 0; +} + +static int __maybe_unused rwdt_resume(struct device *dev) +{ + struct rwdt_priv *priv = dev_get_drvdata(dev); + + if (watchdog_active(&priv->wdev)) + rwdt_write(priv, priv->cks | RWTCSRA_TME, RWTCSRA); + return 0; +} + +static SIMPLE_DEV_PM_OPS(rwdt_pm_ops, rwdt_suspend, rwdt_resume); + static const struct of_device_id rwdt_ids[] = { { .compatible = "renesas,rcar-gen3-wdt", }, + { .compatible = "renesas,rcar-gen2-wdt", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, rwdt_ids); @@ -218,6 +234,7 @@ static struct platform_driver rwdt_driver = { .driver = { .name = "renesas_wdt", .of_match_table = rwdt_ids, + .pm = &rwdt_pm_ops, }, .probe = rwdt_probe, .remove = rwdt_remove,