From mboxrd@z Thu Jan 1 00:00:00 1970 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 3F5D9ECAAD5 for ; Fri, 2 Sep 2022 12:11:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A0BD484A9B; Fri, 2 Sep 2022 14:11:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1662120676; bh=06u5ueDpwkeJvBrM73mgxTqkHuOoNHsHYEhudcITQA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dJLFTrEVwzZGL+jgv8SbzkrDEZVE8gK2jYkd/kwugaDOmupPztRD8rybpo0LxWIdI ttf6a0OPY9Yfp2NchtQMOVYw6WUFkF7RoUw5yEuJwJd7hRgd4NjQ88uM+59L9A1zF0 quR8C0Voif+kfxAhNIBn8L6dcUfyU0ASgp/zTEOv0soih7oFwXWpfbpMzy9UG5hoHU aKg6NAWk4d8kgsJYSvNY7C4YMZVKz0XgR8HlUoMi/fhG/8a2aHtz+AXQ8FphBazy3q NPuPEghFE+AIa7SU+lgy0jX4Fkcw01LaitF7TRt3KPTZeN5hZzbTUuJysoUYDaYfJI OX8TylArB88fQ== Received: by phobos.denx.de (Postfix, from userid 109) id F10BA84AA3; Fri, 2 Sep 2022 14:11:09 +0200 (CEST) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [80.241.59.204]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E0ECA84A8D for ; Fri, 2 Sep 2022 14:11:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4MJxZt6rLNz9sSv; Fri, 2 Sep 2022 14:11:02 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Cc: trini@konsulko.com, sjg@chromium.org, rasmus.villemoes@prevas.dk Subject: [PATCH v1 2/6] cyclic: Introduce schedule() function Date: Fri, 2 Sep 2022 14:10:45 +0200 Message-Id: <20220902121049.1282136-3-sr@denx.de> In-Reply-To: <20220902121049.1282136-1-sr@denx.de> References: <20220902121049.1282136-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4MJxZt6rLNz9sSv 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.6 at phobos.denx.de X-Virus-Status: Clean This patch introduces a schedule() function, which shall be used instead of the old WATCHDOG_RESET. Follow-up patches will make sure, that this new function is used. Signed-off-by: Stefan Roese Reviewed-by: Simon Glass --- v1: - Add Simon's SoB tag - Add more comments in the header to fully document the prototypes common/cyclic.c | 11 +++++++++++ include/cyclic.h | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/common/cyclic.c b/common/cyclic.c index f0bfd18c9242..0b07ede8d35e 100644 --- a/common/cyclic.c +++ b/common/cyclic.c @@ -18,6 +18,8 @@ DECLARE_GLOBAL_DATA_PTR; +void hw_watchdog_reset(void); + struct list_head *cyclic_get_list() { return &gd->cyclic->cyclic_list; @@ -96,6 +98,15 @@ void cyclic_run(void) gd->cyclic->cyclic_running = false; } +void schedule(void) +{ + /* The HW watchdog is not integrated into the cyclic IF (yet) */ + if (IS_ENABLED(CONFIG_HW_WATCHDOG)) + hw_watchdog_reset(); + + cyclic_run(); +} + int cyclic_uninit(void) { struct cyclic_info *cyclic, *tmp; diff --git a/include/cyclic.h b/include/cyclic.h index 23902234cc87..760163643345 100644 --- a/include/cyclic.h +++ b/include/cyclic.h @@ -106,6 +106,14 @@ struct list_head *cyclic_get_list(void); * needs to be executed, then call into these registered functions. */ void cyclic_run(void); + +/** + * schedule() - Schedule all potentially waiting tasks + * + * Basically a wrapper for cyclic_run(), pontentially enhanced by some + * other parts, that need to get handled periodically. + */ +void schedule(void); #else static inline struct cyclic_info *cyclic_register(cyclic_func_t func, uint64_t delay_us, @@ -124,6 +132,10 @@ static inline void cyclic_run(void) { } +static inline void schedule(void) +{ +} + static inline int cyclic_init(void) { return 0; -- 2.37.3