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 623F1C433EF for ; Fri, 11 Mar 2022 16:35:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4515F83108; Fri, 11 Mar 2022 17:35:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="F9Mukyx5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B887483110; Fri, 11 Mar 2022 17:35:00 +0100 (CET) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 95BCF83093 for ; Fri, 11 Mar 2022 17:34:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=krjdev@gmail.com Received: by mail-wr1-x42a.google.com with SMTP id k24so13766487wrd.7 for ; Fri, 11 Mar 2022 08:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=m7BaWGFZlw1x16a/tD6F9POSUTGecMzTEp0ve/CEd5c=; b=F9Mukyx5+mftv7Zf3uq5dCSS/346bcuiPUl7Mw3mYv9As0AeHxFasII6S9oMHCniBj H9Cx4K/FVDxW98OTGs1OG3jFlfuNS3Z+EFudniFJx3fZbygoGBud2BXSJq0b54cZGCWG 29FinZ+uRwaBOnvfUWYt47tbjegck0s0LiIE6a+PMXXug0XwFTzCAanxXTpdz0C7KDvM 7kzrsyD1/Rww0Z0pacqJL8UUJ+Eki07ZzN0JU2nW5mDPdo4UUI3qezRGLkr7BaunvvDQ jYRaajTJghA0Ob82EeRUr4CxxkJZjPlYscLngpdYiXPwMmWYw+envz8sbo3DliP+dn4e /GHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=m7BaWGFZlw1x16a/tD6F9POSUTGecMzTEp0ve/CEd5c=; b=kJPbxDWIL8QB0zk+DiA2cLm1VtqSV2Nx3Qa9QbmrcbDSdhCJEz18rVrQHSTehJDbox OjPOanQ79UbYd+mH5vkTnXnrSYeq5fGzRbldeoOTFRpU+Bxuuyup+QNVjdOXsulUu6a4 Q4crI3BfqZqidwNOeIiWPhXhS1DB7KDrL7RdxakD6Z4cKkRJWYqS1xv9jKRkbPIPL3vq Im4GKmHPRvQliRqmhhDVCH3P6FXRZnJDyTYXrLFh8JQeV74p/MoIxcvmf6eYnsxoIE/y mPrpP2z+TzY/JUQilurb2D8d8nLPxsR8k/ob8NG+gqD35vdGoQPNmJry0zKjTG939Yw4 rYyw== X-Gm-Message-State: AOAM531Eo39L19mDFmPzRxxLDOtoGj4V2dPAMba6zGyzqfO3GSOS2GaB 2wrQqwtEH4lJknIoO7Zs0WM= X-Google-Smtp-Source: ABdhPJyVxI+BlmC6TJmWiZCQGTvB6ZbyMOP/UkJtxRz6f7wEcaG7w2hv3lDa8LLGMI5i5WyBRza60g== X-Received: by 2002:a05:6000:1e07:b0:1f1:d782:2863 with SMTP id bj7-20020a0560001e0700b001f1d7822863mr8177543wrb.406.1647016497031; Fri, 11 Mar 2022 08:34:57 -0800 (PST) Received: from [10.42.42.166] (212-197-176-189.adsl.highway.telekom.at. [212.197.176.189]) by smtp.gmail.com with ESMTPSA id e1-20020a05600c108100b00389cdb3372csm7484612wmd.26.2022.03.11.08.34.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Mar 2022 08:34:56 -0800 (PST) Message-ID: <94de191b-7219-cf93-e1c0-d860a54dd524@gmail.com> Date: Fri, 11 Mar 2022 17:34:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH 2/2] lib: time.c: Try also DM timer, when CONFIG_TIMER_EARLY is selected Content-Language: de-DE To: krjdev@gnail.com, u-boot@lists.denx.de, trini@konsulko.com References: <20220310184549.1883-1-krjdev@gmail.com> <20220310184549.1883-3-krjdev@gmail.com> From: "Johannes (krjdev) Krottmayer" In-Reply-To: <20220310184549.1883-3-krjdev@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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.5 at phobos.denx.de X-Virus-Status: Clean Hi, Ignore these patches. Have send them to the wrong maintainers... There are also somm issues. Thanks! On 10.03.22 19:45, Johannes Krottmayer wrote: > Description: > > When CONFIG_TIMER_EARLY is selected only the timer_early_* functions > will be called. With this patch first gd->timer will be checked, if the > DM timer is available, it uses the DM timer. When gd->timer is empty, > the timer_early_* functions will be called. > > Signed-off-by: Johannes Krottmayer > Cc: Tom Rini > --- > lib/time.c | 46 ++++++++++++++++++++++++++++++++-------------- > 1 file changed, 32 insertions(+), 14 deletions(-) > > diff --git a/lib/time.c b/lib/time.c > index 96074b84af..85803d8ff5 100644 > --- a/lib/time.c > +++ b/lib/time.c > @@ -5,7 +5,6 @@ > */ > > #include > -#include > #include > #include > #include > @@ -66,17 +65,22 @@ extern unsigned long __weak timer_read_counter(void); > #if CONFIG_IS_ENABLED(TIMER) > ulong notrace get_tbclk(void) > { > - if (!gd->timer) { > + int ret; > + > #ifdef CONFIG_TIMER_EARLY > + if (!gd->timer) > return timer_early_get_rate(); > + > + ret = dm_timer_init(); > + > + if (ret) > + return ret; > #else > - int ret; > + ret = dm_timer_init(); > > - ret = dm_timer_init(); > - if (ret) > - return ret; > + if (ret) > + return ret; > #endif > - } > > return timer_get_rate(gd->timer); > } > @@ -86,19 +90,32 @@ uint64_t notrace get_ticks(void) > u64 count; > int ret; > > - if (!gd->timer) { > #ifdef CONFIG_TIMER_EARLY > + if (!gd->timer) > return timer_early_get_count(); > -#else > - int ret; > > - ret = dm_timer_init(); > - if (ret) > - panic("Could not initialize timer (err %d)\n", ret); > -#endif > + ret = dm_timer_init(); > + > + if (ret) > + panic("Could not initialize timer (err %d)\n", ret); > + > + ret = timer_get_count(gd->timer, &count); > + > + if (ret) { > + if (spl_phase() > PHASE_TPL) > + panic("Could not read count from timer (err %d)\n", > + ret); > + else > + panic("no timer (err %d)\n", ret); > } > +#else > + ret = dm_timer_init(); > + > + if (ret) > + panic("Could not initialize timer (err %d)\n", ret); > > ret = timer_get_count(gd->timer, &count); > + > if (ret) { > if (spl_phase() > PHASE_TPL) > panic("Could not read count from timer (err %d)\n", > @@ -106,6 +123,7 @@ uint64_t notrace get_ticks(void) > else > panic("no timer (err %d)\n", ret); > } > +#endif > > return count; > }