From: Jonas Karlman <jonas@kwiboo.se>
To: Kever Yang <kever.yang@rock-chips.com>,
Simon Glass <sjg@chromium.org>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, Jonas Karlman <jonas@kwiboo.se>
Subject: [PATCH 01/11] rockchip: rk3588: Use hptimer reg names in rockchip_stimer_init
Date: Sun, 6 Apr 2025 00:24:22 +0000 [thread overview]
Message-ID: <20250406002447.1555596-2-jonas@kwiboo.se> (raw)
In-Reply-To: <20250406002447.1555596-1-jonas@kwiboo.se>
Define constants for hptimer reg names and use them instead of magic
numbers in rockchip_stimer_init().
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
arch/arm/mach-rockchip/rk3588/rk3588.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c
index 6395483f14f1..ac35866e2f87 100644
--- a/arch/arm/mach-rockchip/rk3588/rk3588.c
+++ b/arch/arm/mach-rockchip/rk3588/rk3588.c
@@ -116,18 +116,25 @@ void board_debug_uart_init(void)
}
#ifdef CONFIG_XPL_BUILD
+
+#define HP_TIMER_BASE CONFIG_ROCKCHIP_STIMER_BASE
+#define HP_CTRL_REG 0x04
+#define TIMER_EN BIT(0)
+#define HP_LOAD_COUNT0_REG 0x14
+#define HP_LOAD_COUNT1_REG 0x18
+
void rockchip_stimer_init(void)
{
/* If Timer already enabled, don't re-init it */
- u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + 0x4);
+ u32 reg = readl(HP_TIMER_BASE + HP_CTRL_REG);
- if (reg & 0x1)
+ if (reg & TIMER_EN)
return;
- asm volatile("msr CNTFRQ_EL0, %0" : : "r" (CONFIG_COUNTER_FREQUENCY));
- writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 0x14);
- writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 0x18);
- writel(0x1, CONFIG_ROCKCHIP_STIMER_BASE + 0x4);
+ asm volatile("msr cntfrq_el0, %0" : : "r" (CONFIG_COUNTER_FREQUENCY));
+ writel(0xffffffff, HP_TIMER_BASE + HP_LOAD_COUNT0_REG);
+ writel(0xffffffff, HP_TIMER_BASE + HP_LOAD_COUNT1_REG);
+ writel(TIMER_EN, HP_TIMER_BASE + HP_CTRL_REG);
}
#endif
--
2.49.0
next prev parent reply other threads:[~2025-04-06 0:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-06 0:24 [PATCH 00/11] rockchip: Small cleanups for RK356x and RK3588 Jonas Karlman
2025-04-06 0:24 ` Jonas Karlman [this message]
2025-04-08 3:17 ` [PATCH 01/11] rockchip: rk3588: Use hptimer reg names in rockchip_stimer_init Kever Yang
2025-04-06 0:24 ` [PATCH 02/11] rockchip: Remove partitions env variable for RK356x Jonas Karlman
2025-04-08 3:18 ` Kever Yang
2025-04-06 0:24 ` [PATCH 03/11] rockchip: Remove partitions env variable for RK3588 Jonas Karlman
2025-04-08 3:19 ` Kever Yang
2025-04-06 0:24 ` [PATCH 04/11] rockchip: Ensure device settings is defined before rk3568_common.h Jonas Karlman
2025-04-08 3:19 ` Kever Yang
2025-04-06 0:24 ` [PATCH 05/11] rockchip: Ensure device settings is defined before rk3588_common.h Jonas Karlman
2025-04-08 3:19 ` Kever Yang
2025-04-06 0:24 ` [PATCH 06/11] rockchip: Use rk3568_common.h by default for RK356x boards Jonas Karlman
2025-04-08 3:19 ` Kever Yang
2025-04-06 0:24 ` [PATCH 07/11] rockchip: Use rk3588_common.h by default for RK3588 boards Jonas Karlman
2025-04-08 3:19 ` Kever Yang
2025-04-06 0:24 ` [PATCH 08/11] rockchip: rk3568: Drop BOARD_LATE_INIT from target config Jonas Karlman
2025-04-08 3:19 ` Kever Yang
2025-04-06 0:24 ` [PATCH 09/11] rockchip: rk3588: " Jonas Karlman
2025-04-08 3:20 ` Kever Yang
2025-04-06 0:24 ` [PATCH 10/11] rockchip: Enable meminfo and rng commands for Generic RK3566/RK3568 Jonas Karlman
2025-04-08 3:20 ` Kever Yang
2025-04-06 0:24 ` [PATCH 11/11] rockchip: Enable meminfo and rng commands for Generic RK3588 Jonas Karlman
2025-04-08 3:20 ` Kever Yang
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=20250406002447.1555596-2-jonas@kwiboo.se \
--to=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=philipp.tomsich@vrull.eu \
--cc=sjg@chromium.org \
--cc=trini@konsulko.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