From d16b0e0a00a6e5c19acf3c582aac30e68a59a60c Mon Sep 17 00:00:00 2001 From: Jisheng Zhang Date: Sun, 27 Aug 2023 19:00:47 +0800 Subject: [PATCH] lib: utils: reset: thead: add back "plic-delegate" handling When backporting commit 78c2b19218bd ("lib: utils/irqchip: Automatically delegate T-HEAD PLIC access"), we removed the delegate property handling as upstream does, but it will break sdk linux kernel which still relies on "plic-delegate" property, add back it. --- lib/utils/reset/fdt_reset_thead.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/utils/reset/fdt_reset_thead.c b/lib/utils/reset/fdt_reset_thead.c index f8327ba..3e134ab 100644 --- a/lib/utils/reset/fdt_reset_thead.c +++ b/lib/utils/reset/fdt_reset_thead.c @@ -82,6 +82,13 @@ static int thead_reset_init(void *fdt, int nodeoff, clone_csrs(cnt); } + /* Delegate plic enable regs for S-mode */ + val = fdt_getprop(fdt, nodeoff, "plic-delegate", &len); + if (len > 0 && val) { + p = (void *)(ulong)fdt64_to_cpu(*val); + writel(BIT(0), p); + } + /* Old reset method for secondary harts */ if (fdt_getprop(fdt, nodeoff, "using-csr-reset", &len)) { csr_write(0x7c7, (ulong)&__thead_pre_start_warm);