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 8E944C433FE for ; Fri, 20 May 2022 13:50:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 122ED842F4; Fri, 20 May 2022 15:49:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1653054587; bh=8d7n+8FqQyOXLdLQ/DfP3xFmvD9lGzr+cFkYmSFFs/8=; h=From:To:Subject:In-reply-to:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From; b=Fak4lafkAAmHrD33j40p8zhM2xVynlhn5BK+8R8OVt96mxe6D4iMsdzplT6Cd2cXH mRaNIk1Ffp9BxMg4p+xwLB0uyGi5LAwc3bIgoKg0qUloKbrQeWFO0C3cdLAhnu9MsU bzat3cyphh/po0ryQbwgQx3GzdmY/cHqE7lwxx3e9lQD76gkFT5W4uGrbkJ/esyXvp zlapB+HUEeooagkPYYHJ2X0ufqKLD1qmkDxr/2LJDKC2mJNxlbqx5fmTlovHwCn+GN X/Hz2luQn80pFo08o4BvUyK9xZuZkFAaNorn+eu6eozs39ctBCkQxUMFlhE7XFwaFm i98tvvmZDCHRg== Received: by phobos.denx.de (Postfix, from userid 109) id 553F883F63; Fri, 20 May 2022 15:43:56 +0200 (CEST) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 665EE80FC8 for ; Fri, 20 May 2022 15:43:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sbabic@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4L4ScR0jFHz1r0Pf; Fri, 20 May 2022 15:43:51 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4L4ScR0ZLGz1qqkC; Fri, 20 May 2022 15:43:51 +0200 (CEST) X-Amavis-Alert: BAD HEADER SECTION, Missing required header field: "Date" Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id eAv5EhUxnMKG; Fri, 20 May 2022 15:43:50 +0200 (CEST) Received: from papero (host-88-217-136-221.customer.m-online.net [88.217.136.221]) by mail.mnet-online.de (Postfix) with ESMTP; Fri, 20 May 2022 15:43:50 +0200 (CEST) From: sbabic@denx.de X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 1631175 X-Patchwork-Delegate: sbabic@denx.de To: Michael Trimarchi ,u-boot@lists.denx.de Subject: [PATCH V4 2/5] mtd: nand: mxs_nand_spl: Fix bad block skipping In-reply-to: <20220515093534.1737172-3-michael@amarulasolutions.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Message-Id: <20220520134356.553F883F63@phobos.denx.de> Date: Fri, 20 May 2022 15:43:51 +0200 (CEST) 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 > The specific implementation was having bug. Those bugs are since > the beginning of the implementation. Some manufactures can already > experience this bug in their SPL code. This bug can be more visible on > architecture that has complicated boot process like imx8mn. Older > version of uboot can be affected if the bad block > appear in correspoding of the beginning of u-boot image. In order to > adjust the function we scan from the first erase block. > The problematic part of old code was in this part: > while (is_badblock(mtd, offs, 1)) { > page = page + nand_page_per_block; > /* Check i we've reached the end of flash. */ > if (page >= mtd->size >> chip->page_shift) { > free(page_buf); > return -ENOMEM; > } > } > Even we fix it adding increment of the offset of one erase block size > , we don't fix the problem, because the first erase block where the > image start is not checked. The code was tested on an imx8mn where > the boot rom api was not able to skip it. This code is used by other > architecures like imx6 and imx8mm > Cc: Han Xu > Cc: Fabio Estevam > Acked-by: Han Xu > Tested-By: Tim Harvey > Signed-off-by: Michael Trimarchi Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de =====================================================================