From patchwork Sun May 15 09:35:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 1954 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 88E0C3F1F5 for ; Sun, 15 May 2022 11:35:51 +0200 (CEST) Received: by mail-ej1-f71.google.com with SMTP id gn26-20020a1709070d1a00b006f453043956sf4956720ejc.15 for ; Sun, 15 May 2022 02:35:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652607351; cv=pass; d=google.com; s=arc-20160816; b=HFKW2VhIxPLjXEhxm3dM9WRqEwnRLvcku6gBkarrrTvBJYfc+/IXhCBvs0RXkmMq/S mQ4PrQztG7kY6fr2tzOIrME5a+1/t01Na9aLZewZGGM553akxG/lSTAwjktu4PdGGyVK dLMxVKHQK+AB96gRAWdu5KotftnZj+/kgNB6pSOnur77K+dRZAHiTp5SXbtMBj2UG7H2 54vb5xIxU3EtoarAGSF4JUIR/nuGCoW1upvFh+Y7LtjR9JdRd1Cu3j68OhzW8OBkIWcw wena5zKY3IeQv9f6gMNNZ1maSn6KaUHytcc6fWX9bgeoUKMrj5sM6yD32cukV+TcMzRO UVdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=XHeUMEYiHDQ1i3NF7clSVP8an2qFDpTa82QhV4hi+V0=; b=rGZCXXGrM+42ZzkszHwS6ZEaTKgWdIfhzQQl1UVs++ZGLQCjr00Z7MyuIXQmKGMtMw uM8oZq2fnlLCMtXevqFydcFNeidfFCi7ZB1D60So4luaMCHcyo6qSg1sZAj9XQ7ZOXze 6rEBl/Ejp/yUghERgQm2nfEPFU/ujssQtAHl00J2cuXo1JtamkzWbRQDjxF4f8mu23Wn +UTnmrnaYb3JNbfR3KoRtUlqap6m+B16SWfmv3R42KVnCRKbcy62B22DpbF7T4jWYC36 yldPkyAw+HqU5Q8jSfLRNel70/xgitoCH+KwKju6Wt7O+SBj7oigddgv96nFSQ2xq5f0 bqMQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ikLw7IIz; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=XHeUMEYiHDQ1i3NF7clSVP8an2qFDpTa82QhV4hi+V0=; b=eMT98jDuqXMbmuG7KqSLjdWt9bzgo+57O7i4W0P3Dwrwo71x9HGMc4VxUKrawTXoke 5TlbfuNxSd4nYwpsFDCJ6r9ctqnx5Go8oEN/upr39IecafBEjfaQ+qbm8f141xEMiluu B411FmZRBGOjn7OvbmB1lPEJ1F0bDBIYyeYCo= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=XHeUMEYiHDQ1i3NF7clSVP8an2qFDpTa82QhV4hi+V0=; b=Ii/6sfeosvgUFTDy4WddlXu7TDWgfclDvb6YPPHPhJkdo/EayiM7YNrr0s+lRlXYTN xMpbe9iWfDT0IkIr4aTXipk8ItQ9Wx1UNcvo1ZzqFiu08oA3T19bN42rWACbc1M1OPjW SFiYC2+KPege1nZd2xrxBh58gTVV1pwFls2fefhsXQ6AvsQlCyCw2GUMbZHlgDRksg0C 2/ySqE+esJ7xwcPc32vDCGxznpEHVQ9/yJ1ZbJzefNg4PcmRkyZjXBrLGc72lTb0yZMm I3Q6NbcM7Ee9jjIhkL/upGblmHMX8EYhOxkzICnWK2/Sn/wCNV6KL0Tq3eoTxN3wDRHh pb+Q== X-Gm-Message-State: AOAM5307xrYDq/SHsQE1eTFJty5ng+hjKOV4ZbqwcUS36Aw6r9rkAxue Y//8cwBkbPzCGXseFis5ZzKojLxT X-Google-Smtp-Source: ABdhPJyOjYtW73utRJQ902hvhtFD6n9vMArp4CjVVIJH5AFAS0lK38zYx6qGIvoSRdwzTimc7SU1YQ== X-Received: by 2002:a05:6402:1ac4:b0:425:cd55:a953 with SMTP id ba4-20020a0564021ac400b00425cd55a953mr7631203edb.192.1652607351258; Sun, 15 May 2022 02:35:51 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:7f1a:b0:6f4:7118:d7c7 with SMTP id qf26-20020a1709077f1a00b006f47118d7c7ls6008945ejc.1.gmail; Sun, 15 May 2022 02:35:50 -0700 (PDT) X-Received: by 2002:a17:907:d0c:b0:6f4:a5b9:3799 with SMTP id gn12-20020a1709070d0c00b006f4a5b93799mr10838065ejc.732.1652607349876; Sun, 15 May 2022 02:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652607349; cv=none; d=google.com; s=arc-20160816; b=tniIIDKm6F/+YaTVUHKCImaEzu6nDopuRJGuuJaoEGKzPKY3kncfFU/pwn5vpwsTMX DUkHejjehtdN58NHqO72Q6UJ6d1jjHahSLazYfyr+eUWijYbV+/9uaqfXlZbPoNbS+ZG 1mE2rMkVXcZ1MiyIRkGG9LBpStG/qeDpw4bHFLHs+wfdyfBVz30fJ213PzVRI24mfEED EFCH7OIyWRmoyxCeCuVCh5n7mki2TclIlN+nbD2Ah4vGevSD18vPZbLuURZ/KXaSGNFv 8iJBbzrtdDBEz0Ze1aaOX30voMd/tL5sBmrKp7D5w71542e6uqzx9DCM445+9RxtGtSI iUjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=HIJm0hdkQ6uc0gFfWcYsba71RxUpTyUBv/+jqi+ooyw=; b=P0DmE4oUlPR5lNUsfYCg4JgJkE7lqI4ozWA8nlGxTHxw5Ej/IYs4rIjQUXmez3NAF2 3FZfDtP8Ns3b2uBjk4QiPVE/xw53G1Y7Rwj8a/TTPLWmbPspt2f2k7MmYkuDikY9p0UF 9FtjJ2Kg73Iug1lMEjKEq2DW2+MbH1Nt4vue1/+7OfCoRcfqCURNOPPnDSEZTUV5OQH0 XckzYASqUYQ6T/bzTwYO/3Iz335VG1x0m+Zsza+LpjTv151K1eBdHU/rM+9/EANqWUFF 5BGJ6jS5+nBH5DHfa0w0p/Hh5O3awG0Imk2qdMTIGSnY3G1FX6geVtJOv77dLliAdaDU PGZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ikLw7IIz; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id cr19-20020a170906d55300b006e867333eeesor2576098ejc.16.2022.05.15.02.35.49 for (Google Transport Security); Sun, 15 May 2022 02:35:49 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; 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 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ikLw7IIz; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;