imx8m: move env_get_location for imx8mn and imx8mp at board level
Subsystems (3)
v3 cover imx8m: move env_get_location for imx8mn and imx8mp at board level
This series move env_get_location from soc to board level. As suggested
by Michael <[email protected]> make no sense to define an unique way for multiple board. One board can boot from emmc and having
env on spi flash etc.. Anyways, this function is kept in imx8mn_evk, imx8mp_evk, phycore-imx8mp and imx8mn_beacon boards instead of being completely dropped.
Tommaso Merciai (5):
imx8m: drop env_get_location for imx8mn and imx8mp
imx: imx8mn_evk: override env_get_location
imx: imx8mp_evk: override env_get_location
beacon: imx8mn: override env_get_location in imx8mn_beacon.c
phytec: phycore_imx8mp: override env_get_location in phycore-imx8mp.c
arch/arm/mach-imx/imx8m/soc.c | 39 -------------------- board/beacon/imx8mn/imx8mn_beacon.c | 35 +++++++++++++++++- board/freescale/imx8mn_evk/imx8mn_evk.c | 35 ++++++++++++++++++ board/freescale/imx8mp_evk/imx8mp_evk.c | 34 +++++++++++++++++ board/phytec/phycore_imx8mp/phycore-imx8mp.c | 33 +++++++++++++++++ 5 files changed, 136 insertions(+), 40 deletions(-)
Signature · 1 line
2.25.1
RFC PATCH v3 1/5 imx8m: drop env_get_location for imx8mn and imx8mp
This function defined for two architecture is not really generic and can generate problem when people add a new board.
--- arch/arm/mach-imx/imx8m/soc.c | 39 ----------------------------------- 1 file changed, 39 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +0 -39
@@ -1313,45 +1313,6 @@ void do_error(struct pt_regs *pt_regs, unsigned int esr)#endif #if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) -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; - - switch (dev) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH - case QSPI_BOOT: - env_loc = ENVL_SPI_FLASH; - break; -#endif -#ifdef CONFIG_ENV_IS_IN_NAND - case NAND_BOOT: - env_loc = ENVL_NAND; - break; -#endif -#ifdef CONFIG_ENV_IS_IN_MMC - case SD1_BOOT: - case SD2_BOOT: - case SD3_BOOT: - case MMC1_BOOT: - case MMC2_BOOT: - case MMC3_BOOT: - env_loc = ENVL_MMC; - break; -#endif - default: -#if defined(CONFIG_ENV_IS_NOWHERE) - env_loc = ENVL_NOWHERE; -#endif - break; - } - - return env_loc; -} - #ifndef ENV_IS_EMBEDDED long long env_get_offset(long long defautl_offset) {
Signature · 1 line
2.25.1
Re: [RFC PATCH v3 1/5] imx8m: drop env_get_location for imx8mn and imx8mp
Hello Tommaso,
Am Samstag, dem 25.12.2021 um 21:25 +0100 schrieb Tommaso Merciai:
Quoted 50 lines
This function defined for two architecture is not really generic and can generate problem when people add a new board.
Signed-off-by Tommaso Merciai <[email protected]>--- arch/arm/mach-imx/imx8m/soc.c | 39 ------------------------------- ---- 1 file changed, 39 deletions(-)arch/arm/mach- renamed from arch/arm/mach-imx/imx8m/soc.c +0
-0
imx/imx8m/soc.c
index863508776d..f0030a557a100644arch/arm/mach-imx/imx8m/soc.c +0
-31@@ -1313,45 +1313,6 @@ void do_error(struct pt_regs *pt_regs, unsigned int esr)#endif #if defined(CONFIG_IMX8MN ) || defined(CONFIG_IMX8MP ) -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; - -switch (dev) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH -case QSPI_BOOT : - env_loc =ENVL_SPI_FLASH ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_NAND -case NAND_BOOT : - env_loc =ENVL_NAND ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_MMC -case SD1_BOOT : -case SD2_BOOT : -case SD3_BOOT : -case MMC1_BOOT : -case MMC2_BOOT : -case MMC3_BOOT : - env_loc =ENVL_MMC ; -break ; -#endif -default : -#if defined(CONFIG_ENV_IS_NOWHERE )
arch/arm/mach-imx/imx8m/soc.c void do_error(struct pt_regs *pt_regs, · line 1318
Quoted 10 lines
arch/arm/mach-imx/imx8m/soc.c +0
-8- env_loc =ENVL_NOWHERE ; -#endif -break ; - } - -return env_loc; -} -#ifndef ENV_IS_EMBEDDED long long env_get_offset (long long defautl_offset)
would it not make sense to move also env_get_offset() to board level?
Regards,
Teresa
Quoted 1 line
{
Signature · 5 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855
Re: [RFC PATCH v3 1/5] imx8m: drop env_get_location for imx8mn and imx8mp
Hi Teresa
Quoted 58 lines · Teresa Remmet
Hello Tommaso,
Am Samstag, dem 25.12.2021 um 21:25 +0100 schrieb Tommaso Merciai:
Quoted 54 lines
This function defined for two architecture is not really generic and can generate problem when people add a new board.
Signed-off-by Tommaso Merciai <[email protected]>--- arch/arm/mach-imx/imx8m/soc.c | 39 ------------------------------- ---- 1 file changed, 39 deletions(-)arch/arm/mach- renamed from arch/arm/mach-imx/imx8m/soc.c +0
-0
imx/imx8m/soc.c
index863508776d..f0030a557a100644arch/arm/mach-imx/imx8m/soc.c +0
-35@@ -1313,45 +1313,6 @@ void do_error(struct pt_regs *pt_regs, unsigned int esr)#endif #if defined(CONFIG_IMX8MN ) || defined(CONFIG_IMX8MP ) -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; - -switch (dev) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH -case QSPI_BOOT : - env_loc =ENVL_SPI_FLASH ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_NAND -case NAND_BOOT : - env_loc =ENVL_NAND ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_MMC -case SD1_BOOT : -case SD2_BOOT : -case SD3_BOOT : -case MMC1_BOOT : -case MMC2_BOOT : -case MMC3_BOOT : - env_loc =ENVL_MMC ; -break ; -#endif -default : -#if defined(CONFIG_ENV_IS_NOWHERE ) - env_loc =ENVL_NOWHERE ; -#endif -break ; - }
Quoted 9 lines
arch/arm/mach-imx/imx8m/soc.c void do_error(struct pt_regs *pt_regs, unsigned int esr) · line 1317
Quoted 6 lines
arch/arm/mach-imx/imx8m/soc.c +0
-4- -return env_loc; -} -#ifndef ENV_IS_EMBEDDED long long env_get_offset (long long defautl_offset)would it not make sense to move also
env_get_offset()to board level?
Drop it in another patch. This is not reference in uboot
Michael
Quoted 11 lines
Regards,
TeresaQuoted 1 line
{
--
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, GermanyGeschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [RFC PATCH v3 1/5] imx8m: drop env_get_location for imx8mn and imx8mp
Hello Michael,
Am Dienstag, dem 04.01.2022 um 12:06 +0100 schrieb Michael Nazzareno Trimarchi:
Quoted 74 lines
Hi Teresa
Quoted 60 lines · Teresa Remmet
Hello Tommaso,
Am Samstag, dem 25.12.2021 um 21:25 +0100 schrieb Tommaso Merciai:
Quoted 57 lines
This function defined for two architecture is not really generic and can generate problem when people add a new board.
Signed-off-by Tommaso Merciai <[email protected]>--- arch/arm/mach-imx/imx8m/soc.c | 39 --------------------------- ---- ---- 1 file changed, 39 deletions(-)arch/arm/mach- renamed from arch/arm/mach-imx/imx8m/soc.c +0
-0
imx/imx8m/soc.c
index863508776d..f0030a557a100644arch/arm/mach-imx/imx8m/soc.c +0
-36@@ -1313,45 +1313,6 @@ void do_error(struct pt_regs *pt_regs, unsigned int esr)#endif #if defined(CONFIG_IMX8MN ) || defined(CONFIG_IMX8MP ) -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; - -switch (dev) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH -case QSPI_BOOT : - env_loc =ENVL_SPI_FLASH ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_NAND -case NAND_BOOT : - env_loc =ENVL_NAND ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_MMC -case SD1_BOOT : -case SD2_BOOT : -case SD3_BOOT : -case MMC1_BOOT : -case MMC2_BOOT : -case MMC3_BOOT : - env_loc =ENVL_MMC ; -break ; -#endif -default : -#if defined(CONFIG_ENV_IS_NOWHERE ) - env_loc =ENVL_NOWHERE ; -#endif -break ; - } -Quoted 9 lines
Quoted 5 lines
arch/arm/mach-imx/imx8m/soc.c +0
-3-return env_loc; -} -#ifndef ENV_IS_EMBEDDED long long
env_get_offset(long long defautl_offset)would it not make sense to move also
env_get_offset()to board level?
Quoted 1 line
Drop it in another patch. This is not reference in uboot
Ah thanks!
Teresa
Quoted 19 lines
Michael
Quoted 14 lines
Regards,
TeresaQuoted 1 line
{
--
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, GermanyGeschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber |
Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE
149059855
Signature · 5 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855
Re: [RFC PATCH v3 1/5] imx8m: drop env_get_location for imx8mn and imx8mp
In reply to Teresa RemmetQuoted 57 lines · Teresa Remmet
Hello Tommaso,
Am Samstag, dem 25.12.2021 um 21:25 +0100 schrieb Tommaso Merciai:
Quoted 54 lines
This function defined for two architecture is not really generic and can generate problem when people add a new board.
Signed-off-by Tommaso Merciai <[email protected]>--- arch/arm/mach-imx/imx8m/soc.c | 39 ------------------------------- ---- 1 file changed, 39 deletions(-)arch/arm/mach- renamed from arch/arm/mach-imx/imx8m/soc.c +0
-0
imx/imx8m/soc.c
index863508776d..f0030a557a100644arch/arm/mach-imx/imx8m/soc.c +0
-35@@ -1313,45 +1313,6 @@ void do_error(struct pt_regs *pt_regs, unsigned int esr)#endif #if defined(CONFIG_IMX8MN ) || defined(CONFIG_IMX8MP ) -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; - -switch (dev) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH -case QSPI_BOOT : - env_loc =ENVL_SPI_FLASH ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_NAND -case NAND_BOOT : - env_loc =ENVL_NAND ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_MMC -case SD1_BOOT : -case SD2_BOOT : -case SD3_BOOT : -case MMC1_BOOT : -case MMC2_BOOT : -case MMC3_BOOT : - env_loc =ENVL_MMC ; -break ; -#endif -default : -#if defined(CONFIG_ENV_IS_NOWHERE ) - env_loc =ENVL_NOWHERE ; -#endif -break ; - }
Quoted 8 lines
arch/arm/mach-imx/imx8m/soc.c void do_error(struct pt_regs *pt_regs, unsigned int esr) · line 1317
Quoted 6 lines
arch/arm/mach-imx/imx8m/soc.c +0
-4- -return env_loc; -} -#ifndef ENV_IS_EMBEDDED long long env_get_offset (long long defautl_offset)would it not make sense to move also
env_get_offset()to board level?
Hi Teresa,
I think is better to put this function at board level. In this way others boards that use i.MX8MN/i.MX8MM SOC can customize env_get_location function. For example: maybe one user want store U-Boot env on a device other than the boot device.
Tommaso
Quoted 12 lines
Regards,
TeresaQuoted 1 line
{
Signature · 5 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855
Re: [RFC PATCH v3 1/5] imx8m: drop env_get_location for imx8mn and imx8mp
Hello Tommaso,
Am Samstag, dem 08.01.2022 um 20:08 +0100 schrieb Tommaso Merciai:
Quoted 70 lines · Teresa Remmet
Quoted 60 lines
Hello Tommaso,
Am Samstag, dem 25.12.2021 um 21:25 +0100 schrieb Tommaso Merciai:
Quoted 57 lines
This function defined for two architecture is not really generic and can generate problem when people add a new board.
Signed-off-by Tommaso Merciai <[email protected]>--- arch/arm/mach-imx/imx8m/soc.c | 39 --------------------------- ---- ---- 1 file changed, 39 deletions(-)arch/arm/mach- renamed from arch/arm/mach-imx/imx8m/soc.c +0
-0
imx/imx8m/soc.c
index863508776d..f0030a557a100644arch/arm/mach-imx/imx8m/soc.c +0
-36@@ -1313,45 +1313,6 @@ void do_error(struct pt_regs *pt_regs, unsigned int esr)#endif #if defined(CONFIG_IMX8MN ) || defined(CONFIG_IMX8MP ) -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; - -switch (dev) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH -case QSPI_BOOT : - env_loc =ENVL_SPI_FLASH ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_NAND -case NAND_BOOT : - env_loc =ENVL_NAND ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_MMC -case SD1_BOOT : -case SD2_BOOT : -case SD3_BOOT : -case MMC1_BOOT : -case MMC2_BOOT : -case MMC3_BOOT : - env_loc =ENVL_MMC ; -break ; -#endif -default : -#if defined(CONFIG_ENV_IS_NOWHERE ) - env_loc =ENVL_NOWHERE ; -#endif -break ; - } -Quoted 8 lines
Quoted 5 lines
arch/arm/mach-imx/imx8m/soc.c +0
-3-return env_loc; -} -#ifndef ENV_IS_EMBEDDED long long
env_get_offset(long long defautl_offset)would it not make sense to move also
env_get_offset()to board level?
Quoted 7 lines
Hi Teresa,
I think is better to put this function at board level. In this way others boards that use i.MX8MN/i.MX8MM SOC can customizeenv_get_location
function. For example: maybe one user want store U-Boot env on a device
other than the boot device.
Michael send a patch to remove the function. Which I missed. See:
https://lore.kernel.org/u-boot/[email protected]/
So everything is fine then.
Thanks,
Teresa
Quoted 16 lines
Tommaso
Quoted 14 lines
Regards,
TeresaQuoted 1 line
{
Signature · 8 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855
Signature · 5 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855
Re: [RFC PATCH v3 1/5] imx8m: drop env_get_location for imx8mn and imx8mp
Quoted 81 lines · Teresa Remmet
Hello Tommaso,
Am Samstag, dem 08.01.2022 um 20:08 +0100 schrieb Tommaso Merciai:
Quoted 70 lines · Teresa Remmet
Quoted 60 lines
Hello Tommaso,
Am Samstag, dem 25.12.2021 um 21:25 +0100 schrieb Tommaso Merciai:
Quoted 57 lines
This function defined for two architecture is not really generic and can generate problem when people add a new board.
Signed-off-by Tommaso Merciai <[email protected]>--- arch/arm/mach-imx/imx8m/soc.c | 39 --------------------------- ---- ---- 1 file changed, 39 deletions(-)arch/arm/mach- renamed from arch/arm/mach-imx/imx8m/soc.c +0
-0
imx/imx8m/soc.c
index863508776d..f0030a557a100644arch/arm/mach-imx/imx8m/soc.c +0
-36@@ -1313,45 +1313,6 @@ void do_error(struct pt_regs *pt_regs, unsigned int esr)#endif #if defined(CONFIG_IMX8MN ) || defined(CONFIG_IMX8MP ) -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; - -switch (dev) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH -case QSPI_BOOT : - env_loc =ENVL_SPI_FLASH ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_NAND -case NAND_BOOT : - env_loc =ENVL_NAND ; -break ; -#endif -#ifdef CONFIG_ENV_IS_IN_MMC -case SD1_BOOT : -case SD2_BOOT : -case SD3_BOOT : -case MMC1_BOOT : -case MMC2_BOOT : -case MMC3_BOOT : - env_loc =ENVL_MMC ; -break ; -#endif -default : -#if defined(CONFIG_ENV_IS_NOWHERE ) - env_loc =ENVL_NOWHERE ; -#endif -break ; - } -Quoted 8 lines
Quoted 5 lines
arch/arm/mach-imx/imx8m/soc.c +0
-3-return env_loc; -} -#ifndef ENV_IS_EMBEDDED long long
env_get_offset(long long defautl_offset)would it not make sense to move also
env_get_offset()to board level?Quoted 7 lines
Hi Teresa,
I think is better to put this function at board level. In this way others boards that use i.MX8MN/i.MX8MM SOC can customizeenv_get_location
function. For example: maybe one user want store U-Boot env on a device
other than the boot device.
Quoted 7 lines
Michael send a patch to remove the function. Which I missed. See:
https://lore.kernel.org/u-boot/[email protected]/So everything is fine then.
Thanks,
Teresa
Hi Teresa,
Perfect.
Thanks,
Tommaso
Quoted 23 lines
Quoted 17 lines
Tommaso
Quoted 14 lines
Regards,
TeresaQuoted 1 line
{
Signature · 8 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855Signature · 5 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855
RFC PATCH v3 2/5 imx: imx8mn_evk: override env_get_location
In reply to Tommaso MerciaiOverride env_get_location function at board level, previously dropped down from soc.c
References:
- commit 37d3e3bb95d7532e2503f115dd6c6762fd3b0262
---
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(+)
board/freescale/imx8mn_evk/imx8mn_evk.c +35 -0
@@ -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 ;
Signature · 1 line
2.25.1
RFC PATCH v3 3/5 imx: imx8mp_evk: override env_get_location
In reply to Tommaso MerciaiOverride env_get_location function at board level, previously dropped down from soc.c
References:
- commit 37d3e3bb95d7532e2503f115dd6c6762fd3b0262
---
Changes since v1:
- Fix code indentation using checkpatch as suggested by MBehún
board/freescale/imx8mp_evk/imx8mp_evk.c | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
board/freescale/imx8mp_evk/imx8mp_evk.c +34 -0
@@ -5,6 +5,7 @@#include <common.h> #include <env.h> +#include <env_internal.h> #include <errno.h> #include <init.h> #include <miiphy.h>
@@ -17,6 +18,7 @@#include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> #include <asm/mach-imx/gpio.h> +#include <asm/mach-imx/boot_mode.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -32,6 +34,38 @@ static iomux_v3_cfg_t const wdog_pads[] = { MX8MP_PAD_GPIO1_IO02__WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_PAD_CTRL), }; +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_early_init_f (void ) {struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR ;
Signature · 1 line
2.25.1
RFC PATCH v3 4/5 beacon: imx8mn: override env_get_location in imx8mn_beacon.c
In reply to Tommaso MerciaiOverride env_get_location function at board level, previously dropped down from arch/arm/mach-imx/imx8m/soc.c
References:
- commit 37d3e3bb95d7532e2503f115dd6c6762fd3b0262
--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
board/beacon/imx8mn/imx8mn_beacon.c +34 -1
@@ -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 ) {
Signature · 1 line
2.25.1
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
Quoted 7 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262
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
Quoted 63 lines
Signed-off-by Tommaso Merciai <[email protected]>--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +34
-2@@ -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
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
Quoted 10 lines · Adam Ford
Quoted 7 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262
Quoted 7 lines
I am traveling, so I can't test this. However, I question why not make the function
__weakand 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/--weak
Let me know.
Thanks,
Tommaso
Quoted 64 lines
Quoted 64 lines
Signed-off-by Tommaso Merciai <[email protected]>--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +34
-2@@ -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
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
Quoted 20 lines · Tommaso Merciai
Quoted 11 lines · Adam Ford
Quoted 7 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262I am traveling, so I can't test this. However, I question why not make
the
Quoted 6 lines
function
__weakand 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
Quoted 8 lines
Hi Adam,
Thanks for your reply.env_get_locationfunction is already declared (__weak) in:-
env/env.cOverride 2 times the same function, is that correct?
I didn't know it was already _weak. I am not sure it can be done in two places. i'm traveling, so i dont have the source code to review it.
Quoted 81 lines
I think can be a good solution too, declare it as
__weakinsoc.cand override
it at board level.Some References:
-
https://developer.arm.com/documentation/dui0491/i/Compiler-specific-Features/--weakLet me know.
Thanks,
TommasoQuoted 25 lines
Quoted 25 lines
Signed-off-by Tommaso Merciai <[email protected]>--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +2
-1@@ -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 ;Quoted 9 lines
board/beacon/imx8mn/imx8mn_beacon.c
Quoted 9 lines
board/beacon/imx8mn/imx8mn_beacon.c +9
-0+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) {Quoted 2 lines
board/beacon/imx8mn/imx8mn_beacon.c line 28
Quoted 2 lines
board/beacon/imx8mn/imx8mn_beacon.c +2
-0+ env_loc =ENVL_SPI_FLASH ; + } else if (IS_ENABLED(CONFIG_ENV_IS_IN_NAND) && dev ==
NAND_BOOT) {Quoted 28 lines
Quoted 28 lines
board/beacon/imx8mn/imx8mn_beacon.c +21
-1+ 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
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
Quoted 27 lines · Adam Ford
Quoted 24 lines · Tommaso Merciai
Quoted 11 lines · Adam Ford
Quoted 7 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262I am traveling, so I can't test this. However, I question why not make
the
Quoted 6 lines
function
__weakand 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_locationfunction is already declared (__weak) in:
Quoted 7 lines
Quoted 4 lines
-
env/env.cOverride 2 times the same function, is that correct?
I didn't know it was already
_weak. I am not sure it can be done in two places. i'm traveling, so i dont have the source code to review it.
No problem. Take your time.
Thanks,
Tommaso
Quoted 83 lines
Quoted 83 lines
I think can be a good solution too, declare it as
__weakinsoc.cand override
it at board level.Some References:
-
https://developer.arm.com/documentation/dui0491/i/Compiler-specific-Features/--weakLet me know.
Thanks,
TommasoQuoted 25 lines
Quoted 25 lines
Signed-off-by Tommaso Merciai <[email protected]>--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +2
-1@@ -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 ;Quoted 9 lines
board/beacon/imx8mn/imx8mn_beacon.c
Quoted 9 lines
board/beacon/imx8mn/imx8mn_beacon.c +9
-0+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) {Quoted 2 lines
board/beacon/imx8mn/imx8mn_beacon.c line 28
Quoted 2 lines
board/beacon/imx8mn/imx8mn_beacon.c +2
-0+ env_loc =ENVL_SPI_FLASH ; + } else if (IS_ENABLED(CONFIG_ENV_IS_IN_NAND) && dev ==
NAND_BOOT) {Quoted 28 lines
Quoted 28 lines
board/beacon/imx8mn/imx8mn_beacon.c +21
-1+ 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
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
In reply to Tommaso MerciaiQuoted 8 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262Signed-off-by Tommaso Merciai <[email protected]>
I am going to re-do the patch for the beacon board, because I talked it over with my colleagues, and we'd like to force the environment to one location or another and not base it on whether or not it was the boot device.
I guess my questions is what's the status of the remaining patch series, and how do I integrate my desired changes into it? I can send you what I want for my board if you're going to resubmit the series. I wonder if a sub-function could be called where the existing env_get_location() is renamed to something else, but declared as weak can called from env_get_location. Anyone who wants a their own function can write their own so we don't have two functions with the same name declared as weak.
What are your thoughts on that?
adam
Quoted 60 lines
--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +34
-2@@ -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
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
Quoted 10 lines · Adam Ford
Quoted 8 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262Signed-off-by Tommaso Merciai <[email protected]>
Hi Adam,
Quoted 8 lines
I am going to re-do the patch for the beacon board, because I talked it over with my colleagues, and we'd like to force the environment to one location or another and not base it on whether or not it was the boot device.
I guess my questions is what's the status of the remaining patch series, and how do I integrate my desired changes into it? I can send you what I want for my board if you're going to resubmit the series.
It's ok for me. Send me your changes.
Thanks.
Quoted 7 lines
I wonder if a sub-function could be called where the existing
env_get_location()is renamed to something else, but declared as weak can called fromenv_get_location. Anyone who wants a their own function can write their own so we don't have two functions with the same name declared as weak.What are your thoughts on that?
Right. In this way every boards that use imx8mp/imx8mn can override this function according to their own needs.
Tommaso
Quoted 62 lines
adam
Quoted 60 lines
--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +34
-2@@ -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
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
Quoted 33 lines · Tommaso Merciai
Quoted 10 lines · Adam Ford
Quoted 8 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262Signed-off-by Tommaso Merciai <[email protected]>Hi Adam,
Quoted 8 lines
I am going to re-do the patch for the beacon board, because I talked it over with my colleagues, and we'd like to force the environment to one location or another and not base it on whether or not it was the boot device.
I guess my questions is what's the status of the remaining patch series, and how do I integrate my desired changes into it? I can send you what I want for my board if you're going to resubmit the series.
It's ok for me. Send me your changes.
Thanks.Quoted 6 lines
I wonder if a sub-function could be called where the existing
env_get_location()is renamed to something else, but declared as weak can called fromenv_get_location. Anyone who wants a their own function can write their own so we don't have two functions with the same name declared as weak.
Quoted 5 lines
Quoted 1 line
What are your thoughts on that?
Right. In this way every boards that use imx8mp/imx8mn can override this function according to their own needs.
After trying some different options, I wonder if we can just delete env_get_location() completely from arch/arm/mach-imx/imx8m/soc.c.
For my board, it does exactly what I want when I delete that function since the default from env.c is sufficient. I think it's probably safest to use your original approach to move them to individual board files with the idea that some people may not need it at all. When placed into their board files, they can choose what they want for themselves.
I would suggest sending a patch without the RFC and place the function into the various imx8mn and imx8mp boards, but know that you can skip the beacon board. I would also suggest that you add a note that people should test this to see if it's really what they want or if they can live without the code and fall back on the default.
adam
Quoted 64 lines
Tommaso
Quoted 62 lines
adam
Quoted 60 lines
--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +34
-2@@ -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
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
Hi
Quoted 35 lines · Adam Ford
Quoted 33 lines · Tommaso Merciai
Quoted 10 lines · Adam Ford
Quoted 8 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262Signed-off-by Tommaso Merciai <[email protected]>Hi Adam,
Quoted 8 lines
I am going to re-do the patch for the beacon board, because I talked it over with my colleagues, and we'd like to force the environment to one location or another and not base it on whether or not it was the boot device.
I guess my questions is what's the status of the remaining patch series, and how do I integrate my desired changes into it? I can send you what I want for my board if you're going to resubmit the series.
It's ok for me. Send me your changes.
Thanks.Quoted 6 lines
I wonder if a sub-function could be called where the existing
env_get_location()is renamed to something else, but declared as weak can called fromenv_get_location. Anyone who wants a their own function can write their own so we don't have two functions with the same name declared as weak.
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
What are your thoughts on that?
Right. In this way every boards that use imx8mp/imx8mn can override this function according to their own needs.
After trying some different options, I wonder if we can just delete
env_get_location()completely fromarch/arm/mach-imx/imx8m/soc.c.
Totally agree. I sent patches to remove in the beginning. That function must be removed
Michael
Quoted 79 lines
For my board, it does exactly what I want when I delete that function since the default from
env.cis sufficient. I think it's probably safest to use your original approach to move them to individual board files with the idea that some people may not need it at all. When placed into their board files, they can choose what they want for themselves.I would suggest sending a patch without the RFC and place the function into the various imx8mn and imx8mp boards, but know that you can skip the beacon board. I would also suggest that you add a note that people should test this to see if it's really what they want or if they can live without the code and fall back on the default.
adam
Quoted 64 lines
Tommaso
Quoted 62 lines
adam
Quoted 60 lines
--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +34
-2@@ -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
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c
In reply to Adam FordQuoted 34 lines · Adam Ford
Quoted 33 lines · Tommaso Merciai
Quoted 10 lines · Adam Ford
Quoted 8 lines · Tommaso Merciai
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262Signed-off-by Tommaso Merciai <[email protected]>Hi Adam,
Quoted 8 lines
I am going to re-do the patch for the beacon board, because I talked it over with my colleagues, and we'd like to force the environment to one location or another and not base it on whether or not it was the boot device.
I guess my questions is what's the status of the remaining patch series, and how do I integrate my desired changes into it? I can send you what I want for my board if you're going to resubmit the series.
It's ok for me. Send me your changes.
Thanks.Quoted 6 lines
I wonder if a sub-function could be called where the existing
env_get_location()is renamed to something else, but declared as weak can called fromenv_get_location. Anyone who wants a their own function can write their own so we don't have two functions with the same name declared as weak.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
What are your thoughts on that?
Right. In this way every boards that use imx8mp/imx8mn can override this function according to their own needs.
Hi Adam,
Quoted 9 lines
After trying some different options, I wonder if we can just delete
env_get_location()completely fromarch/arm/mach-imx/imx8m/soc.c.For my board, it does exactly what I want when I delete that function since the default from
env.cis sufficient. I think it's probably safest to use your original approach to move them to individual board files with the idea that some people may not need it at all. When placed into their board files, they can choose what they want for themselves.
Ack.
Quoted 6 lines
I would suggest sending a patch without the RFC and place the function into the various imx8mn and imx8mp boards, but know that you can skip the beacon board. I would also suggest that you add a note that people should test this to see if it's really what they want or if they can live without the code and fall back on the default.
Ok, I'll send v4 of the series (without RFC label) in these days.
Thanks,
Tommaso
Quoted 67 lines
adam
Quoted 64 lines
Tommaso
Quoted 62 lines
adam
Quoted 60 lines
--- board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)board/beacon/imx8mn/imx8mn_beacon.c +34
-2@@ -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
RFC PATCH v3 5/5 phytec: phycore_imx8mp: override env_get_location in phycore-imx8mp.c
In reply to Tommaso MerciaiOverride env_get_location function at board level, previously dropped down from arch/arm/mach-imx/imx8m/soc.c
References:
- commit 37d3e3bb95d7532e2503f115dd6c6762fd3b0262
--- board/phytec/phycore_imx8mp/phycore-imx8mp.c | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+)
board/phytec/phycore_imx8mp/phycore-imx8mp.c +33 -0
@@ -11,9 +11,42 @@#include <asm/mach-imx/boot_mode.h> #include <env.h> #include <miiphy.h> +#include <env_internal.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; +} +static int setup_fec (void ) { struct iomuxc_gpr_base_regs *gpr =
Signature · 1 line
2.25.1
Re: [RFC PATCH v3 5/5] phytec: phycore_imx8mp: override env_get_location in phycore-imx8mp.c
Hello Tommaso,
thank you for working on this.
Am Samstag, dem 25.12.2021 um 21:25 +0100 schrieb Tommaso Merciai:
Quoted 29 lines
Override
env_get_locationfunction at board level, previously dropped down fromarch/arm/mach-imx/imx8m/soc.cReferences:
- commit37d3e3bb95d7532e2503f115dd6c6762fd3b0262Signed-off-by Tommaso Merciai <[email protected]>--- board/phytec/phycore_imx8mp/phycore-imx8mp.c | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+)board/phytec/phycore_imx8mp/phycore-imx8mp.c +5
-0@@ -11,9 +11,42 @@#include <asm/mach-imx/boot_mode.h> #include <env.h> #include <miiphy.h> +#include <env_internal.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 ;
board/phytec/phycore_imx8mp/phycore-imx8mp.c line 31
Quoted 10 lines
board/phytec/phycore_imx8mp/phycore-imx8mp.c +8
-0+ +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 ;
For phyCORE-i.MX8MP board code you could just remove the NAND part. As there is no NAND flash available on the hardware.
Thanks,
Teresa
Quoted 23 lines
board/phytec/phycore_imx8mp/phycore-imx8mp.c +20
-0+ }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; +} +static int setup_fec (void ){
structiomuxc_gpr_base_regs*gpr =
Signature · 5 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855