From patchwork Thu Aug 25 08:32:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alice Guo (OSS)" X-Patchwork-Id: 12954381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B819C04AA5 for ; Thu, 25 Aug 2022 08:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=He+7H235YzQVnWDFoHzl0saS7pECmlN9MiR80XtfCa0=; b=cIEljnxWlAwhHL 87Gz8ubQeERtRrehykXfkk+LuS+3lKAL3sGTWMvETpm7jvw+CEVH/DUNjhz5YUrAP5J8VydqI6Emf 72ImIAMRnBBeNhKSqiTHtZbd5evTEaQOQ7qoMXNcu47fdawIyzyvG51nQbdmfGu3Fcffm1GhzCxY3 Ho7ybRBzqXZsgEhvsgCeCOkzrjiBPH0bOKk73Gjfz+/fGmCEFR+ECXz7UGSlsmewC8Oy52kXdrsUI kpOhmQO4IElWxSNv2ghURG9iqlrNMW4LakYbyxANtlCHMgYC+XdlUGoQ4/0Sj4OpNcQ10fYzBubW5 rsn/GBC5xnHAHCoWagkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oR8M3-00A7rM-Jp; Thu, 25 Aug 2022 08:36:48 +0000 Received: from mail-am6eur05on2073.outbound.protection.outlook.com ([40.107.22.73] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oR8Ig-00A5nz-2O for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2022 08:33:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iAzLpVlI/R6VKXWfVy6vbDm9niqzY1MC7bA+EoVm89aaO9Ua5fK9cZuDmSNUrJoSZVEtIAqSIu2JzqGjh00sK4ZOgm+QFcXJUw08GvZ9BxStDpuOWyV+wJ7zwsKoX7A2XIR0uQCiX0L57UD/vGn8WbxXVV7jcsQGD+DlP6/S4YLl5uB1/v5Vc4zYvc2Am6DuHfggjxf4MKg8uQ3XKra1YeIcyYbgKHWEncDTTzpOYFJZEOcTR5SlLNq2g/6fVJeqBEyfIV4Ik5sVzmSG1ZRieEbQ+U+70Sc+dKvdSc6SqZxfH5V8e3YoPw8K3hlCEnZFEibVp6nVjVj7BW7Z6pZ1sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Eq18NP4/7hBByccpJqoOVx1AgOzC4V0xM7AvIlkxYnc=; b=RHmIngtYoiCLclMZ5igoUfy7RkJzzs6Aspqz8CF4nAB39pdBA53e0ms3FPu004RTHzMuXoMtFCfb2VmNoKNtZIpg1pZkuYZiSPNHiR6029VKPd9CEK4+5g+FL918vqH7bFz/D773D2Kh2C52R/PHBkXcl25sWaeFIdgHQtoTOU+NnrzTRQb3p9FNRfIhkJeV2Vxg3ifn9+CcQP/MZXfK+7IjUigM2CkIT79xJz2OdU5PZrnC697GfkEJOVorBhgHqqtZSOGG2UAhxE5+PSalYYLjWVgODUEZ+zlLQIa8GxzlQPIT477HRyDD/zcdpMLMeRGOCSoBiPbGLYWvgoVO5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Eq18NP4/7hBByccpJqoOVx1AgOzC4V0xM7AvIlkxYnc=; b=cDSE53Qgwh77cxKtAS6VhqW0YtUfQIpnib9YJIV1uSMH3pbojnMS0YYTFJIl/WquUjD559+bIWRovSNzr/BwDbh5KEPkhOBhb/WFTpSEi3mFMeFtXoQrzwv6ayzE8+a0OwXISNWIbFtvPDMISrUxBli6FNu/LgM7dX+fpdw+p00= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM6PR04MB6053.eurprd04.prod.outlook.com (2603:10a6:20b:b9::10) by AM6PR04MB4901.eurprd04.prod.outlook.com (2603:10a6:20b:1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 08:33:15 +0000 Received: from AM6PR04MB6053.eurprd04.prod.outlook.com ([fe80::6cd5:f11c:4e5c:d79c]) by AM6PR04MB6053.eurprd04.prod.outlook.com ([fe80::6cd5:f11c:4e5c:d79c%3]) with mapi id 15.20.5566.015; Thu, 25 Aug 2022 08:33:14 +0000 From: "Alice Guo (OSS)" To: m.felsch@pengutronix.de, linux@roeck-us.net, wim@linux-watchdog.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/7] watchdog: imx7ulp_wdt: init wdog when it was active Date: Thu, 25 Aug 2022 16:32:55 +0800 Message-Id: <20220825083256.14565-7-alice.guo@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220825083256.14565-1-alice.guo@oss.nxp.com> References: <20220825083256.14565-1-alice.guo@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0225.apcprd06.prod.outlook.com (2603:1096:4:68::33) To AM6PR04MB6053.eurprd04.prod.outlook.com (2603:10a6:20b:b9::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37a89f51-31d6-40b9-4c10-08da86747402 X-MS-TrafficTypeDiagnostic: AM6PR04MB4901:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X2RGlD7iaU+EROplLRqNw92nFDyHAcvl6sQHsgSUrDzWtUc09D0WLGchjs2ZzCAjJIX+ok1CHihIOLXaZioZ+TIS3cWG2Sfl2b7zRCY0dKI7DIPTml/NMzT080Pdw8E4s38ZUkHcPOhEX2dWcHqRGEWEOtLr51uu+VxeIFN07Cx5QVuN0w7MT97/5Up44MGSO9j17pNooruTmKPkCwQ/Giw5u5V6mW39oMqBoSUjNveVVUCQeLfYhgKYJX5a+p0TsF/U82TI6dID0JUHNAixHlvG/cS3VJ6MZqRjo3AP1Y+n6SlN5e0Mhwbut8+zBWS+IUcpUnP7F9yNraGSXVkb7vMJ5BbjCG6YAJ3Rc77Jae7e/uUSDXvQTuv9RZzb4p2Ab1jUxutIkRjOPMl5FZ9Tnbn2hlGThO9n+HXEWxRWVFcprL5m8DLwXJxJNQ8Q0oOJq503hnwIfFVJo9c92xtHHV6IVFJh1oyOjTqHVCevED1CBeMy3XQ9WQeUTp6FEm8MjGFB1XjCrAXpzVUVzgl8YTtiQjORUYI5msaLG4geIxhHM3TiKNxv7gWWoURnmfiqh6mvRPeQzzqiUJbnwh5KmbjkvuwHtcNY+Ni2Q/kCI6FNWqxQ07B1jtjcj+AIdq1RlPFrwnGSRf2HW2qIa69O8plbR7wmln6/+CFhsSbojqMSmq7qfAod2u0ZudHhxIe2M8zItpvcWNfJr8GkMr/zHzqCx/xYggfM+MBL1U18+mXRC4JjF256xJuPppAjhdh+7f9+6JgGvcOd/FkPbLbW5A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6053.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(376002)(136003)(346002)(39860400002)(396003)(8936002)(5660300002)(7416002)(38100700002)(38350700002)(4326008)(66946007)(66556008)(66476007)(478600001)(8676002)(6486002)(6666004)(41300700001)(316002)(2616005)(186003)(1076003)(26005)(6512007)(83380400001)(2906002)(52116002)(6506007)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wX1keeo6Hth+l79aJ2M4iKpFoeTI9j/b5QG/D0HL/9hBn7ye6meoIsECmCI/P0t4qXavyjuCnNxD+u2Z3bDIRPjsiogBWS8YiSajtHpaMRHkN34Uhw3AAcvp+icXQFh1yl2UgXZZvKMsETufMT6irzT7MC68bo+kZ5fdgyBtPhFQXncLZ6P32SJBVx92hS7F5KvzJO6npNbBIV5QCzdwNY3k/UuWW2AAMUq7vYADoiTy8fe3aXw7/4OeoCNCtR6qzDh1zTXWXLzXbH9NCtpPepKA7+1WvHnxqNYDt2L4Up5B4AH+I6uIVwoiBDYqeVh/iGJ1Cbg/bmtUaoeGFVRrBlVPwZP7v8p3mSqmkvJjFpGLBhKzM83cYt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mXyhDIrWaLiD1+sItSqswsbpyrEylP0lfsBfls+UiHoQVtvVM9kRZJp+czjfMGY424xX+81uyUZqWioYY1qS0wnCoV2odE/7DSaNuNOb5F75VW1jpYAafBIh3Z+gKETPqtlfT3sy3ynjF4nZUF X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37a89f51-31d6-40b9-4c10-08da86747402 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6053.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 08:33:14.8701 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: glJwEKpfhckEK+SlU4Fri9ahErzySRNrKTRll5M6nqZ7TW9OFK3a3CqH3BYT2M5uJ17946q2BnobVVX4HTmGYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4901 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220825_013318_151972_222897E8 X-CRM114-Status: GOOD ( 10.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jason Liu Paired with suspend, we can only init wdog again when it was active and ping it once to avoid the watchdog timeout after it resumed. Signed-off-by: Jason Liu Signed-off-by: Alice Guo Reviewed-by: Ye Li Reviewed-by: Jacky Bai Tested-by: Jacky Bai Reviewed-by: Guenter Roeck --- Changes for v2: - none drivers/watchdog/imx7ulp_wdt.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c index 0cafa86fff7f..dee02c2a52c9 100644 --- a/drivers/watchdog/imx7ulp_wdt.c +++ b/drivers/watchdog/imx7ulp_wdt.c @@ -136,13 +136,6 @@ static int imx7ulp_wdt_enable(struct watchdog_device *wdog, bool enable) return ret; } -static bool imx7ulp_wdt_is_enabled(void __iomem *base) -{ - u32 val = readl(base + WDOG_CS); - - return val & WDOG_CS_EN; -} - static int imx7ulp_wdt_ping(struct watchdog_device *wdog) { struct imx7ulp_wdt_device *wdt = watchdog_get_drvdata(wdog); @@ -382,11 +375,11 @@ static int __maybe_unused imx7ulp_wdt_resume_noirq(struct device *dev) if (ret) return ret; - if (imx7ulp_wdt_is_enabled(imx7ulp_wdt->base)) + if (watchdog_active(&imx7ulp_wdt->wdd)) { imx7ulp_wdt_init(imx7ulp_wdt, timeout); - - if (watchdog_active(&imx7ulp_wdt->wdd)) imx7ulp_wdt_start(&imx7ulp_wdt->wdd); + imx7ulp_wdt_ping(&imx7ulp_wdt->wdd); + } return 0; }