| // SPDX-License-Identifier: GPL-2.0+ |
| * Copyright (C) 2020, Sean Anderson <seanga2@gmail.com> |
| * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com> |
| * U-Boot syscon driver for SiFive's Core Local Interruptor (CLINT). |
| * The CLINT block holds memory-mapped control and status registers |
| * associated with software and timer interrupts. |
| #include <asm/global_data.h> |
| #define MSIP_REG(base, hart) ((ulong)(base) + (hart) * 4) |
| ret = uclass_get_device_by_driver(UCLASS_TIMER, |
| DM_DRIVER_GET(sifive_clint), &dev); |
| gd->arch.clint = dev_read_addr_ptr(dev); |
| int riscv_send_ipi(int hart) |
| writel(1, (void __iomem *)MSIP_REG(gd->arch.clint, hart)); |
| int riscv_clear_ipi(int hart) |
| writel(0, (void __iomem *)MSIP_REG(gd->arch.clint, hart)); |
| int riscv_get_ipi(int hart, int *pending) |
| *pending = readl((void __iomem *)MSIP_REG(gd->arch.clint, hart)); |