Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp284615rwe; Wed, 24 Aug 2022 00:27:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR7/U/wxxO4yYBKoZf4TrBpyE8EVIMZz5RycFcYpGueh6/zD9jbR7oXXUo07JSuuIOc/vmxk X-Received: by 2002:a17:907:1609:b0:73d:a99a:7945 with SMTP id hb9-20020a170907160900b0073da99a7945mr2014680ejc.218.1661326064892; Wed, 24 Aug 2022 00:27:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661326064; cv=pass; d=google.com; s=arc-20160816; b=Qj3GfiguqDlIDAN9ndSmbuU50YTB01D3rhfhiKBCfpLjE4EjE8k5OgOorwF+4t3S40 Iinv0qM7Dhqaloo2S/mo6NebhIdOz/PeL4RZbb9rUztpgDHTocGHvxu1JfDhCtktHbcJ r3GC11kTynXENBsY1l1rsbfGSHq6Og768ibgmoGmcfgBuOv+SBrvXQdbNs8UsiaCU8Wv mYwZdJZNaMqXPaQ9XU2OxIzVfzqmMYoP5/hVG5zfYaRVHxHRDSUWV8dCEOmSIigHAg6o 8u1jVOZ8tHxS2LY4hYR31S7ehh4Qfe+vBMaOiihXaORz+J7y82/aM0h3fyjdGGkczlEh RYmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=7XfqlKSqb47d4Aly9B1w/kMaSOSdk+xJ9l1ygizbZfI=; b=tmdjcCC+YUzk8ccYgabtb9cXmRC+Hn/zLq+ynwbCOU5HIlGFfylZeHjcMoz/TFeLpB ERf8pbL1u3LLOjZwO6z08WhNIv1M39j3Z232rGyZO6B1vyzOpJxs3SdmvXGtp7JuJdEE tLH3W6d5l/Vx7Qb+PJK/q5WGEx4whptP1naPtIXj8I+dhh9Wg7f3d18VkhAWF1H9aAbv GgutmrJkM7soRN8Rf1RnMG+DK+oAq12gaacQBOEIsolU1YdMlxfyYUg1QbsMyRdiDKcQ xygOAmGp6Q9TV9NRza3BNBpOLcXHcoFIG6ATpW6vTiKlcBq4Tegbu7AfylhpgW6htIqh bKhg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b="eT/SBBHS"; 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 b10-20020a056402350a00b0043d32528589si4163454edd.549.2022.08.24.00.27.18; Wed, 24 Aug 2022 00:27:44 -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="eT/SBBHS"; 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 S235024AbiHXGYh (ORCPT + 99 others); Wed, 24 Aug 2022 02:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbiHXGYf (ORCPT ); Wed, 24 Aug 2022 02:24:35 -0400 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50057.outbound.protection.outlook.com [40.107.5.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B57287DF73; Tue, 23 Aug 2022 23:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YhG6o+XnMWCHxHtRxUBFuEFTQEA6mYIXRiVIzpJwjzdGpzrCJTxAsS0K3FtOjgahQpe+30guybv2t+6lF+upqJOIWZBoiJlbdD7/1p1GlXaaXBXVNMbwjbB/dO/zK2ricI9BTFAZvfsTlnlz509xCVAz1D3H18XHORMY15F50VpJM0KicII21mFEBwTu/YD1cRWNkN8QpF/nPgS6x7hjRg8HnsuRQ2MLEKZZemzilj/vg9PNyM7FWWnZfHVV5H5zFWdqtukj3Z8iJX5dJQEQTFzeD9yVm3I8LK0BPnfaUvirsz2P6vGhQVA2Iknar7+NrGoDOERiVnVIvoHynI3h+w== 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=7XfqlKSqb47d4Aly9B1w/kMaSOSdk+xJ9l1ygizbZfI=; b=ALFDM044FcFpMSn0IcuWeJWO68z5RO53UmRI63v5n6m2g2pSSr3Fot5wLrlv4hgkC2D8uAJfjxZhu0ilcrun6GhXNiVcUawHZ6pGGRaYGEoPfb3/s9F6iWMPFVZejwOrtC9tbK7h5/KpW1+dkC8Y7CWk/QoCpTbKQmN4DkYRrRhvPjwG2PSTBrOOokxPyXZIDn/kYQCPwiiTgB4JZkm/Hi7dDLBcWWCLfUlK6UK2BZYDa+ZQj7bYhrUYQJf2TZ0IaIk8A6399ymSuD8fWVJVNmGmHoxa0wOVnXZGCE9VI0fu51nM/W1LvGnk/V4ys3UGNJTqP12jgzEFOZcNh1D8lg== 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=7XfqlKSqb47d4Aly9B1w/kMaSOSdk+xJ9l1ygizbZfI=; b=eT/SBBHSRMQ6B3DF5LVPVa/5K4giSl30NcKBKOlam9UBaPn+lV+Nt73uXHgIchAKMLWDmBsYTgH+MwpSj8QhQm0zBdrIwmRBdkCIDNQJA1wYn+WujRJnkAsXBhj6OIihjp+j9eiXyh21ewBtATLQZBuPlPSGTn7RGGnzQWNvRtc= Received: from AM6PR04MB6053.eurprd04.prod.outlook.com (2603:10a6:20b:b9::10) by DU2PR04MB9194.eurprd04.prod.outlook.com (2603:10a6:10:2f9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Wed, 24 Aug 2022 06:24:29 +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.5546.022; Wed, 24 Aug 2022 06:24:29 +0000 From: "Alice Guo (OSS)" To: Guenter Roeck , Marco Felsch CC: "Alice Guo (OSS)" , "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 Thread-Topic: [PATCH 2/7] watchdog: imx7ulp: Add explict memory barrier for unlock sequence Thread-Index: AQHYsSoBdxZHPlON40a5XuD6jrx4qK2xDxMAgAmF+ACAAAMHAIAAZZiAgAEFDYCAADtTgIAAMAWAgAErGXA= Date: Wed, 24 Aug 2022 06:24:28 +0000 Message-ID: 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> In-Reply-To: <20220823120219.GA203169@roeck-us.net> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 518d908a-8bc7-4c59-06fe-08da85994cbc x-ms-traffictypediagnostic: DU2PR04MB9194: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: 3F//NB5araybfza8eSpW1+8OpRAsvxjvh2weCY2usIAY6ZCc+yBZB+TaDrFID+xF8P/1djyXV/V/lYadMMezZBqKogwnN+Lk3NX/tspojGN4xKS4Hyz3Zt48kOW9FLTmtzOnsU20xkFgFXqU2wu39rkRwC3m21yzk88fMzUDVFahx2Bi1Aae7LuZZ+hQ4U1lAXcG8PH0mtHUDNcfTtG+n8RVMteFqNlx8ERctPzWbU2ozNrBmUbhh0g/bq69ojxy02TFdkMLlpeswxC8UTBj/7HpFBgIInRT3nYEoRpd+Gz4RDkktzc1rjU8suP0ZXhWzZqMILbzvaLTXYn9f3D0DIilE1w84Z+Zka+afP58f9pT70rwqOL7AOjhakfCFS428r6xdIAX0x5VJWUMXAa0piI1nMlhVlkovtnho1yaXAi2K9pXPQcQGQo55+D1L9XRYQZUsz7nYtG4vHIUnD1QnuR8fh1cgbXA8yd2bDhmA9QB3CLjxPLoAsw4iO2riahT7be9vNScR1d1PuxENtdtGm73H+PW7Uf2yiZhrvBtid0A0dQKXE6hHD1HAb4jMNXPhmCyVGqG96VG4+qm3mrc27la9JqbWYcDjJQuGetDJTlg0mdvuueIftDxkXYRDngcf9SNcffMbrWXXh/Hd5Pgr2ZLDB+TO/P35h52if2oBB9LhkWU19wEYChbxFZJbV10bZdkPcrkDnUjaQ7kxPMcDPOTKI7+y/5vHU++0oLDXHPsspJm7Zb5Rdp43Qxx56wlK/V080O0gJWd14uM1MW9dw== 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)(396003)(136003)(376002)(39860400002)(346002)(66946007)(66556008)(76116006)(64756008)(66476007)(122000001)(4326008)(66446008)(110136005)(8676002)(86362001)(33656002)(38100700002)(38070700005)(478600001)(9686003)(26005)(53546011)(7696005)(8936002)(83380400001)(186003)(6506007)(71200400001)(41300700001)(55016003)(5660300002)(54906003)(316002)(2906002)(7416002)(52536014);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bvumYSn6I2f58wq393a8plx3+PbTqScjkgHU4MEsw6Zyy29ag+BFB8aWAYin?= =?us-ascii?Q?+nCp7alt+SCdmHbfpMSFtF/A+4wkUjvR6Nvw3GfvNQzRIP2ay63pAMB1ibjr?= =?us-ascii?Q?NunzR35hM4P96yHLTS0r1VrfsNo7WpiCzP1+ciWZYhxwRBdNiqtBa1haj7MP?= =?us-ascii?Q?dTrExWyKpbus14G04zIRQSFRRIwVvxMuw9tYKVCHZHYBVpQSmqZQKLQOFISt?= =?us-ascii?Q?qlQyGAFB0zB9iVRyHVAIuKMpiEibJrLOAwCkqEgPO6tcW1a4ywUwb4cZkt+L?= =?us-ascii?Q?mRliVs7kceAsPbVnIhbiFrubhjj8tmaQHXTsQqSic414fu9vN5MFG3s0gtmO?= =?us-ascii?Q?oKfsAdJD9VG4bsc5GRF0ygSSXrzHpFoAW7FufxVWbe+zwDUzlTkuemyPb1Y/?= =?us-ascii?Q?WHIXZMy1h1SBxz2K5PAolrw2m/+JjN33318UED6qRt3zTJE9nhmayeIwd/YP?= =?us-ascii?Q?2l+n8Zw899EA0FYhPiHJ8P/dOuF8P273+jrjmpy8LjStEEdxb01eHyJ1o/zo?= =?us-ascii?Q?FvqDvy+ZcD0xmK5qJ0Alcc+JZOkwhjPd2dvYPC4Uy3045QU1wiflXjVG8diX?= =?us-ascii?Q?Cz6VDrP92HT7zG2NgTJueGRGypEGdnS2SO6K3vn5lAklmAN6Hf7OOfmOQMV1?= =?us-ascii?Q?ksfppEsJdXnEQbU3nnBTnY4a3udQouYysjRoo/MAiGraFhCnsTbdIeyepBvj?= =?us-ascii?Q?HQgHHHTqh1NeUoSeYdTCFdqUgDN2Me79TNzmw/LP3EMTM8nrkNfyliJQJIvU?= =?us-ascii?Q?x3jFhOkzseRORpfZusNi23yw6tJGn6bqA76P9rwdWdcIGnmYGk3gWLIGq6aY?= =?us-ascii?Q?JuQUQHCYRfy5ZRy+r9P/9uFNaPpM3CAMMljwgF6rUfD0HSW/n/8fSavoV4zw?= =?us-ascii?Q?lMIqqSmzFPNJZXdF5XZ8F/+XOn+Q0GCqjqB9MiSL32TZpcBqS0hughIrpGec?= =?us-ascii?Q?DOwfX1m0w4+UfzNZVLaUzp4QQ8QNIRzvnP2S8+8hDxOghnkQojTyNitDokVj?= =?us-ascii?Q?HCuZYzuFFFcQR+E7lz3N0+by52XJU1fqFUByfpeR84v0AA45mITyg/L9bsOB?= =?us-ascii?Q?cj5qXyjWb4TDGSxEGoa7EWVWiAxZHSdJBqDxxJ8oVR7qQpJ9eFFWNRbxvQEo?= =?us-ascii?Q?a/EHZsKYJr7oRape2F/AuZuUdy6czmGXEPoFHVf5UoXV77NVBv3AWYMzgeiG?= =?us-ascii?Q?mHaMFuLfeMGUMmN/dcPA6EHgg2ZD+Yx6kcfuhW6BMuirCKWSepuf2hI/bPnW?= =?us-ascii?Q?Wqo2ud3DLOJ7uyLDif9VkuK4xRcQoIMgKBsKArieASEstuln0C+g4GRp7gCS?= =?us-ascii?Q?d8Mbz2mIDijCAhTZKA6GBwA4Shil6CMwMaElrnZKa9UABD4wjIUtUdbocDrJ?= =?us-ascii?Q?4bYkdzvJo+Qu2GxE8u9sXBVxYj40GCE02jH5QmbPfwj7VKOa7445CLx70bKE?= =?us-ascii?Q?HDbHrMFeCo16htkGletGNE8l5NIzsnePt/5+7O8ht2I8qQpFihXe/tGYD+ru?= =?us-ascii?Q?/yxzrhrecSQmzuaYv2xehIWvwpQWj+wZGaYNRgcS2e9RUZ6i6REQYKfMMcSY?= =?us-ascii?Q?fSLoJBOZbj1zRcHmXmNlruFcYpkBMFiWk4jvG527?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6053.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 518d908a-8bc7-4c59-06fe-08da85994cbc X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Aug 2022 06:24:28.9603 (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: ORLGevc8vZvRoieTHAkkgzDgTN4zOwzCNxN6zZTfK/ni6sTDRMbSzkz261TlBD3p4sEqCDMpd5Cio9SRYLlnaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9194 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 > -----Original Message----- > From: Guenter Roeck On Behalf Of Guenter Roeck > Sent: Tuesday, August 23, 2022 8:02 PM > To: Marco Felsch > Cc: Alice Guo (OSS) ; 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 fo= r > unlock sequence >=20 > On Tue, Aug 23, 2022 at 11:10:27AM +0200, Marco Felsch wrote: > > On 22-08-23, Alice Guo (OSS) wrote: > > > > > > > > > > -----Original Message----- > > > > From: Guenter Roeck On Behalf Of Guenter Roeck > > > > Sent: Monday, August 22, 2022 10:04 PM > > > > To: Marco Felsch > > > > Cc: Alice Guo (OSS) ; > > > > 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 > > > > > > > > On Mon, Aug 22, 2022 at 10:00:10AM +0200, Marco Felsch wrote: > > > > > On 22-08-22, Alice Guo (OSS) wrote: > > > > > > > -----Original Message----- > > > > > > > From: Marco Felsch > > > > > > > Sent: Tuesday, August 16, 2022 2:24 PM > > > > > > > To: Alice Guo (OSS) > > > > > > > Cc: wim@linux-watchdog.org; linux@roeck-us.net; > > > > > > > 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 > > > > > > > > > > > > > > On 22-08-16, Alice Guo (OSS) wrote: > > > > > > > > From: Jacky Bai > > > > > > > > > > > > > > > > Add explict memory barrier for the wdog unlock sequence. > > > > > > > > > > > > > > Did you inspected any failures? It's not enough to say what > > > > > > > you did, you need to specify the why as well. > > > > > > > > > > > > > > Regards, > > > > > > > Marco > > > > > > > > > > > > Hi, > > > > > > > > > > > > Two 16-bit writes of unlocking the Watchdog should be > > > > > > completed within a > > > > certain time. The first mb() is used to ensure that previous > > > > instructions are completed. > > > > > > The second mb() is used to ensure that the unlock sequence > > > > > > cannot be > > > > affected by subsequent instructions. The reason will be added in > > > > the commit log of v2. > > > > > > > > > > Hi, > > > > > > > > > > I know what memory barriers are. My question was, did you see > > > > > any issues? Since the driver is used mainline and no one reported > issues. > > > > > > > > > > Also just don't use the *_relaxed() versions is more common, > > > > > than adding > > > > > mb() calls around *_relaxed() versions. > > > > > > > > > > > > > Agreed with both. The series is a bit short in explaining _why_ > > > > the changes are made. > > > > > > > > Guenter > > > > > > > > > Regards, > > > > > Marco > > > > > > > > > > > > > > > > > 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 withi= n 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-b= it > and 32-bit access. >=20 > > Also this is a explanation worth to be added to the commit message ;) > > >=20 > Definitely. Also, the use of mb(), if it should indeed be needed, would h= ave to > be explained in a code comment. >=20 > Thanks, > Guenter Hi Marco and Guenter, Thank you for your comments. I plan to enable support for 32-bit unlock com= mand write words in bootloader. In this way, there is no need to distinguis= h whether the unlock command is a 32-bit command or a 16-bit command in dri= ver. Best Regards, Alice Guo > > > 2. Also just don't use the *_relaxed() versions is more common, than > > > adding mb() calls around *_relaxed() versions. Memory barriers > > > cannot be added between two 16-bit writes. I do not know the reason. > > > > As written above, writel() as well as writel_relaxed() are not 16-bit > > access functions. > > > > So to me it looks as you need first to ensure that 32-bit access mode > > is enabled. After that you can write drop the to writel_relaxed() > > functions and instead just write: > > > > writel(UNLOCK, wdt->base + WDOG_CNT); > > > > Also why do we need to unlock the watchdog during imx7ulp_wdt_init()? > > This is handled just fine during imx7ulp_wdt_enable() and during > > imx7ulp_wdt_set_timeout(). So just drop those relaxed writes and > > everything should be fine. > > > > Regards, > > Marco