Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3687078rwb; Sun, 25 Sep 2022 10:44:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6s3W3dO7ncJJP+5EGAhfngyonJx7vtxaui8tb6wisPy3ih30dsub1svVl9Ky021/9qpKZC X-Received: by 2002:a17:907:1b1f:b0:72f:56db:cce9 with SMTP id mp31-20020a1709071b1f00b0072f56dbcce9mr14421795ejc.605.1664127840292; Sun, 25 Sep 2022 10:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664127840; cv=none; d=google.com; s=arc-20160816; b=lyJ0RVJyj+s9B2W0lHewwI+nc1ojY0ihO3gCesHrST73TWKp9li9bgr6gf/ZP8sCDP cetQw6N/msEqkX5sbXKE/CrgZalECVN/hsY8+yc9zkpbfRkxZhOcArLX5RIDqWmibVTT yfk1sLmZxBf35KBE+mn2PZX6s/EBJoRw/bNCJI2c6w/+gfAed/xKGim36RjVWzZZzUDy pl3HQa7sIHm8xgDR1K0Gye/IqMq5QhSmT0YI47xuZz6mSjIWBznGzKiQsbjzoIhRzM2x y2KfB64t10sfJTrTCwSD5BPCVCTRW0s5tcJJbaB2Yn2UK1ccwCckTlRNUONuNCxSK407 ZHbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=86BisdAmXDJ9lANgukVe30ctpG4RM3PlB3Cg2D9niNY=; b=MowcmXIV/pWRtQNIXiS3cwQ9tpnHMsxSBGSr9/IzUf1La6mNoF2wPZoyYRqpE471LA saAYVQsdhcxH1tPOAH00jAVFti4xS6SvfzZuLADd9VSpvAYJsFrpXPeH4GRbXy5eQeCy d20A8xg0qZblzzj72Ec0D9zu8tpeVOYAQY4ijn6xm5BOtb+s/35tDP80hD0dBKiZvOoJ dD/MCMX3sOcKR+7QTqJj1OVI5d+A4Gh36LCSYhvUT3Nu42MvJbXV0LgOfZME2y5fyXQV ZxKHDxArc+EI5fE2Bbc2IDV3uYBjvreITzo55nKJ0e0srWswUHBxMfbBRHNXIVUltaUO +Gcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cP13hLPo; 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 c13-20020a170906924d00b00751a4675a99si11529700ejx.108.2022.09.25.10.43.35; Sun, 25 Sep 2022 10:44:00 -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=@gmail.com header.s=20210112 header.b=cP13hLPo; 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 S232940AbiIYRhy (ORCPT + 99 others); Sun, 25 Sep 2022 13:37:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232911AbiIYRht (ORCPT ); Sun, 25 Sep 2022 13:37:49 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69DC72F021; Sun, 25 Sep 2022 10:37:48 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id t190so4657829pgd.9; Sun, 25 Sep 2022 10:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date; bh=86BisdAmXDJ9lANgukVe30ctpG4RM3PlB3Cg2D9niNY=; b=cP13hLPoZIU49fFY+2bs8EtmhUkwvrz+XvTYOumfteg/YTgSyZJJtm8kbZFXEF6BOz SjsjHjDvbpJZZYjxiebfDgfZXSe+JwiV3166tUx6w1l7BstHPcZbTeoBPlw1rYrsQ/my r1HZIrh3yBXDlt//On1S/WmL5A0VsmCksOrk8xIOZJmLi8IZhV3J9Rf5IWQk37PNHcLC xuFtBdLYDOodlo+IMVIqS/PXcbtZNIkFaJ2yCRYxX7IOCwEOQ9id/jVLK5VQR0Nxd7VI iw1TdVUduSBDLxb84bJ0sWGjpash9/4LOKgUpJbb2lfqew0sxmMLTISd4wnXmK2/vnfG 99Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date; bh=86BisdAmXDJ9lANgukVe30ctpG4RM3PlB3Cg2D9niNY=; b=HMrxgENMlaIT486x7L51Kyq2txCc6HOau9dumURFyNxam0m+hcBdyCl43cwJKl+VD0 W0UzbTtMgo3GnTIfpw/BvgFnAvYeOsO50sy+4jv2iQ72kRFAMOFr81puxhc7kORbxsRW ZTECEN9NSZk3y6sI3HOFJzdg5RSq0HyngVC8E96Gg9DpwJ/bdYrRM5EuxhWdCs1l8dct 8UCwuTOGDCDUJegDmEBONYD3M4plk/9CVDMxy/GotcSzSDJxkfMENknXNw5vXnb4HSPX Ujdq4d3/V234mVLleetRUJhAEdl1FTpA9jCH2cGT5A7B6aATcnLlH/ITZJo5f+tI374D OQXg== X-Gm-Message-State: ACrzQf19yfa0waP/5VeHsSr3KIX+bJanJRG3kd26qn2yAOakkt1WAp3O Wkzrtx/xvSWudHoACTdJYcs= X-Received: by 2002:a05:6a00:1a8f:b0:548:8ce8:db73 with SMTP id e15-20020a056a001a8f00b005488ce8db73mr19679232pfv.10.1664127467998; Sun, 25 Sep 2022 10:37:47 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id b130-20020a621b88000000b0053e468a78a8sm10219020pfb.158.2022.09.25.10.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 10:37:47 -0700 (PDT) Sender: Guenter Roeck Date: Sun, 25 Sep 2022 10:37:46 -0700 From: Guenter Roeck To: "Alice Guo (OSS)" Cc: m.felsch@pengutronix.de, wim@linux-watchdog.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, kernel@pengutronix.de, linux-imx@nxp.com, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/7] watchdog: imx7ulp: Add explict memory barrier for unlock sequence Message-ID: <20220925173746.GB1763764@roeck-us.net> References: <20220825083256.14565-1-alice.guo@oss.nxp.com> <20220825083256.14565-3-alice.guo@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825083256.14565-3-alice.guo@oss.nxp.com> X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 On Thu, Aug 25, 2022 at 04:32:51PM +0800, Alice Guo (OSS) wrote: > From: Jacky Bai > > When reconfiguring the WDOG Timer of i.MX7ULP, there is a certain > probability causes it to reset. The reason is that the CMD32EN of the > WDOG Timer of i.MX7ULP is disabled in bootloader. The unlock sequence > are two 16-bit writes to the CNT register within 16 bus clocks. Adding > mb() is to guarantee that two 16-bit writes are finished within 16 bus > clocks. Memory barriers cannot be added between these two 16-bit writes > so that writel_relaxed is used. > > Suggested-by: Ye Li > Signed-off-by: Jacky Bai > Signed-off-by: Alice Guo > Reviewed-by: Ye Li Reviewed-by: Guenter Roeck > --- > > Changes for v2: > - add the reason why memory barriers are added for unlock sequence in commit log > > drivers/watchdog/imx7ulp_wdt.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c > index 014f497ea0dc..b8ac0cb04d2f 100644 > --- a/drivers/watchdog/imx7ulp_wdt.c > +++ b/drivers/watchdog/imx7ulp_wdt.c > @@ -179,9 +179,13 @@ static int imx7ulp_wdt_init(void __iomem *base, unsigned int timeout) > int ret; > > local_irq_disable(); > + > + mb(); > /* unlock the wdog for reconfiguration */ > writel_relaxed(UNLOCK_SEQ0, base + WDOG_CNT); > writel_relaxed(UNLOCK_SEQ1, base + WDOG_CNT); > + mb(); > + > ret = imx7ulp_wdt_wait(base, WDOG_CS_ULK); > if (ret) > goto init_out; > -- > 2.17.1 >