Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp375210rwe; Thu, 25 Aug 2022 01:47:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR4meNAhELQ9g6rP8e5nS7o6n1hn/dqpcSyhQWtq2g1bAej5RVeb18EMZwyq87tgH0t2rITi X-Received: by 2002:a17:90b:14d2:b0:1fb:acff:998 with SMTP id jz18-20020a17090b14d200b001fbacff0998mr1794947pjb.70.1661417266745; Thu, 25 Aug 2022 01:47:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661417266; cv=pass; d=google.com; s=arc-20160816; b=PD32uOYMYBmpU6lpju3kSUawZJFatWvRrogQ9JpD7g8tTzN4jSAJM6uowvCoGNEgF1 RAFxq50pDEynSfzVMyiBPGucmAmWrqz3lHLo88KS64c2+cVW8dyAbaHAjn1iv43ag9sS gqPVbdxzlv9+m05AeyiU9Fe0C+qFQifSTkBJzm28TtoLtkbbTp3anRRMPCMo+DqgfzM4 hsAn4E4YmgUssAVnW5Vd7rSlvSOjRE+CTALjIz2EPsxBy6SY5EdMZ/8A3uSsYgdoVOjb SH/Rld/gzppdjnlJT/MKFpjQICrbKDWkHeL+rkOY63ZNXk4FvDR/oCs+TzBEcedMZDVr bDdA== 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=kdq8c6LIrM/UWoQW8Y9QzYYiADG1jHHgY9JFpC+nqpk=; b=WHAUklq1VBCF63S5kR5hH56EKuSFEyF/sgJxtNSwmk2nCkcKJrqEwa0tjeLY0WsLNW dMPmbwoceOqj/23mF8VOtoGnpayv3WfduzCocZn3dMlfZumq+2QcDu7vtgBTcCdi01Pu wh+FVVKei3CdPnrG9lt92HBcavqFQyk/TtXfWFySQVjZUfUD+k/R2aXvZaiwG2VsTM0v yRmKgUir7FpbYxSaFFSvpu5KwMd4F/bA5I+uU8NrntjTlA3/LIhh+4z2TcfxmSV1MU6f NxroEk19+zr2RbZCAz93jxkd4npKcaSiHItb3JZ6+S+iVFmq2rkAGNNHqI7WQujUGfZL 0eqA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=U4Nepmdi; 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 nu15-20020a17090b1b0f00b001fac102fdeesi3564443pjb.95.2022.08.25.01.47.35; Thu, 25 Aug 2022 01:47:46 -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=U4Nepmdi; 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 S229909AbiHYIdG (ORCPT + 99 others); Thu, 25 Aug 2022 04:33:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237377AbiHYIdC (ORCPT ); Thu, 25 Aug 2022 04:33:02 -0400 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50059.outbound.protection.outlook.com [40.107.5.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA1EAA6ADD; Thu, 25 Aug 2022 01:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGEfnPcnDLA+3OIHRQn/Txv1VVhUJXvLq5P3AROGfjHAvGvWSUF2PzB+tNslNwbnk+bysVYnmtWnfwVWO4NpVoeRIwGSjxr8GyI1xx5Qjhmqdz/qRQffHOC5FGxplCzMi9aXHHjHQ4+D+tzRweQQqQm84pbof4HhMH49v1Fd2ZDBmMkbr1EdeZJyp06y3E/cS0/K65hWpQUh0h8e4iY4KRkzCsgZvyVMHqD5lmE9VVj/NIC+xIX/bxQptB3kYGSupf3k8BDCo6YUaCEiv3uoaEs/6hnNI7XyhjLmV32GN4uQBAmI5kwjvNiMm6DRYNU3lCsbRZ3L5+0Y6QhyLTznEg== 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=kdq8c6LIrM/UWoQW8Y9QzYYiADG1jHHgY9JFpC+nqpk=; b=OAbfp5CnxLk3EkNcGv1Rk5Aqrtb+VDUW0fPEtpnS6BDyJKTWqGIb292x8bXMZq+BFVlnQZYqYK0C7eK37DVkAZ2LStJS9x5Lm7tSsfqwuO9LC+YM36aSFl5CDafsrfOaU4h32kGEVLGy084pcLzHgKDddCCK6Qto9oHSZxSrnVAvxVNu9hCBuro5HTSdqwEd4QMEcG42qdCh4vrcsbK9C/zlx0XwzC62mofk+Cn0nttypeV1ShKgtiFy4SbnotuYJioX6U+FfGEtRBEXLtroDYKoG5jCC/XIE8TL7TnPkCj/Dir/cTSspozQZ5fWrbQaKe1QVViMefM2oQuQNYmuWA== 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=kdq8c6LIrM/UWoQW8Y9QzYYiADG1jHHgY9JFpC+nqpk=; b=U4NepmdiTtPTd83xZuiBqFvw7ytUYMdVYy6AqE/5CNeJ3wa9Ox50BVv2TGY5mC4rZcDsZ5jIb9ieRJEkgrDsJbXvUMMMoRmfC4bhsl5t8x981MkxBmr/IHiPP0LBbfs3XX+H434RsNl9eISudraCGQWBV7F1S0oo12Lx/kciNxM= 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:32:52 +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:32:52 +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 2/7] watchdog: imx7ulp: Add explict memory barrier for unlock sequence Date: Thu, 25 Aug 2022 16:32:51 +0800 Message-Id: <20220825083256.14565-3-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: 657567e6-0bbd-44fc-cb1b-08da86746670 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: z4K2+ofqI7VK2EVrPju1REpQyL3y95QOGRUBQ3h6W438SeL4T5ohf7drDximkrqk5cY7uAFzuAIh6zzBhMJPJZSx00YXaX3Lg7YEAxnO9JWtWphx8hV2hs540Vroi5ONwk45DxPRAmEYYhavrX3mmigdlO2r2VnB49RfY0I3m6QUyQggEQLnT6zfU5MdQOkp2uyfnl3KH75nell8umwfJuT6uTxSW7XBQdpX8rDpgJbvMGJpTPaZk7TWQ91SKtd+bXlxK4XOxCC8auX3lh94AVbJSRMmJwEgq3oVgmBxmNDaqgXewe83y2wrIreFeBQGe7XGKvSvQkUXY2PxrfaxYaSvLYmuQbau1GipiWZPjaRXcUeWfdT/FDKyO+voSECGm/nz9HRAMeBpNZcRVpZqzduMMI2LV/EzGh/czExqcvenpTfbQ/OKJ38l0HuZNZVMzeRjygGkEPuHakIWR0HkVhcClfvaQVzmvtvuqSTRkEuezGaROV+QWtvRy0A1Q3gWPFZ+C426lid7ssPDCGEuvUYkzctaRHBlc6QE+B7VOeIjRjKxMthot6BJnfOsBBtZ/i2saL7yXpFX8TSYyfhXFr9gHAKITn5GTFemiNPR+TgRhkw5c1sgC+Vj85GFYxZ5YTya3K0X+c+cXvwm803mF8fOh45jOds+GAaIooZ8KeZOv7WhpGJ3BRxTPJDY4+HVZWYFqsKGJMeTiylGz/S0o1VR3hSWl2S/w4qRm8R7BS0wGAYeKzxs4ViIZWvT/Ratlp6IZ4ZrSZ60odwAoxkW4w== 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)(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?xSuMh4+zeNDbnpTARcqakOz3eV76U2UUj2+63eXTaWfyzVD6EWm1WQcmyJR1?= =?us-ascii?Q?WwbIKCp0I3hf0E0s6p0VVW4003EDtxmJLMZREj/RhEQ/JEMxUs6sY5npTy7j?= =?us-ascii?Q?tE+Qgz613RPxn6sFxvFTVsVSlFxfFIGFQ4Co4BxWqF39V9cQxCNQblLVrQ7e?= =?us-ascii?Q?czVF3KCSqCSHUCAZyQiv4Hj6qWt7BSacFz63yE5s6HGMRL+Spxy9wZpFpNCF?= =?us-ascii?Q?ueW2M+LFDAIbf16RIrkiwZQK+hx+oZPOUsft2MWQttXaHNLBuFNxraO/Prbt?= =?us-ascii?Q?db6HmFkL2G21KEHSChl32A9hqmJtDWsprFLZgvtMHEOkSysAHtm9W2ItqdoH?= =?us-ascii?Q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ZosQssp0?= =?us-ascii?Q?M0BEtmeBmG/3WrSdxwO6yaEL8QxgCJf+pLU7pPdPlKbZhXNFvvpKUcxLMjZo?= =?us-ascii?Q?85uqY6B9mpZEj8QZcNjodtTzugdzIurraserFdgZAMjwA6ailN36PqCR1o3k?= =?us-ascii?Q?10d6L4hz/gluV/H1WiR5ohNDDtylgbe+iVqM+GUJC0lZkkit0Engn3NMNz4B?= =?us-ascii?Q?616PzDHOqgiiEV0unufYCE6fzjPqOxW1vp9TECo/81iCSuJqnsULVZvIP7i4?= =?us-ascii?Q?Q/pUC3ITk4SVu6zkVD/Mvt5HfFx6zwA/Ajq+sYsQgOM+P0UCvqAIDkVur7Ge?= =?us-ascii?Q?kYAdPhJayZKCXJRVNTI2AxpaYWU6QLSrDg9OeJzU?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 657567e6-0bbd-44fc-cb1b-08da86746670 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:32:52.0905 (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: hnDJjs2VLDUY1ldjBPc/9UL75tDeZ1UkIuzyeUs6bE+vrW82UaEZsoBEqEZF9EoCWa2uyUO5pL+8+2kqQ2myLg== 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: 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 --- 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