
On Sun, Dec 26, 2021 at 09:20:30AM +0000, Adam Ford wrote:
On Sat, Dec 25, 2021 at 8:26 PM Tommaso Merciai tomm.merciai@gmail.com wrote:
Override env_get_location function at board level, previously dropped down from arch/arm/mach-imx/imx8m/soc.c
References:
- commit 37d3e3bb95d7532e2503f115dd6c6762fd3b0262
I am traveling, so I can't test this. However, I question why not make the function __weak and leave it where it was, so we don't have to copy this code from board to board. For those who need something that differs from this, they can write their own function which will replace the standard version.
adam
Hi Adam, Thanks for your reply. env_get_location function is already declared (__weak) in:
- env/env.c
Override 2 times the same function, is that correct?
I think can be a good solution too, declare it as __weak in soc.c and override it at board level.
Some References: - https://developer.arm.com/documentation/dui0491/i/Compiler-specific-Features...
Let me know.
Thanks, Tommaso
Signed-off-by: Tommaso Merciai tomm.merciai@gmail.com
board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/board/beacon/imx8mn/imx8mn_beacon.c b/board/beacon/imx8mn/imx8mn_beacon.c index 7fe252b262..05ab5613ee 100644 --- a/board/beacon/imx8mn/imx8mn_beacon.c +++ b/board/beacon/imx8mn/imx8mn_beacon.c @@ -6,14 +6,47 @@ #include <common.h> #include <miiphy.h> #include <netdev.h>
+#include <env_internal.h> #include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> +#include <asm/mach-imx/boot_mode.h> #include <asm/global_data.h> #include <asm/io.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;
+}
#if IS_ENABLED(CONFIG_FEC_MXC) static int setup_fec(void) { -- 2.25.1