From patchwork Mon Mar 1 22:33:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 1445788 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DqFRb2BC5z9sR4 for ; Tue, 2 Mar 2021 09:34:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BE49C81F8F; Mon, 1 Mar 2021 23:33:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 1BF6F80036; Mon, 1 Mar 2021 23:33:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from finn.localdomain (unknown [108.161.129.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3227180036 for ; Mon, 1 Mar 2021 23:33:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=tharvey@gateworks.com Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1lGr6k-001BgJ-W5; Mon, 01 Mar 2021 22:33:43 +0000 From: Tim Harvey To: Stefano Babic , Fabio Estevam Cc: u-boot@lists.denx.de, Tim Harvey Subject: [PATCH 01/11] spl: fit: nand: skip bad block handling if NAND chip not fully defined Date: Mon, 1 Mar 2021 14:33:27 -0800 Message-Id: <20210301223337.7763-2-tharvey@gateworks.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210301223337.7763-1-tharvey@gateworks.com> References: <20210301223337.7763-1-tharvey@gateworks.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean commit 9f6a14c47ff9 ("spl: fit: nand: fix fit loading in case of bad blocks") added support for adjusting the image offset to account for bad blocks. However this requires nand_spl_adjust_offset() which requires fully defined specifics of the NAND chip being used may not be avialable. Allow skipping this support for drivers or configs which don't specify the NAND chip details statically with defines. Signed-off-by: Tim Harvey Reviewed-by: Tom Rini --- common/spl/spl_nand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index d13a524597..8213836df4 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -42,11 +42,13 @@ static int spl_nand_load_image(struct spl_image_info *spl_image, static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs, ulong size, void *dst) { - ulong sector; int err; +#ifdef CONFIG_SYS_NAND_BLOCK_SIZE + ulong sector; sector = *(int *)load->priv; offs = sector + nand_spl_adjust_offset(sector, offs - sector); +#endif err = nand_spl_load_image(offs, size, dst); if (err) return 0;