From patchwork Mon Jan 16 10:53:04 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: 44082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1126997wrn; Mon, 16 Jan 2023 02:54:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXsOk1zl2syNdgCeLJn8Y7JiLmBsi+bL02Ti25hoLQlPDRvxpFEp9NJNJF72S6PpFId7P4U3 X-Received: by 2002:a17:906:3591:b0:86f:f198:2acc with SMTP id o17-20020a170906359100b0086ff1982accmr4470761ejb.11.1673866487357; Mon, 16 Jan 2023 02:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673866487; cv=none; d=google.com; s=arc-20160816; b=gITn1bcmigXRezM4pvmxDu8ohJD4QJ0j9lDojG9Yk5hCAa6kUiqdevih07rl/AS6Vi q7U+Jn/iX6jsGodLfBLEOTWE+Ybhc+g9/s7JZ3oI/LHEV3V1lYcZpB4qu/z67ANTv9ep yBjQrdPbY4b4u2FA9O7F9WxJAYDN0GkVxQtyUlEV79cZ7RvEvSYdBNZmzAaKzxLZ+60J blrho+ukNT/5LC9E8hFKrAp6318fvLOVIlao9sdfvBevrz+lSRg3P38L/cEr9+z8ssYe pgiag+x/YQXS/q+fcPKL8vnYIm7xmWcrPxg+2CNzyfrgYcdmaG0OI9JksrPsZZqwPO5s 7Ihg== 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=WVRQn0/z4/Txw4tds1T9p+ZOw4h5tZ0f/iFMTnbJITI=; b=C7NWMj39LYax04XBIe1VQ8/6O122jV6m1w/dRm6enutPyf+O4S09pDuj0ICsXpfmSG f2Jypwn+T31iT+WUekQO/vObaPFGlIeb/xnZ0JEBAiTGWhkcit9DN/ItmVdEVpXG62Jm hG+ymdWOH/Gv3UGonDDigBmY6agPCmImd8GqQs/DomuIVKohtqrZp1JOnBFNJz7KDlam NYSIo0y9MTCjeCRTQVcOLmEmdYoSmU2lKoy7D7jhq1a5RiDHcYLMFh8vOUfHGmzEOmY8 V8faqQhcbEcRlNo+t5gLGb3Tr9UwkgD1ZdLOj7uw6fIymg/ERvwVQy9K/OL3Hr0z9LQo 4ISg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Pj6hEWsf; 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 dt3-20020a170907728300b007c15653692csi29473925ejc.287.2023.01.16.02.54.23; Mon, 16 Jan 2023 02:54:47 -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=Pj6hEWsf; 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 S230395AbjAPKx6 (ORCPT + 99 others); Mon, 16 Jan 2023 05:53:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229863AbjAPKxW (ORCPT ); Mon, 16 Jan 2023 05:53:22 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FAAB6A46; Mon, 16 Jan 2023 02:53:15 -0800 (PST) X-UUID: f6cbfb40958b11ed945fc101203acc17-20230116 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=WVRQn0/z4/Txw4tds1T9p+ZOw4h5tZ0f/iFMTnbJITI=; b=Pj6hEWsfv9oRV4U2rOZYD6l4jaT5dTzEwB26ZnKI+aGzKPbg3ROGkhgk5NgRyCr2TgNlDsOfADYL/he+suWi+RjuZY2QHJ007jjMKjRL9NE9S0PC8Sa5zPF1I86VUFe3VuvyQzIj3KenYyiqCmqVP4/RU+4p/wlmYKPgKSeJW0w=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.18,REQID:4a0b832a-bab0-49c3-8c4c-e05570b52d2d,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:bb93638c-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,NGT X-UUID: f6cbfb40958b11ed945fc101203acc17-20230116 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 814725318; Mon, 16 Jan 2023 18:53:09 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 16 Jan 2023 18:53:07 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 16 Jan 2023 18:53:07 +0800 From: Allen-KH Cheng To: Wim Van Sebroeck , Guenter Roeck , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , CC: , , , , , Allen-KH Cheng Subject: [PATCH v2 1/2] dt-bindings: watchdog: mtk-wdt: Add reset-by-toprgu support Date: Mon, 16 Jan 2023 18:53:04 +0800 Message-ID: <20230116105305.31818-2-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230116105305.31818-1-allen-kh.cheng@mediatek.com> References: <20230116105305.31818-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?1755176225833641062?= X-GMAIL-MSGID: =?utf-8?q?1755176225833641062?= 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 --- .../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..b4de6b134ce1 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 generate unit (toprgu) generates reset signals + and distributes them to each system. If present, means the watchdog + timer will reset by toprgu once system resets. + type: boolean + '#reset-cells': const: 1 From patchwork Mon Jan 16 10:53:05 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: 44083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1127031wrn; Mon, 16 Jan 2023 02:54:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXssIMnm6WkYyLLroKdfAAE/vVdhgqTfPA3by21guLgThOj9Av95WiKGVmTqGe6toh4HO6R0 X-Received: by 2002:a17:907:2587:b0:7c0:ac4b:8b9 with SMTP id ad7-20020a170907258700b007c0ac4b08b9mr64743814ejc.14.1673866492316; Mon, 16 Jan 2023 02:54:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673866492; cv=none; d=google.com; s=arc-20160816; b=TknpFIwEHfk2zGI1QCvSdhCl644IckOWNkxsqwJSro0YtmjU52/9StSMIktIJbpGTO D6sc8mT2BxU24fym1d8EPDDQ664eOaIO7iEt4DOe5Ho/Xs7zOYXR7TxAGzYrIJYAvIBQ Ohpgzk3C2YLgXbPmfPxCqsXJ+o46eCHNxaWfKbmomMZgk67Q6W7bY+1P+ZiQKdtbchXu FKHgiXGOMPSfHRt8l1eD4q6/k8ElXvDNjk3P98ewvsFeKxivreQFqbbTAUyyniqptlFF XicQRfTddyUsD0wkNUmOw0MAA1CI4+YCFobRKqjdbsKfKVqabHi0D3cP0TOJy7lVwHBp 87jA== 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=4G8Y0ViVJzXb6BsOeFBPQvk3DHX0QfUnX0ejt3ACyfU=; b=Cd+LAIuHu3EHbdUwl0DCSrwDaI8TUMEaT6nSDDczWKcmo+wsg35/MUq+M6SIlSKAmN kUfDSw9XJwdMC6Z4hV2vkOXKYyiwM6ZApicTQiioVyABu3WhOLbKd3tO+zldhjBJUwPF TeDfoKiMggsvjoQj5tf+WcGRfo4/Qdl/OPRwZtHriKkxITDyTf6s5uxoBKr9b0QtuCVO PXHFBpGByoAGqNuIu8NvnA4DNC+AEKIRAYmRqUgt0V4U5TVQkXDL/sgh2hMHrrTjZsdP uPJALfsSt8k3dlhWO1ZTqyNMIdqD+HlES0b7Gck3gX9KWiJyJSBI+fnMuzG9Z/m8WsxZ LvZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=kzEtSVn8; 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 vi5-20020a170907d40500b0086fcc2f95c7si3756544ejc.289.2023.01.16.02.54.29; Mon, 16 Jan 2023 02:54:52 -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=kzEtSVn8; 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 S230427AbjAPKyD (ORCPT + 99 others); Mon, 16 Jan 2023 05:54:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbjAPKxV (ORCPT ); Mon, 16 Jan 2023 05:53:21 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86BD5196B2; Mon, 16 Jan 2023 02:53:15 -0800 (PST) X-UUID: f74acf9c958b11ed945fc101203acc17-20230116 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=4G8Y0ViVJzXb6BsOeFBPQvk3DHX0QfUnX0ejt3ACyfU=; b=kzEtSVn8Hu+INqkYtPtHDQ84mcUFru8ZQY4cxOv92Vqa6UWd0+OxRSpEFlYeHAbw0ZIeNiU8seI8zAokpPIEBbz1lSpH7zX6ct3IrOUZ7I+x9PqFEoFC4Y59a7FuUsYtUcSpFC0DpujVOqpVS5qRmYBo0xNX5FnFCmlIcgmC+pM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.18,REQID:07ba01da-45e7-47bd-b518-c0bbed90f295,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.18,REQID:07ba01da-45e7-47bd-b518-c0bbed90f295,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:3ca2d6b,CLOUDID:75a2c854-dd49-462e-a4be-2143a3ddc739,B ulkID:2301161853114L1JMK7F,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0 X-CID-BVR: 0,NGT X-UUID: f74acf9c958b11ed945fc101203acc17-20230116 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 886985106; Mon, 16 Jan 2023 18:53:10 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 16 Jan 2023 18:53:08 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 16 Jan 2023 18:53:08 +0800 From: Allen-KH Cheng To: Wim Van Sebroeck , Guenter Roeck , Krzysztof Kozlowski , Matthias Brugger , Rob Herring , CC: , , , , , Allen-KH Cheng Subject: [PATCH v2 2/2] watchdog: mtk_wdt: Add reset_by_toprgu support Date: Mon, 16 Jan 2023 18:53:05 +0800 Message-ID: <20230116105305.31818-3-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230116105305.31818-1-allen-kh.cheng@mediatek.com> References: <20230116105305.31818-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, T_SPF_TEMPERROR,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?1755176230984203883?= X-GMAIL-MSGID: =?utf-8?q?1755176230984203883?= 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; }