|
|
Subscribe / Log in / New account

riscv: Use GCR.U timer device as clocksource

From:  Aleksa Paunovic via B4 Relay <devnull+aleksa.paunovic.htecgroup.com-AT-kernel.org>
To:  Daniel Lezcano <daniel.lezcano-AT-linaro.org>, Thomas Gleixner <tglx-AT-linutronix.de>, Rob Herring <robh-AT-kernel.org>, Krzysztof Kozlowski <krzk+dt-AT-kernel.org>, Conor Dooley <conor+dt-AT-kernel.org>, Paul Walmsley <paul.walmsley-AT-sifive.com>, Palmer Dabbelt <palmer-AT-dabbelt.com>, Albert Ou <aou-AT-eecs.berkeley.edu>, Alexandre Ghiti <alex-AT-ghiti.fr>
Subject:  [PATCH v6 0/2] riscv: Use GCR.U timer device as clocksource
Date:  Wed, 06 Aug 2025 14:26:38 +0200
Message-ID:  <20250806-riscv-time-mmio-v6-0-2df0e8219998@htecgroup.com>
Cc:  linux-kernel-AT-vger.kernel.org, devicetree-AT-vger.kernel.org, linux-riscv-AT-lists.infradead.org, Djordje Todorovic <djordje.todorovic-AT-htecgroup.com>, Aleksa Paunovic <aleksa.paunovic-AT-htecgroup.com>, Conor Dooley <conor.dooley-AT-microchip.com>
Archive-link:  Article

This series adds bindings for the GCR.U timer device and corresponding
driver support. Accessing the memory mapped mtime register in the GCR.U
region should be faster than trapping to M mode each time the timer
needs to be read.

Signed-off-by: Aleksa Paunovic <aleksa.paunovic@htecgroup.com>
---
Changes in v6:
- Rename mti,gcru to mips,p8700-gcru
- Link to v5: https://lore.kernel.org/r/20250711-riscv-time-mmio-v5-0-9...

Changes in v5:
- Fixed build issues on 32-bit RISC-V and sparse warnings
- Remove clint_time_val and clint.h, replace with riscv_time_val
- Depend on RISCV_TIMER in Kconfig
Changes in v4:
- Remove "select" from mti,gcru.yaml.
- Refactor the driver to use function pointers instead of static keys.

Previous versions:
v1: https://lore.kernel.org/lkml/20241227150056.191794-1-arik...
v2: https://lore.kernel.org/linux-riscv/20250409143816.15802-...
v3: https://lore.kernel.org/linux-riscv/DU0PR09MB61968695A2A3...
v4: https://lore.kernel.org/r/20250514-riscv-time-mmio-v4-0-c...
v5: https://lore.kernel.org/r/20250711-riscv-time-mmio-v5-0-9...

---
Aleksa Paunovic (2):
      dt-bindings: timer: mips,p8700-gcru
      riscv: Allow for riscv-clock to pick up mmio address.

 .../devicetree/bindings/timer/mips,p8700-gcru.yaml | 38 +++++++++++++
 arch/riscv/include/asm/clint.h                     | 26 ---------
 arch/riscv/include/asm/timex.h                     | 63 ++++++++++++----------
 drivers/clocksource/Kconfig                        | 12 +++++
 drivers/clocksource/timer-clint.c                  | 20 ++++---
 drivers/clocksource/timer-riscv.c                  | 34 ++++++++++++
 6 files changed, 128 insertions(+), 65 deletions(-)
---
base-commit: 038d61fd642278bab63ee8ef722c50d10ab01e8f
change-id: 20250424-riscv-time-mmio-5628e0fca8af

Best regards,
-- 
Aleksa Paunovic <aleksa.paunovic@htecgroup.com>





Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds