lib: utils/irqchip: plic: Move delegation to base PLIC driver

This needs to be in the base PLIC driver as part of the power management
save/restore flow.

This is also in preparation for moving the PLIC information in the
scratch area to the base PLIC driver. After that change, the FDT PLIC
layer will be unable to look up the `struct plic_data` after cold boot.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2024-11-04 20:10:03 -08:00
committed by Anup Patel
parent a786aed08d
commit c26e3fd2ed
3 changed files with 18 additions and 13 deletions

View File

@@ -164,10 +164,7 @@ static int irqchip_plic_cold_init(const void *fdt, int nodeoff,
if (rc)
goto fail_free_data;
if (match->data) {
void (*plic_plat_init)(struct plic_data *) = match->data;
plic_plat_init(pd);
}
pd->flags = (unsigned long)match->data;
rc = plic_cold_irqchip_init(pd);
if (rc)
@@ -184,19 +181,12 @@ fail_free_data:
return rc;
}
#define THEAD_PLIC_CTRL_REG 0x1ffffc
static void thead_plic_plat_init(struct plic_data *pd)
{
writel_relaxed(BIT(0), (char *)pd->addr + THEAD_PLIC_CTRL_REG);
}
void thead_plic_restore(void)
{
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
struct plic_data *plic = plic_get_hart_data_ptr(scratch);
thead_plic_plat_init(plic);
plic_delegate(plic);
}
static const struct fdt_match irqchip_plic_match[] = {
@@ -204,7 +194,7 @@ static const struct fdt_match irqchip_plic_match[] = {
{ .compatible = "riscv,plic0" },
{ .compatible = "sifive,plic-1.0.0" },
{ .compatible = "thead,c900-plic",
.data = thead_plic_plat_init },
.data = (void *)PLIC_FLAG_THEAD_DELEGATION },
{ /* sentinel */ }
};