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>
This commit is contained in:
Bin Meng
2020-03-17 07:59:49 -07:00
committed by Anup Patel
parent dd9439fbac
commit 3f1c847d1f

View File

@@ -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");