Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1178165rdh; Mon, 25 Sep 2023 05:43:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFW/bwRkpcdJKsMCwNG0R6OIVjjShARJYUjsu5HscjPfSHEMuSptZUOZ7L9UClwWCk/tb88 X-Received: by 2002:a17:902:74c3:b0:1c6:d01:86a7 with SMTP id f3-20020a17090274c300b001c60d0186a7mr2635443plt.20.1695645804305; Mon, 25 Sep 2023 05:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695645804; cv=none; d=google.com; s=arc-20160816; b=EZ0u50UaGjfB3NkfkgXQD4cVR+i34B68Jqzju6qUxB1dln5rbh/WcKknM5CNIrnHJy T8mVpnp/GZdT1u4rRVIVymFNQet1ZYxkMZf//Brz6IdeSchMmfhsfN3n/YfEQCI8+1w1 edIhwVpV9eAnz7xUd0UCbA5pFyjqvCr810fuLtvCehXxYYY5rSEgjJy9K4cIZasN27c3 NRfQgWTj/WsgUSGwiUfegdAfao7QjUZiJhImP+G35+nSpfoRCR181amXyN1eQ4FunbOy YMSD8eF0+T8OCPbPG/AT87s2xPbltqlH3vm/U2WXlUfISHQPha/8DrM1aPs4qUI7+BRB XU6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=UqjDrarA+shRfC8ltMwHAr+TUFm7nNOSDNsd970tbLw=; fh=GMwZ6XEEuBRfDD4Z7D3O/WIUeMvgit4T4g2d/y/HSLc=; b=ne6Utu2hob76BzpWmsp3SZW0RRZecnFuy4D9gQfYiie9Mip0GKlu3YaDKk9xRU09hc DrKqudY43kiVspSB0/NcUmVTFu7/kRO0r3G0QOkHdlqXUYY2KD5o5pLE+3wK5QXt5Wcp uOCZmwdwAcKFRRx+ZDXWyyDXs2FVJkblagy9RIluCfCxTpgVFEokfuZq1QCGH835KGle TR7k150/8L8a5D5tFm1Omi5oV0QafNJfdjRz5vsGnLfaFYtuh+RI4EIjXULS+dCZCuAl 7cJmfMSKRLlZowV4CnLBP0pmn6KMY/XX8Nr4bg3WBjQ86KG+fxMmPfbskC5VNai7WUfF JX0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm1 header.b=RcK132xu; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=b6SNUx6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l9-20020a170902f68900b001b8a56b9895si9741208plg.616.2023.09.25.05.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 05:43:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm1 header.b=RcK132xu; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=b6SNUx6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3CEF58077590; Sun, 24 Sep 2023 19:43:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231801AbjIYCnV (ORCPT + 99 others); Sun, 24 Sep 2023 22:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbjIYCnU (ORCPT ); Sun, 24 Sep 2023 22:43:20 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A68692; Sun, 24 Sep 2023 19:43:12 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 707CF32009E2; Sun, 24 Sep 2023 22:43:07 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute6.internal (MEProxy); Sun, 24 Sep 2023 22:43:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1695609786; x=1695696186; bh=Uq jDrarA+shRfC8ltMwHAr+TUFm7nNOSDNsd970tbLw=; b=RcK132xuzObTUxcJHj mtGTHR8mL/CpJNmGrJByJFEQZ0Ifrln/vtjoUSEnPyumebLrZsOfpBz4CVzrqXL1 JSqtLwbn9Vuy/bwrvU/0/nvMvzQstLMrASo0YKkjPTq6+FOuFoGcDvnYcdMnRbdg lnrGVRU/tp1sXO/kaUi2aGs0+v0REVCggPushe5k+id/VEH7trEfsBrzhgYqPN0t Auov+5t7haL4VvAX+DOn0RmsOc7+QpVKrKIIoWsK9BvFvsIkkyWnjvhW3Klpcqmc G9LnsUrwU/XHTCMG4clVWZOPq4h2cSdzN9Nq28nCdRQdBmKtCPhzKNcRs9QIWO6l mncw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1695609786; x=1695696186; bh=UqjDrarA+shRf C8ltMwHAr+TUFm7nNOSDNsd970tbLw=; b=b6SNUx6Zq9Bd/AlDRQxfxa630kKvx wi3BsWPfm5OPxf+tK4hoafLUs+Hm71TpohijG9w+4AMtciNcPsROigv54FJMtlYl 046taGoiYYhNFg6GB6+frndhQggqUAexQoBmphd723CQ8AXZo4rz/YugZgBUxm9L Q7P/1blq1Sqe31CIFsmS+a7baWPGCLajU61eeYRvX1li/Z//jAQ9ICipnqdY0L3P 34AbfD7nPTIJTCHcYvkF31u6HjGl2mMNLugkUKAtQckeKlGeQPGgThhiprveLibp LHeie6Fhu9NHRWYinzta/snfiCzdcvBSvC3/rcx4iyVU7EM38svgFsAGQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudelfedgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehn ughrvgifucflvghffhgvrhihfdcuoegrnhgurhgvfiesrghjrdhiugdrrghuqeenucggtf frrghtthgvrhhnpeekvdekjeekgfejudffteetgeejkeetteduvedtffdtledutdfhheev feetkeeiteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvfiesrghjrdhiugdrrghu X-ME-Proxy: Feedback-ID: idfb84289:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id B7A451700090; Sun, 24 Sep 2023 22:43:05 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-761-gece9e40c48-fm-20230913.001-gece9e40c MIME-Version: 1.0 Message-Id: <6df088a6-75ab-42f2-ba39-3f155714ed2d@app.fastmail.com> In-Reply-To: <20230922104231.1434-5-zev@bewilderbeest.net> References: <20230922104231.1434-4-zev@bewilderbeest.net> <20230922104231.1434-5-zev@bewilderbeest.net> Date: Mon, 25 Sep 2023 12:12:45 +0930 From: "Andrew Jeffery" To: "Zev Weiss" , "Conor Dooley" , "Guenter Roeck" , "Joel Stanley" , "Krzysztof Kozlowski" , "Milton D. Miller II" , "Rob Herring" , "Wim Van Sebroeck" , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, openbmc@lists.ozlabs.org Cc: "Eddie James" , "Ivan Mikhaylov" , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= Subject: Re: [PATCH 1/2] dt-bindings: watchdog: aspeed-wdt: Add aspeed,reset-mask property Content-Type: text/plain 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_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 24 Sep 2023 19:43:26 -0700 (PDT) On Fri, 22 Sep 2023, at 20:12, Zev Weiss wrote: > This property configures the Aspeed watchdog timer's reset mask, which > controls which peripherals are reset when the watchdog timer expires. > Some platforms require that certain devices be left untouched across a > reboot; aspeed,reset-mask can now be used to express such constraints. > > Signed-off-by: Zev Weiss > --- > .../bindings/watchdog/aspeed-wdt.txt | 18 +++- > include/dt-bindings/watchdog/aspeed-wdt.h | 92 +++++++++++++++++++ > 2 files changed, 109 insertions(+), 1 deletion(-) > create mode 100644 include/dt-bindings/watchdog/aspeed-wdt.h > > diff --git a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt > b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt > index a8197632d6d2..3208adb3e52e 100644 > --- a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt > +++ b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt > @@ -47,7 +47,15 @@ Optional properties for AST2500-compatible watchdogs: > is configured as push-pull, then set the pulse > polarity to active-high. The default is active-low. > > -Example: > +Optional properties for AST2500- and AST2600-compatible watchdogs: > + - aspeed,reset-mask: A bitmask indicating which peripherals will be reset if > + the watchdog timer expires. On AST2500 this should be a > + single word defined using the AST2500_WDT_RESET_* macros; > + on AST2600 this should be a two-word array with the first > + word defined using the AST2600_WDT_RESET1_* macros and the > + second word defined using the AST2600_WDT_RESET2_* macros. > + > +Examples: > > wdt1: watchdog@1e785000 { > compatible = "aspeed,ast2400-wdt"; > @@ -55,3 +63,11 @@ Example: > aspeed,reset-type = "system"; > aspeed,external-signal; > }; > + > + #include > + wdt2: watchdog@1e785040 { > + compatible = "aspeed,ast2600-wdt"; > + reg = <0x1e785040 0x40>; > + aspeed,reset-mask = + (AST2600_WDT_RESET2_DEFAULT & ~AST2600_WDT_RESET2_LPC)>; > + }; Rob has acked your current approach already, but I do wonder about an alternative that aligns more with the clock/reset/interrupt properties. Essentially, define a new generic watchdog property that is specified on the controllers to be reset by the watchdog (or even on just the watchdog node itself, emulating what you've proposed here): watchdog-resets = ; The phandle links to the watchdog of interest, and the index specifies the controller associated with the configuration. It might even be useful to do: watchdog-resets = ; "enable" could provide explicit control over whether somethings should be reset or not (as a way to prevent reset if the controller targeted by the provided index would otherwise be reset in accordance with the default reset value in the watchdog controller). The macros from the dt-bindings header can then use macros to name the indexes rather than define a mask tied to the register layout. The index may still in some way represent the mask position. This has the benefit of hiding the issue of one vs two configuration registers between the AST2500 and AST2600 while also allowing other controllers to exploit the binding (Nuvoton BMCs? Though maybe it's generalising too early?). It'd probably need a new function exported from the watchdog subsystem for the drivers to call through, though I don't think that's too much of a hurdle? Andrew > diff --git a/include/dt-bindings/watchdog/aspeed-wdt.h > b/include/dt-bindings/watchdog/aspeed-wdt.h > new file mode 100644 > index 000000000000..7ae6d84b2bd9 > --- /dev/null > +++ b/include/dt-bindings/watchdog/aspeed-wdt.h > @@ -0,0 +1,92 @@ > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ > + > +#ifndef DT_BINDINGS_ASPEED_WDT_H > +#define DT_BINDINGS_ASPEED_WDT_H > + > +#define AST2500_WDT_RESET_CPU (1 << 0) > +#define AST2500_WDT_RESET_COPROC (1 << 1) > +#define AST2500_WDT_RESET_SDRAM (1 << 2) > +#define AST2500_WDT_RESET_AHB (1 << 3) > +#define AST2500_WDT_RESET_I2C (1 << 4) > +#define AST2500_WDT_RESET_MAC0 (1 << 5) > +#define AST2500_WDT_RESET_MAC1 (1 << 6) > +#define AST2500_WDT_RESET_GRAPHICS (1 << 7) > +#define AST2500_WDT_RESET_USB2_HOST_HUB (1 << 8) > +#define AST2500_WDT_RESET_USB_HOST (1 << 9) > +#define AST2500_WDT_RESET_HID_EHCI (1 << 10) > +#define AST2500_WDT_RESET_VIDEO (1 << 11) > +#define AST2500_WDT_RESET_HAC (1 << 12) > +#define AST2500_WDT_RESET_LPC (1 << 13) > +#define AST2500_WDT_RESET_SDIO (1 << 14) > +#define AST2500_WDT_RESET_MIC (1 << 15) > +#define AST2500_WDT_RESET_CRT (1 << 16) > +#define AST2500_WDT_RESET_PWM (1 << 17) > +#define AST2500_WDT_RESET_PECI (1 << 18) > +#define AST2500_WDT_RESET_JTAG (1 << 19) > +#define AST2500_WDT_RESET_ADC (1 << 20) > +#define AST2500_WDT_RESET_GPIO (1 << 21) > +#define AST2500_WDT_RESET_MCTP (1 << 22) > +#define AST2500_WDT_RESET_XDMA (1 << 23) > +#define AST2500_WDT_RESET_SPI (1 << 24) > +#define AST2500_WDT_RESET_SOC_MISC (1 << 25) > + > +#define AST2500_WDT_RESET_DEFAULT 0x023ffff3 > + > +#define AST2600_WDT_RESET1_CPU (1 << 0) > +#define AST2600_WDT_RESET1_SDRAM (1 << 1) > +#define AST2600_WDT_RESET1_AHB (1 << 2) > +#define AST2600_WDT_RESET1_SLI (1 << 3) > +#define AST2600_WDT_RESET1_SOC_MISC0 (1 << 4) > +#define AST2600_WDT_RESET1_COPROC (1 << 5) > +#define AST2600_WDT_RESET1_USB_A (1 << 6) > +#define AST2600_WDT_RESET1_USB_B (1 << 7) > +#define AST2600_WDT_RESET1_UHCI (1 << 8) > +#define AST2600_WDT_RESET1_GRAPHICS (1 << 9) > +#define AST2600_WDT_RESET1_CRT (1 << 10) > +#define AST2600_WDT_RESET1_VIDEO (1 << 11) > +#define AST2600_WDT_RESET1_HAC (1 << 12) > +#define AST2600_WDT_RESET1_DP (1 << 13) > +#define AST2600_WDT_RESET1_DP_MCU (1 << 14) > +#define AST2600_WDT_RESET1_GP_MCU (1 << 15) > +#define AST2600_WDT_RESET1_MAC0 (1 << 16) > +#define AST2600_WDT_RESET1_MAC1 (1 << 17) > +#define AST2600_WDT_RESET1_SDIO0 (1 << 18) > +#define AST2600_WDT_RESET1_JTAG0 (1 << 19) > +#define AST2600_WDT_RESET1_MCTP0 (1 << 20) > +#define AST2600_WDT_RESET1_MCTP1 (1 << 21) > +#define AST2600_WDT_RESET1_XDMA0 (1 << 22) > +#define AST2600_WDT_RESET1_XDMA1 (1 << 23) > +#define AST2600_WDT_RESET1_GPIO0 (1 << 24) > +#define AST2600_WDT_RESET1_RVAS (1 << 25) > + > +#define AST2600_WDT_RESET1_DEFAULT 0x030f1ff1 > + > +#define AST2600_WDT_RESET2_CPU (1 << 0) > +#define AST2600_WDT_RESET2_SPI (1 << 1) > +#define AST2600_WDT_RESET2_AHB2 (1 << 2) > +#define AST2600_WDT_RESET2_SLI2 (1 << 3) > +#define AST2600_WDT_RESET2_SOC_MISC1 (1 << 4) > +#define AST2600_WDT_RESET2_MAC2 (1 << 5) > +#define AST2600_WDT_RESET2_MAC3 (1 << 6) > +#define AST2600_WDT_RESET2_SDIO1 (1 << 7) > +#define AST2600_WDT_RESET2_JTAG1 (1 << 8) > +#define AST2600_WDT_RESET2_GPIO1 (1 << 9) > +#define AST2600_WDT_RESET2_MDIO (1 << 10) > +#define AST2600_WDT_RESET2_LPC (1 << 11) > +#define AST2600_WDT_RESET2_PECI (1 << 12) > +#define AST2600_WDT_RESET2_PWM (1 << 13) > +#define AST2600_WDT_RESET2_ADC (1 << 14) > +#define AST2600_WDT_RESET2_FSI (1 << 15) > +#define AST2600_WDT_RESET2_I2C (1 << 16) > +#define AST2600_WDT_RESET2_I3C_GLOBAL (1 << 17) > +#define AST2600_WDT_RESET2_I3C0 (1 << 18) > +#define AST2600_WDT_RESET2_I3C1 (1 << 19) > +#define AST2600_WDT_RESET2_I3C2 (1 << 20) > +#define AST2600_WDT_RESET2_I3C3 (1 << 21) > +#define AST2600_WDT_RESET2_I3C4 (1 << 22) > +#define AST2600_WDT_RESET2_I3C5 (1 << 23) > +#define AST2600_WDT_RESET2_ESPI (1 << 26) > + > +#define AST2600_WDT_RESET2_DEFAULT 0x03fffff1 > + > +#endif > -- > 2.40.0.5.gf6e3b97ba6d2.dirty