summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-07-22 13:48:24 -0600
committerTom Rini <[email protected]>2024-07-22 13:48:24 -0600
commitcfaa58b8b7839617a74a44a8f08b94b011f8edbc (patch)
treec95a63857d6c0cb43505def8826bbe8035bdb277 /include
parentf1aa32d65d31c8f8a43617e724495d0aad011620 (diff)
parentf1296bfff71b0cbac2241c0d6f1a88468c5af16d (diff)
Merge patch series "Generalize PHYTEC Overlay Handling"
Daniel Schultz <[email protected]> says: The overlays are specified in the bootenv.txt file that is loaded into the environment. Then these overlays get loaded and applied via a script. These scripts for loading and applying devicetree overlays are identical for many phytec boards. Create a common overlays.env that can be included. Add support for devicetree overlays to phycore-imx8mp and include the overlays.env for phycore-imx93. Rename existing environment variables according to bootstd doc. Move MMC boot logic into a common k3_mmc.env file and include the new overlays.env file as well.
Diffstat (limited to 'include')
-rw-r--r--include/env/phytec/k3_mmc.env21
-rw-r--r--include/env/phytec/overlays.env38
2 files changed, 59 insertions, 0 deletions
diff --git a/include/env/phytec/k3_mmc.env b/include/env/phytec/k3_mmc.env
new file mode 100644
index 00000000000..3d3595ceb7e
--- /dev/null
+++ b/include/env/phytec/k3_mmc.env
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2024 PHYTEC Messtechnik GmbH
+ * Author: Daniel Schultz <[email protected]>
+ */
+
+/* Logic for TI K3 based SoCs to boot from a MMC device. */
+
+#include <env/phytec/overlays.env>
+
+mmcargs=setenv bootargs console=${console} earlycon=${earlycon}
+ root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
+loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} Image
+loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
+mmcboot=run mmcargs;
+ mmc dev ${mmcdev};
+ mmc rescan;
+ run loadimage;
+ run loadfdt;
+ run mmc_apply_overlays;
+ booti ${loadaddr} - ${fdt_addr_r}
diff --git a/include/env/phytec/overlays.env b/include/env/phytec/overlays.env
new file mode 100644
index 00000000000..78721cde654
--- /dev/null
+++ b/include/env/phytec/overlays.env
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2024 PHYTEC Messtechnik GmbH
+ * Author: Benjamin Hahn <[email protected]>
+ */
+
+/* Logic to load and apply overlays. Load overlays from bootenv.txt into
+ * environment and apply those overlays.
+ * The variables bootenv_addr_r and fdtoverlay_addr_r are board specific.
+ * get_cmd can be either tftp or dhcp. */
+
+bootenv=bootenv.txt
+mmc_load_bootenv=load mmc ${mmcdev}:${mmcpart} ${bootenv_addr_r} ${bootenv}
+mmc_load_overlay=load mmc ${mmcdev}:${mmcpart} ${fdtoverlay_addr_r} ${overlay}
+mmc_apply_overlays=
+ fdt address ${fdt_addr_r};
+ if test ${no_overlays} = 0; then
+ for overlay in ${overlays};
+ do;
+ if run mmc_load_overlay; then
+ fdt resize ${filesize};
+ fdt apply ${fdtoverlay_addr_r};
+ fi;
+ done;
+ fi;
+net_load_bootenv=${get_cmd} ${bootenv_addr_r} ${bootenv}
+net_load_overlay=${get_cmd} ${fdtoverlay_addr_r} ${overlay}
+net_apply_overlays=
+ fdt address ${fdt_addr_r};
+ if test ${no_overlays} = 0; then
+ for overlay in ${overlays};
+ do;
+ if run net_load_overlay; then
+ fdt resize ${filesize};
+ fdt apply ${fdtoverlay_addr_r};
+ fi;
+ done;
+ fi;