From patchwork Fri Jan 6 11:53:25 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: 13091333 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 DE768C4708D for ; Fri, 6 Jan 2023 12:16:07 +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=u96uCX4V2am6iOTYpS4ARIkENugDvYJzkEOAAHLfems=; b=sMHRPOC1ffcyUa VLdl4O4JT6tNqTKtQoQlEh6gtDww3yh0KKJHwyFIs7GvtcQhIqawTHvXCZQ7FgfeO3lfiqrKbBZzW pr6cUx/wX/Sb94MK9KmwdBgJsncxZxHY1ydeMNjA92bWBXXRU2MO+czCNZH+wQLzCN0Llm7l7RlJn 0TfSuQBB3dEnp//aGJ/Iqka4CB9eXaDBgh106/qjcFaGCvt4Z81t87PXbqLgaZOPuCZ7sdOltHUE2 zqUASEIXv8kDEYSOT/mOjo1SQ/LtQSmIPecqN2YwMdENoXR5lN2FUDXwp1rkGPDrF7P52nh5KjJzr 8NYvSUF60gb5dk3KWrWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDlch-007xm1-HP; Fri, 06 Jan 2023 12:14:59 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDlcc-007xkA-3M; Fri, 06 Jan 2023 12:14:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=11f2m6HWavy1ycHJjCqVibR6VCcvs9IjPFDFLxUESd4=; b=DD4uU2plmlx3uTr/+RTYYnDT2V ASS3DhTcbWhABIZQ9xVy8sqEQFMUGW5cET5J7JSeispLlharUkvKdKpCboSmb0qeltd7znPbFSIGN gNqz958NnNS5nGfWdyZ34DYHN7o6v7oxGD1pBRPc+1jcnbhy8bObRu9RLHF9tQFKUAUJVsLbCwlyH yvmWkg6GPa1ES5PqEPGc2aZHhdMxKiTDmPAdxjYnEwjsD/XhXZo+cWJ022jZfMGgH3AzXux+nSJIK PJKXHbH6mA094gA0dUy6zNxoDnW1prIZfiYPBSS8+BriEcEK7SpxqHM8k1W/Xv0qQ4yGHaCyzrkKe 1bN1ur3Q==; Received: from mailgw02.mediatek.com ([216.200.240.185]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDlcO-001mHG-2A; Fri, 06 Jan 2023 12:14:44 +0000 X-UUID: 4be63f2b7bc7495f8855deb8a7e1a02f-20230106 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=11f2m6HWavy1ycHJjCqVibR6VCcvs9IjPFDFLxUESd4=; b=KWMm219cnN+xu6dKaEdI49NOOeeOul9VVoHiZOPRxpRGRG7rR4n3GUXkdjQXeBA3MwDL13tH/iDdNOHbhobazSfVajyvn+gO9YVlXXs16nQSOm4VYhqSylzyQGo6eyXpmxZ0B8dMlgABrvEQjSuOH21Wvj2oYdHE/Tm+2sP57nU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.17,REQID:97d32b3c-4852-4a8f-9afe-f550300c5f89,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:543e81c,CLOUDID:2c5bde53-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,NGT X-UUID: 4be63f2b7bc7495f8855deb8a7e1a02f-20230106 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1665324938; Fri, 06 Jan 2023 05:14:35 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Fri, 6 Jan 2023 19:54:31 +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; Fri, 6 Jan 2023 19:54:31 +0800 From: Allen-KH Cheng To: Wim Van Sebroeck , Guenter Roeck , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , CC: , , , , , Allen-KH Cheng Subject: [PATCH 1/2] dt-bindings: watchdog: mtk-wdt: Add reset-by-toprgu support Date: Fri, 6 Jan 2023 19:53:25 +0800 Message-ID: <20230106115326.15374-2-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230106115326.15374-1-allen-kh.cheng@mediatek.com> References: <20230106115326.15374-1-allen-kh.cheng@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230106_121441_550793_FF33D59A X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. 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 In some applications, the mtk-wdt requires the toprgu (TOP Reset Generation Unit) to reset counter after wdt resets. Add optional mediatek,reset-by-toprgu property to enable it. Signed-off-by: Allen-KH Cheng --- .../devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml b/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml index b3605608410c..bf06dcd0c12c 100644 --- a/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml +++ b/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml @@ -52,6 +52,10 @@ properties: description: Disable sending output reset signal type: boolean + mediatek,reset-by-toprgu: + description: Reset counter by toprgu + type: boolean + '#reset-cells': const: 1 From patchwork Fri Jan 6 11:53:26 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: 13091334 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 17D8DC4708D for ; Fri, 6 Jan 2023 12:16:21 +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=VVm8f2P2jOdfLp6RNNl0LJEGHCQnTttN8JkoiQWklqw=; b=GYpOnFAmAnIs8a pyV7Cocnje214BVFiz/X8QlcFY+fJMs8LN3tFjujDTa6d3itUgTXXoMXuXpDyrSjvKZRjLv80srsK 95nMM+ne+MG4sHWHJKO2tA4O7dh9JACWSinmAgvj6pGFYxFJL0anI1DTYx9yRK70q2FMR6Z1irtpI 748/GwMTZr5LbGgg5YPHMqrepStWsnpln3gpvWAYti+ld07CXqTxYfK5ae1x14FJa/xLWAnxj2HCx vGhM3P/x6HmIku3vuFBBHiY0s2IUI6M3gWiASSJ0/Befw5elpCWXDirKTOZhpQW9+HiQgCjxfsnuw AYgWZllbbOD5F6Lk7XfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDld2-007xyo-AF; Fri, 06 Jan 2023 12:15:20 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDlcw-007xuV-D0; Fri, 06 Jan 2023 12:15:15 +0000 X-UUID: 2f08e2c2cab942b59607f5c0e28e11bc-20230106 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=2hXwYWe+jSegcz4Df7bZIw4pzdL+uc/kulrqwbGGLYw=; b=KMMeE1RqzOSSCc5b+EMSblYd1OumkGv1i/BC0UBV++nX3fmaKBhcljMNjsOZURoSpdMZKy5s2NsrSpLaj9+DJ7japiTLwVeCkXH3zNNPgJDxBIm5DaFVmIh3ZJV5HZUOkYULHdQJ50blvgVxdATqj1bf1xWINzCj7aA2fPCPPpM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.17,REQID:7bb4b8b8-1182-4bdb-88c4-b060a6492ffb,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:543e81c,CLOUDID:482a08f5-ff42-4fb0-b929-626456a83c14,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,NGT X-UUID: 2f08e2c2cab942b59607f5c0e28e11bc-20230106 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1158632104; Fri, 06 Jan 2023 05:15:09 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Fri, 6 Jan 2023 19:54:33 +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; Fri, 6 Jan 2023 19:54:33 +0800 From: Allen-KH Cheng To: Wim Van Sebroeck , Guenter Roeck , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , CC: , , , , , Allen-KH Cheng Subject: [PATCH 2/2] watchdog: mtk_wdt: Add reset_by_toprgu support Date: Fri, 6 Jan 2023 19:53:26 +0800 Message-ID: <20230106115326.15374-3-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230106115326.15374-1-allen-kh.cheng@mediatek.com> References: <20230106115326.15374-1-allen-kh.cheng@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230106_041514_486695_69E2C73A X-CRM114-Status: GOOD ( 12.45 ) 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 In some cases, the MediaTek watchdog requires the toprgu to reset counter after wdt resets. Provide a reset_by_toprgu parameter for configuration. Signed-off-by: Allen-KH Cheng --- 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; }