From 9675d9202780fd996c00ad34f0360c89376205b3 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 21 Jun 2023 23:11:46 +0800 Subject: riscv: Rename SiFive CLINT to RISC-V ALINT As the RISC-V ACLINT specification is defined to be backward compatible with the SiFive CLINT specification, we rename SiFive CLINT to RISC-V ALINT in the source tree to be future-proof. Signed-off-by: Bin Meng Reviewed-by: Rick Chen --- drivers/timer/sifive_clint_timer.c | 74 -------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 drivers/timer/sifive_clint_timer.c (limited to 'drivers/timer/sifive_clint_timer.c') diff --git a/drivers/timer/sifive_clint_timer.c b/drivers/timer/sifive_clint_timer.c deleted file mode 100644 index be45f17ddfb..00000000000 --- a/drivers/timer/sifive_clint_timer.c +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2020, Sean Anderson - * Copyright (C) 2018, Bin Meng - */ - -#include -#include -#include -#include -#include -#include -#include - -#define CLINT_MTIME_OFFSET 0xbff8 -#define ACLINT_MTIME_OFFSET 0 - -/* mtime register */ -#define MTIME_REG(base, offset) ((ulong)(base) + (offset)) - -static u64 notrace sifive_clint_get_count(struct udevice *dev) -{ - return readq((void __iomem *)MTIME_REG(dev_get_priv(dev), - dev_get_driver_data(dev))); -} - -#if CONFIG_IS_ENABLED(RISCV_MMODE) && IS_ENABLED(CONFIG_TIMER_EARLY) -/** - * timer_early_get_rate() - Get the timer rate before driver model - */ -unsigned long notrace timer_early_get_rate(void) -{ - return RISCV_MMODE_TIMER_FREQ; -} - -/** - * timer_early_get_count() - Get the timer count before driver model - * - */ -u64 notrace timer_early_get_count(void) -{ - return readq((void __iomem *)MTIME_REG(RISCV_MMODE_TIMERBASE, - RISCV_MMODE_TIMEROFF)); -} -#endif - -static const struct timer_ops sifive_clint_ops = { - .get_count = sifive_clint_get_count, -}; - -static int sifive_clint_probe(struct udevice *dev) -{ - dev_set_priv(dev, dev_read_addr_ptr(dev)); - if (!dev_get_priv(dev)) - return -EINVAL; - - return timer_timebase_fallback(dev); -} - -static const struct udevice_id sifive_clint_ids[] = { - { .compatible = "riscv,clint0", .data = CLINT_MTIME_OFFSET }, - { .compatible = "sifive,clint0", .data = CLINT_MTIME_OFFSET }, - { .compatible = "riscv,aclint-mtimer", .data = ACLINT_MTIME_OFFSET }, - { } -}; - -U_BOOT_DRIVER(sifive_clint) = { - .name = "sifive_clint", - .id = UCLASS_TIMER, - .of_match = sifive_clint_ids, - .probe = sifive_clint_probe, - .ops = &sifive_clint_ops, - .flags = DM_FLAG_PRE_RELOC, -}; -- cgit v1.2.3