aboutsummaryrefslogtreecommitdiffstats
path: root/roms/u-boot/arch/arm/lib/bootm-fdt.c
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/u-boot/arch/arm/lib/bootm-fdt.c
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/u-boot/arch/arm/lib/bootm-fdt.c')
-rw-r--r--roms/u-boot/arch/arm/lib/bootm-fdt.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/roms/u-boot/arch/arm/lib/bootm-fdt.c b/roms/u-boot/arch/arm/lib/bootm-fdt.c
new file mode 100644
index 000000000..29020bd1c
--- /dev/null
+++ b/roms/u-boot/arch/arm/lib/bootm-fdt.c
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2013, Google Inc.
+ *
+ * Copyright (C) 2011
+ * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
+ * - Added prep subcommand support
+ * - Reorganized source - modeled after powerpc version
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger@sysgo.de>
+ *
+ * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
+ */
+
+#include <common.h>
+#include <fdt_support.h>
+#ifdef CONFIG_ARMV7_NONSEC
+#include <asm/armv7.h>
+#endif
+#include <asm/global_data.h>
+#include <asm/psci.h>
+#include <asm/spin_table.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_FMAN_ENET
+__weak int fdt_update_ethernet_dt(void *blob)
+{
+ return 0;
+}
+#endif
+
+int arch_fixup_fdt(void *blob)
+{
+ __maybe_unused int ret = 0;
+#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_OF_LIBFDT)
+ struct bd_info *bd = gd->bd;
+ int bank;
+ u64 start[CONFIG_NR_DRAM_BANKS];
+ u64 size[CONFIG_NR_DRAM_BANKS];
+
+ for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
+ start[bank] = bd->bi_dram[bank].start;
+ size[bank] = bd->bi_dram[bank].size;
+#ifdef CONFIG_ARMV7_NONSEC
+ ret = armv7_apply_memory_carveout(&start[bank], &size[bank]);
+ if (ret)
+ return ret;
+#endif
+ }
+
+#ifdef CONFIG_OF_LIBFDT
+ ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
+ if (ret)
+ return ret;
+#endif
+
+#ifdef CONFIG_ARMV8_SPIN_TABLE
+ ret = spin_table_update_dt(blob);
+ if (ret)
+ return ret;
+#endif
+
+#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV8_PSCI) || \
+ CONFIG_IS_ENABLED(SEC_FIRMWARE_ARMV8_PSCI)
+ ret = psci_update_dt(blob);
+ if (ret)
+ return ret;
+#endif
+#endif
+
+#ifdef CONFIG_FMAN_ENET
+ ret = fdt_update_ethernet_dt(blob);
+ if (ret)
+ return ret;
+#endif
+ return 0;
+}