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 CA13EC433F5 for ; Fri, 28 Jan 2022 04:51:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 47DC2834E4; Fri, 28 Jan 2022 05:51:17 +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="B+gwaqKq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 459A9834D2; Fri, 28 Jan 2022 05:51:16 +0100 (CET) Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) (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 5B8ED834E4 for ; Fri, 28 Jan 2022 05:51:13 +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=mr.bossman075@gmail.com Received: by mail-qt1-x82e.google.com with SMTP id y17so4295334qtx.9 for ; Thu, 27 Jan 2022 20:51:13 -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 :cc:references:from:in-reply-to:content-transfer-encoding; bh=c8BrdK2+H6SnRptk4cDVkoht0TSVRL7Iirp/2NLtOt8=; b=B+gwaqKqbmvj1qZl7Wanf0+1AcWlBtp6I9FzOYyfsFXv/d9/5N70Zg+BgY1fPHgdA9 NgZNU85zCSrJ3KDaYaZlj/mtiHz8+9T5HzYHZQtX2DokbTKB1ZnmqAvoHUVeRfqv6e9p UaQduo5yfpm+g2joeVhKh851EAYGFZNT/Fy6dbpWDJ+cEi+WAsLhv9WbHY1CEony2qrj eCMCd+xkgiNulrwoE9nkdc/Eo7vN5j12FzeepOFVM2DDRuTFxXgiVV/dkPd3YjrYv4EX 48eGCifqhna/K7LHzzjd7f/8JVkqhrIr2sN47TXi63qSTtjCrs+WHx8JJ4g9rnbwO+fQ cRKw== 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:cc:references:from:in-reply-to :content-transfer-encoding; bh=c8BrdK2+H6SnRptk4cDVkoht0TSVRL7Iirp/2NLtOt8=; b=i64jYjQGIrmLP3v3ChoFAs3cbwUOPS2KXHoFQjvlpOcUhmNxsr2lVUq9Fr153UWpPW wvCmFSXu+h/JjTj1HR77ZV6ilNbBUJGynTaSDN5F8lmxDyxlHBJ4hlmmfvls4RJCFGr4 L7i53qbeuT8GF1W+8IazhK+Y5R6b3lyplMBMAW95pXxcaenRkumaMt3+td0VLPNF8AcT NdFcs4u1frvJLtoOtx5eZ+ft6//zQC3szCyf4uQfcRfc5AF61OlAO8m+Wb+Cn9j+C2WV oVh7JW4YxR/dcQGRf3hHv9aU4rGf4oDcgyXlZVZKupHz00kNIjaa7dK6M2y46W/lX3NA +xnQ== X-Gm-Message-State: AOAM5330bH5CadnPIMx3Q1j0i4+nnHrh0D+Em7sCw078hvn3qu94SyxJ uXGJGECswLGReNJI2D1DWnA= X-Google-Smtp-Source: ABdhPJwMWiMTCh+4empYIZwb8CoV/6TWIaxd4SE7Cnfu9GEBN2EJNgasYewZBFslcCckydrmHLT4pg== X-Received: by 2002:ac8:5cce:: with SMTP id s14mr5116702qta.178.1643345471985; Thu, 27 Jan 2022 20:51:11 -0800 (PST) Received: from [10.4.10.38] (146-115-144-188.s4282.c3-0.nwt-cbr1.sbo-nwt.ma.cable.rcncustomer.com. [146.115.144.188]) by smtp.gmail.com with ESMTPSA id a141sm2564905qkc.73.2022.01.27.20.51.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jan 2022 20:51:11 -0800 (PST) Message-ID: Date: Thu, 27 Jan 2022 23:51:09 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v2 02/12] mach-sunxi: Move timer code to mach folder Content-Language: en-US To: Andre Przywara Cc: samuel@sholland.org, u-boot@lists.denx.de, jagan@amarulasolutions.com, hdegoede@redhat.com, sjg@chromium.org, icenowy@aosc.io, marek.behun@nic.cz, festevam@denx.de, narmstrong@baylibre.com, tharvey@gateworks.com, christianshewitt@gmail.com, pbrobinson@gmail.com, jernej.skrabec@gmail.com, hs@denx.de, arnaud.ferraris@gmail.com, giulio.benetti@benettiengineering.com, thirtythreeforty@gmail.com References: <20220126135329.2997430-1-Mr.Bossman075@gmail.com> <20220126135329.2997430-3-Mr.Bossman075@gmail.com> <20220127102114.13263dc4@donnerap.cambridge.arm.com> <81d96db1-52e1-c7c4-3b00-1a9affa474dd@gmail.com> <20220128004137.470fc71a@slackpad.fritz.box> From: Jesse Taube In-Reply-To: <20220128004137.470fc71a@slackpad.fritz.box> Content-Type: text/plain; charset=UTF-8; format=flowed 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 On 1/27/22 19:41, Andre Przywara wrote: > On Thu, 27 Jan 2022 15:40:13 -0500 > Jesse Taube wrote: > > Hi, > >> On 1/27/22 05:21, Andre Przywara wrote: >>> On Wed, 26 Jan 2022 08:53:19 -0500 >>> Jesse Taube wrote: >>> >>>> Both armv7 and arm926ejs use this timer code so move it to mach-sunxi. >>> >>> Very nice, thanks for cleaning this up. >>> >>> But please remove the respective line from the Makefile in >>> arch/arm/cpu/armv7/sunxi/, otherwise 32-bit board builds fail: >>> make[2]: *** No rule to make target 'arch/arm/cpu/armv7/sunxi/timer.o' ... >> Oh my I'm very sorry about this. There is one thing though >> arch/arm/cpu/armv7/sunxi/ needs to have one .o file in there to compile. >> If I remove `ifdef CONFIG_SPL_BUILD` for fel_utils it will work but its >> not used in u-boot proper. > > Mmh, not sure I follow, I cannot reproduce any problem. Can you > elaborate? And did you do a "make clean" afterwards? If nothing is built by that MAKEFILE which would happen if !(CONFIG_MACH_SUN6I || CONFIG_MACH_SUN8I_H3 CONFIG_MACH_SUN8I || CONFIG_ARMV7_PSCI) it will error with the following `ar: arch/arm/cpu/armv7/sunxi/built-in.o: No such file or directory` I don't know if there is a config that will break it currently but it is possible. So we will have to let it generate some .o file. Even if it is optimized out. Should I still wait for your review of V2? Also thank you so much for being interested in this! Have my patches been okay so far? I really hope this gets in before cleanup of sunxi starts as rebasing it was already difficult. Thank you, Jesse Taube > Cheers, > Andre > > >>> Cheers, >>> Andre >>> >>>> Signed-off-by: Jesse Taube >>>> --- >>>> V1->V2: >>>> * New commit >>>> --- >>>> arch/arm/mach-sunxi/Makefile | 3 +++ >>>> arch/arm/{cpu/armv7/sunxi => mach-sunxi}/timer.c | 7 ++++--- >>>> 2 files changed, 7 insertions(+), 3 deletions(-) >>>> rename arch/arm/{cpu/armv7/sunxi => mach-sunxi}/timer.c (97%) >>>> >>>> diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile >>>> index 5d3fd70f74..b1adb75e17 100644 >>>> --- a/arch/arm/mach-sunxi/Makefile >>>> +++ b/arch/arm/mach-sunxi/Makefile >>>> @@ -25,6 +25,9 @@ obj-$(CONFIG_MACH_SUN8I) += clock_sun6i.o >>>> endif >>>> obj-$(CONFIG_MACH_SUN9I) += clock_sun9i.o gtbus_sun9i.o >>>> obj-$(CONFIG_SUN50I_GEN_H6) += clock_sun50i_h6.o >>>> +ifndef CONFIG_ARM64 >>>> +obj-y += timer.o >>>> +endif >>>> >>>> ifdef CONFIG_SPL_BUILD >>>> obj-$(CONFIG_DRAM_SUN4I) += dram_sun4i.o >>>> diff --git a/arch/arm/cpu/armv7/sunxi/timer.c b/arch/arm/mach-sunxi/timer.c >>>> similarity index 97% >>>> rename from arch/arm/cpu/armv7/sunxi/timer.c >>>> rename to arch/arm/mach-sunxi/timer.c >>>> index b758599636..fc9d419a25 100644 >>>> --- a/arch/arm/cpu/armv7/sunxi/timer.c >>>> +++ b/arch/arm/mach-sunxi/timer.c >>>> @@ -51,6 +51,7 @@ int timer_init(void) >>>> struct sunxi_timer_reg *timers = >>>> (struct sunxi_timer_reg *)SUNXI_TIMER_BASE; >>>> struct sunxi_timer *timer = &timers->timer[TIMER_NUM]; >>>> + >>>> writel(TIMER_LOAD_VAL, &timer->inter); >>>> writel(TIMER_MODE | TIMER_DIV | TIMER_SRC | TIMER_RELOAD | TIMER_EN, >>>> &timer->ctl); >>>> @@ -58,15 +59,14 @@ int timer_init(void) >>>> return 0; >>>> } >>>> >>>> -/* timer without interrupts */ >>>> static ulong get_timer_masked(void) >>>> { >>>> /* current tick value */ >>>> ulong now = TICKS_TO_HZ(read_timer()); >>>> >>>> - if (now >= gd->arch.lastinc) /* normal (non rollover) */ >>>> + if (now >= gd->arch.lastinc) { /* normal (non rollover) */ >>>> gd->arch.tbl += (now - gd->arch.lastinc); >>>> - else { >>>> + } else { >>>> /* rollover */ >>>> gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) >>>> - gd->arch.lastinc) + now; >>>> @@ -76,6 +76,7 @@ static ulong get_timer_masked(void) >>>> return gd->arch.tbl; >>>> } >>>> >>>> +/* timer without interrupts */ >>>> ulong get_timer(ulong base) >>>> { >>>> return get_timer_masked() - base; >>> >