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 7703AC433F5 for ; Sat, 29 Jan 2022 15:23:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BBFAE836CA; Sat, 29 Jan 2022 16:23:23 +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="pQ9arm68"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CAB20836AB; Sat, 29 Jan 2022 16:23:18 +0100 (CET) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (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 D329A836A5 for ; Sat, 29 Jan 2022 16:23:15 +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-x832.google.com with SMTP id h8so1666723qtk.13 for ; Sat, 29 Jan 2022 07:23:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VFAMK22IqLavjQVsJNChmoScttRPcFYgz8B0gli/B+c=; b=pQ9arm68z0bebqYggMoXRRWSRg+g4Fn4+3o0ELphahgwRjZ/dlNlHdo18QQxjt1X+w N+O5E15pgexwSRi6B+vEI+6mWvMMuevD9VSTkKUvBDD+MDksJiEpjS+h3G0C+ruzIbFj Palb6KQMPXOmEEjGT+uUg7qmtHX91zQI/CHSijyDFIcBTkPCy0jnHceDeigovnHRmAHV vkNAeLoB1Eu3tG9Hhgval5YzqyPCBcTP+clezNdVpT7EUS3t+0yAEQ69OpMU5Ftpev// aLvSmotVD8LtKMdKys3zc4Clc3um38Ide5/G0ER2DhDXhhCHPg+6zhoGD1dFK8+o2VDJ fIQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VFAMK22IqLavjQVsJNChmoScttRPcFYgz8B0gli/B+c=; b=fuQltNn0YQLTRz4/09ZzHhaq9kyjcbqfWFQpBCFqyFjNBWYjofLnrstDqow5umAK2H ZHLbZ6+HeSmeQ3Docj16Vwagv66CPmExsi6O/yJbfGPAqDIuxDKNTbEwi/lqlA5NjGHM KDy9d2VlOHCrbnxwP00XO0zYJ07xhXFS2lZ93RX5jVT9eG4pK2+S9ZzY6UjCAjaJKP2l Uw2PYKQYrFae9+O8g+NyKOpUmeejhs66IfLbI78Z/NTBuYoF6cysAiTQkdTCsmUbqZbd SBsqKMZvf5AWxrxpolvyRW8IHD3oHebHPQZ/nAxuJAywjoBVG3ofux8dSEdjNkBWb8un biFw== X-Gm-Message-State: AOAM531DlBawnliCAXvQFzkZKDB+H7gRlQc1GxARRwG5LKJy5Susd31l m8k7wcXSxNNeRYwSses+3xiu3Zkxgks= X-Google-Smtp-Source: ABdhPJwmEtT5LLrAQH/lNNIsDY+xnN2jvcht5T9x8K1Mo8Vo4yxOoeIyhp+sAIXnD7o43+4j/GWyGA== X-Received: by 2002:ac8:5716:: with SMTP id 22mr8469296qtw.322.1643469794479; Sat, 29 Jan 2022 07:23:14 -0800 (PST) Received: from jesse-desktop.jtp-bos.lab (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 c127sm5063124qkf.36.2022.01.29.07.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jan 2022 07:23:14 -0800 (PST) From: Jesse Taube X-Google-Original-From: Jesse Taube To: u-boot@lists.denx.de Cc: jagan@amarulasolutions.com, andre.przywara@arm.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, samuel@sholland.org, arnaud.ferraris@gmail.com, giulio.benetti@benettiengineering.com, Mr.Bossman075@gmail.com, thirtythreeforty@gmail.com Subject: [PATCH v3 02/10] mach-sunxi: Move timer code to mach folder Date: Sat, 29 Jan 2022 10:23:01 -0500 Message-Id: <20220129152309.1567937-3-Mr.Bossman075@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220129152309.1567937-1-Mr.Bossman075@gmail.com> References: <20220129152309.1567937-1-Mr.Bossman075@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Both armv7 and arm926ejs use this timer code so move it to mach-sunxi. Signed-off-by: Jesse Taube --- V1->V2: * New commit V2->V3: * Remove timer.o from armv7 Makefile --- arch/arm/cpu/armv7/sunxi/Makefile | 1 - arch/arm/mach-sunxi/Makefile | 3 +++ arch/arm/{cpu/armv7/sunxi => mach-sunxi}/timer.c | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) rename arch/arm/{cpu/armv7/sunxi => mach-sunxi}/timer.c (97%) diff --git a/arch/arm/cpu/armv7/sunxi/Makefile b/arch/arm/cpu/armv7/sunxi/Makefile index ad11be7863..3e975b366c 100644 --- a/arch/arm/cpu/armv7/sunxi/Makefile +++ b/arch/arm/cpu/armv7/sunxi/Makefile @@ -5,7 +5,6 @@ # Based on some other Makefile # (C) Copyright 2000-2003 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-y += timer.o obj-$(CONFIG_MACH_SUN6I) += tzpc.o obj-$(CONFIG_MACH_SUN8I_H3) += tzpc.o 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; -- 2.34.1