[U-Boot] [PATCH v2 0/5] toradex: configblock: apalis-imx8 and colibri-imx8x fixes

This series fixes some shortcomings of the current apalis-imx8 and colibri-imx8x SKU handling.
Changes in v2: - Added my S-b and others R-bs. - Avoid line continuations as pointed out by Max.
Marcel Ziswiler (4): toradex: configblock: generic wi-fi/bt handling toradex: configblock: fix colibri imx8x target toradex: configblock: fix apalis imx8 target toradex: configblock: avoid line continuations
Stefan Agner (1): toradex: configblock: initialize MMC before switching partition
board/toradex/common/tdx-cfg-block.c | 66 +++++++++++++++++++--------- 1 file changed, 46 insertions(+), 20 deletions(-)

From: Stefan Agner stefan.agner@toradex.com
If the module is in serial downloader mode, we do no longer read the environment from eMMC. Therefor, the eMMC is unitialized when trying to read the config block. Use mmc_init to initialize the selected MMC device before using it.
Note: In case the MMC has already been initialized, the mmc_init detects that and returns immediately.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Max Krummenacher max.krummenacher@toradex.com Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
---
Changes in v2: - Added my S-b and others R-bs.
board/toradex/common/tdx-cfg-block.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index f69c4433b2..67e0557f67 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -129,6 +129,10 @@ static int tdx_cfg_block_mmc_storage(u8 *config_block, int write) ret = -ENODEV; goto out; } + if (mmc_init(mmc)) { + puts("MMC init failed\n"); + return -EINVAL; + } if (part != mmc_get_blk_desc(mmc)->hwpart) { if (blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part)) { puts("MMC partition switch failed\n");

From: Stefan Agner stefan.agner@toradex.com If the module is in serial downloader mode, we do no longer read the environment from eMMC. Therefor, the eMMC is unitialized when trying to read the config block. Use mmc_init to initialize the selected MMC device before using it. Note: In case the MMC has already been initialized, the mmc_init detects that and returns immediately. Signed-off-by: Stefan Agner stefan.agner@toradex.com Acked-by: Max Krummenacher max.krummenacher@toradex.com Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Marcel Ziswiler marcel.ziswiler@toradex.com
Make the interactive Wi-Fi/BT handling generic by pulling it out of the Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and Colibri iMX8X.
Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
---
Changes in v2: - Avoid line continuation as reported by checkpatch. - Added R-bs.
board/toradex/common/tdx-cfg-block.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 67e0557f67..451f8d4c11 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -291,6 +291,7 @@ static int get_cfgblock_interactive(void) char message[CONFIG_SYS_CBSIZE]; char *soc; char it = 'n'; + char wb = 'n'; int len;
/* Unknown module by default */ @@ -300,10 +301,17 @@ static int get_cfgblock_interactive(void) sprintf(message, "Is the module the 312 MHz version? [y/N] "); else sprintf(message, "Is the module an IT version? [y/N] "); - len = cli_readline(message); it = console_buffer[0];
+#if defined(CONFIG_TARGET_APALIS_IMX8) || \ + defined(CONFIG_TARGET_COLIBRI_IMX6ULL) || \ + defined(CONFIG_TARGET_COLIBRI_IMX8X) + sprintf(message, "Does the module have Wi-Fi / Bluetooth? [y/N] "); + len = cli_readline(message); + wb = console_buffer[0]; +#endif + soc = env_get("soc"); if (!strcmp("mx6", soc)) { #ifdef CONFIG_TARGET_APALIS_IMX6 @@ -331,12 +339,6 @@ static int get_cfgblock_interactive(void) tdx_hw_tag.prodid = COLIBRI_IMX6S; } #elif CONFIG_TARGET_COLIBRI_IMX6ULL - char wb = 'n'; - - sprintf(message, "Does the module have Wi-Fi / Bluetooth? " \ - "[y/N] "); - len = cli_readline(message); - wb = console_buffer[0]; if (it == 'y' || it == 'Y') { if (wb == 'y' || wb == 'Y') tdx_hw_tag.prodid = COLIBRI_IMX6ULL_WIFI_BT_IT;

From: Marcel Ziswiler marcel.ziswiler@toradex.com Make the interactive Wi-Fi/BT handling generic by pulling it out of the Colibri iMX6ULL interactive part to be re-used for Apalis iMX8 and Colibri iMX8X. Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Marcel Ziswiler marcel.ziswiler@toradex.com
The Colibri iMX8X target got re-named late in the cycle which we forgot to reflect here. Furthermore, it was missing the interactive part should a customer have bricked his module and want to re-create the configuration block. Fix this.
Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
---
Changes in v2: - Added R-bs.
board/toradex/common/tdx-cfg-block.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 451f8d4c11..9146cbac94 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -8,7 +8,7 @@
#if defined(CONFIG_TARGET_APALIS_IMX6) || \ defined(CONFIG_TARGET_COLIBRI_IMX6) || \ - defined(CONFIG_TARGET_COLIBRI_IMX8QXP) + defined(CONFIG_TARGET_COLIBRI_IMX8X) #include <asm/arch/sys_proto.h> #else #define is_cpu_type(cpu) (0) @@ -355,9 +355,19 @@ static int get_cfgblock_interactive(void) tdx_hw_tag.prodid = COLIBRI_IMX7D; else if (!strcmp("imx7s", soc)) tdx_hw_tag.prodid = COLIBRI_IMX7S; - else if (is_cpu_type(MXC_CPU_IMX8QXP)) - tdx_hw_tag.prodid = COLIBRI_IMX8QXP_WIFI_BT_IT; - else if (!strcmp("tegra20", soc)) { + else if (is_cpu_type(MXC_CPU_IMX8QXP)) { + if (it == 'y' || it == 'Y') { + if (wb == 'y' || wb == 'Y') + tdx_hw_tag.prodid = COLIBRI_IMX8QXP_WIFI_BT_IT; + else + tdx_hw_tag.prodid = COLIBRI_IMX8QXP_IT; + } else { + if (wb == 'y' || wb == 'Y') + tdx_hw_tag.prodid = COLIBRI_IMX8DX_WIFI_BT; + else + tdx_hw_tag.prodid = COLIBRI_IMX8DX; + } + } else if (!strcmp("tegra20", soc)) { if (it == 'y' || it == 'Y') if (gd->ram_size == 0x10000000) tdx_hw_tag.prodid = COLIBRI_T20_256MB_IT;

From: Marcel Ziswiler marcel.ziswiler@toradex.com The Colibri iMX8X target got re-named late in the cycle which we forgot to reflect here. Furthermore, it was missing the interactive part should a customer have bricked his module and want to re-create the configuration block. Fix this. Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Marcel Ziswiler marcel.ziswiler@toradex.com
The Apalis iMX8 was missing the interactive part should a customer have bricked his module and want to re-create the configuration block. Fix this.
Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
---
Changes in v2: - Added R-bs.
board/toradex/common/tdx-cfg-block.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 9146cbac94..a7909d3898 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -7,6 +7,7 @@ #include "tdx-cfg-block.h"
#if defined(CONFIG_TARGET_APALIS_IMX6) || \ + defined(CONFIG_TARGET_APALIS_IMX8) || \ defined(CONFIG_TARGET_COLIBRI_IMX6) || \ defined(CONFIG_TARGET_COLIBRI_IMX8X) #include <asm/arch/sys_proto.h> @@ -355,7 +356,19 @@ static int get_cfgblock_interactive(void) tdx_hw_tag.prodid = COLIBRI_IMX7D; else if (!strcmp("imx7s", soc)) tdx_hw_tag.prodid = COLIBRI_IMX7S; - else if (is_cpu_type(MXC_CPU_IMX8QXP)) { + else if (is_cpu_type(MXC_CPU_IMX8QM)) { + if (it == 'y' || it == 'Y') { + if (wb == 'y' || wb == 'Y') + tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT; + else + tdx_hw_tag.prodid = APALIS_IMX8QM_IT; + } else { + if (wb == 'y' || wb == 'Y') + tdx_hw_tag.prodid = APALIS_IMX8QP_WIFI_BT; + else + tdx_hw_tag.prodid = APALIS_IMX8QP; + } + } else if (is_cpu_type(MXC_CPU_IMX8QXP)) { if (it == 'y' || it == 'Y') { if (wb == 'y' || wb == 'Y') tdx_hw_tag.prodid = COLIBRI_IMX8QXP_WIFI_BT_IT;

From: Marcel Ziswiler marcel.ziswiler@toradex.com The Apalis iMX8 was missing the interactive part should a customer have bricked his module and want to re-create the configuration block. Fix this. Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

From: Marcel Ziswiler marcel.ziswiler@toradex.com
Fix issue as reported by checkpatch.pl. Leave long lines as line continuation in text output is not recommended.
Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
---
Changes in v2: - Avoid line continuations as pointed out by Max. - Added R-bs.
board/toradex/common/tdx-cfg-block.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index a7909d3898..c19d7611c2 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -511,8 +511,7 @@ static int do_cfgblock_create(cmd_tbl_t *cmdtp, int flag, int argc, * On NAND devices, recreation is only allowed if the page is * empty (config block invalid...) */ - printf("NAND erase block %d need to be erased before creating" \ - " a Toradex config block\n", + printf("NAND erase block %d need to be erased before creating a Toradex config block\n", CONFIG_TDX_CFG_BLOCK_OFFSET / get_nand_dev_by_index(0)->erasesize); goto out; @@ -521,8 +520,7 @@ static int do_cfgblock_create(cmd_tbl_t *cmdtp, int flag, int argc, * On NOR devices, recreation is only allowed if the sector is * empty and write protection is off (config block invalid...) */ - printf("NOR sector at offset 0x%02x need to be erased and " \ - "unprotected before creating a Toradex config block\n", + printf("NOR sector at offset 0x%02x need to be erased and unprotected before creating a Toradex config block\n", CONFIG_TDX_CFG_BLOCK_OFFSET); goto out; #else @@ -633,9 +631,8 @@ static int do_cfgblock(cmd_tbl_t *cmdtp, int flag, int argc, return CMD_RET_USAGE; }
-U_BOOT_CMD( - cfgblock, 4, 0, do_cfgblock, - "Toradex config block handling commands", - "create [-y] [barcode] - (Re-)create Toradex config block\n" - "cfgblock reload - Reload Toradex config block from flash" +U_BOOT_CMD(cfgblock, 4, 0, do_cfgblock, + "Toradex config block handling commands", + "create [-y] [barcode] - (Re-)create Toradex config block\n" + "cfgblock reload - Reload Toradex config block from flash" );

From: Marcel Ziswiler marcel.ziswiler@toradex.com Fix issue as reported by checkpatch.pl. Leave long lines as line continuation in text output is not recommended. Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Reviewed-by: Igor Opaniuk igor.opaniuk@toradex.com Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic
participants (2)
-
Marcel Ziswiler
-
sbabic@denx.de