board: toradex: use get_nand_dev_by_index()
authorGrygorii Strashko <grygorii.strashko@ti.com>
Tue, 27 Jun 2017 00:13:06 +0000 (19:13 -0500)
committerTom Rini <trini@konsulko.com>
Wed, 12 Jul 2017 02:41:52 +0000 (22:41 -0400)
As part of preparation for nand DM conversion the new API has been
introduced to remove direct access to nand_info array. So, use it here
instead of accessing to nand_info array directly.

Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
board/toradex/colibri_t20/colibri_t20.c
board/toradex/common/tdx-cfg-block.c

index 7d574fbdab5324ffec68a8b8c6d19321e6f32717..71b8fd3ede0b90fc10327ed7f40d19e8c0953cc1 100644 (file)
@@ -69,7 +69,7 @@ int checkboard(void)
 {
        printf("Model: Toradex Colibri T20 %dMB V%s\n",
               (gd->ram_size == 0x10000000) ? 256 : 512,
-              (nand_info[0]->erasesize >> 10 == 512) ?
+              (get_nand_dev_by_index(0)->erasesize >> 10 == 512) ?
               ((gd->ram_size == 0x10000000) ? "1.1B" : "1.1C") : "1.2A");
 
        return 0;
index 68ec4369ad7e01ae11d987adca77679f8790b474..1bf8ca8f76d9ad17f12dd52ea2ee00ad753d5a6d 100644 (file)
@@ -154,8 +154,10 @@ static int read_tdx_cfg_block_from_nand(unsigned char *config_block)
        size_t size = TDX_CFG_BLOCK_MAX_SIZE;
 
        /* Read production parameter config block from NAND page */
-       return nand_read_skip_bad(nand_info[0], CONFIG_TDX_CFG_BLOCK_OFFSET,
-                        &size, NULL, TDX_CFG_BLOCK_MAX_SIZE, config_block);
+       return nand_read_skip_bad(get_nand_dev_by_index(0),
+                                 CONFIG_TDX_CFG_BLOCK_OFFSET,
+                                 &size, NULL, TDX_CFG_BLOCK_MAX_SIZE,
+                                 config_block);
 }
 
 static int write_tdx_cfg_block_to_nand(unsigned char *config_block)
@@ -163,7 +165,8 @@ static int write_tdx_cfg_block_to_nand(unsigned char *config_block)
        size_t size = TDX_CFG_BLOCK_MAX_SIZE;
 
        /* Write production parameter config block to NAND page */
-       return nand_write_skip_bad(nand_info[0], CONFIG_TDX_CFG_BLOCK_OFFSET,
+       return nand_write_skip_bad(get_nand_dev_by_index(0),
+                                  CONFIG_TDX_CFG_BLOCK_OFFSET,
                                   &size, NULL, TDX_CFG_BLOCK_MAX_SIZE,
                                   config_block, WITH_WR_VERIFY);
 }
@@ -426,7 +429,8 @@ static int do_cfgblock_create(cmd_tbl_t *cmdtp, int flag, int argc,
                 * empty (config block invalid...)
                 */
                printf("NAND erase block %d need to be erased before creating a Toradex config block\n",
-                      CONFIG_TDX_CFG_BLOCK_OFFSET / nand_info[0]->erasesize);
+                      CONFIG_TDX_CFG_BLOCK_OFFSET /
+                      get_nand_dev_by_index(0)->erasesize);
                goto out;
 #elif defined(CONFIG_TDX_CFG_BLOCK_IS_IN_NOR)
                /*