Skip to contentSkip to conversation

board: toradex: common: fail gracefully on missing NAND chip

PATCH New Stefan Agner 1 participant 2 messages Aug 6, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 board: toradex: common: fail gracefully on missing NAND chip

From: Stefan Agner <[email protected]>

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail gracefully in this case.

---

 board/toradex/common/tdx-cfg-block.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
board/toradex/common/tdx-cfg-block.c +5 -2
index 57edb6c5c9..d4f5b1803a 100644
@@ -156,10 +156,13 @@ out:
 static int read_tdx_cfg_block_from_nand(unsigned char *config_block)
 {
 	size_t size = TDX_CFG_BLOCK_MAX_SIZE;
+	struct mtd_info *mtd = get_nand_dev_by_index(0);
+
+	if (!mtd)
+		return -ENODEV;
 
 	/* Read production parameter config block from NAND page */
-	return nand_read_skip_bad(get_nand_dev_by_index(0),
-				  CONFIG_TDX_CFG_BLOCK_OFFSET,
+	return nand_read_skip_bad(mtd, CONFIG_TDX_CFG_BLOCK_OFFSET,
 				  &size, NULL, TDX_CFG_BLOCK_MAX_SIZE,
 				  config_block);
 }
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/2 colibri_imx7_emmc: add Colibri iMX7D 1GB (eMMC) module support

From: Stefan Agner <[email protected]>

This commit adds support for the Toradex Colibri iMX7D 1GB Computer on Module. The module is very similar to the Colibri iMX7D 512MB but uses eMMC instead of raw NAND. This patch introduces a new board specific Kconfig symbol to select between the two flash options.

---

 board/toradex/colibri_imx7/Kconfig        | 42 ++++++++++-
 board/toradex/colibri_imx7/MAINTAINERS    |  4 +
 board/toradex/colibri_imx7/colibri_imx7.c | 41 ++++++++++-
 include/configs/colibri_imx7.h            | 90 ++++++++++++++++++-----
 4 files changed, 154 insertions(+), 23 deletions(-)
board/toradex/colibri_imx7/Kconfig +41 -1
index 414a600eef..d33ec63523 100644
@@ -1,5 +1,24 @@
 if TARGET_COLIBRI_IMX7
 
+choice
+	prompt "Colibri iMX7S/D variant"
+
+config TARGET_COLIBRI_IMX7_NAND
+	bool "Support Colibri iMX7 Solo 256MB/Dual 512MB (raw NAND) modules"
+	imply NAND_MXS
+	help
+	  Choose this option if you build for a Toradex Colibri iMX7S
+	  256MB or Colibri iMX7D 512MB module which do have raw NAND
+	  on-module.
+
+config TARGET_COLIBRI_IMX7_EMMC
+	bool "Support Colibri iMX7 Dual 1GB (eMMC) modules"
+	help
+	  Choose this option if you build for a Toradex Colibri iMX7D
+	  1GB module which does have eMMC on-module.
+
+endchoice
+
 config SYS_BOARD
 	default "colibri_imx7"
 
@@ -19,6 +38,11 @@ config COLIBRI_IMX7_EXT_PHYCLK
 config TDX_CFG_BLOCK
 	default y
 
+config TDX_CFG_BLOCK_2ND_ETHADDR
+	default y
+
+if TARGET_COLIBRI_IMX7_NAND
+
 config TDX_HAVE_NAND
 	default y
 
@@ -28,9 +52,25 @@ config TDX_CFG_BLOCK_OFFSET
 config TDX_CFG_BLOCK_OFFSET2
 	default "133120"
 
-config TDX_CFG_BLOCK_2ND_ETHADDR
+endif
+
+if TARGET_COLIBRI_IMX7_EMMC
+
+config TDX_HAVE_MMC
 	default y
 
+config TDX_CFG_BLOCK_DEV
+	default "0"
+
+config TDX_CFG_BLOCK_PART
+	default "1"
+
+# Toradex config block in eMMC, at the end of 1st "boot sector"
+config TDX_CFG_BLOCK_OFFSET
+	default "-512"
+
+endif
+
 source "board/toradex/common/Kconfig"
 
 endif
board/toradex/colibri_imx7/MAINTAINERS +4 -0
index 5ffb2417aa..9c1d42aa8c 100644
@@ -1,6 +1,10 @@
 Colibri iMX7
 M:	Stefan Agner <[email protected]>
+M:	Toradex ARM Support <[email protected]>
+W:	http://developer.toradex.com/software/linux/linux-software
+W:	https://www.toradex.com/community
 S:	Maintained
 F:	board/toradex/colibri_imx7/
 F:	include/configs/colibri_imx7.h
 F:	configs/colibri_imx7_defconfig
+F:	configs/colibri_imx7_emmc_defconfig
board/toradex/colibri_imx7/colibri_imx7.c +37 -4

88 lines not on this page · raw message

include/configs/colibri_imx7.h +72 -18

166 lines not on this page · raw message

Signature · 1 line
2.18.0