From: Jesse Taube <mr.bossman075@gmail.com>
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 [thread overview]
Message-ID: <20220129152309.1567937-3-Mr.Bossman075@gmail.com> (raw)
In-Reply-To: <20220129152309.1567937-1-Mr.Bossman075@gmail.com>
Both armv7 and arm926ejs use this timer code so move it to mach-sunxi.
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
---
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
next prev parent reply other threads:[~2022-01-29 15:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-29 15:22 [PATCH v3 00/10] Add support for SUNIV and F1C100s Jesse Taube
2022-01-29 15:23 ` [PATCH v3 01/10] arm: arm926ej-s: start.S: port save_boot_params support from armv7 code Jesse Taube
2022-01-29 15:23 ` Jesse Taube [this message]
2022-01-29 22:58 ` [PATCH v3 02/10] mach-sunxi: Move timer code to mach folder Andre Przywara
2022-01-29 15:23 ` [PATCH v3 03/10] arm: arm926ej-s: Add sunxi code Jesse Taube
2022-01-29 15:23 ` [PATCH v3 04/10] ARM: sunxi: Add clock and uart to sunxi headers Jesse Taube
2022-01-29 15:23 ` [PATCH v3 05/10] sunxi: Add F1C100s DRAM initial support Jesse Taube
2022-01-29 15:23 ` [PATCH v3 06/10] sunxi: board: Add support for SUNIV Jesse Taube
2022-01-29 15:23 ` [PATCH v3 07/10] configs: sunxi: Add common SUNIV header Jesse Taube
2022-01-29 15:23 ` [PATCH v3 08/10] mach-sunxi: Add support for SUNIV architecture Jesse Taube
2022-01-29 22:59 ` Andre Przywara
2022-01-29 15:23 ` [PATCH v3 09/10] ARM: dts: suniv: Add device tree files and bindings for F1C100s Jesse Taube
2022-01-29 23:00 ` Andre Przywara
2022-01-29 15:23 ` [PATCH v3 10/10] configs: sunxi: Add support for Lichee Pi Nano Jesse Taube
2022-01-29 23:00 ` Andre Przywara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220129152309.1567937-3-Mr.Bossman075@gmail.com \
--to=mr.bossman075@gmail.com \
--cc=andre.przywara@arm.com \
--cc=arnaud.ferraris@gmail.com \
--cc=christianshewitt@gmail.com \
--cc=festevam@denx.de \
--cc=giulio.benetti@benettiengineering.com \
--cc=hdegoede@redhat.com \
--cc=hs@denx.de \
--cc=icenowy@aosc.io \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=marek.behun@nic.cz \
--cc=narmstrong@baylibre.com \
--cc=pbrobinson@gmail.com \
--cc=samuel@sholland.org \
--cc=sjg@chromium.org \
--cc=tharvey@gateworks.com \
--cc=thirtythreeforty@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox