Merge tag 'arc-updates-for-2018.09' of git://git.denx.de/u-boot-arc
[oweals/u-boot.git] / board / toradex / common / tdx-cfg-block.c
index f850a3c98e50389d21ef7dad156ad0d797877e47..d4f5b1803ad68fb376020a0df800f7bbc14936ea 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2016 Toradex, Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -92,6 +91,13 @@ const char * const toradex_modules[] = {
        [33] = "Colibri iMX7 Dual 512MB",
        [34] = "Apalis TK1 2GB",
        [35] = "Apalis iMX6 Dual 1GB IT",
+       [36] = "Colibri iMX6ULL 256MB",
+       [37] = "Apalis iMX8 QuadMax 4GB Wi-Fi / Bluetooth",
+       [38] = "Colibri iMX8X",
+       [39] = "Colibri iMX7 Dual 1GB (eMMC)",
+       [40] = "Colibri iMX6ULL 512MB Wi-Fi / Bluetooth IT",
+       [41] = "Colibri iMX7 Dual 512MB EPDC",
+       [42] = "Apalis TK1 4GB",
 };
 
 #ifdef CONFIG_TDX_CFG_BLOCK_IS_IN_MMC
@@ -150,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);
 }