From patchwork Thu Aug 25 08:32:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alice Guo (OSS)" X-Patchwork-Id: 12954376 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 265FFC28D13 for ; Thu, 25 Aug 2022 08:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0q4vZBXp8JtqOwnq6nTl9k/ei91KjFt64r6Mkf5dlSY=; b=Q9A8Sxm1lpjNU/ qbplEaW5htfBvPb/NH51rT+PcRDZqyxt7upvcrbrRNe4zkUIrAQ5K5ZLeaQMafNxGizEYHGl0cRpA bPfT9csJcADCy42lGKlzIQBTr68jfuUJyf3C0E3NkOozWq1SvDCj6zJJmhamze+LK3CKN6MvdW6dI kG05TRFTCctdcbPHb+DRaOQQQwIqTexvRb95YJIeSQGAtZb/UAYEWQBBBR3f2toliF9VgixQIZb8T +bp2NjWvkMKsNYzjVYY9GYW1me71zO+ABkO9A4a7g/bIBFqb2gF4pl4PGC4BCOa2Jib1AUoRYM/tt pnctnCrU/QZeyehCOSyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oR8Jt-00A6YS-8k; Thu, 25 Aug 2022 08:34:33 +0000 Received: from mail-am6eur05on2063.outbound.protection.outlook.com ([40.107.22.63] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oR8IS-00A5ja-Kv for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2022 08:33:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lTjRWhhtX0gJN5whj72h6fkd/LfYce0MKuJMRqumyqPToBftm4peHnVrvLVEoIvZFID2C9k02pF42OJfm4AEAsU6t4QqcqvOZAlgA5CcnimmuZkP/SDC2TEzjOyomMeSWoKEIXwLP+nrUfinoYHDddMcJLdjqemPSWPapIe+9mN3ww47B1uAGXppXUafO/BN8AWM0mN2kEFqNxG97ppdeCKGPsVPOdFZAfY2PM4WZx3lpczN1sFEu8luYTO8ydf1KU+MfhaC1RHcUtcxK8W+0UnXqPTkRE8gNjLNN+NDeNf/VTvmv/Gp6MyZ7tZnhLb5N0qUfXip6sx3Lqn47kicDQ== 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=lOvx8PFif0c8G1i/uD7gAfYKTonb/FFBmXB88pWKY5U=; b=iZQO4VXuwKpY1j8mL7gdF9xg3Kde7F2n5jDqylpps4kVkMPz1+X3kqPzYUooTbKQGMIeWZZcVanCD3ADTY3MsSU6xqwrp40I4yQ7Y8WSaDPdqeq4Z9eMQ/fio2mfjEhgFMAI4qF0CHCk8C4pwRvT+G1LxpRgAyG7Oh07EVFVsPlMTGN/mq/Zyb3E5ms5wwkz9H/dNpBYmdQPP3z2PkiSoP7TZQbk/ATAHxaoqzie7vMn2jy8dlgIlW7xgIsTcSmx/CNp79QvG3NKOkRTC4682Ry3qya1Qs22UknskUKkpbXot3kLWqdcZdanRThEulJ4W0/w6FZAt6/OcEvZDFTRpA== 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=lOvx8PFif0c8G1i/uD7gAfYKTonb/FFBmXB88pWKY5U=; b=iPomr3L5anT1M7+rsEV8vnlmMFtWcnLaDaT45aNq8y9Sclp8zMb1aDuScpsSodrRpmmTxC9iUddk9hhp3x4f7SwMT07Hz8j32HtF3ugGv57Alc8bDSVKv9P/8/TjxfdlGJ33nnLvcl1FqwYWlKl5qUcOHKbLfVX2PGHuI2+rBvQ= 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:58 +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:58 +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 3/7] watchdog: imx7ulp_wdt: Check CMD32EN in wdog init Date: Thu, 25 Aug 2022 16:32:52 +0800 Message-Id: <20220825083256.14565-4-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> 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: 582f7f76-4fae-43b7-67cc-08da86746a0b 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: YikAmK7gqiz4gl2LCzERPh3sXkNnhZVAQDvMfIlmYEWFtjmnbGZjY46BNuflfl21VimGrj87Cor0c4LBd6S65kT4dx+Mixq3uYPY8dRXJwQK2KKjkFNu69cuXyqnjdjosrYK1gEe12aJvUR+03Ymuv07FGiPlu6bbfRxE56dWteaVR1DJn6mG/CuAkUeDyX7bei0KmMF0T7x+T1vyDMupM9sf3nEDp92cVmXMqSwdFLtPEWwcvn8uBqsDm2biWNvL5Oc328MXvdeOVkYF7Jz27Gf2sREYJbtXknXz66A2+ScDhQ4as9zBtnj2i07uhBxm+OOaxeayL3Sk2aW5A4oHpe65S3QENCDNPHYtQGv3722bGIdhSwS21L6SFkYmP718q+zhs0sfUohAvZq6hsr4Z+wyF1ObLl6dg86EuGvc63/G/pNJDFT3AJCa5G2Owi29BskMbZ3T5QJn1S4UaslKFkPS+oUO1u2rjYiKaILd8ZrGOdHHHjmCvyIGSoPrgGsmfT8R+51pinSyqLMBjSDFWGtS2FzHv1RhHq3dmmUmihqbgsueiGQsiXCNqnv1kZmQs0ttYL1jBzildtcIh2DxpCFY0/1vZpZg0FJrNSX2rniTL0NQCayBIqC9OLceyV2YxcJid8UQwYfVVw2MTXC7Ks8b+xSY4EEE4OO1EgKViNLry6/g9dEAy9vFLmLZD0eQc0A4GXIQpcShoGvN5o9Ck76H4fAq3PAvILp6OCxddT/sbJYh7oFL0scZw0J/+S6WBxvFS1BUsXo4peDpdiDIw== 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: AwgOc2pjEFScFFCnebuEY9rNGrHLepouYJ/bqf4MgqVrFvXxJiN3tHtPDwnJA2QCpI3N9PvRPyHQV30MkMFOCNjHQeDhJddeHkjqtMenjLWovJylgAJ0TBKCUkvxqIp7Qt2BUTeNw8a1z9XDQOdW+6l2nFR3zwQsdl4D81OJe98iYPksFaat2IvZXSOUezqN+RbIzFRHn/WL4p0rSmzmq26gKOgGzolkR9JGE8JJWoEawWAtiwfJWDz7R0aZRkh4+IX5loa+ASE+Ifs++lYTzRVElQh38wQeReepP5vYnd3kfXywhjwXkJlyDcehqpL+ItuIDEQJzUFF4VLg9hX/yhoHsZZAHp3ZOk6cNGGrfO3WWKO6heTtur/IU1FOuI7uHKKxod8SkeWyVi61FrC9Row8oGTT5FMN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s4oZ0aXEqV1dNLtd6SCUxLIsvmFlo3yJbqoUO7r9JbBvmTGKwO+Ab3QlA+cVJ0qSG7GP62xX0z+xJf3mUwqdu X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 582f7f76-4fae-43b7-67cc-08da86746a0b 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:58.2775 (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: 0PIyAkPPnYwmbWkQ76EHG/Ww+kvHFvDxL7JrUE6Z+VfuYZnJ8j9Lhlwz5EYfD/R0jkooauEB/c1rKtV3wwJSwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4901 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220825_013304_757369_8C171F36 X-CRM114-Status: GOOD ( 11.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ye Li When bootloader has enabled the CMD32EN bit, switch to use 32bits unlock command to unlock the CS register. Using 32bits command will help on avoiding 16 bus cycle window violation for two 16 bits commands. Signed-off-by: Ye Li Signed-off-by: Alice Guo Reviewed-by: Jacky Bai Acked-by: Jason Liu Reviewed-by: Guenter Roeck --- Changes for v2: - none drivers/watchdog/imx7ulp_wdt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c index b8ac0cb04d2f..a0f6b8cea78f 100644 --- a/drivers/watchdog/imx7ulp_wdt.c +++ b/drivers/watchdog/imx7ulp_wdt.c @@ -180,11 +180,16 @@ static int imx7ulp_wdt_init(void __iomem *base, unsigned int timeout) local_irq_disable(); - mb(); - /* unlock the wdog for reconfiguration */ - writel_relaxed(UNLOCK_SEQ0, base + WDOG_CNT); - writel_relaxed(UNLOCK_SEQ1, base + WDOG_CNT); - mb(); + val = readl(base + WDOG_CS); + if (val & WDOG_CS_CMD32EN) { + writel(UNLOCK, base + WDOG_CNT); + } else { + 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)