forked from Mirrors/opensbi

Move Andes PLICSW ipi device to fdt ipi framework, this patch is based on Leo's modified IPI scheme on PLICSW. Current IPI scheme uses bit 0 of pending reigster on PLICSW to send IPI from hart 0 to hart 7, but bit 0 needs to be hardwired to 0 according to spec. After some investigation, self-IPI seems to be seldom or never used, so we re-order the IPI scheme to support 8 core platforms. dts example (Quad-core AX45MP): plicsw: interrupt-controller@e6400000 { compatible = "andestech,plicsw"; reg = <0x00000000 0xe6400000 0x00000000 0x00400000>; interrupts-extended = <&CPU0_intc 3 &CPU1_intc 3 &CPU2_intc 3 &CPU3_intc 3>; interrupt-controller; #address-cells = <2>; #interrupt-cells = <2>; }; Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2022 Andes Technology Corporation
|
|
*
|
|
* Authors:
|
|
* Zong Li <zong@andestech.com>
|
|
* Nylon Chen <nylon7@andestech.com>
|
|
* Leo Yu-Chi Liang <ycliang@andestech.com>
|
|
* Yu Chien Peter Lin <peterlin@andestech.com>
|
|
*/
|
|
|
|
#include <sbi/riscv_io.h>
|
|
#include <sbi_utils/fdt/fdt_helper.h>
|
|
#include <sbi_utils/ipi/fdt_ipi.h>
|
|
#include <sbi_utils/ipi/andes_plicsw.h>
|
|
|
|
extern struct plicsw_data plicsw;
|
|
|
|
int fdt_plicsw_cold_ipi_init(void *fdt, int nodeoff,
|
|
const struct fdt_match *match)
|
|
{
|
|
int rc;
|
|
|
|
rc = fdt_parse_plicsw_node(fdt, nodeoff, &plicsw.addr, &plicsw.size,
|
|
&plicsw.hart_count);
|
|
if (rc)
|
|
return rc;
|
|
|
|
rc = plicsw_cold_ipi_init(&plicsw);
|
|
if (rc)
|
|
return rc;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct fdt_match ipi_plicsw_match[] = {
|
|
{ .compatible = "andestech,plicsw" },
|
|
{},
|
|
};
|
|
|
|
struct fdt_ipi fdt_ipi_plicsw = {
|
|
.match_table = ipi_plicsw_match,
|
|
.cold_init = fdt_plicsw_cold_ipi_init,
|
|
.warm_init = plicsw_warm_ipi_init,
|
|
.exit = NULL,
|
|
};
|