From patchwork Sat Apr 23 08:38:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 1621318 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=qAtMlLHm; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kll6n1d3tz9s0B for ; Sat, 23 Apr 2022 18:38:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B158B83A79; Sat, 23 Apr 2022 10:38:35 +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="qAtMlLHm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0FE6C83D34; Sat, 23 Apr 2022 10:38:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (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 3C27583A70 for ; Sat, 23 Apr 2022 10:38:30 +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-wm1-x336.google.com with SMTP id r19so6362269wmq.0 for ; Sat, 23 Apr 2022 01:38:30 -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:mime-version :content-transfer-encoding; bh=rpdjTCuckVnD3ZhJjinIYQaaNkLL+K6LQ8/GRqE/Oe0=; b=qAtMlLHmwixadtuG/sM1/1rqAsoM4r9G80SnfP9auX9cA1RqqBxsCAe7IbOFvH+iFj vaZ6nHz3a79ERxaWRJu8ibVJ4a0BOqsYt9Rppphr01jWPPy5xU05ma4o7pfSmVy0suzA umW2QqrWu4Zptx+yoxCNXwKdjHto2NEXZ9rVc= 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:mime-version :content-transfer-encoding; bh=rpdjTCuckVnD3ZhJjinIYQaaNkLL+K6LQ8/GRqE/Oe0=; b=YKT9p9x5IPukXM85g0wuKyxJiiFhvGu00+LJe6Vx5rsLslozwynqaS0IAfO8u7r1FL q4jVAZkICYEkGgu1tMrMHqEzvVkga5zj0lzNj3QjllAMxpkNfdDX9toAxki6iamMddkD I6+6CGC5wBg1QKNZCk6HFAa4zrC3qwiYvLbR++4LoC7ukFVjKAfLCj4LMIGA1U+2K8UW xb/gOAxNDiIKWgwRmgE4APqoUTrkrriyB1TJJzE5V6pse6pu+54XSilM6k3fAFdYRewy 6du2Uex1g/oT2woisfHjOAMJ0VPg/GwZcShnE/18BMxeEDCBjHi979Wjo9PvGldaFRD/ yP5g== X-Gm-Message-State: AOAM5326uC9vWjgRkk2gWjIKDKpm7AWL/vkgbWiI9GULnIktXTAI/seq z4O1g5HvEpPnxdo9Vh7lb2eWAw== X-Google-Smtp-Source: ABdhPJzRvmqLO/7op3lfnwxb/prKiXniE2N2HUma1113Xu38LhOTH26Wznalxvgl9DpkLaAjdknbJg== X-Received: by 2002:a05:600c:4fd0:b0:392:8cd5:8abe with SMTP id o16-20020a05600c4fd000b003928cd58abemr16893736wmq.73.1650703109758; Sat, 23 Apr 2022 01:38:29 -0700 (PDT) Received: from panicking.amarulasolutions.com ([5.171.215.34]) by smtp.gmail.com with ESMTPSA id i14-20020a0560001ace00b0020aac00f862sm3712398wry.98.2022.04.23.01.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Apr 2022 01:38:29 -0700 (PDT) From: Michael Trimarchi To: Tim Harvery , Ye Li Cc: Miquel Raynal , u-boot@lists.denx.de, Fabio Estevam , Dario Binacchi , Sean Anderson Subject: [RFC PATCH] spl: spl_nand: Fix bad block handling in fitImage Date: Sat, 23 Apr 2022 10:38:26 +0200 Message-Id: <20220423083826.31168-1-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 Signed-off-by: Michael Trimarchi --- 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;