Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3DE08C433EF for ; Sun, 15 May 2022 09:26:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 56F4883F60; Sun, 15 May 2022 11:26:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="E+PF5PFZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C4B984099; Sun, 15 May 2022 11:26:00 +0200 (CEST) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A7FA784011 for ; Sun, 15 May 2022 11:25:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@amarulasolutions.com Received: by mail-ej1-x630.google.com with SMTP id tk15so46293ejc.6 for ; Sun, 15 May 2022 02:25:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lqpc+4C+2iXEt08Np8F5Se0LUURUGSaGVqPRbJIufRg=; b=E+PF5PFZVVPDSRdq60+wPqmqLCt4NvE/9v/TzHZ5vx5x3Bp3E0QLM6DojV7VOgowLe KPfuPU36clSzBv3LbtvHZOxRFAy4RDYSKBy3MEHyl5vSJBpnWtoCVCijT+dICReJI1RI Xnz9JcXTgHnVmAR97YUlhu4DpOpfR88UVDP9A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lqpc+4C+2iXEt08Np8F5Se0LUURUGSaGVqPRbJIufRg=; b=NXQ4iCGnufmnaUGcsrI5Jeugw/uSQFKNldscn2T4zbYXu5Qf4NDmgaV2Y+IQn6o53+ 5s3wPG9iu/UYLc1jYn4reUOdpD1ls1KjlJeRuWfiUoAztDTY++gfh7U1byRc+cDRIyNe SI+myidhOopdiR3rV4Kc1TZ9nDTUHrPRGBN7HbJ2BEXXirtQA0nPdW6bknrtMBHp0P6K fRJNaTwaI27gd9oIeAAUR55n63sHzeoR7gK0BqXLy6WKZHAHK+vq/Z45pf+zki4v+ie5 cEXBAmPridU4FriHGfkcFtxcCZwwUfL7+Z160XF5NWPhGqrjIZqQ3uul4zQDB51Qvi+z 7e5A== X-Gm-Message-State: AOAM530s7c4ZGPVi+YJUJiwGfUtLnZlDrd/0zRy+1UisAWuuojYFcGwq CF+35HxnATGAUi/34CD5HOcuYw== X-Google-Smtp-Source: ABdhPJxJYDESEuG/s+io50U/OUw5eAfF8QHZ9Gn4DqlbyAMMKm0YImDVlTKGJ2jFFQVpEkcARqp6oQ== X-Received: by 2002:a17:906:3a45:b0:6f4:e9e7:4ff with SMTP id a5-20020a1709063a4500b006f4e9e704ffmr10990920ejf.100.1652606751407; Sun, 15 May 2022 02:25:51 -0700 (PDT) Received: from localhost.localdomain (mob-109-118-140-232.net.vodafone.it. [109.118.140.232]) by smtp.gmail.com with ESMTPSA id m17-20020a17090677d100b006f3ef214dc5sm2509888ejn.43.2022.05.15.02.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 May 2022 02:25:50 -0700 (PDT) From: Michael Trimarchi To: Han Xu , U-Boot-Denx Cc: Ye Li , Stefano Babic , Miquel Raynal , Fabio Estevam , Dario Binacchi , Sean Anderson , linux-amarula@amarulasolutions.com, Jagan Teki , Ariel D'Alessandro , Tom Rini , Fabio Estevam , Tim Harvey Subject: [PATCH V3 4/5] spl: spl_nand: Fix bad block handling in fitImage Date: Sun, 15 May 2022 11:25:37 +0200 Message-Id: <20220515092538.1736154-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220515092538.1736154-1-michael@amarulasolutions.com> References: <20220515092538.1736154-1-michael@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean If the fitImage has some bad block in fit image area, the offset must be recalulcated. This should be done always. After implementing it in mxs now is possible to call the function even for that platform. Cc: Fabio Estevam Tested-By: Tim Harvey Reviewed-by: Tom Rini Signed-off-by: Michael Trimarchi --- V2->V3: - Add tested-by from Tim - Add ack from Han Xu V1->V2: - move out from RFC --- common/spl/spl_nand.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index fc61b447a5..82a10ffa63 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -43,15 +43,12 @@ static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs, ulong size, void *dst) { int err; -#ifdef CONFIG_SYS_NAND_BLOCK_SIZE ulong sector; sector = *(int *)load->priv; - offs = sector + nand_spl_adjust_offset(sector, offs - sector); -#else offs *= load->bl_len; size *= load->bl_len; -#endif + offs = sector + nand_spl_adjust_offset(sector, offs - sector); err = nand_spl_load_image(offs, size, dst); if (err) return 0; -- 2.25.1