summaryrefslogtreecommitdiff
path: root/board/toradex/common/tdx-cfg-block.c
diff options
context:
space:
mode:
authorGrygorii Strashko <grygorii.strashko@ti.com>2017-06-26 19:13:06 -0500
committerTom Rini <trini@konsulko.com>2017-07-11 22:41:52 -0400
commitbf264cd0f61568404e717eb067e3e2e825715531 (patch)
tree7333e2a04edd0af389a27a28053eee9d8ccf0b94 /board/toradex/common/tdx-cfg-block.c
parent573cc46c652865325690d1559cea221692687872 (diff)
board: toradex: use get_nand_dev_by_index()
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>
Diffstat (limited to 'board/toradex/common/tdx-cfg-block.c')
-rw-r--r--board/toradex/common/tdx-cfg-block.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index 68ec4369ad..1bf8ca8f76 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -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)
/*