[PATCH v2] Allow for riscv-clock to pick up mmio address.
Conor Dooley
conor at kernel.org
Thu Apr 10 03:21:46 PDT 2025
On Wed, Apr 09, 2025 at 02:38:55PM +0000, Aleksa Paunovic wrote:
> From: Dragan Mladjenovic <Dragan.Mladjenovic at syrmia.com>
>
> Allows faster rdtime access via GCR.U mtime shadow register on p8700.
>
> Signed-off-by: Aleksa Paunovic <aleksa.paunovic at htecgroup.com>
> +#if defined(CONFIG_RISCV_TIME_MMIO)
> + gcru = of_find_compatible_node(NULL, NULL, "mti,p8700-gcru");
Firstly, this is an undocumented compatible, so you'll need to create a
binding for it before you can use it. Not much to say on the use of the
compatible in the driver without more information on what the device
looks like.
Secondly, the option you have added is generically named and described,
yet only functions on this p8700 platform. At a minimum, it needs to
explain the platforms where it is relevant, and probably also should
depend on the kconfig option that enables building a dt etc for the
p8700 platform in the first place.
Cheers,
Conor.
> + if (gcru) {
> + if (!of_property_read_u64_index(gcru, "reg", 0, &mmio_addr)) {
> + riscv_time_val = ioremap((long)mmio_addr, 8);
> + if (riscv_time_val) {
> + pr_info("Using mmio time register at 0x%llx\n",
> + mmio_addr);
> + static_branch_enable(
> + &riscv_time_mmio_available);
> + } else {
> + pr_warn("Unable to use mmio time at 0x%llx\n",
> + mmio_addr);
> + }
> + of_node_put(gcru);
> + }
> + }
> +#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20250410/f6004241/attachment.sig>
More information about the linux-riscv
mailing list