18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2015 Imagination Technologies 48c2ecf20Sopenharmony_ci * Author: Paul Burton <paul.burton@mips.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/bug.h> 88c2ecf20Sopenharmony_ci#include <linux/kernel.h> 98c2ecf20Sopenharmony_ci#include <linux/libfdt.h> 108c2ecf20Sopenharmony_ci#include <linux/of_fdt.h> 118c2ecf20Sopenharmony_ci#include <linux/sizes.h> 128c2ecf20Sopenharmony_ci#include <asm/addrspace.h> 138c2ecf20Sopenharmony_ci#include <asm/bootinfo.h> 148c2ecf20Sopenharmony_ci#include <asm/fw/fw.h> 158c2ecf20Sopenharmony_ci#include <asm/mips-boards/generic.h> 168c2ecf20Sopenharmony_ci#include <asm/mips-boards/malta.h> 178c2ecf20Sopenharmony_ci#include <asm/mips-cps.h> 188c2ecf20Sopenharmony_ci#include <asm/page.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define ROCIT_REG_BASE 0x1f403000 218c2ecf20Sopenharmony_ci#define ROCIT_CONFIG_GEN1 (ROCIT_REG_BASE + 0x04) 228c2ecf20Sopenharmony_ci#define ROCIT_CONFIG_GEN1_MEMMAP_SHIFT 8 238c2ecf20Sopenharmony_ci#define ROCIT_CONFIG_GEN1_MEMMAP_MASK (0xf << 8) 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistatic unsigned char fdt_buf[16 << 10] __initdata __aligned(8); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* determined physical memory size, not overridden by command line args */ 288c2ecf20Sopenharmony_ciextern unsigned long physical_memsize; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cienum mem_map { 318c2ecf20Sopenharmony_ci MEM_MAP_V1 = 0, 328c2ecf20Sopenharmony_ci MEM_MAP_V2, 338c2ecf20Sopenharmony_ci}; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define MAX_MEM_ARRAY_ENTRIES 2 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistatic __init int malta_scon(void) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci int scon = MIPS_REVISION_SCONID; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci if (scon != MIPS_REVISION_SCON_OTHER) 428c2ecf20Sopenharmony_ci return scon; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci switch (MIPS_REVISION_CORID) { 458c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_QED_RM5261: 468c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_LV: 478c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_FPGA: 488c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_FPGAR2: 498c2ecf20Sopenharmony_ci return MIPS_REVISION_SCON_GT64120; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_EMUL_BON: 528c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_BONITO64: 538c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_20K: 548c2ecf20Sopenharmony_ci return MIPS_REVISION_SCON_BONITO; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_MSC: 578c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_FPGA2: 588c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_24K: 598c2ecf20Sopenharmony_ci return MIPS_REVISION_SCON_SOCIT; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_FPGA3: 628c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_FPGA4: 638c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_FPGA5: 648c2ecf20Sopenharmony_ci case MIPS_REVISION_CORID_CORE_EMUL_MSC: 658c2ecf20Sopenharmony_ci default: 668c2ecf20Sopenharmony_ci return MIPS_REVISION_SCON_ROCIT; 678c2ecf20Sopenharmony_ci } 688c2ecf20Sopenharmony_ci} 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistatic unsigned __init gen_fdt_mem_array(__be32 *mem_array, unsigned long size, 718c2ecf20Sopenharmony_ci enum mem_map map) 728c2ecf20Sopenharmony_ci{ 738c2ecf20Sopenharmony_ci unsigned long size_preio; 748c2ecf20Sopenharmony_ci unsigned entries; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci entries = 1; 778c2ecf20Sopenharmony_ci mem_array[0] = cpu_to_be32(PHYS_OFFSET); 788c2ecf20Sopenharmony_ci if (IS_ENABLED(CONFIG_EVA)) { 798c2ecf20Sopenharmony_ci /* 808c2ecf20Sopenharmony_ci * The current Malta EVA configuration is "special" in that it 818c2ecf20Sopenharmony_ci * always makes use of addresses in the upper half of the 32 bit 828c2ecf20Sopenharmony_ci * physical address map, which gives it a contiguous region of 838c2ecf20Sopenharmony_ci * DDR but limits it to 2GB. 848c2ecf20Sopenharmony_ci */ 858c2ecf20Sopenharmony_ci mem_array[1] = cpu_to_be32(size); 868c2ecf20Sopenharmony_ci goto done; 878c2ecf20Sopenharmony_ci } 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci size_preio = min_t(unsigned long, size, SZ_256M); 908c2ecf20Sopenharmony_ci mem_array[1] = cpu_to_be32(size_preio); 918c2ecf20Sopenharmony_ci size -= size_preio; 928c2ecf20Sopenharmony_ci if (!size) 938c2ecf20Sopenharmony_ci goto done; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci if (map == MEM_MAP_V2) { 968c2ecf20Sopenharmony_ci /* 978c2ecf20Sopenharmony_ci * We have a flat 32 bit physical memory map with DDR filling 988c2ecf20Sopenharmony_ci * all 4GB of the memory map, apart from the I/O region which 998c2ecf20Sopenharmony_ci * obscures 256MB from 0x10000000-0x1fffffff. 1008c2ecf20Sopenharmony_ci * 1018c2ecf20Sopenharmony_ci * Therefore we discard the 256MB behind the I/O region. 1028c2ecf20Sopenharmony_ci */ 1038c2ecf20Sopenharmony_ci if (size <= SZ_256M) 1048c2ecf20Sopenharmony_ci goto done; 1058c2ecf20Sopenharmony_ci size -= SZ_256M; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci /* Make use of the memory following the I/O region */ 1088c2ecf20Sopenharmony_ci entries++; 1098c2ecf20Sopenharmony_ci mem_array[2] = cpu_to_be32(PHYS_OFFSET + SZ_512M); 1108c2ecf20Sopenharmony_ci mem_array[3] = cpu_to_be32(size); 1118c2ecf20Sopenharmony_ci } else { 1128c2ecf20Sopenharmony_ci /* 1138c2ecf20Sopenharmony_ci * We have a 32 bit physical memory map with a 2GB DDR region 1148c2ecf20Sopenharmony_ci * aliased in the upper & lower halves of it. The I/O region 1158c2ecf20Sopenharmony_ci * obscures 256MB from 0x10000000-0x1fffffff in the low alias 1168c2ecf20Sopenharmony_ci * but the DDR it obscures is accessible via the high alias. 1178c2ecf20Sopenharmony_ci * 1188c2ecf20Sopenharmony_ci * Simply access everything beyond the lowest 256MB of DDR using 1198c2ecf20Sopenharmony_ci * the high alias. 1208c2ecf20Sopenharmony_ci */ 1218c2ecf20Sopenharmony_ci entries++; 1228c2ecf20Sopenharmony_ci mem_array[2] = cpu_to_be32(PHYS_OFFSET + SZ_2G + SZ_256M); 1238c2ecf20Sopenharmony_ci mem_array[3] = cpu_to_be32(size); 1248c2ecf20Sopenharmony_ci } 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_cidone: 1278c2ecf20Sopenharmony_ci BUG_ON(entries > MAX_MEM_ARRAY_ENTRIES); 1288c2ecf20Sopenharmony_ci return entries; 1298c2ecf20Sopenharmony_ci} 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_cistatic void __init append_memory(void *fdt, int root_off) 1328c2ecf20Sopenharmony_ci{ 1338c2ecf20Sopenharmony_ci __be32 mem_array[2 * MAX_MEM_ARRAY_ENTRIES]; 1348c2ecf20Sopenharmony_ci unsigned long memsize; 1358c2ecf20Sopenharmony_ci unsigned mem_entries; 1368c2ecf20Sopenharmony_ci int i, err, mem_off; 1378c2ecf20Sopenharmony_ci enum mem_map mem_map; 1388c2ecf20Sopenharmony_ci u32 config; 1398c2ecf20Sopenharmony_ci char *var, param_name[10], *var_names[] = { 1408c2ecf20Sopenharmony_ci "ememsize", "memsize", 1418c2ecf20Sopenharmony_ci }; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci /* if a memory node already exists, leave it alone */ 1448c2ecf20Sopenharmony_ci mem_off = fdt_path_offset(fdt, "/memory"); 1458c2ecf20Sopenharmony_ci if (mem_off >= 0) 1468c2ecf20Sopenharmony_ci return; 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci /* find memory size from the bootloader environment */ 1498c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(var_names); i++) { 1508c2ecf20Sopenharmony_ci var = fw_getenv(var_names[i]); 1518c2ecf20Sopenharmony_ci if (!var) 1528c2ecf20Sopenharmony_ci continue; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci err = kstrtoul(var, 0, &physical_memsize); 1558c2ecf20Sopenharmony_ci if (!err) 1568c2ecf20Sopenharmony_ci break; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci pr_warn("Failed to read the '%s' env variable '%s'\n", 1598c2ecf20Sopenharmony_ci var_names[i], var); 1608c2ecf20Sopenharmony_ci } 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci if (!physical_memsize) { 1638c2ecf20Sopenharmony_ci pr_warn("The bootloader didn't provide memsize: defaulting to 32MB\n"); 1648c2ecf20Sopenharmony_ci physical_memsize = 32 << 20; 1658c2ecf20Sopenharmony_ci } 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) { 1688c2ecf20Sopenharmony_ci /* 1698c2ecf20Sopenharmony_ci * SOC-it swaps, or perhaps doesn't swap, when DMA'ing 1708c2ecf20Sopenharmony_ci * the last word of physical memory. 1718c2ecf20Sopenharmony_ci */ 1728c2ecf20Sopenharmony_ci physical_memsize -= PAGE_SIZE; 1738c2ecf20Sopenharmony_ci } 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci /* default to using all available RAM */ 1768c2ecf20Sopenharmony_ci memsize = physical_memsize; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci /* allow the user to override the usable memory */ 1798c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(var_names); i++) { 1808c2ecf20Sopenharmony_ci snprintf(param_name, sizeof(param_name), "%s=", var_names[i]); 1818c2ecf20Sopenharmony_ci var = strstr(arcs_cmdline, param_name); 1828c2ecf20Sopenharmony_ci if (!var) 1838c2ecf20Sopenharmony_ci continue; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci memsize = memparse(var + strlen(param_name), NULL); 1868c2ecf20Sopenharmony_ci } 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci /* if the user says there's more RAM than we thought, believe them */ 1898c2ecf20Sopenharmony_ci physical_memsize = max_t(unsigned long, physical_memsize, memsize); 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci /* detect the memory map in use */ 1928c2ecf20Sopenharmony_ci if (malta_scon() == MIPS_REVISION_SCON_ROCIT) { 1938c2ecf20Sopenharmony_ci /* ROCit has a register indicating the memory map in use */ 1948c2ecf20Sopenharmony_ci config = readl((void __iomem *)CKSEG1ADDR(ROCIT_CONFIG_GEN1)); 1958c2ecf20Sopenharmony_ci mem_map = config & ROCIT_CONFIG_GEN1_MEMMAP_MASK; 1968c2ecf20Sopenharmony_ci mem_map >>= ROCIT_CONFIG_GEN1_MEMMAP_SHIFT; 1978c2ecf20Sopenharmony_ci } else { 1988c2ecf20Sopenharmony_ci /* if not using ROCit, presume the v1 memory map */ 1998c2ecf20Sopenharmony_ci mem_map = MEM_MAP_V1; 2008c2ecf20Sopenharmony_ci } 2018c2ecf20Sopenharmony_ci if (mem_map > MEM_MAP_V2) 2028c2ecf20Sopenharmony_ci panic("Unsupported physical memory map v%u detected", 2038c2ecf20Sopenharmony_ci (unsigned int)mem_map); 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci /* append memory to the DT */ 2068c2ecf20Sopenharmony_ci mem_off = fdt_add_subnode(fdt, root_off, "memory"); 2078c2ecf20Sopenharmony_ci if (mem_off < 0) 2088c2ecf20Sopenharmony_ci panic("Unable to add memory node to DT: %d", mem_off); 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci err = fdt_setprop_string(fdt, mem_off, "device_type", "memory"); 2118c2ecf20Sopenharmony_ci if (err) 2128c2ecf20Sopenharmony_ci panic("Unable to set memory node device_type: %d", err); 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci mem_entries = gen_fdt_mem_array(mem_array, physical_memsize, mem_map); 2158c2ecf20Sopenharmony_ci err = fdt_setprop(fdt, mem_off, "reg", mem_array, 2168c2ecf20Sopenharmony_ci mem_entries * 2 * sizeof(mem_array[0])); 2178c2ecf20Sopenharmony_ci if (err) 2188c2ecf20Sopenharmony_ci panic("Unable to set memory regs property: %d", err); 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci mem_entries = gen_fdt_mem_array(mem_array, memsize, mem_map); 2218c2ecf20Sopenharmony_ci err = fdt_setprop(fdt, mem_off, "linux,usable-memory", mem_array, 2228c2ecf20Sopenharmony_ci mem_entries * 2 * sizeof(mem_array[0])); 2238c2ecf20Sopenharmony_ci if (err) 2248c2ecf20Sopenharmony_ci panic("Unable to set linux,usable-memory property: %d", err); 2258c2ecf20Sopenharmony_ci} 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_cistatic void __init remove_gic(void *fdt) 2288c2ecf20Sopenharmony_ci{ 2298c2ecf20Sopenharmony_ci int err, gic_off, i8259_off, cpu_off; 2308c2ecf20Sopenharmony_ci void __iomem *biu_base; 2318c2ecf20Sopenharmony_ci uint32_t cpu_phandle, sc_cfg; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci /* if we have a CM which reports a GIC is present, leave the DT alone */ 2348c2ecf20Sopenharmony_ci err = mips_cm_probe(); 2358c2ecf20Sopenharmony_ci if (!err && (read_gcr_gic_status() & CM_GCR_GIC_STATUS_EX)) 2368c2ecf20Sopenharmony_ci return; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci if (malta_scon() == MIPS_REVISION_SCON_ROCIT) { 2398c2ecf20Sopenharmony_ci /* 2408c2ecf20Sopenharmony_ci * On systems using the RocIT system controller a GIC may be 2418c2ecf20Sopenharmony_ci * present without a CM. Detect whether that is the case. 2428c2ecf20Sopenharmony_ci */ 2438c2ecf20Sopenharmony_ci biu_base = ioremap(MSC01_BIU_REG_BASE, 2448c2ecf20Sopenharmony_ci MSC01_BIU_ADDRSPACE_SZ); 2458c2ecf20Sopenharmony_ci sc_cfg = __raw_readl(biu_base + MSC01_SC_CFG_OFS); 2468c2ecf20Sopenharmony_ci if (sc_cfg & MSC01_SC_CFG_GICPRES_MSK) { 2478c2ecf20Sopenharmony_ci /* enable the GIC at the system controller level */ 2488c2ecf20Sopenharmony_ci sc_cfg |= BIT(MSC01_SC_CFG_GICENA_SHF); 2498c2ecf20Sopenharmony_ci __raw_writel(sc_cfg, biu_base + MSC01_SC_CFG_OFS); 2508c2ecf20Sopenharmony_ci return; 2518c2ecf20Sopenharmony_ci } 2528c2ecf20Sopenharmony_ci } 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci gic_off = fdt_node_offset_by_compatible(fdt, -1, "mti,gic"); 2558c2ecf20Sopenharmony_ci if (gic_off < 0) { 2568c2ecf20Sopenharmony_ci pr_warn("malta-dtshim: unable to find DT GIC node: %d\n", 2578c2ecf20Sopenharmony_ci gic_off); 2588c2ecf20Sopenharmony_ci return; 2598c2ecf20Sopenharmony_ci } 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci err = fdt_nop_node(fdt, gic_off); 2628c2ecf20Sopenharmony_ci if (err) 2638c2ecf20Sopenharmony_ci pr_warn("malta-dtshim: unable to nop GIC node\n"); 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci i8259_off = fdt_node_offset_by_compatible(fdt, -1, "intel,i8259"); 2668c2ecf20Sopenharmony_ci if (i8259_off < 0) { 2678c2ecf20Sopenharmony_ci pr_warn("malta-dtshim: unable to find DT i8259 node: %d\n", 2688c2ecf20Sopenharmony_ci i8259_off); 2698c2ecf20Sopenharmony_ci return; 2708c2ecf20Sopenharmony_ci } 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci cpu_off = fdt_node_offset_by_compatible(fdt, -1, 2738c2ecf20Sopenharmony_ci "mti,cpu-interrupt-controller"); 2748c2ecf20Sopenharmony_ci if (cpu_off < 0) { 2758c2ecf20Sopenharmony_ci pr_warn("malta-dtshim: unable to find CPU intc node: %d\n", 2768c2ecf20Sopenharmony_ci cpu_off); 2778c2ecf20Sopenharmony_ci return; 2788c2ecf20Sopenharmony_ci } 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci cpu_phandle = fdt_get_phandle(fdt, cpu_off); 2818c2ecf20Sopenharmony_ci if (!cpu_phandle) { 2828c2ecf20Sopenharmony_ci pr_warn("malta-dtshim: unable to get CPU intc phandle\n"); 2838c2ecf20Sopenharmony_ci return; 2848c2ecf20Sopenharmony_ci } 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci err = fdt_setprop_u32(fdt, i8259_off, "interrupt-parent", cpu_phandle); 2878c2ecf20Sopenharmony_ci if (err) { 2888c2ecf20Sopenharmony_ci pr_warn("malta-dtshim: unable to set i8259 interrupt-parent: %d\n", 2898c2ecf20Sopenharmony_ci err); 2908c2ecf20Sopenharmony_ci return; 2918c2ecf20Sopenharmony_ci } 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci err = fdt_setprop_u32(fdt, i8259_off, "interrupts", 2); 2948c2ecf20Sopenharmony_ci if (err) { 2958c2ecf20Sopenharmony_ci pr_warn("malta-dtshim: unable to set i8259 interrupts: %d\n", 2968c2ecf20Sopenharmony_ci err); 2978c2ecf20Sopenharmony_ci return; 2988c2ecf20Sopenharmony_ci } 2998c2ecf20Sopenharmony_ci} 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_civoid __init *malta_dt_shim(void *fdt) 3028c2ecf20Sopenharmony_ci{ 3038c2ecf20Sopenharmony_ci int root_off, len, err; 3048c2ecf20Sopenharmony_ci const char *compat; 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_ci if (fdt_check_header(fdt)) 3078c2ecf20Sopenharmony_ci panic("Corrupt DT"); 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci err = fdt_open_into(fdt, fdt_buf, sizeof(fdt_buf)); 3108c2ecf20Sopenharmony_ci if (err) 3118c2ecf20Sopenharmony_ci panic("Unable to open FDT: %d", err); 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci root_off = fdt_path_offset(fdt_buf, "/"); 3148c2ecf20Sopenharmony_ci if (root_off < 0) 3158c2ecf20Sopenharmony_ci panic("No / node in DT"); 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci compat = fdt_getprop(fdt_buf, root_off, "compatible", &len); 3188c2ecf20Sopenharmony_ci if (!compat) 3198c2ecf20Sopenharmony_ci panic("No root compatible property in DT: %d", len); 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci /* if this isn't Malta, leave the DT alone */ 3228c2ecf20Sopenharmony_ci if (strncmp(compat, "mti,malta", len)) 3238c2ecf20Sopenharmony_ci return fdt; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci append_memory(fdt_buf, root_off); 3268c2ecf20Sopenharmony_ci remove_gic(fdt_buf); 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci err = fdt_pack(fdt_buf); 3298c2ecf20Sopenharmony_ci if (err) 3308c2ecf20Sopenharmony_ci panic("Unable to pack FDT: %d\n", err); 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci return fdt_buf; 3338c2ecf20Sopenharmony_ci} 334