From mboxrd@z Thu Jan 1 00:00:00 1970 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 2E5DDC433EF for ; Sun, 15 May 2022 09:36:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B409184217; Sun, 15 May 2022 11:36:13 +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="ikLw7IIz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D63C88405A; Sun, 15 May 2022 11:35:57 +0200 (CEST) Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (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 E0FBF83F68 for ; Sun, 15 May 2022 11:35:49 +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-x62e.google.com with SMTP id i27so23522396ejd.9 for ; Sun, 15 May 2022 02:35:49 -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=HIJm0hdkQ6uc0gFfWcYsba71RxUpTyUBv/+jqi+ooyw=; b=ikLw7IIzwXIlqQklDNbsqjgS9K4T0EfCRV4Blddoz3bUK7InJ63nVCPb2+unP5UFgd UebkIKbSyUg9coYf5cDPrmsBa5SyR5aa9murLPyIw0of/GH9fbIu3Mvt7HPthxfM+3Fx 3leNatmv1HAOHItO+MuUNZURBpgBghu7HYrb0= 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=HIJm0hdkQ6uc0gFfWcYsba71RxUpTyUBv/+jqi+ooyw=; b=Gq8VP4vBQBQi9u8ViHWQP/tj8llRgB6Aarg9rxRSub+HloE0yRiUWdB2sCdvY9haow rkbeU2xQ5YuwU+uWBs7XioV4ey3vgBVi/ANF4jv91gceMZrQXm80pf7Ui04fZz40d1Mc NJXuBFymvtETz0rtZRwLOWwBVO92Ev4o8jkL2g8dRE9KDGJ731CPoxDBz/miaPgvQ31L ZjVDFQtbnz5aoL5paIdu45OY6FpxvAdRS2pP8e8JZr8xmccw7L5OcTrpdyvtQqtalED6 QQw7ZzBBbk84KXb8/XpD/iknUDb6nKT/n81uPY3b3nkEnIV5sHJVRsf8tvN200ToVC0U zuQw== X-Gm-Message-State: AOAM533jeozkYujAjHn7brO2Zf3gdvhux6IDxSR7sCrTiXGUj4YypFMb 1zPeSE0jFg5PKkJb+pflwMKUfQ== X-Google-Smtp-Source: ABdhPJxMrPSGBXRaSRCzx9ebX2DG1HKaocZVotA0Tfpgi8GGCH4xMUOFEVE2oprxkhKCVdpgyrg1mg== X-Received: by 2002:a17:906:4fd1:b0:6f3:be23:7ad5 with SMTP id i17-20020a1709064fd100b006f3be237ad5mr11198915ejw.264.1652607349590; Sun, 15 May 2022 02:35:49 -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 p6-20020a17090664c600b006f3ef214de8sm2516582ejn.78.2022.05.15.02.35.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 May 2022 02:35:49 -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 V4 4/5] spl: spl_nand: Fix bad block handling in fitImage Date: Sun, 15 May 2022 11:35:33 +0200 Message-Id: <20220515093534.1737172-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220515093534.1737172-1-michael@amarulasolutions.com> References: <20220515093534.1737172-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 --- V3->V4: - none 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