Skip to contentSkip to conversation

toradex: configblock: apalis-imx8 and colibri-imx8x fixes

PATCH New Marcel Ziswiler 2 participants 11 messages Jul 12, 2019 – Jul 20, 2019 x86 trust domain extensions (TDX)

lore
Share & tools
lore
#0 lore raw

v2 cover 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(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH v2 1/5 toradex: configblock: initialize MMC before switching partition

From: Stefan Agner <[email protected]>

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.

---

Changes in v2:
- Added my S-b and others R-bs.

 board/toradex/common/tdx-cfg-block.c | 4 ++++
 1 file changed, 4 insertions(+)
board/toradex/common/tdx-cfg-block.c +4 -0
index f69c4433b2..67e0557f67 100644
@@ -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");
Signature · 1 line
2.21.0
#2 lore raw

PATCH v2 1/5 toradex: configblock: initialize MMC before switching partition

Quoted 7 lines

From: Stefan Agner <[email protected]>
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.

Quoted 5 lines

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH v2 2/5 toradex: configblock: generic wi-fi/bt handling

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

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.

---

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(-)
board/toradex/common/tdx-cfg-block.c +9 -7
index 67e0557f67..451f8d4c11 100644
@@ -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;
Signature · 1 line
2.21.0
#4 lore raw

PATCH v2 2/5 toradex: configblock: generic wi-fi/bt handling

Quoted 7 lines

From: Marcel Ziswiler <[email protected]>
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.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH v2 3/5 toradex: configblock: fix colibri imx8x target

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

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.

---

Changes in v2:
- Added R-bs.

 board/toradex/common/tdx-cfg-block.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
board/toradex/common/tdx-cfg-block.c +14 -4
index 451f8d4c11..9146cbac94 100644
@@ -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;
Signature · 1 line
2.21.0
#6 lore raw

PATCH v2 3/5 toradex: configblock: fix colibri imx8x target

Quoted 8 lines

From: Marcel Ziswiler <[email protected]>
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.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#7 lore raw

PATCH v2 4/5 toradex: configblock: fix apalis imx8 target

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

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.

---

Changes in v2:
- Added R-bs.

 board/toradex/common/tdx-cfg-block.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
board/toradex/common/tdx-cfg-block.c +14 -1
index 9146cbac94..a7909d3898 100644
@@ -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;
Signature · 1 line
2.21.0
#8 lore raw

PATCH v2 4/5 toradex: configblock: fix apalis imx8 target

Quoted 7 lines

From: Marcel Ziswiler <[email protected]>
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.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#9 lore raw

PATCH v2 5/5 toradex: configblock: avoid line continuations

In reply to Marcel Ziswiler

From: Marcel Ziswiler <[email protected]>

Fix issue as reported by checkpatch.pl. Leave long lines as line continuation in text output is not recommended.

---

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(-)
board/toradex/common/tdx-cfg-block.c +6 -9
index a7909d3898..c19d7611c2 100644
@@ -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"
 );
Signature · 1 line
2.21.0
#10 lore raw

PATCH v2 5/5 toradex: configblock: avoid line continuations

Quoted 6 lines

From: Marcel Ziswiler <[email protected]> Fix issue as reported by checkpatch.pl. Leave long lines as line continuation in text output is not recommended.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================