From patchwork Sun May 15 09:25:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 1947 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8F9F83F1F5 for ; Sun, 15 May 2022 11:25:53 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id q12-20020a056402040c00b0042a84f9939dsf1826017edv.7 for ; Sun, 15 May 2022 02:25:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652606753; cv=pass; d=google.com; s=arc-20160816; b=ZVpz2RE5y6m7lkBbgqzLWpbQAeWC12mbVeUq3BuJ4M0ZpkukeZzXoklati/KnhrTyx aJSm9uKqby2XvIi9au9nWUOOGHPDqGZe1v49SB4psfeShzcUPjmANWxHpzfAmJFwMz/l i5PQs8wI9dCVND3GkhMg/xti1uYKgQkf1g23B+hGdQgGsXGSBckCL2RLJFcsFrv2xbuN cLaolPbmit7KzRrig3+UFgtEWQeL3qxX2nlHy9CbryAbWpAdmNqht46wYUOtTjjiwW70 8Ks+I8ERzSbhbcya4c67ro33A0pyHxDGcKRhQ9UxXwP6Ojp2q0DCwVmKG+O9HwMG+rAl Pqmg== 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=vE6epefha6srk2Mh1iKxygWCmicQCXoIgd0ZBNYiLnk=; b=WSVs39Nr170GWzF5PfLHsL6wr9adVbznCZzHFOFYhUj1f5KK5gnLiD3lj1czufP330 CzB/owpKvolJy4ePxhnrXl8QNms4JkmeEhRKDxIlc6D0YOg5X3yIejfxNW+lEngoMl7Z s2+3u0gxvS1QkWG2oNmrvJ3/fAR/OMtkjLkmezL22U7RP4pmv6ySg8k0TI3rpu64K+AF 1uVpViJzg91J3bekq1Po2BmPZQZVwhp3jOw1VC+3IXDnj9MjhmWhJ6w0YzLm50VbS1LC K0GHPZtEQdzdm7XFG7ibMzeWsMVOzu4iiiICBdiyeJkAEAFednfy1f74+hBKt4lO1S94 XIAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E+PF5PFZ; 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=vE6epefha6srk2Mh1iKxygWCmicQCXoIgd0ZBNYiLnk=; b=LPA+vKhxHeGMJLbqQmOOBvnxjRvo3bukVVs0TbXFUTdGjoaRAileOKbqh0pekxnYHc etY2p5fIqcWDGR0Mv57uUF0iompQiodnRNwWW4ERHr6eR8Zcdr8+Q3GZinhzC8sR/pFo bZrrIVPb+3MHVHbSSU/A8VbD2AWSUD5H+b33w= 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=vE6epefha6srk2Mh1iKxygWCmicQCXoIgd0ZBNYiLnk=; b=s/CQehhTZbvgTlGXqunEYglyyajAnTIUxTb02GyKw/0b6JFC/eGqksUPLQ4UX9GDbW ODLcRBustnfpjhh6EDhDYDmimepueLxgxtXNq/WFBFm5qlKeik+5FlQJOOiw+agTXMIV YkFCLTPckz2/Z4nK363/14tRCPXHHfU0+Y4itOgwYMo94DSwB39bvkTG7IjZwMNCu+b7 NyTratXnHITvwJ1Y0Sn87IOoHk+3SOYOOcamWeXiX6RLQcj0RYOY3sPWhQX09V5/rSO2 fABOqjod0mtL5SrKMzdt3stneMRex4LzzWPs3pzKJKGqtuq6+XMHGbOWK6+jKVeePnp5 ZbMQ== X-Gm-Message-State: AOAM530f0dcg79h4B53ZNhN0Bdk5mUKjXx3aY8kHAaALQDQhtGQX9N3+ 7TnBMEowVDvTejxPDeKn67GhAhNI X-Google-Smtp-Source: ABdhPJzjqnW93IVUBR0IcVL0rm8FuyvgbnHiQeYPAIX6Q/PlcXeEzPlrVCeLZWofMFc34PMvYR/fmg== X-Received: by 2002:a05:6402:40c5:b0:427:af77:c10c with SMTP id z5-20020a05640240c500b00427af77c10cmr7593185edb.387.1652606753091; Sun, 15 May 2022 02:25:53 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:6e09:b0:6f3:ead4:abc6 with SMTP id sd9-20020a1709076e0900b006f3ead4abc6ls5995051ejc.5.gmail; Sun, 15 May 2022 02:25:52 -0700 (PDT) X-Received: by 2002:a17:907:7f9e:b0:6f4:d3d0:8d8e with SMTP id qk30-20020a1709077f9e00b006f4d3d08d8emr11232114ejc.501.1652606751671; Sun, 15 May 2022 02:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652606751; cv=none; d=google.com; s=arc-20160816; b=L6tK//SW+vYDEXzRmoss3xznuTfQzI4UFu/q9uhOaei6PEuiFWH1Lp+sPKk9gpQVn+ EOScP1AlEwIw8rtASItCJeKAOo3dmLRLIjvnxtFulLHjp+JT2j+WUxBUQrdL3fqgi0aB GqWEovtU33Qj0MHT9pwE4qFlOGrFTYNHZR0SRrVDrWPrsXnqIhs3YENWgHSriA2ozyHv As8OwSo1FYYV4wG347xic48/IrlUXCRrk6w+R41vnQi1zzdbyPPrBq7kM4I9FPwk8XbA 5t/nsNn0QrfQeA+jlIzZvRhkqzgfRZKpQOrg713m9K7K9PlfyWoqKBJuNqzMkZ3stKe7 T70w== 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=Lqpc+4C+2iXEt08Np8F5Se0LUURUGSaGVqPRbJIufRg=; b=g6J6OzKkm47JjRM+kAZnKzEdFuvhm9y0LxdTDWcFnhym8G6/ICq8ztTVY+NHsMusVB SVZFkiJOg6YMnJYZCvP2COdnJYg1etqbN/N2vRMHy0xWtgJv4GkHsY0WT6upbxmPhprB WZO7a8XqGIhwjqEZDAn2y5XPqt2vwuzshzMP6eVTd3Ki/dCP77yvHueAl52DATcmzJjk 2yHnfRmCjf3rzaEa7MPUEt2wR/XoYqcaRN0sJBr5fDTcDVnZx4j3N/1gG8AhMNttzcEp 2A7qVKNKRAA+7YXIt/Z3cgzC4IV5eSOWXoJ8LbiO0WfYoNtIesHYVyxZe68zm2S67aQV aeSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E+PF5PFZ; 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 y29-20020a170906519d00b006f3957492a1sor2444399ejk.122.2022.05.15.02.25.51 for (Google Transport Security); Sun, 15 May 2022 02:25:51 -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: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 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=E+PF5PFZ; 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 --- 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;