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 5356BC433F5 for ; Wed, 27 Apr 2022 05:51:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 45BDA83E5C; Wed, 27 Apr 2022 07:51:11 +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="g7CRUepf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0910A83E5C; Wed, 27 Apr 2022 07:50:47 +0200 (CEST) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (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 46D7C83EAE for ; Wed, 27 Apr 2022 07:50:42 +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-wr1-x42d.google.com with SMTP id q23so951185wra.1 for ; Tue, 26 Apr 2022 22:50:42 -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=THlS4ZMp+Xhl0QOJDBBGjs47Vso6hptMgx9+MWWJYCI=; b=g7CRUepfQa8ldDV8Vh9uF/A8J0wiGnBrQLtmUqNgOQzbnX6PMtQN/HnM+mifqaEtdq Znixr8DjEANG37VSs5ltkF2DGHgKCEsWvQ8bfW5HXo8Y+9rGt9ARLQskBcfk+ShH2f61 4dz6kcR8alie2xytz+ES6fQOlP7L9t441I7f8= 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=THlS4ZMp+Xhl0QOJDBBGjs47Vso6hptMgx9+MWWJYCI=; b=CvV83pFdVEX/kHdlwwTzsFk6GkEMJ5TkXeLAbiF/S21ABbNQaW0IhSZKWQ/+cpk+m1 Z3Y8bmfa2WIkKdlhq5euoJLpKHJ1NZ8FGj4roLpeis12SiU2w9qlfp4MHrhVUboXbJyH 5wC29zOmMkNZufcnv7oULqPVjh4dHe2PKLJSJypcCSBe3kHf7as5byE8sJ6+jbbo88ht gPAHFLhV1oy7QKQDMXm/oW8ULLymEy88Kb3SY/K65XBxPRiBDKd5xhBqZBY7o175ZFfE 9lCwna24TxdPoaTJxZCzBZ4Le/H+W0XBYayeXBGGecHezlyB3N5IAAP0KKQHlIgdBa8Z 7m5Q== X-Gm-Message-State: AOAM533X1eh1HOMIbprzwh++1vDxtthmNUE+WBsgZfRY/TwXuHyo5rve WrmbsSkaIKDx7kXlTCHLmW7g1Q== X-Google-Smtp-Source: ABdhPJxFLiPie3eDi8Zb4XtynqBNQLdf0VVkoKhZ1sdXZJOE/L29eqqp/zWlS3NGfsWblh0dD+0Lvg== X-Received: by 2002:a5d:4f08:0:b0:20a:ddfe:bd99 with SMTP id c8-20020a5d4f08000000b0020addfebd99mr10244657wru.339.1651038641819; Tue, 26 Apr 2022 22:50:41 -0700 (PDT) Received: from panicking.amarulasolutions.com ([5.171.215.247]) by smtp.gmail.com with ESMTPSA id f11-20020a7bcc0b000000b0037e0c362b6dsm769827wmh.31.2022.04.26.22.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 22:50:41 -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-kernel@amarulasolutions.com, Jagan Teki , Ariel D'Alessandro , Fabio Estevam Subject: [PATCH 4/4] spl: spl_nand: Fix bad block handling in fitImage Date: Wed, 27 Apr 2022 07:50:25 +0200 Message-Id: <20220427055025.231586-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427055025.231586-1-michael@amarulasolutions.com> References: <20220427055025.231586-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 Signed-off-by: Michael Trimarchi --- 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