All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] riscv: timer: Fix M-mode early timer support
@ 2026-09-09  6:30 Nikita Shubin
  2026-09-09  6:30 ` [PATCH v2 1/2] riscv: timer: Enable early timer for M‑mode Nikita Shubin
  2026-09-09  6:31 ` [PATCH v2 2/2] riscv: timer: Make RISCV_TIMER definitions weak Nikita Shubin
  0 siblings, 2 replies; 7+ messages in thread
From: Nikita Shubin @ 2026-09-09  6:30 UTC (permalink / raw)
  To: u-boot; +Cc: Yao Zi, Tom Rini, Michal Simek, Nikita Shubin

This series addresses two issues with the generic RISC-V timer driver.

Patch 1 adds proper M‑mode support: timer_early_get_rate() is now defined
for M‑mode using RISCV_MMODE_TIMER_FREQ, and timer_early_get_count() is
no longer guarded by RISCV_SMODE, making it available whenever
CONFIG_TIMER_EARLY is enabled. This is necessary because functions like
net_random_ethaddr() rely on get_ticks() which uses timer_early_get_count().

Patch 2 marks timer_early_get_rate() and timer_early_get_count() as __weak
to prevent link conflicts with other drivers (e.g., ACLINT MTIMER) that may
also provide their own implementation.

Changes in v2:
- Updated Kconfig help text and driver comments to clarify M-mode support
- Simplified code a bit
- Added patch to make RISCV_TIMER definitions weak

Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
---
Changes in v2:
- Updated Kconfig help text and driver comments to clarify M-mode support
- Simplified code a bit
- Add patch to make timer_early_get_count() weak (optional)

- Link to v1: https://lore.kernel.org/r/20260904-riscv_fix_early_timer_mmode-v1-1-210e769b0ac2@maquefel.me

---
Nikita Shubin (2):
      riscv: timer: Enable early timer for M‑mode
      riscv: timer: Make RISCV_TIMER definitions weak

 drivers/timer/Kconfig       | 13 +++++++++++--
 drivers/timer/riscv_timer.c | 16 +++++++++++-----
 2 files changed, 22 insertions(+), 7 deletions(-)
---
base-commit: cc557af4553382f6f50e3ed62b9577054e7bc54f
change-id: 20260904-riscv_fix_early_timer_mmode-174f3ee4e106

Best regards,
-- 
Nikita Shubin


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-10 13:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09  6:30 [PATCH v2 0/2] riscv: timer: Fix M-mode early timer support Nikita Shubin
2026-09-09  6:30 ` [PATCH v2 1/2] riscv: timer: Enable early timer for M‑mode Nikita Shubin
2026-09-10 12:23   ` Yao Zi
2026-09-10 13:15     ` Nikita Shubin
2026-09-09  6:31 ` [PATCH v2 2/2] riscv: timer: Make RISCV_TIMER definitions weak Nikita Shubin
2026-09-10  4:13   ` Yao Zi
2026-09-10  5:03     ` Nikita Shubin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.