From patchwork Tue Jan 17 01:40:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen-KH Cheng X-Patchwork-Id: 44404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1499630wrn; Mon, 16 Jan 2023 17:41:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXsw4iDznCgRAY3BVvQpCoYYpLuwPqzrt3JIn1wVFx4fppcTbBdNi234MOxhDt8EBFJF3O8A X-Received: by 2002:aa7:8a50:0:b0:587:d491:995f with SMTP id n16-20020aa78a50000000b00587d491995fmr1706241pfa.20.1673919675293; Mon, 16 Jan 2023 17:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673919675; cv=none; d=google.com; s=arc-20160816; b=HpzqOPuyvDw2WQxT4BoYihQfKIpn4QGuhFhBQvlk+5nuxiNjGlmNrBv8buA9T3khBA QcSBN2wcmJ3Olz06O/CTEHIR8+Eif+K62LSN0sCjL9I2ya5eQ0nGoXjibCoUBAIZFKok aH4IEKHXVR6MflC/HI36lzu4ZlUYBGINT0O+QbJVBW+Nc8C4IGhDQwriHAtEGp19/wVn OOE/DOvFXGTUSDnC/vXBQbEd/n7TTtoY86BXtwhAhAo1PqYVLDiL6EoXm4ifQXb1aKTU 40LPgC15F+4U3TmxI7gPNupiY330RUOFVcCcLDizznwPrKD2hPs+/OKt1TKj9swGoivo xhXA== ARC-Message-Signature: i=1; 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=6oPqNoh4XwViDpcqgPnVTYVHmgJBWp1+827qEDxJS0Q=; b=wpNYQTBVAwwhncFcbeKdMMLVBlOXkFVw/Mmyr2enTHMQSdfwK+R6rcyLb7VRzisL4V ki0/Oj+Z4jThvBp9vyR7Gx33fvngKeSsjIobALyvG+BEQMKkZAFgAw+OWYTxLpl5U+My Ducj+43xL3l+x7BLHigvFGW6UnMGNs1oV6OSAsKSpiobFeAYgqoyKPyAg4frU/E+drxo eFC+cBd7DETZmt2U7VvklNjIaWXPgoICKB4yvHhHLGByUCJE2hddYuN0VjeC3CRPUypX Ie9Q3jnzf4bduyJuJZvRnAt7X9V33stSqXh7lxBshUPATqV8mz5W6mEptMkSKDu0HDka J2qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=oUzzpq7e; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a056a00114400b0058195b7d00esi32301863pfm.164.2023.01.16.17.41.02; Mon, 16 Jan 2023 17:41:15 -0800 (PST) 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=@mediatek.com header.s=dk header.b=oUzzpq7e; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235112AbjAQBkt (ORCPT + 99 others); Mon, 16 Jan 2023 20:40:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234550AbjAQBkj (ORCPT ); Mon, 16 Jan 2023 20:40:39 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6EA1298F6; Mon, 16 Jan 2023 17:40:32 -0800 (PST) X-UUID: eb62f5d4960711eda06fc9ecc4dadd91-20230117 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=6oPqNoh4XwViDpcqgPnVTYVHmgJBWp1+827qEDxJS0Q=; b=oUzzpq7ebqwSk/gnoBji/C7Uac+qDLRj3G8PgHtARt3uNO4HpgenaZ9BaHQ24DNIqyg3t7U9uaomra2UnSSXHVzYe+tqh4y43Sq38Cnnle8FnIUFkgtfx2TIy8+dg+zzQu6g1BTqtU/3N18jjp4ZCNt0QpmAwb7zRcpzSxVSlng=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.18,REQID:42189052-ff89-48be-ab81-0cebf943c609,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:3ca2d6b,CLOUDID:8258d454-dd49-462e-a4be-2143a3ddc739,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0 X-CID-BVR: 0 X-UUID: eb62f5d4960711eda06fc9ecc4dadd91-20230117 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1215428695; Tue, 17 Jan 2023 09:40:27 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 17 Jan 2023 09:40:26 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 17 Jan 2023 09:40:26 +0800 From: Allen-KH Cheng To: Wim Van Sebroeck , Guenter Roeck , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , CC: , , , , , Allen-KH Cheng Subject: [PATCH v3 1/2] dt-bindings: watchdog: mtk-wdt: Add reset-by-toprgu support Date: Tue, 17 Jan 2023 09:40:22 +0800 Message-ID: <20230117014023.2993-2-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230117014023.2993-1-allen-kh.cheng@mediatek.com> References: <20230117014023.2993-1-allen-kh.cheng@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755231997477412250?= X-GMAIL-MSGID: =?utf-8?q?1755231997477412250?= In some applications, the mtk-wdt requires the TOPRGU (Top Reset Generation Unit) to reset timer after system resets. Add optional mediatek,reset-by-toprgu property to enable it. Signed-off-by: Allen-KH Cheng Reviewed-by: AngeloGioacchino Del Regno Acked-by: Krzysztof Kozlowski Reviewed-by: Guenter Roeck --- .../devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml b/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml index b3605608410c..55b34461df1b 100644 --- a/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml +++ b/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml @@ -52,6 +52,12 @@ properties: description: Disable sending output reset signal type: boolean + mediatek,reset-by-toprgu: + description: The Top Reset Generation Unit (TOPRGU) generates reset signals + and distributes them to each IP. If present, the watchdog timer will be + reset by TOPRGU once system resets. + type: boolean + '#reset-cells': const: 1 From patchwork Tue Jan 17 01:40:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen-KH Cheng X-Patchwork-Id: 44405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1501703wrn; Mon, 16 Jan 2023 17:47:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXsehEoM4TGGJRTWjusynUTW/sy7tqoEFypgRCD/ftyjfaomW7edlWPFdmvkTKsI5NPocQwF X-Received: by 2002:a17:902:9b97:b0:193:3314:540d with SMTP id y23-20020a1709029b9700b001933314540dmr1614234plp.51.1673920033109; Mon, 16 Jan 2023 17:47:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673920033; cv=none; d=google.com; s=arc-20160816; b=LHq7N4Bwia/A4An4GZlI+Y0t5E9Yq9Sh7kc1u5C5Gv9/EDp6FCRwOod2RsLfFj1AOo Uzp2fIfJBWChhJzW9XJlmpiNskj/sYRXgv9MxNPvq76/f7q2ccAnMen89c27TtMIHxK1 4feeQ3F1dtaRhS+u0O4gnQrmBS9NE7TTxCxKVjJ3KoCb+MVpLxWTsWwVovh0u5JYbk1d BUmAcGl8s8LnF+4Dzwrrk2k+1kq8jsBQoW4FTYgxlvflFwNfGYDiseFWRIuwjHP2BJNg ETTfVFnhyQPpk8v/YDDj4i0bYS8kgiwOxkLKXMuH08lx0Hll6KIcH1Nv/Kcg9HkCCVpk mnlg== ARC-Message-Signature: i=1; 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=KIYgMczl2d+gSz+cbdTqjNO5HXOYoOO5PWiSiasILCQ=; b=z/uLC5Gdy58hhn5E3Rh+uOJPoA1KGxdviTzys2l7fVLGhnsnyic2RnJXOK+IVY0Sy1 m/c33udSPX6MBm3mwAErDbAs1pSDQIBVXm0e4Ot+DZfRp0P3K+fxs+SjO8h62pgkbpmx gFLB4yr+qLZwnPATu8Cvo4A6gKAWrOYmCs8NbUABu3PXcgGI0AtgBzC8RGSwkwA4IOu/ IpXRpBdB2nqY0NcB8vYJ7/hzomhDiQZqsgHFPRpychSGNyjUUSOnhyYk1VYMvDIX6nXH oq3aZSAZfs3vxmd8zGXGiIfpI9ZkyfazUtZm4R7ymzTlE6voKLeUB5howW1F2CM9Krv9 GTjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=sOiXUME4; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a170903210900b00192d3110c58si27468490ple.18.2023.01.16.17.47.00; Mon, 16 Jan 2023 17:47:13 -0800 (PST) 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=@mediatek.com header.s=dk header.b=sOiXUME4; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235214AbjAQBlC (ORCPT + 99 others); Mon, 16 Jan 2023 20:41:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235008AbjAQBkk (ORCPT ); Mon, 16 Jan 2023 20:40:40 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A613B26874; Mon, 16 Jan 2023 17:40:33 -0800 (PST) X-UUID: eb64d476960711eda06fc9ecc4dadd91-20230117 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=KIYgMczl2d+gSz+cbdTqjNO5HXOYoOO5PWiSiasILCQ=; b=sOiXUME4H62SMbbAj7eRHhgSuX9R3qs6TjJrvHdY2PlH5JGnU3yw4XQKbNl0vbAc0v87CttgAwQtX2G3Xj3jQz1nezyJj7CbkkGhkiTiIwA442NSLrAFjQo+Cd1+MQX1+1vFcW2WJfDqtzalh2xRZG36MPnuhtOhPjOM6zM0hTQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.18,REQID:4344885f-de4a-4b7a-a0fd-64d6177cb78a,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:3ca2d6b,CLOUDID:71486f8c-8530-4eff-9f77-222cf6e2895b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0 X-CID-BVR: 0 X-UUID: eb64d476960711eda06fc9ecc4dadd91-20230117 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 248583976; Tue, 17 Jan 2023 09:40:27 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 17 Jan 2023 09:40:26 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 17 Jan 2023 09:40:26 +0800 From: Allen-KH Cheng To: Wim Van Sebroeck , Guenter Roeck , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , CC: , , , , , Allen-KH Cheng Subject: [PATCH v3 2/2] watchdog: mtk_wdt: Add reset_by_toprgu support Date: Tue, 17 Jan 2023 09:40:23 +0800 Message-ID: <20230117014023.2993-3-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230117014023.2993-1-allen-kh.cheng@mediatek.com> References: <20230117014023.2993-1-allen-kh.cheng@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755232372758465124?= X-GMAIL-MSGID: =?utf-8?q?1755232372758465124?= In some cases, the MediaTek watchdog requires the TOPRGU to reset timer after system resets. Provide a reset_by_toprgu parameter for configuration. Signed-off-by: Allen-KH Cheng Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Guenter Roeck --- drivers/watchdog/mtk_wdt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index 3e6212591e69..a9c437598e7e 100644 --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c @@ -50,6 +50,7 @@ #define WDT_MODE_IRQ_EN (1 << 3) #define WDT_MODE_AUTO_START (1 << 4) #define WDT_MODE_DUAL_EN (1 << 6) +#define WDT_MODE_CNT_SEL (1 << 8) #define WDT_MODE_KEY 0x22000000 #define WDT_SWRST 0x14 @@ -70,6 +71,7 @@ struct mtk_wdt_dev { spinlock_t lock; /* protects WDT_SWSYSRST reg */ struct reset_controller_dev rcdev; bool disable_wdt_extrst; + bool reset_by_toprgu; }; struct mtk_wdt_data { @@ -279,6 +281,8 @@ static int mtk_wdt_start(struct watchdog_device *wdt_dev) reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN); if (mtk_wdt->disable_wdt_extrst) reg &= ~WDT_MODE_EXRST_EN; + if (mtk_wdt->reset_by_toprgu) + reg |= WDT_MODE_CNT_SEL; reg |= (WDT_MODE_EN | WDT_MODE_KEY); iowrite32(reg, wdt_base + WDT_MODE); @@ -408,6 +412,9 @@ static int mtk_wdt_probe(struct platform_device *pdev) mtk_wdt->disable_wdt_extrst = of_property_read_bool(dev->of_node, "mediatek,disable-extrst"); + mtk_wdt->reset_by_toprgu = + of_property_read_bool(dev->of_node, "mediatek,reset-by-toprgu"); + return 0; }