summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2022-06-13 04:03:54 +0300
committerAnup Patel <anup@brainfault.org>2022-06-13 09:24:06 +0300
commit5e5675874ca042fe977ffb27afcfa06cadc84b8b (patch)
treee8aedc2bb0687b1ea890d1fb261f697d241d874a /lib
parent69be3dff9df767c19a461fadf73ad7331b4bdb4c (diff)
downloadopensbi-5e5675874ca042fe977ffb27afcfa06cadc84b8b.tar.xz
lib: utils/irqchip: Add wrapper for T-HEAD PLIC delegation
The delegation bit is lost along with the rest of the PLIC state when the CPU power domain in the Allwinner D1 is powered down, so the PLIC needs to be re-delegated to S-mode during the hart resume path. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/irqchip/fdt_irqchip_plic.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/utils/irqchip/fdt_irqchip_plic.c b/lib/utils/irqchip/fdt_irqchip_plic.c
index 89b12d4..a6e185c 100644
--- a/lib/utils/irqchip/fdt_irqchip_plic.c
+++ b/lib/utils/irqchip/fdt_irqchip_plic.c
@@ -151,6 +151,13 @@ 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 plic_data *plic = plic_hartid2data[current_hartid()];
+
+ thead_plic_plat_init(plic);
+}
+
static const struct fdt_match irqchip_plic_match[] = {
{ .compatible = "riscv,plic0" },
{ .compatible = "sifive,plic-1.0.0" },