Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11787317pjo; Thu, 2 Jan 2020 14:16:40 -0800 (PST) X-Google-Smtp-Source: APXvYqxu3o0cgPKHpA2BbyNkOPBW+9kG0A5MMljxlPpJANHUaJ44N351JVDjj58YzYDAw2DombKG X-Received: by 2002:a05:6830:1501:: with SMTP id k1mr81907923otp.125.1578003400315; Thu, 02 Jan 2020 14:16:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003400; cv=none; d=google.com; s=arc-20160816; b=WnFtYeT/l/+f9GeGYB9/mOm78TmPnGauaSYd9iwgitjcqIDklkCAd+jGfv4m9bFSbd 1wWBB7WvgUyDJnGiP6FNxm6YLjcgJCIUSXpbaIs/h8qajwQkQNORgvsGKF+ZzBrJQIEi gTwZ4DJFS+VILFMWoFFGrZR0ExOvjXBnI2khZo4sVY//4iNV43Tjt04Xq8K1ftpuJpQi lfWXywfKeeNqli+Y1sJuzMLSTk6Cwh2Tyt81nuoIJNTqYK4BHbv7mdjjikTFEoIP+YxG AeqZ8T5kKDbLSGnDMv5qCyXcugqeyINcpqsHZZS/YOEMNgwWEXq3XzeKD/yU8mXhdtT9 U7wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=++2ya8zqegUYBeuXJncmVYjs8visEkjKZtAE39bIMLI=; b=epjWzb465Bd/hoEqqPgrXq1VBVOYfcwtD4iaMa6IKeCv2cfoorjnhUyVMLY0RWPRim 5JcQJWrjavbpYXCoBq880TC4gMa1bCmAwU5KTqUBIh5uINGa3KlpYT5UgQcbURVnmykh GdTOcdQRhBEP4dgZEq4hFIg6jdh510bSPIZwhHdaSU6CjlsUiEydyyHKX3iH3mKV0hQi p/D2fNW5mfyI11BVsDZClAlWBdbt00PZgnb7dQylMtpzQeHrPgxxLDHlidsRABYuNEvI iV/gwQE3TxDv6M1opItDb+x53S4LigoNkrQEF7lBw79GSt3bXAOcoA3uViX0tkhY6V0a YFPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T429RGus; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w202si18936723oiw.194.2020.01.02.14.16.28; Thu, 02 Jan 2020 14:16:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T429RGus; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727515AbgABWOR (ORCPT + 99 others); Thu, 2 Jan 2020 17:14:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:54434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727862AbgABWOO (ORCPT ); Thu, 2 Jan 2020 17:14:14 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8491221D7D; Thu, 2 Jan 2020 22:14:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003254; bh=YD5Qd+d9+AvbAi/KPYotBzxb9IG9TQDX7dJEYehuDCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T429RGus5MCafrAUlLRxkyAXQLgpFDhPn0qpKYy4v9lFY/p+g/tBwAmYz5nBWiHTz q2TSoXBZxFgU0jk99wgeiXwxay54t8XbwG0rfMvyffy1SgRBEkzW8i5nTRQ7OVLGxY VpYnr9Zaxbz5TRL5bxvsEW9aGweErfwwGirpZg+4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.4 083/191] watchdog: imx7ulp: Fix reboot hang Date: Thu, 2 Jan 2020 23:06:05 +0100 Message-Id: <20200102215838.833496463@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabio Estevam [ Upstream commit 6083ab7b2f3f25022e2e8f4c42f14a8521f47873 ] The following hang is observed when a 'reboot' command is issued: # reboot # Stopping network: OK Stopping klogd: OK Stopping syslogd: OK umount: devtmpfs busy - remounted read-only [ 8.612079] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) The system is going down NOW! Sent SIGTERM to all processes Sent SIGKILL to all processes Requesting system reboot [ 10.694753] reboot: Restarting system [ 11.699008] Reboot failed -- System halted Fix this problem by adding a .restart ops member. Fixes: 41b630f41bf7 ("watchdog: Add i.MX7ULP watchdog support") Signed-off-by: Fabio Estevam Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20191029174037.25381-1-festevam@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/imx7ulp_wdt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c index 5ce51026989a..ba5d535a6db2 100644 --- a/drivers/watchdog/imx7ulp_wdt.c +++ b/drivers/watchdog/imx7ulp_wdt.c @@ -106,12 +106,28 @@ static int imx7ulp_wdt_set_timeout(struct watchdog_device *wdog, return 0; } +static int imx7ulp_wdt_restart(struct watchdog_device *wdog, + unsigned long action, void *data) +{ + struct imx7ulp_wdt_device *wdt = watchdog_get_drvdata(wdog); + + imx7ulp_wdt_enable(wdt->base, true); + imx7ulp_wdt_set_timeout(&wdt->wdd, 1); + + /* wait for wdog to fire */ + while (true) + ; + + return NOTIFY_DONE; +} + static const struct watchdog_ops imx7ulp_wdt_ops = { .owner = THIS_MODULE, .start = imx7ulp_wdt_start, .stop = imx7ulp_wdt_stop, .ping = imx7ulp_wdt_ping, .set_timeout = imx7ulp_wdt_set_timeout, + .restart = imx7ulp_wdt_restart, }; static const struct watchdog_info imx7ulp_wdt_info = { -- 2.20.1