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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0ABAEC77B7A for ; Thu, 25 May 2023 11:58:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A31084702; Thu, 25 May 2023 13:57:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="YR/NIiW1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 74A53846F6; Thu, 25 May 2023 13:57:58 +0200 (CEST) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 660D384783 for ; Thu, 25 May 2023 13:57:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=3509853230=patrick.delaunay@foss.st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34PASVln013040; Thu, 25 May 2023 13:57:54 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=bvMN49xlDrxzLv66X+PTuk51MUhJXzk+0/dwu/XBMVY=; b=YR/NIiW1rltV4qQqL5VzFXDAUlUisy05X+ziRtCss7nRxlVaEYkdtRVB/vx4gyouvt4i syLmrGpbkd7SW4PJBYqi2z1WUbqzApKB5NSbrQxTrT7CiI79ns19zCrHbTOdTIaJxozU 2p4ZpYoviR/IqWbsruJ3JaumzTji7ovNFJG1a132E+3HTFeQh8O6OWmcXmHAerhyWAu5 eZazRnLtdSnPXQ/DIOivJmxV3iO6aoK2sZEMnZHe7BSc4ZNWVb6X3Hi+rdFpeZA6wKwx OmPMzEc1HWxoMZcndK8WCkmFAjflsjEXm4XVvRFSgQLIFViL7dSSmbQUTpej1CNxgmi1 xA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3qt39tt0cf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 13:57:54 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5E53C10002A; Thu, 25 May 2023 13:57:53 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4EAEE21ADDD; Thu, 25 May 2023 13:57:53 +0200 (CEST) Received: from [10.48.1.0] (10.48.1.0) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 25 May 2023 13:57:52 +0200 Message-ID: <05d299c9-8e1d-231b-214e-e7dceadf5e76@foss.st.com> Date: Thu, 25 May 2023 13:57:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] ARM: stm32: Add IWDG handling into PSCI suspend code Content-Language: en-US To: Marek Vasut , Patrice CHOTARD , CC: Ilias Apalodimas , Sughosh Ganu , , References: <20230511002206.180116-1-marex@denx.de> <0a44a562-fe18-c8a5-393a-a526be3ca42d@denx.de> <0ee4f382-4c6e-0209-3db9-83d44219c710@denx.de> From: Patrick DELAUNAY In-Reply-To: <0ee4f382-4c6e-0209-3db9-83d44219c710@denx.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.48.1.0] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-25_02,2023-05-22_02 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Hi On 5/12/23 15:55, Marek Vasut wrote: > On 5/12/23 15:43, Patrick DELAUNAY wrote: >> Hi, > > Hi, > >>>>> +        /* Ping IWDG2 and ACK pretimer IRQ */ >>>>> +        if (iwdg2_wake) { >>>>> +            writel(IWDG_KR_RELOAD_KEY, STM32_IWDG2_BASE + IWDG_KR); >>>>> +            writel(IWDG_EWCR_EWIC, STM32_IWDG2_BASE + IWDG_EWCR); >>>>> +        } >>>>> +    } >>>>>         writel(0x3, STM32_RCC_BASE + RCC_MP_SREQCLRR); >>>>>       ddr_sw_self_refresh_exit(); >>>> >>>> >>>> Reviewed-by: Patrice Chotard >>> >>> I feel like maybe I need to whack the IWDG also BEFORE entering >>> suspend, expect a V2 shortly. >>> >>> Do you think this IWDG approach is fine to keep the system from >>> rebooting in suspend ? Or do you see any better option for the MP1 ? >> >> >> I think it is fine if you want to have watchdog running in STANDBY >> even this patch force a wakeup. >> >> but if IWDG 1 or 2 should be not running in STANDBY (but also for >> STOP) for your product, > > Why ? > > I want the watchdog to monitor that the platform is still OK, even in > suspend. Also, as far as I can tell, once the IWDG is started, it > cannot be stopped, right ? without change OTP (so with the default behavior) => yes the watchdog IWDG is running without way to stop it. > >> it can be managed directly by the hardware with OTP, to freeze watchdog. >> >> => it is a decision for each product of the desired behavior of the >> IWDG in low power mode. >> >> >> See Ref Manual: 48.3 IWDG implementation >> >> Table 332. STM32MP157x IWDG features >> >> Option bytes to control the activity in Standby mode (6) >> >> 6. Controlled via option bytes OTP_IWDG1_FZ_STANDBY and >> OTP_IWDG2_FZ_STANDBY, respectively, for IWDG1 and IWDG2. >> >> and in Table17 => OTP 18 = HW2 bit 5 to 8 > > I saw the OTP fuses, but I don't want to blow them. Or is that really > the suggestion ST would provide for suspend/resume, blow the fuses ? > > (I wonder, why isn't the logic of those fuses inverted then, i.e. by > default stop the watchdog in suspend AND blow fuses to keep it running > in suspend?) it is a SoC design choice => the default behavior is watchdog is running in standby and stop, so you need to reload it That imply the limit of the duration of max duration of standby to avoid reset.... and the usage of IWDG pre-timeout in this case it a good place to wakeup the SoC and add sanity checks (check the system is still running) before to reload it. Patrick