U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Schultz <d.schultz@phytec.de>
To: <u-boot@lists.denx.de>, <trini@konsulko.com>, <upstream@lists.phytec.de>
Cc: <w.egorov@phytec.de>, <t.remmet@phytec.de>, <d-gole@ti.com>,
	Benjamin Hahn <B.Hahn@phytec.de>,
	Daniel Schultz <d.schultz@phytec.de>
Subject: [PATCH v2 1/9] include: env: phytec: Create env file for loading and applying overlays
Date: Tue, 16 Jul 2024 22:11:26 -0700	[thread overview]
Message-ID: <20240717051134.1538180-2-d.schultz@phytec.de> (raw)
In-Reply-To: <20240717051134.1538180-1-d.schultz@phytec.de>

From: Benjamin Hahn <B.Hahn@phytec.de>

The env scripts for loading and applying overlays are identical for many
PHYTEC Boards. Create a common env that can be included.

The env variables bootenv_addr and fdto_addr are board specific and need
to be set in the board specific file. The env variable get_cmd also
needs to be set in board specific files and can be set to tftp or dhcp.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
---
 include/env/phytec/overlays.env | 37 +++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 include/env/phytec/overlays.env

diff --git a/include/env/phytec/overlays.env b/include/env/phytec/overlays.env
new file mode 100644
index 00000000000..febb991f4f5
--- /dev/null
+++ b/include/env/phytec/overlays.env
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later  */
+/*
+ * Copyright (C) 2024 PHYTEC Messtechnik GmbH
+ * Author: Benjamin Hahn <b.hahn@phytec.de>
+ */
+
+/* Logic to load and apply overlays. Load overlays from bootenv.txt into
+ * environment and apply those overlays.
+ * The variables bootenv_addr and fdto_addr are board specific. */
+
+bootenv=bootenv.txt
+mmc_load_bootenv=load mmc ${mmcdev}:${mmcpart} ${bootenv_addr} ${bootenv}
+mmc_load_overlay=load mmc ${mmcdev}:${mmcpart} ${fdto_addr} ${overlay}
+mmc_apply_overlays=
+	fdt address ${fdt_addr};
+	if test ${no_overlays} = 0; then
+		for overlay in ${overlays};
+		do;
+			if run mmc_load_overlay; then
+				fdt resize ${filesize};
+				fdt apply ${fdto_addr};
+			fi;
+		done;
+	fi;
+net_load_bootenv=${get_cmd} ${bootenv_addr} ${bootenv}
+net_load_overlay=${get_cmd} ${fdto_addr} ${overlay}
+net_apply_overlays=
+	fdt address ${fdt_addr};
+	if test ${no_overlays} = 0; then
+		for overlay in ${overlays};
+		do;
+			if run net_load_overlay; then
+				fdt resize ${filesize};
+				fdt apply ${fdto_addr};
+			fi;
+		done;
+	fi;
-- 
2.25.1


  reply	other threads:[~2024-07-17  5:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17  5:11 [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Daniel Schultz
2024-07-17  5:11 ` Daniel Schultz [this message]
2024-07-17  5:11 ` [PATCH v2 2/9] phycore-imx8mp: Add overlay and bootenv.txt support Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 3/9] phycore_imx93: include common overlays.env Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 4/9] board: phytec: renaming of variables according to bootstd doc Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 5/9] include: env: " Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 6/9] include: env: phytec: Add common mmc boot for K3 SoMs Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 7/9] include: env: phytec: k3_mmc: Apply overlays during boot Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 8/9] board: phytec: phycore_am62x: Use k3_mmc.env logic Daniel Schultz
2024-07-17  5:11 ` [PATCH v2 9/9] board: phytec: phycore_am64x: " Daniel Schultz
2024-07-23 21:04 ` [PATCH v2 0/9] Generalize PHYTEC Overlay Handling Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240717051134.1538180-2-d.schultz@phytec.de \
    --to=d.schultz@phytec.de \
    --cc=B.Hahn@phytec.de \
    --cc=d-gole@ti.com \
    --cc=t.remmet@phytec.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=upstream@lists.phytec.de \
    --cc=w.egorov@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox