summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2020-03-17 17:59:49 +0300
committerAnup Patel <anup@brainfault.org>2020-03-18 08:26:43 +0300
commit3f1c847d1fec852a2b98ee408e4193d70949acd4 (patch)
treeda73d67b646210e72105bbec2b5510621437ad9a /platform
parentdd9439fbace2196c24d90b9274a6014418d5b413 (diff)
downloadopensbi-3f1c847d1fec852a2b98ee408e4193d70949acd4.tar.xz
platform: sifive/fu540: Replace cpu0 node fix-up with the new helper
This replaces the FU540 specific cpu0 node "status" property fix-up with the newly introduced generic fdt_cpu_fixup() helper. Unlike previous logic, the helper routine does not test the "mmu-type" property to determine which node we should fix up, instead it uses sbi_platform_hart_disabled() API. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/sifive/fu540/platform.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c
index b655d45..6a8c7b2 100644
--- a/platform/sifive/fu540/platform.c
+++ b/platform/sifive/fu540/platform.c
@@ -58,31 +58,7 @@
static void fu540_modify_dt(void *fdt)
{
- u32 i, size;
- int err;
- int cpu_offset;
- char cpu_node[32] = "";
- const char *mmu_type;
-
- size = fdt_totalsize(fdt);
- err = fdt_open_into(fdt, fdt, size + 256);
- if (err < 0)
- sbi_printf(
- "Device Tree can't be expanded to accmodate new node");
-
- for (i = 0; i < FU540_HART_COUNT; i++) {
- sbi_sprintf(cpu_node, "/cpus/cpu@%d", i);
- cpu_offset = fdt_path_offset(fdt, cpu_node);
- mmu_type = fdt_getprop(fdt, cpu_offset, "mmu-type", NULL);
- if (mmu_type && (!strcmp(mmu_type, "riscv,sv32") ||
- !strcmp(mmu_type, "riscv,sv39") ||
- !strcmp(mmu_type, "riscv,sv48")))
- continue;
- else
- fdt_setprop_string(fdt, cpu_offset, "status",
- "disabled");
- memset(cpu_node, 0, sizeof(cpu_node));
- }
+ fdt_cpu_fixup(fdt);
fdt_plic_fixup(fdt, "riscv,plic0");