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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C492DC433F5 for ; Fri, 12 Nov 2021 16:48:20 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34DFF6103A for ; Fri, 12 Nov 2021 16:48:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 34DFF6103A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1588A83013; Fri, 12 Nov 2021 17:48:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="YlRejE7Q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A759783014; Fri, 12 Nov 2021 17:48:15 +0100 (CET) Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFB8F83012 for ; Fri, 12 Nov 2021 17:48:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x731.google.com with SMTP id 193so9644006qkh.10 for ; Fri, 12 Nov 2021 08:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GmFdLLso1RtSG336hY+kPKGs5L5zOZmz2nSnP4VQO/Y=; b=YlRejE7Q4IZ3iWXKKd2/7kPMhjHLPgU8r8d63qOkE0fyTlUcJ5xZSxDaoja0Tc7Rku ZI3QIvh7jeC1ZSsl2lHkUbDJkMe0t7bEZEdQd/dKDXBev9+s9LaZMxS5FpG2juOZjUPg 0inFOKa9jeTL9fBDina1aem3ssQuOoXjjHdfw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GmFdLLso1RtSG336hY+kPKGs5L5zOZmz2nSnP4VQO/Y=; b=eWVs1BGxKttFrfwBg8gn09QpDJMMZsaBK/Q8YL+H5P2r2RmFJfszTidhEmugweUvEH 6ticYJDzYom1EoEB7ZBGjuZren8Niu1Zwv3T5wCy2VCeneqSbXCdTyUlHaOahf+65NQg hhruQ2Ywl50e3eY3sJSV8n7IsDUEkhM7nj/gGEPQ+EElBluIT/7Iw22ss1W7+PZz7TBt pYYIiuJfgWrk6aUZDTWZumSTDvQW4yvVpDIDsr+3kVsjMIOwU8+vMDFnaqpndCig2KAe p9SswBZoX+z0hZyh0z8g8DvgJlN7UvTr2uc96b2TqLP3DcKFEeJOxPA8JXBrxmFdUs2+ rQeQ== X-Gm-Message-State: AOAM530R+HY6V0xqfsiHwaK7jMBvqyx9FTeZMm5+XCTvNats4AUySpre FZcMeAdKFsgPJJT0lzL1h0Zf0w== X-Google-Smtp-Source: ABdhPJzZWs/IZuEK6xm1gDPIBtK14OUKbsiCOQz/cUBszaaKI9ON7R5+cgREom3UluR8yAS26TZD4A== X-Received: by 2002:a05:620a:3181:: with SMTP id bi1mr3516342qkb.456.1636735690587; Fri, 12 Nov 2021 08:48:10 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-99df-60fa-a7c9-fbd2.res6.spectrum.com. [2603:6081:7b01:cbda:99df:60fa:a7c9:fbd2]) by smtp.gmail.com with ESMTPSA id f1sm1504472qtf.74.2021.11.12.08.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 08:48:09 -0800 (PST) Date: Fri, 12 Nov 2021 11:48:07 -0500 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Stefan Roese , Marek =?iso-8859-1?Q?Beh=FAn?= , u-boot@lists.denx.de, Marek =?iso-8859-1?Q?Beh=FAn?= Subject: Re: [PATCH u-boot-marvell] arm: mvebu: turris_omnia: enable A385 watchdog before disabling MCU watchdog Message-ID: <20211112164807.GA24579@bill-the-cat> References: <20211109161402.23111-1-kabel@kernel.org> <89b3be1b-21f7-f260-43e3-40daeec3b89d@denx.de> <20211112163138.GY24579@bill-the-cat> <20211112164042.n6rynjoiiemkudye@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="WRweex51P3WvE3RZ" Content-Disposition: inline In-Reply-To: <20211112164042.n6rynjoiiemkudye@pali> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --WRweex51P3WvE3RZ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 12, 2021 at 05:40:42PM +0100, Pali Roh=E1r wrote: > On Friday 12 November 2021 11:31:38 Tom Rini wrote: > > On Fri, Nov 12, 2021 at 02:44:15PM +0100, Stefan Roese wrote: > > > On 11/9/21 17:14, Marek Beh=FAn wrote: > > > > From: Pali Roh=E1r > > > >=20 > > > > Commit aeb0ca64dbb5 ("arm: mvebu: turris_omnia: disable MCU watchdo= g in > > > > SPL when booting over UART") disabled MCU watchdog when booting over > > > > UART to ensure that watchdog does not reboot the board before UART > > > > transfer finishes. > > > >=20 > > > > But if UART transfer fails for some reason, or if U-Boot binary cra= shes, > > > > then board hangs forever as there is no watchdog running which could > > > > reset it. > > > >=20 > > > > To fix this issue, enable A385 watchdog with very high timeout befo= re > > > > disabling MCU watchdog to ensure that even slow transfer can finish > > > > successfully before watchdog timer expires and also to ensure that = if > > > > board hangs for some reason, watchdog will reset it. > > > >=20 > > > > Omnia's MCU watchdog has fixed 120 seconds timer and it cannot be > > > > changed (without updating MCU firmware). A385 watchdog by default u= ses > > > > 25 MHz input clock and so the largest timeout value (2^32-1) can be > > > > just 171 seconds. But A385 watchdog can be switched to use NBCLK (L= 2) as > > > > input clock (on Turris Omnia it is 800 MHz clock) and in this case = final > > > > watchdog clock frequency is calculated as: > > > >=20 > > > > freq =3D NBCLK / 2 / (2 ^ R) > > > >=20 > > > > So A385 watchdog on Turris Omnia can be configured to at most 1374 > > > > seconds (about 22 minutes). We set it to 10 minutes, which should be > > > > enough even for bigger U-Boot binaries or slower UART transfers. > > > >=20 > > > > Both U-Boot and Linux kernel, when initializing A385 watchdog, swit= ch > > > > watchdog timer to 25 MHz input clock, so usage of NBCLK input clock= in > > > > U-Boot SPL does not cause any issues. > > > >=20 > > > > Fixes: aeb0ca64dbb5 ("arm: mvebu: turris_omnia: disable MCU watchdo= g in SPL when booting over UART") > > > > Signed-off-by: Pali Roh=E1r > > > > Signed-off-by: Marek Beh=FAn > > >=20 > > > I'm wondering if it makes sense to add this "slow" watchdog support to > > > the common watchdog driver instead (orion_wdt.c). So that it dynamica= lly > > > configures the needed input clock for the desired timeout. > > >=20 > > > Would this be possible? > >=20 > > I know I'm late to the thread here, but why can't / aren't we servicing > > the 120s watchdog during UART loading? >=20 > UART loading is not done by U-Boot. It is done by BootROM. Ah, that's the bit of the system I didn't know, ok. > BootROM first loads SPL. Then it starts executing SPL and SPL must > return control back to BootROM. BootROM then continue loading of proper > U-Boot via UART and after successful transfer it executes proper U-Boot. >=20 > BootROM does not enable watchdog and does not kick watchdog during UART > transfer. >=20 > So if we enable 120s watchdog in SPL and BootROM does not finish loading > of proper U-Boot then board is rebooted. >=20 > Turris Omnia has additional MCU watchdog, which is activated after > reset, but there is no function to kick this watchdog. It can be only > stopped. Commit mentioned in Fixes: tag turned this MCU watchdog in SPL > and this new commit enable one-shot A385 watchdog with large timeout > which should be enough for loading proper U-Boot. I'm not sure I can think of anything better to handle this than what you're describing off-hand, but I'll keep thinking about it in case I do.. > > Or have I gone crazy and we don't do that on say OMAP? >=20 > I do not know how is loading over UART implemented on OMAP. On OMAP3 I > always used only loading over USB and watchdog was not enabled in > X-Loader / SPL. Right, OK, it wasn't until AM33xx and later that I started enabling SPL watchdog support (which could be done on omap3 too) and since we implement the normal servicing mechanisms and that U-Boot SPL is what's doing the load over UART of main U-Boot, this case is fine there. --=20 Tom --WRweex51P3WvE3RZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmGOmscACgkQFHw5/5Y0 tyxJOwv9H8MKYACo4ZkzAVz1bClWRHY8jOzPyTslHfpCU1WCYOlxnmM9S4aNI/Uh VWJq0dii5WueU9ZYKWtvOD3UD5jj/hfT+JDaCkNQsl3laJWMPuDxctskU9Tf7/M/ 1gid5/3Y9MAjF4hHVU22svniwXbITOK9MP904irupGWU4R4nxpJK4Ga5ri5qNBqm fARJStu3MCp/6Oyr5f3zOz3u4fQqIgYdzFgZrEFIjs0K/vsMi1UL8bt3DvVh9wb8 MrHNrsuQk8tiJu0RPZoRRJeyQgz05bBlDIW2Jxr/ZyuxTcgA6uIaJabk58at9OsA t6AW7oE3uCIgjOJFd1l1ewpSvjTIm+Ay63hDkKPJ+BX2gchVFCrVOR+DwDmT9h5S uxyDNPVPlid/NbxuX1PtS8uo695NwHPoB4ypnQ7pONgNF3No94RQC0oIfROxmnA0 VF+Bcva7bIPQvZGKJSfwVk08N5EJ2waawsf+kcvnC0iaq2C4WRiDEcgC4TdpkFo+ lr79H899 =YaG4 -----END PGP SIGNATURE----- --WRweex51P3WvE3RZ--