Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1598744rdh; Mon, 25 Sep 2023 19:15:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERZ3z71IkGfrsMNTyL8qk1o5tgp/dpJg5pgLM5JbJo7+f7PKij8d88FcwZKN8VpbjzoHO4 X-Received: by 2002:a1f:cd83:0:b0:48d:12c6:a876 with SMTP id d125-20020a1fcd83000000b0048d12c6a876mr4813327vkg.6.1695694544853; Mon, 25 Sep 2023 19:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695694544; cv=none; d=google.com; s=arc-20160816; b=jqjD/4CMYST1GllVen5hvFhRM0r9bUdy3XzyL2TV//KUnuxMR1KvybXagBK+qU/OFq cSVcvioaTsCZrlQlY7o6/e5XZxL8Yd5v7FcnHr5rZ1FdFjgRG+zGDaGdeudSeNYCXTrk tAJATTwzTfCRnSbKnyI5k/0NZ9z6ft0jhO1jqvQKyYhPqa+XsDhChkSqxJkBQNNvPU+V 9s9qWW/2JhA9KZYwrGSeyMlAeCQdWV7MoVoiC0DUojkLiXZB9RCK0wTHNjS52ICNIqNU HHXdP6OHcy+5q0hUBZWFXSJw2FxwOF/j8PHPFfibYkXqpDoMZNkx8l3Bl78eMzY9oi3w BtdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=il9pZHitpvQPocfosyxq64m7qx5tIUZKMM6PXb+s62k=; fh=7QHLSZm+nW9ElhV8D95Qo6VCOSn5T5iGc9zMTKuYEek=; b=Ttm0zyUbMLLaY91k4P2WnzgPKQP1TM+upPUzPqDRz49+rMlh3p4Xhc2dz2aqFCMlQS epzr6xKOUbAGDzbLfiip40WaNw+dgDLFLuloYYTETYuOtgTbeZMHYZ6OfskND+jfzLFe F+ruTitN9qcZWgUX+b2tCTrc1oaH9nLqclS0oIyKR7CFCbdIxuwD5sjgRhvrS+Njgf0y Xw7tijqaz99CvdBtQLTi+rdnshIDHDDJomv5Rzz+yT/8S/ABT+JnVahI+osGTPJkR0Kx o0zkcHE6KBs9UooIjFUoSHsroQKmupzdqEdro4SXAUHNHSSCA74v1LmwylDwWkCbhjqq yN4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeconstruct.com.au header.s=2022a header.b=MQzeTH5a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeconstruct.com.au Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id a10-20020a056a001d0a00b00690ccc67aa4si11348496pfx.198.2023.09.25.19.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 19:15:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@codeconstruct.com.au header.s=2022a header.b=MQzeTH5a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeconstruct.com.au Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4BC9D8029327; Mon, 25 Sep 2023 17:58:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232691AbjIZA6J (ORCPT + 99 others); Mon, 25 Sep 2023 20:58:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232323AbjIZA6I (ORCPT ); Mon, 25 Sep 2023 20:58:08 -0400 Received: from codeconstruct.com.au (pi.codeconstruct.com.au [203.29.241.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4A2BD6; Mon, 25 Sep 2023 17:57:58 -0700 (PDT) Received: from [192.168.68.112] (ppp118-210-175-231.adl-adc-lon-bras34.tpg.internode.on.net [118.210.175.231]) by mail.codeconstruct.com.au (Postfix) with ESMTPSA id DDB5B20075; Tue, 26 Sep 2023 08:57:46 +0800 (AWST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeconstruct.com.au; s=2022a; t=1695689871; bh=il9pZHitpvQPocfosyxq64m7qx5tIUZKMM6PXb+s62k=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=MQzeTH5alD6g2hNmisWGJknBk91CflzzODcRg5LoMfyPQAMZYJu4LuTjAcjDtAOLR shyC8m27Jg9jxVYShrkXV0nhIP9cx3Re+BR4kTiYh47rjO6QTuwd0WlK0qbnqP9HCH RGhQSEtWrIGM5BTcmNRPvJINxUL5jF1p7Hr+b7FqVMaAyitbEBYDx19/htNdYJzb1n obNcw4r/mJ72J//8KfkkycqdOLS4sjTFYVLYiKCKDnusyaBuZP3DLvGq12QlvW/6Mh JC1Ay0NyAeSyCpkGmljO+HgTr1kW07AB6CenNX/wTExtaIXg7gGEIaIydNXg5zO0K+ QmwvbfUNLkhoQ== Message-ID: <20e3bef8282b1dd412020ecb24d90cbd89f39756.camel@codeconstruct.com.au> Subject: Re: [PATCH 1/2] dt-bindings: watchdog: aspeed-wdt: Add aspeed,reset-mask property From: Andrew Jeffery To: Guenter Roeck , Zev Weiss Cc: devicetree@vger.kernel.org, Conor Dooley , Wim Van Sebroeck , linux-watchdog@vger.kernel.org, linux-aspeed@lists.ozlabs.org, Andrew Jeffery , openbmc@lists.ozlabs.org, Eddie James , linux-kernel@vger.kernel.org, Thomas =?ISO-8859-1?Q?Wei=DFschuh?= , g@hatter.bewilderbeest.net, Rob Herring , Joel Stanley , Krzysztof Kozlowski , Ivan Mikhaylov , "Milton D. Miller II" , linux-arm-kernel@lists.infradead.org Date: Tue, 26 Sep 2023 10:27:45 +0930 In-Reply-To: References: <20230922104231.1434-4-zev@bewilderbeest.net> <20230922104231.1434-5-zev@bewilderbeest.net> <6df088a6-75ab-42f2-ba39-3f155714ed2d@app.fastmail.com> <6b0d4901-d543-4a06-a1e4-7f1558f5361f@hatter.bewilderbeest.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 17:58:15 -0700 (PDT) On Mon, 2023-09-25 at 17:35 -0700, Guenter Roeck wrote: > On Mon, Sep 25, 2023 at 05:04:10PM -0700, Zev Weiss wrote: > > On Sun, Sep 24, 2023 at 07:42:45PM PDT, Andrew Jeffery wrote: > > >=20 > > >=20 > > > On Fri, 22 Sep 2023, at 20:12, Zev Weiss wrote: > > > > This property configures the Aspeed watchdog timer's reset mask, wh= ich > > > > controls which peripherals are reset when the watchdog timer expire= s. > > > > Some platforms require that certain devices be left untouched acros= s a > > > > reboot; aspeed,reset-mask can now be used to express such constrain= ts. > > > >=20 > > > > 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 > > > >=20 > > > > 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 watch= dogs: > > > > is configured as push-pull, then set the pulse > > > > polarity to active-high. The default is active-low. > > > >=20 > > > > -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: > > > >=20 > > > > wdt1: watchdog@1e785000 { > > > > compatible =3D "aspeed,ast2400-wdt"; > > > > @@ -55,3 +63,11 @@ Example: > > > > aspeed,reset-type =3D "system"; > > > > aspeed,external-signal; > > > > }; > > > > + > > > > + #include > > > > + wdt2: watchdog@1e785040 { > > > > + compatible =3D "aspeed,ast2600-wdt"; > > > > + reg =3D <0x1e785040 0x40>; > > > > + aspeed,reset-mask =3D > > > + (AST2600_WDT_RESET2_DEFAULT & ~AST2600_WDT_RESET2_LPC)>; > > > > + }; > > >=20 > > > Rob has acked your current approach already, but I do wonder about an > > > alternative that aligns more with the clock/reset/interrupt propertie= s. > > > 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): > > >=20 > > > watchdog-resets =3D ; > > >=20 > > > The phandle links to the watchdog of interest, and the index specifie= s > > > the controller associated with the configuration. It might even be > > > useful to do: > > >=20 > > > watchdog-resets =3D ; > > >=20 > > > "enable" could provide explicit control over whether somethings shoul= d > > > 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). > > >=20 > > > The macros from the dt-bindings header can then use macros to name th= e > > > indexes rather than define a mask tied to the register layout. The in= dex > > > may still in some way represent the mask position. This has the benef= it > > > 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?). > > >=20 > >=20 > > Sorry, I'm having a bit of a hard time picturing exactly what you're > > suggesting here...to start with: > >=20 > > > property that is specified on the controllers to be reset by the > > > watchdog > >=20 > > and > >=20 > > > or even on just the watchdog node itself > >=20 > > seem on the face of it like two fairly different approaches to me. The > > former sounds more like existing clock/reset/etc. stuff, where the > > peripheral has a property describing its relationship to the "central" > > subsystem, and various peripheral drivers are all individually responsi= ble > > for observing that property and calling in to the central subsystem to > > configure things for that peripheral appropriately; if I'm understandin= g you > > correctly, it might look something like: > >=20 > > &spi1 { > > watchdog-resets =3D <&wdt1 WDT_INDEX_SPI1 0>; > > }; > >=20 > > Or maybe something more like how pinctrl works, via phandles to subnode= s of > > the central device? > >=20 > > &wdt1 { > > wdt1_spi1_reset: spi1_reset { > > reg =3D <0x1c>; > > bit =3D <24>; > > }; > > }; > >=20 > > &spi1 { > > watchdog-resets =3D <&wdt1_spi1_reset 0>; > > }; > >=20 > > Either way, it seems like it'd be complicated by any insufficient > > granularity in the watchdog w.r.t. having independent control over the > > individual devices represented by separate DT nodes (such as how the AS= T2500 > > watchdog has a single SPI controller reset bit instead of one per SPI > > interface, or its "misc SOC controller" bit governing all sorts of odds= and > > ends). > >=20 > > In the latter case (property on the wdt node), would it essentially jus= t be > > kind of an indirection layer mapping hardware-independent device indice= s to > > specific registers/bits? It's not obvious to me what purpose a phandle= to > > the peripheral device node would serve (would the wdt driver have a goo= d way > > of identifying what specific peripheral it's pointing to to know what b= it to > > twiddle?), but maybe I'm misunderstanding what you're suggesting... > >=20 > >=20 > > I guess my other uncertainty is the balance between generalization and > > applicability -- how many other watchdog devices have sufficient compar= able > > configurability to make use of it? I haven't pored over all of them, b= ut > > from a random sampling of 20 so of the other existing wdt drivers I don= 't > > see any obvious candidates -- the closest I saw were cpwd.c, which > > apparently can distinguish between a CPU reset and a CPU/backplane/boar= d > > reset, and realtek_otto_wdt.c, which can do a CPU or a SOC reset (thoug= h I > > don't have any of the hardware docs to know what capabilities other dev= ices > > might provide that the drivers don't use). Do the Nuvoton BMCs have > > watchdogs with peripheral-granularity reset configuration? > >=20 >=20 > Quite frankly, I don't like where this is going. It is getting way > too complicated. And when something is becoming way too complicated, > I tend to put it on my backburner list. The length of that list quickly > approaches maxint. >=20 No worries. I figured I should at least give the idea some air-time, even if we did end up discounting it. I feel my description and Zev's queries make it sound more complex than it might be in practice but I also haven't written the patch, so never mind! Andrew