Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp375489rwe; Thu, 25 Aug 2022 01:48:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR54XNw4IiB4HST4gAqBmb644g5u6Q+PBJmECvhuUg5w6klsC+LmD2yw2F5Y961JQmb+3L8i X-Received: by 2002:a17:902:d2c1:b0:172:c1af:fd26 with SMTP id n1-20020a170902d2c100b00172c1affd26mr2950414plc.4.1661417298346; Thu, 25 Aug 2022 01:48:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661417298; cv=pass; d=google.com; s=arc-20160816; b=O3u59JgL1uaq8+2dXAqCP8tZEm+wo2ertr16pw68luuzkELDOwBu7O6aHDjaopFguY BiH/OnQzeZ9ujylf6wLOzqFo8GFqvU0Lj6ae11sC6ksykGJY73HIbM4MDuexRcHKAf9B 8YmpoxDaJEgY6ndlbr0YxHusP6dyhnK1lFTwesijWJxjVBcHRL3gwBh930dCWIQaCYoE JWe0Y/Y1/7j3gl9COjPFXaLH1FtyO6oagjiDeR71zG0DqUDjNXq9wV0jZrDixtzRcngv 2QVaXYO4sP24ymPmZalkFy1WSDf685mPrlVqj/ecIiE9E2G6iEZ+zneFYoKFxbBr2mIA SiBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=aNViKVwCmN0GscD9sjksbn3UEavjiC29upJaUxT2dZc=; b=muTGg1vTdZPikBVsW/235T+ec3ByRKgKMu35rq4RtFoKVAzBlG4PG6EYjJnfOgPZoJ 29/HSlQFkccsgCCtWGqR5Jk3FyqKKqgORQ4AWRFvcNY/erpa6+5nOlsQxYxDB6KjP2A2 t3X9zBW+gfIbMluq22mNRVWKDeO6dMbeh8B0NFjtZnuFc8/C7L3sUNWV4u6xoZiL+7OQ xLx+Hpg/YGtzT/VWpuempDNA1bj9gDYRsOCxwLBKFwHLXT0eW9ZreIwuVPrUBwFpGZk9 7X4vNvLN4xNPphrOyMESWmFjs2U4+6PKLAer1YnQCzuyZz/OXTbyPG7gnEmiUbMjoryX +xgA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=JSO8SKrt; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020a634754000000b00429946b0642si17401381pgk.469.2022.08.25.01.48.07; Thu, 25 Aug 2022 01:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=JSO8SKrt; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237341AbiHYId1 (ORCPT + 99 others); Thu, 25 Aug 2022 04:33:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237676AbiHYIdR (ORCPT ); Thu, 25 Aug 2022 04:33:17 -0400 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50075.outbound.protection.outlook.com [40.107.5.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCB0BA6ADD; Thu, 25 Aug 2022 01:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PWqL2UUFmVUy4YeqygiwNPbOv8D9MZVwLms7fOkYj44wKC5NpC8BVij4GR99pIK4PYWoKgsE4yTOsCFsv4/W3CBR+L/6l44P9Q0QlcDxt1CE8kKqIplwuq8aIgneMOLzpXgN5SoJyuCUP5pBhHu8nGgUAmCo2LeyOnLhgkpxErn8pmiTaWzvc7j1+8sNAWwbQyVPwZStWeAU9QnpjqcOtJsfRcnJN8zSii95xAJMMHiCRfCndZdPyLA/xyrS6icklT+6084ix9v/HPozp4yKWTTxhGM91g6qM44K6kp/j9wK01DmK6ny58Q7g/3K7Gpkj/cWVGFrx+TL7Cjsofq96w== 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=aNViKVwCmN0GscD9sjksbn3UEavjiC29upJaUxT2dZc=; b=LXjfdjMiZpuQXDo+B31DgkImVQXZ52brWM8co2Pjwp5FjmxQJTokEjGmsF1fi1M4uo8fBGyu80A5NKTmuVV7bsj940gz5XySdlp46/iMHuEQQkCwfqukd/gQfrk1MfYthlQXLXB9cGPC3xGEjqbAyjx0ayu0QJGnKk9yftE17aFgVyk7n+Z5WF8Z9XXaKEiLa0M5eacEChhXR40L0H6GiqK12kB8I4WXG9bFTeg0k7kTSUg45TcFfyTNm1O+2P4EV+4fOi71ZZbOMfVu3O2+BngjWK8BhFZnTB0Be6DXdMFcEz3W4Y13gbTm3XXAa9q8Gb8CdTqyv/LqwZ4Upxwc2w== 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=aNViKVwCmN0GscD9sjksbn3UEavjiC29upJaUxT2dZc=; b=JSO8SKrtRDSA92POQD6ABhtKlj6FoW1rn8fCEdYRzsQUSAnfnSwG4vJ+ADV+uG2BeWCMxADgRaBxVadya9IqriO6pTaDi2Ly9ok0bga2EkgdNeQ8xuPheOOC8c9aitcc8A0DFdFA4Axj5K3627jtAWX/i1mI3pT3QUqjnwiyQDQ= 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:05 +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:05 +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 4/7] watchdog: imx7ulp_wdt: Fix RCS timeout issue Date: Thu, 25 Aug 2022 16:32:53 +0800 Message-Id: <20220825083256.14565-5-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> Content-Type: text/plain 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: fb8f8ef6-98eb-423b-444c-08da86746e8d 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: afIdRbdJblhX+p/hKtVOwEprWwtW77o/ULRoh6OlUSvvi1xH5UHsEJ1tOTZlJDc/SXmM92M/7pteC2I8U3Swv/SBsYDRWa9/HtfVE9IbZiRUOwlSxh8YHfcjXYAuc40nu6KK3H7uSw2DBHXhCUunIrZOuR03xUg+Y2aBUwEQkheWn3abUHeCSFkEnzix9ToaRenneWzG+rk0brJ4AsYRC4bNew5WgKVbzRDo81XGWqVbX7p4RAGV20dKsEccVlboT4RG2d7Vq4H/ZsVo/G7mV58FrO2G7/ehjswm9q4WmbMZ/qcUsiZ9sl6XwOlYXLNOniP3/LuMnJnJaNbwBhJdE5LotWNVXtFp7d5BIIFo9RNMYKrvad7mau4esIqekQQcUwVNoRRA85rCzvy5fxIb8Vih3GX9kij/ERcvYs/KCzX3buokj4Vma/s2u5NV+LY3TdlGVDheSzcY0mCJPm8wIiQUsQSaSyB9S/i1eSVBdnrtKzmw0kN8vysQyHdynaz8B0JFYEF+9NWlkTp04nbWegkfmNAzwzfswC47iX/LAXOSJ7h6Y594ZiaMVNAigzc4SZC3QqobdK+QOgqbA8Z+dA3CfNNiOzr8S/yhaVB7i2/VMsIjrI94QmsokqjbH5Ov8fyedMRZSeWAaPj6IZSz5CSb1qiLfzF78hIhUijHvrUy9CTCJLcJ+kOM2WTGSeus6fXjk6WJyOXGG5VmpJYi3NKax6kZfoJlF6/ZMYDLDDMUVgOxwFkUExH5SqYa3OOEOSwM59P5gzQ6231bnToRKg== 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: =?us-ascii?Q?YChAzppbXlAaUiqb5caKW7RPjjWA6Z0kPr+MqbpdnFw2IwsIqe8kQNSNvuRC?= =?us-ascii?Q?pafGaCY5jP5p7MHVWsRe6XJKxLFDxKVq43Dn803FHFTpjvFEvABMTR7C/rdt?= =?us-ascii?Q?RaZ9b465ZuuTU4U/KOvIb+EEbyygJ3K5x26L6kUPoLxLhznZ1CK9wbcAdHYm?= =?us-ascii?Q?wrkIzNQwETPgumkMRKut+/M9e+atVsrt6h9NZlShn7qX3v7WG8FNZ0La/hnz?= =?us-ascii?Q?VrSlAE23TwpePBdqsDGB6uVRn2YyC3ZWxLxNgkmjqhTzYCr9jwH7TwuVJyA2?= =?us-ascii?Q?R6K2ly2hEh9rGGX/qESvjkWGfxUcejoqN3PZYMP1p4TzFSA5WR7/kDZVHvKm?= =?us-ascii?Q?h76Sh3T61EbjRvJp1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XOKSvvGL?= =?us-ascii?Q?fFSGllpVzjWoHSQPBcusqqhJB7CBzgox8gQCigdAlI1rxwZ/iUUruQvuxcoM?= =?us-ascii?Q?5orhE9xbfd9FhGk3XpyFOGueTlE+2pXy5sy9OIORMGNLNl8LGdaSEUznc02b?= =?us-ascii?Q?MclYIeOQ6sAKsOtdUzHfvs95C0I+Bp4xfiNYJMxNvltvDhFjly7spJm2znmf?= =?us-ascii?Q?H2Frjr54ewPsTSzdeCMWV+ABSD4l9LMKA2wFzr/RZyUA/s759N3638HjjPee?= =?us-ascii?Q?OxZni/vth4so4cV2qZeT8tSDzDXn/P+sET5920HNV4sMdTd71lgEpqir7dFK?= =?us-ascii?Q?Q1CflMLtnvKLjXCBJzx2Cw1n+Sp0MdDichYt1qFs?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb8f8ef6-98eb-423b-444c-08da86746e8d 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:05.7301 (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: k8X+4xV/p5H69zoNh213N56H21o8oXl6VejZI/52TpwuU/yiFczDf5/gzENA1+5ukKu9sFchhAhZNtA5fqD5Yg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4901 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- Changes for v2: - none 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; -- 2.17.1