mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-18 10:48:51 +00:00
401d1c4f5d
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
59 lines
1.2 KiB
C
59 lines
1.2 KiB
C
// 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 <common.h>
|
|
#include <dm.h>
|
|
#include <asm/global_data.h>
|
|
#include <asm/io.h>
|
|
#include <asm/smp.h>
|
|
#include <linux/err.h>
|
|
|
|
/* MSIP registers */
|
|
#define MSIP_REG(base, hart) ((ulong)(base) + (hart) * 4)
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
int riscv_init_ipi(void)
|
|
{
|
|
int ret;
|
|
struct udevice *dev;
|
|
|
|
ret = uclass_get_device_by_driver(UCLASS_TIMER,
|
|
DM_DRIVER_GET(sifive_clint), &dev);
|
|
if (ret)
|
|
return ret;
|
|
|
|
gd->arch.clint = dev_read_addr_ptr(dev);
|
|
if (!gd->arch.clint)
|
|
return -EINVAL;
|
|
|
|
return 0;
|
|
}
|
|
|
|
int riscv_send_ipi(int hart)
|
|
{
|
|
writel(1, (void __iomem *)MSIP_REG(gd->arch.clint, hart));
|
|
|
|
return 0;
|
|
}
|
|
|
|
int riscv_clear_ipi(int hart)
|
|
{
|
|
writel(0, (void __iomem *)MSIP_REG(gd->arch.clint, hart));
|
|
|
|
return 0;
|
|
}
|
|
|
|
int riscv_get_ipi(int hart, int *pending)
|
|
{
|
|
*pending = readl((void __iomem *)MSIP_REG(gd->arch.clint, hart));
|
|
|
|
return 0;
|
|
}
|