All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yao Zi <ziyao@disroot.org>
To: Uros Stajic <uros.stajic@htecgroup.com>,
	"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Cc: Djordje Todorovic <Djordje.Todorovic@htecgroup.com>
Subject: Re: [PATCH v3 12/12] timer: p8700: Add support for reading time from memory-mapped mtime
Date: Thu, 31 Jul 2025 05:57:14 +0000	[thread overview]
Message-ID: <aIsFunyE5mGhGhbV@pie> (raw)
In-Reply-To: <20250729162035.209849-13-uros.stajic@htecgroup.com>

On Tue, Jul 29, 2025 at 04:25:14PM +0000, Uros Stajic wrote:
> The P8700 core does not support reading the time CSR directly and
> raises an illegal instruction exception. This patch adds support for
> reading the timer value via its memory-mapped address at 0x16108050
> when running on a P8700 processor.
> 
> Signed-off-by: Uros Stajic <uros.stajic@htecgroup.com>
> ---
>  drivers/timer/riscv_timer.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Sorry that I didn't review v2 further, but

> diff --git a/drivers/timer/riscv_timer.c b/drivers/timer/riscv_timer.c
> index 1f4980ceb38..5138236a028 100644
> --- a/drivers/timer/riscv_timer.c
> +++ b/drivers/timer/riscv_timer.c
> @@ -18,8 +18,15 @@
>  #include <timer.h>
>  #include <asm/csr.h>
>  
> +#define P8700_TIMER_ADDR 0x16108050
> +
>  static u64 notrace riscv_timer_get_count(struct udevice *dev)
>  {
> +	if (IS_ENABLED(CONFIG_P8700_RISCV)) {
> +		u32 *mtime_addr = (u32 *)P8700_TIMER_ADDR;
> +		return *mtime_addr;
> +	}
> +

This introduces platform-specific code to the generic RISC-V
TIME-CSR-based timer driver.

If your platform doesn't implement a TIME CSR in hardware, I suggest
using riscv_aclint_timer.c if the provider of P8700_TIMER is
compatible with the RISC-V ACLINT specification, or just introducing a
new driver otherwise.

Regards,
Yao Zi

>  	__maybe_unused u32 hi, lo;
>  
>  	if (IS_ENABLED(CONFIG_64BIT))
> -- 
> 2.34.1

  reply	other threads:[~2025-07-31  5:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 16:21 [PATCH v3 00/12] riscv: Add support for P8700 platform on Boston board Uros Stajic
2025-07-29 16:22 ` [PATCH v3 01/12] riscv: Add initial support for P8700 SoC Uros Stajic
2025-07-29 16:22 ` [PATCH v3 02/12] board: boston-riscv: Add initial support for P8700 Boston board Uros Stajic
2025-07-29 16:22 ` [PATCH v3 03/12] gpio: Add GPIO driver for Intel EG20T Uros Stajic
2025-08-01  8:51   ` Yao Zi
2025-07-29 16:23 ` [PATCH v3 04/12] pci: xilinx: Avoid writing memory base/limit for root bridge Uros Stajic
2025-07-29 16:23 ` [PATCH v3 05/12] riscv: Add support for MIPS GIC syscon on RISC-V SoCs Uros Stajic
2025-07-29 16:23 ` [PATCH v3 06/12] net: pch_gbe: Add PHY reset and MAC address fallback for RISC-V Uros Stajic
2025-07-29 16:24 ` [PATCH v3 07/12] libfdt: Allow non-64b aligned memreserve entries Uros Stajic
2025-07-29 16:24 ` [PATCH v3 08/12] riscv: p8700: Add software emulation for AMO* instructions Uros Stajic
2025-08-01  7:54   ` Yao Zi
2025-08-19  7:47     ` Uros Stajic
2025-07-29 16:24 ` [PATCH v3 09/12] riscv: p8700: Add Coherence Manager (CM) and IOCU support Uros Stajic
2025-08-01  8:47   ` Yao Zi
2025-08-19  7:55     ` Uros Stajic
2025-07-29 16:24 ` [PATCH v3 10/12] riscv: boston: Add support for LED character display command Uros Stajic
2025-07-29 16:25 ` [PATCH v3 11/12] cmd: riscv: Add 'startharts' command to start multiple harts Uros Stajic
2025-07-29 16:25 ` [PATCH v3 12/12] timer: p8700: Add support for reading time from memory-mapped mtime Uros Stajic
2025-07-31  5:57   ` Yao Zi [this message]
2025-08-19  7:59     ` Uros Stajic

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=aIsFunyE5mGhGhbV@pie \
    --to=ziyao@disroot.org \
    --cc=Djordje.Todorovic@htecgroup.com \
    --cc=u-boot@lists.denx.de \
    --cc=uros.stajic@htecgroup.com \
    /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 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.