From patchwork Fri Feb 10 20:23:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 726713 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3vKmfK1jWlz9s82 for ; Sat, 11 Feb 2017 07:25:29 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 370CE4B820; Fri, 10 Feb 2017 21:24:32 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QviN4UA79k3x; Fri, 10 Feb 2017 21:24:32 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D1646B389C; Fri, 10 Feb 2017 21:23:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1737C4B64C for ; Fri, 10 Feb 2017 21:23:28 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gQa97thgWYo1 for ; Fri, 10 Feb 2017 21:23:28 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by theia.denx.de (Postfix) with ESMTPS id 14C5A4B63D for ; Fri, 10 Feb 2017 21:23:23 +0100 (CET) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v1AKN9Wo015927; Fri, 10 Feb 2017 14:23:09 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v1AKN9a3004048; Fri, 10 Feb 2017 14:23:09 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Fri, 10 Feb 2017 14:23:09 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v1AKN9PZ013434; Fri, 10 Feb 2017 14:23:09 -0600 Received: from localhost (uda0226610.am.dhcp.ti.com [128.247.83.96]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v1AKN9313588; Fri, 10 Feb 2017 14:23:09 -0600 (CST) From: Grygorii Strashko To: Lokesh Vutla , Lukasz Majewski , Tom Rini , Scott Wood , Joe Hershberger , Simon Glass Date: Fri, 10 Feb 2017 14:23:03 -0600 Message-ID: <20170210202304.20652-17-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.10.1.dirty In-Reply-To: <20170210202304.20652-1-grygorii.strashko@ti.com> References: <20170210202304.20652-1-grygorii.strashko@ti.com> MIME-Version: 1.0 Cc: Marcel Ziswiler , u-boot@lists.denx.de, Lucas Stach Subject: [U-Boot] [PATCH v3 16/17] board: toradex: use get_nand_dev_by_index() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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. Cc: Lucas Stach Cc: Marcel Ziswiler Signed-off-by: Grygorii Strashko Reviewed-by: Marcel Ziswiler --- board/toradex/colibri_t20/colibri_t20.c | 2 +- board/toradex/common/tdx-cfg-block.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c index 7d574fb..71b8fd3 100644 --- a/board/toradex/colibri_t20/colibri_t20.c +++ b/board/toradex/colibri_t20/colibri_t20.c @@ -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; diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 0014ce8..7722b92 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -153,8 +153,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) @@ -162,7 +164,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); } @@ -425,7 +428,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) /*