From patchwork Tue Aug 16 04:36:40 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: 12944270 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 117EEC25B0D for ; Tue, 16 Aug 2022 04:41:04 +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=dN0ClrTgmEYa4HO6IuuozuWws1mIpAus/dKVwxk7KZA=; b=NArC0KStJkwfib 5FAaTeivdhknlK5MKWRkcFGK66h/Dyu1UHt+7x6RZB32AtWpvmCBRu2lZi2oi7Azgg9v0TAiBlPcl fVnrB4ueVg8IPp4JqdQCiHqwRWct4J7zo8OZbQB9y1vVb35wDAPGzMHYmp4q8tSkGukIdf8HY9zOb Tnc5wwedEx8u3XI111yxyjbZjk23vhFZ63McFSQbLAOGQ4p7i/Gryhn3sVfAyyrFIzH4wQYf72pjn LNNpvphHDKTYDti980Pb19og/zIq/6N8dlLEwb9DGz585Q0gAFp9w34isntV8iC500a0Q7VA9WvVW L3DKqwec5eQ81tBFyjNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNoMg-00Ar1s-Bc; Tue, 16 Aug 2022 04:39:43 +0000 Received: from mail-vi1eur05on2063.outbound.protection.outlook.com ([40.107.21.63] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNoLX-00Apxm-Q2 for linux-arm-kernel@lists.infradead.org; Tue, 16 Aug 2022 04:38:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PgIGOngJzYBwME1zH03m/Ccdg9S7XJXgHuU3gq5YI4sjQ5Aoo/N9/Es2NcoYvfkFOK0g+AkSxbO8zsLO4b1KzvpvBp69+8s9SsX+XhiBPmnaAvQWmrGniBg9YUIb4qw4+tB5mk0DOjjPdxfwij/FHII5qVAICQM8EJ+hcDIdfpaRpvwvA9wDXl25mULEp+9704vwvfLG+0wuD1GOL9VouZrfNGmTl/nc3sUTZLR1Y5sNB1y5+HpmY/8++tUueqXjJ6Rfai9En2JtTm2PmBe49jbIYuUndD1SZaZqsMBU2ZAGiz6nHmMtAdUC6ATxsZp8KQAeHp9BLUsAbv4H7c5yLg== 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=eGKj1rwSAlQl0PrpC19gH6L7Yx2EKBBTDjPaskBxWto=; b=Ft4nu5qhZklJC3C9jtPg/mpYibiqmp264QhTaWpzuz3Xm2dh6LTTJJRmr/kmrf7eGdUOEmWr/n6bIhZydZLbfFK3cSm6vW8zdaSsffoA5E9SVidvgSiuWn36dCYvZnzXE+kZTPyp8y3YD2EIh22+/4aEeGuiRwon8HbgRfGd5sFVJr+ef/nh+ErH3cwXZhSY+G7+7YzQUyBHvL439MPifEmPv8hIHWfKEH/CV8a5BMmNPB5i8nbNx2pEwuladxwZmXwcUXQ1n0J9YlNcnejW6eQMWNwQXFD6gTWlwaH9EPTPPrP97B2WCKOVa+OT85PJc0Bi3UX2mHWykARyAfm9LA== 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=eGKj1rwSAlQl0PrpC19gH6L7Yx2EKBBTDjPaskBxWto=; b=Z1wB1MPuPxgg/r3w91C85RbIN87DZILEfM//TIaaK/Sy01xyeYi5XO4e12YE45t+XmLSkclznYWWD4s1GgKKCejbu/JrKuTLUyaKYSBQB1Qkf5GZI+vfDP5B2H1eudIy4UdMxm4ialKlDgi7DhWK//S2tJTvUZBSGZaGMIt3vfw= 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 DB8PR04MB7036.eurprd04.prod.outlook.com (2603:10a6:10:12f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.28; Tue, 16 Aug 2022 04:38:28 +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.5525.011; Tue, 16 Aug 2022 04:38:28 +0000 From: "Alice Guo (OSS)" To: wim@linux-watchdog.org, linux@roeck-us.net, 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 4/7] watchdog: imx7ulp_wdt: Fix RCS timeout issue Date: Tue, 16 Aug 2022 12:36:40 +0800 Message-Id: <20220816043643.26569-5-alice.guo@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220816043643.26569-1-alice.guo@oss.nxp.com> References: <20220816043643.26569-1-alice.guo@oss.nxp.com> X-ClientProxiedBy: SG2PR02CA0015.apcprd02.prod.outlook.com (2603:1096:3:17::27) 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: b148172b-d1ba-4701-44c3-08da7f4129da X-MS-TrafficTypeDiagnostic: DB8PR04MB7036: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: BSFAk7x5Z74+JMUG0Fqp1N1z8mcK/smbt5OCrsC+vpKV1CwS/It9l5BcfNOERN7jM+PplmR/AFt3PPJ/LqH5A1pSC2ltKNVSTCtT5av3VwCPi2kde3GeVjb1Nox1fkEDRqUEzO+0Ub3uHJdlgChqRAjlDRRJjkdQwoQnhB0/tnBWLaQs0Qxpe1WADC3EK83S3IOmgw9O+WLerLzMZtaAG0YVCUS21twZvzwYf3vg5ZiO/iwl7kw3s1claJmSXm+9m8MtOVjIOwH+54VN9Ska4GNgcgInG1ORkwrm+01pTiUkZdLPKcz2wDAiRBvgtZ06AcJMETAcQThcH4xT+DY6CVuSKXbPydo/Y4rO7oGnbQLKUs796nnyG1pSpr9nouvdVeiViyhV7yBMc3Vm24Cm3bOaeYQK37csS4onRqeKqbJ+GFIP38+ibx7WY800NwVNfWzWOeikib9QAbcHXoiPDbN4X/yudOW5//A4o1Om7ofYYXZuMbvkvuJOG9Bu1adcaPtd4P/q4nXca/J1u9v1aJbON/x4mgr3A77Fs1HOC+u4hPjvgqwJcJFEatxFtrrJzyMXODOeApHT4HXlaJm1KInVBUxTrHsQovH8HsGNAjvcCj06tgaDCIdXXDrA+tKaJV0kBhqDsV20lXU4MaWoxK3p/1sA60CCK6QYEonS8MYYJU0SDDiwDsxfv/eNT4R78E8PDL5PaNM+7OVfpq9RqMzAxcaRP3qfiorIIqSacGa8hzXHSC+gnqjHAZXfEbpirs6+jgwLUMOv5ezw6piGAC7huHY+oqqasPBTVC4hjHY= 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)(346002)(366004)(396003)(39860400002)(376002)(136003)(83380400001)(38350700002)(86362001)(38100700002)(4326008)(8676002)(66556008)(66946007)(66476007)(316002)(2906002)(8936002)(5660300002)(6512007)(6506007)(26005)(1076003)(41300700001)(2616005)(186003)(52116002)(6666004)(6486002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ztpp4C0Dm1GahN3Jf/56MGBx6oCqkJA9/i9rl3yV8fgM9c8p3ck+B0q/YoprLeRkT2/wQjtInh7+g1V2tebwEAlayQKDT0SThSnQ3yrCbzkE9UHYIhhbb8ajDf48n6dMqAojvAwKFXtGUK6122cu1/XwIg11Ftl1Nr/1zOQghKSscyrAtXHhaIUkKm15QJ8ERwdsCSdwuYx73b8qQ6lCvL7RynnvJeA1xZLKCaQD8qFl+Txd2h3Q2qDYyp5lCtnXKwZEczsShq7l7BCBU9V34MhG9ouJ0TrrC6ghgfNQsJt3E1awd0E93XapJJS/JU3eUumQqxlm2atDXc6m72IR4TTJWMZ69XPHNl143JMWWK0Jda1/HR46q3FyM2SH9s/nLXS5+eJrmHn25KBBZtpaz0q6sgt3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QzDS67N4cw+rwwyiJi+qrBS6JOozMFEP27XCJtuSa4D2a+DSzf9mk6Wz0ydZR6c1Ic1gVQomgzzXRBFvfkzdcPLqZLHVW17MYtWYBTn X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b148172b-d1ba-4701-44c3-08da7f4129da X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6053.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2022 04:38:27.9680 (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: I8EZulMkZ3KAg1COZiki9IUsqbKyoFNF8uI2z7gZuk21YI8/XFrfLBrCvDdzgT9ib7LZ2a/RRAUGdwFoAyj27A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7036 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220815_213831_903458_199710DF X-CRM114-Status: GOOD ( 10.74 ) 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: Ye Li According to measure on i.MX7ULP and i.MX8ULP, the RCS done needs about 3400us and 6700us respectively. So current 20us timeout is not enough. When reconfiguring is on-going, unlock and configure CS will lead to unknown result. Increase the wait timeout value to 10ms and check the return value of RCS wait to fix the issue Signed-off-by: Ye Li Signed-off-by: Alice Guo Reviewed-by: Jacky Bai Acked-by: Jason Liu --- drivers/watchdog/imx7ulp_wdt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c index a0f6b8cea78f..12715c248688 100644 --- a/drivers/watchdog/imx7ulp_wdt.c +++ b/drivers/watchdog/imx7ulp_wdt.c @@ -39,7 +39,7 @@ #define DEFAULT_TIMEOUT 60 #define MAX_TIMEOUT 128 #define WDOG_CLOCK_RATE 1000 -#define WDOG_WAIT_TIMEOUT 20 +#define WDOG_WAIT_TIMEOUT 10000 static bool nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout, bool, 0000); @@ -80,7 +80,7 @@ static int imx7ulp_wdt_enable(struct watchdog_device *wdog, bool enable) writel(val | WDOG_CS_EN, wdt->base + WDOG_CS); else writel(val & ~WDOG_CS_EN, wdt->base + WDOG_CS); - imx7ulp_wdt_wait(wdt->base, WDOG_CS_RCS); + ret = imx7ulp_wdt_wait(wdt->base, WDOG_CS_RCS); enable_out: local_irq_enable(); @@ -127,7 +127,9 @@ static int imx7ulp_wdt_set_timeout(struct watchdog_device *wdog, if (ret) goto timeout_out; writel(val, wdt->base + WDOG_TOVAL); - imx7ulp_wdt_wait(wdt->base, WDOG_CS_RCS); + ret = imx7ulp_wdt_wait(wdt->base, WDOG_CS_RCS); + if (ret) + goto timeout_out; wdog->timeout = timeout;