| // SPDX-License-Identifier: GPL-2.0+ |
| * Copyright (C) 2019, Rick Chen <rick@andestech.com> |
| * U-Boot syscon driver for Andes's Platform Level Machine Timer (PLMT). |
| * The PLMT block holds memory-mapped mtime register |
| * associated with timer tick. |
| #define MTIME_REG(base) ((ulong)(base)) |
| #define PLMT_BASE_GET(void) \ |
| ret = syscon_get_first_range(RISCV_SYSCON_PLMT); \ |
| int riscv_get_time(u64 *time) |
| *time = readq((void __iomem *)MTIME_REG(gd->arch.plmt)); |
| static const struct udevice_id andes_plmt_ids[] = { |
| { .compatible = "riscv,plmt0", .data = RISCV_SYSCON_PLMT }, |
| U_BOOT_DRIVER(andes_plmt) = { |
| .of_match = andes_plmt_ids, |
| .flags = DM_FLAG_PRE_RELOC, |