Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp315649rwe; Wed, 24 Aug 2022 01:12:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR4L9cz+7jl8fqIhigp+RgyJO6EcIDLr3EQglgQziDdqvTUl6D4ydIjV3mw77YIsQT/ULmxf X-Received: by 2002:a17:906:8a67:b0:73d:9b22:938c with SMTP id hy7-20020a1709068a6700b0073d9b22938cmr2163712ejc.347.1661328721298; Wed, 24 Aug 2022 01:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661328721; cv=none; d=google.com; s=arc-20160816; b=l04qD33mdgg5Hp5kVIThKNVts6X5uV5mt4azFIHHS9msEGvczcggNOdbB8loKtUjf/ iSU4KuRfO6WfMzSXsJ494G1OTKrVjgk6aPhhwGmXIfls9Ua0VG9wPW9dEVbEDsGFs0mM M3oPXL37qUcPVajyJwSG3guCYRrWUPB+w1hIkNSiqwUA3DBkDI9ruYWe/5TF0txkBd/Q tGl8Y64BlLl35QsFnDYWvS0yxFSrn3eoRCcY9SYeM4ba7pfrYnnvyVUrjF4jAVuMp+6u eqxjrnLsAAgcKfFzf4bP6Dd+Xa9N+A+Nr+BFJkfHqdHIMVY8batvXm0SSpydzl4co9YA 6SHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=MEk5eEtBm5nx2O4iF1Kqpod1be5ye4bYR7pZ1BbUbyc=; b=d7hmSW3J/2xo84h4VTFrSZKuTMLnWVNDmhDWwV8F8AmeidJkVJ1PYPx8aqH18y421v Y2mgPsYlGFMvgROJWTNH4de/Y6cZFPkwJAPtJxf7gD+L6SGo33+bQyqq8dciSDOoqV3S T37zhmwQA13GfNpVO1+yyevrGgs0Jmz4nwll4IHd9l99PpSeivQljHefnKxZGFLwtFou heUFe3hDC+EFQQchkGdT8XFTn4+1bapNmZkgaOLsAN8KA5J5Ly5ztsVDZSgCiiVbo5uH 9FR9/hMWTuC3CjjbtjGpsWI1i0zSXRGQD4lZEXmhIIpaMXs9fOXDQa2DoxQtRrT7hju0 1Fzg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn10-20020a1709070d0a00b0073c899539e4si1857674ejc.483.2022.08.24.01.11.35; Wed, 24 Aug 2022 01:12:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235587AbiHXIEB (ORCPT + 99 others); Wed, 24 Aug 2022 04:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235563AbiHXID6 (ORCPT ); Wed, 24 Aug 2022 04:03:58 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9F4986054 for ; Wed, 24 Aug 2022 01:03:57 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQlMR-0008Gu-Vj; Wed, 24 Aug 2022 10:03:39 +0200 Received: from mfe by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oQlMQ-0002AW-S9; Wed, 24 Aug 2022 10:03:38 +0200 Date: Wed, 24 Aug 2022 10:03:38 +0200 From: Marco Felsch To: "Alice Guo (OSS)" Cc: Guenter Roeck , "wim@linux-watchdog.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "linux-watchdog@vger.kernel.org" Subject: Re: [PATCH 2/7] watchdog: imx7ulp: Add explict memory barrier for unlock sequence Message-ID: <20220824080338.humjny4fabhmx3z7@pengutronix.de> References: <20220816043643.26569-1-alice.guo@oss.nxp.com> <20220816043643.26569-3-alice.guo@oss.nxp.com> <20220816062330.z2fvurteg337krw2@pengutronix.de> <20220822080010.ecdphpm3i26cco5f@pengutronix.de> <20220822140347.GA4087281@roeck-us.net> <20220823091027.ezyxkn64asajvjom@pengutronix.de> <20220823120219.GA203169@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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 Hi Alice, On 22-08-24, Alice Guo (OSS) wrote: ... > > > > Hi Guenter and Marco, > > > > > > > > 1. did you see any issues? > > > > This WDOG Timer first appeared in i.MX7ULP, no one report issues > > > > probably because few people use i.MX7ULP. This issue was found when > > > > we did a stress test on it. When we reconfigure the WDOG Timer, > > > > there is a certain probability that it reset. The reason for the > > > > error is that when WDOG_CS[CMD32EN] is 0, the unlock sequence is two > > > > 16-bit writes (0xC520, 0xD928) to the CNT register within 16 bus > > > > clocks, and improper unlock sequence causes the WDOG to reset. > > > > Adding mb() is to guarantee that two 16-bit writes are finished within 16 > > bus clocks. > > > > > > After this explanation the whole imx7ulp_wdt_init() seems a bit buggy > > > because writel_relaxed() as well as writel() are 32bit access functions. > > > So the very first thing to do is to enable the 32-bit mode. > > > > > Agreed. This is much better than having extra code to deal with both 16-bit > > and 32-bit access. > > > > > Also this is a explanation worth to be added to the commit message ;) > > > > > > > Definitely. Also, the use of mb(), if it should indeed be needed, would have to > > be explained in a code comment. > > > > Thanks, > > Guenter > > Hi Marco and Guenter, > > Thank you for your comments. I plan to enable support for 32-bit > unlock command write words in bootloader. In this way, there is no > need to distinguish whether the unlock command is a 32-bit command or > a 16-bit command in driver. Please don't move this into the bootloader, enabling it within the init seq. is just fine. If you move it into the bootloader then you can't ensure that the bit is set since there are plenty of bootloaders out there. As I said, just drop the "16bit" unlock sequence from the init function because the unlock is handled just fine in all the watchdog_ops. Regards, Marco