All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tommaso Merciai <tomm.merciai@gmail.com>
Cc: tomm.merciai@gmail.com, michael@amarulasolutions.com,
	Peng Fan <peng.fan@nxp.com>, Stefano Babic <sbabic@denx.de>,
	Fabio Estevam <festevam@gmail.com>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	Teresa Remmet <t.remmet@phytec.de>,
	u-boot@lists.denx.de
Subject: [RFC PATCH v3 2/5] imx: imx8mn_evk: override env_get_location
Date: Sat, 25 Dec 2021 21:25:51 +0100	[thread overview]
Message-ID: <20211225202554.47853-3-tomm.merciai@gmail.com> (raw)
In-Reply-To: <20211225202554.47853-1-tomm.merciai@gmail.com>

Override env_get_location function at board level, previously dropped
down from soc.c

References:
 - commit 37d3e3bb95d7532e2503f115dd6c6762fd3b0262

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
---
Changes since v1:
 - Fix code indentation using checkpatch as suggested by MBehún

 board/freescale/imx8mn_evk/imx8mn_evk.c | 35 +++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/board/freescale/imx8mn_evk/imx8mn_evk.c b/board/freescale/imx8mn_evk/imx8mn_evk.c
index 9a0a0488bf..ec1ab202a6 100644
--- a/board/freescale/imx8mn_evk/imx8mn_evk.c
+++ b/board/freescale/imx8mn_evk/imx8mn_evk.c
@@ -5,11 +5,46 @@
 
 #include <common.h>
 #include <env.h>
+#include <env_internal.h>
 #include <init.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/boot_mode.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+	enum boot_device dev = get_boot_device();
+	enum env_location env_loc = ENVL_UNKNOWN;
+
+	if (prio)
+		return env_loc;
+
+	if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH) && dev == QSPI_BOOT) {
+		env_loc = ENVL_SPI_FLASH;
+	} else if (IS_ENABLED(CONFIG_ENV_IS_IN_NAND) && dev == NAND_BOOT) {
+		env_loc = ENVL_NAND;
+	} else if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC)) {
+		switch (dev) {
+		case SD1_BOOT:
+		case SD2_BOOT:
+		case SD3_BOOT:
+		case MMC1_BOOT:
+		case MMC2_BOOT:
+		case MMC3_BOOT:
+			env_loc = ENVL_MMC;
+			break;
+		default:
+			break;
+		}
+	} else if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE)) {
+		env_loc = ENVL_MMC;
+	}
+
+	return env_loc;
+}
+
 int board_init(void)
 {
 	return 0;
-- 
2.25.1


  parent reply	other threads:[~2021-12-25 20:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-25 20:25 [RFC PATCH v3 0/5] imx8m: move env_get_location for imx8mn and imx8mp at board level Tommaso Merciai
2021-12-25 20:25 ` [RFC PATCH v3 1/5] imx8m: drop env_get_location for imx8mn and imx8mp Tommaso Merciai
2022-01-04 11:04   ` Teresa Remmet
2022-01-04 11:06     ` Michael Nazzareno Trimarchi
2022-01-04 11:48       ` Teresa Remmet
2022-01-08 19:08     ` Tommaso Merciai
2022-01-11  9:35       ` Teresa Remmet
2022-01-11 20:19         ` Tommaso Merciai
2021-12-25 20:25 ` Tommaso Merciai [this message]
2021-12-25 20:25 ` [RFC PATCH v3 3/5] imx: imx8mp_evk: override env_get_location Tommaso Merciai
2021-12-25 20:25 ` [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c Tommaso Merciai
2021-12-26  9:20   ` Adam Ford
2021-12-26 11:17     ` Tommaso Merciai
2021-12-26 11:23       ` Adam Ford
2021-12-26 11:46         ` Tommaso Merciai
2022-01-26 18:05   ` Adam Ford
2022-01-26 20:58     ` Tommaso Merciai
2022-01-27 16:59       ` Adam Ford
2022-01-27 17:01         ` Michael Nazzareno Trimarchi
2022-01-27 22:39         ` Tommaso Merciai
2021-12-25 20:25 ` [RFC PATCH v3 5/5] phytec: phycore_imx8mp: override env_get_location in phycore-imx8mp.c Tommaso Merciai
2022-01-04 10:56   ` Teresa Remmet

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=20211225202554.47853-3-tomm.merciai@gmail.com \
    --to=tomm.merciai@gmail.com \
    --cc=festevam@gmail.com \
    --cc=michael@amarulasolutions.com \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=t.remmet@phytec.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.