From patchwork Fri Jul 8 09:54:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2098 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 256A93F047 for ; Fri, 8 Jul 2022 11:55:03 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id z20-20020a05640240d400b0043a82d9d65fsf6301433edb.0 for ; Fri, 08 Jul 2022 02:55:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657274102; cv=pass; d=google.com; s=arc-20160816; b=P3XYlcGXH+UpPq4lRGdZacWxd29imF5GwxgfyjB2aZwbZvFGdEhIGzUvtfaIUSpDO7 aFs+iAYYbNscjIK1g238gz9egNGgwukejjE63LzlsOW9HM425+n6w2LYGfwz35ln4vRM l5sJTy7OaBW696ydSdH/aKb1yJ/lQCeQHV1EmuZ9Ty6lw/wnT6X5MmhduJDADnMAt+t0 BoiDmtogI8rpbdGwn/GB/kmIB+Cr74dj5jabUM/Brt9bmeBRFlt7BZGQ1Y9fNyKH5/Aj /bYO1Zs4/wwv4sWhtN0YsaAorAprag4hRzQElg/pY+XWCOWugchRTf73OHuLlsoSiETv U+kQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=7/nQJd9SpvB47PGoKqO5Kn5i3o38fPvwXn8x9S9mb9I=; b=RFqdD5Xg6sQxIWINrWWp6W73lSnH9H4ZgD+TUcUkTfc3lhNA3T0dWE3GNPFXSdL3+g Xp4KZLwTctl/YHbpQTdLI2sWQysYjaR18JBtEPYjC3DRtpMNjplbcdb/ThrFC9q2Ckb9 nnPKk29OR/yF9O31fmS5stXUcGOq5DqIskUnXOoSxkGVsoamXRsefOwKfZrdRF4fxuHG OrgX8UebXTcAfiySLrtVcOg91hdDn2yFhvM/J52e/knIltVtRXXDs5aoMBRM+wlEtnCc wGIN7v2z/Ip8bhYdrNgdQq7GPJqCKxbVgYB+k/U5JYKcWPSHNzrlB6NjmFO8ToKDZAq1 4hlQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Cn/m2hnb"; 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:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=7/nQJd9SpvB47PGoKqO5Kn5i3o38fPvwXn8x9S9mb9I=; b=TPSBNGrIaTk5aj82pUyKQee3Y+KBAyYk1n+pfASNE7HiaJjpFMGwK4h5UuQEUlpsY0 wVU27j/WfTkqHRfeHXOB3gfhumcKQb/5YUogDIaj48B2GGwlEryTIuWjxZBLZAoQkDBw iSYiLqYwDS1hR3auibFxjIy5SY7ub7G8PEAIo= 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: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=7/nQJd9SpvB47PGoKqO5Kn5i3o38fPvwXn8x9S9mb9I=; b=nxvSQmQRwiRBDNo+F992UWK6H5lTIoVTdWxjwXl+mY+bJIx3wQVQmB+fMvXfRNUSgw 1wVct2FAX1gfdyVK+WVaenfkpAyEc1FV0A3olISDprlBWZX7C8mXEEKOEhfnp4pAyR1b lsoHrsLCEyZyNPF/aDLAJS8mMamujcu3lkm1BkIx9uNfw8vBdaFEg6OJ+zRtDe/Svn6t XNkNOcQnhHyRRYykZv9ipjKYS1LU96utkYjlYnaoETGqfK7MHdypazekJStOYPaeKxui 4H29EA2+yLkiQ9rcANv6fzZt31dMKo/rBXgDTw5UQGLsWGdCilA6/cy5pIzvA+CeW/U9 Wuew== X-Gm-Message-State: AJIora9FbEF6tSyxR0a6yxsZn8+zwsOCV6xiLVNYSIPb59U8ifwLORNM pWnLXmLB4tptGvuMB5MTdgw4MWl1 X-Google-Smtp-Source: AGRyM1tJsLeP/Ff8mKObIqa/pD8iAcyqXGB1WXsahfhyb+qGiBMHMu3uGxUP5e4gha/41IfRlp6qAg== X-Received: by 2002:a17:907:1c13:b0:72a:fb14:4a0c with SMTP id nc19-20020a1709071c1300b0072afb144a0cmr2669447ejc.305.1657274102578; Fri, 08 Jul 2022 02:55:02 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:95c1:b0:6ff:45d:c05d with SMTP id n1-20020a17090695c100b006ff045dc05dls545700ejy.5.gmail; Fri, 08 Jul 2022 02:55:01 -0700 (PDT) X-Received: by 2002:a17:907:1dc2:b0:72a:efdb:2c4a with SMTP id og2-20020a1709071dc200b0072aefdb2c4amr2829015ejc.25.1657274101173; Fri, 08 Jul 2022 02:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657274101; cv=none; d=google.com; s=arc-20160816; b=Uih2V4QILJotv9zgzVe9F3JR+2jkHI9+QLYE0Zj++g+XaduaFRVpw5pVGNUCkIJVb9 FEton1Nl81R9r+A+pKRrJKT2MgGTDbU1rY/9Ky0PuiOkwnGylReM6paITsjIRRc9lTNz 4kG1Qnw6kTasZP01Vdc1kXqzOeynv98aaf8uIqIakyjyHHIv08lXNbLhBeNOs8YY7LxW vsTsgQZJCrzkFDvpqsFESZa+COV5mpTJOQeXzMnSKHpY4TGkOuiCGIikaMqh1ZZJviH+ nHXzEyzFubTZZtX4jSI2OKK3oZlP2lVfvZOMUV8vccKNoGPWqAHaXic1QHdR289jq7lX CKsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=kmz44/PGwk8ZR5YMjWaKJTxEhx38Jps8/Gm7QuwZCQ4=; b=zNdF4IqMJFNZErbNhRR2+ONh7MePfR5ySHcXrnPjxvC+WRwTeCYdKAebLbUijUmi1F UANoxnYRk4QJaXvY11qC9LDaOfWhtWmY06bGNw59AtAN0txoECXP2tPcYOvGXTs7wfsU Nx2vqBfJ1IAd3MDSLR5AicZ38rsiAxy2vpTMk8RtbqtjopcAcy9zIv9bwaLkdXVid3VL 7gqlCqy7iG71WR6p26pPZPAUucMDTe5IdTet3IewKtwlBkycYSC6y8CvZPw/PoO7VmtP 8Q0mxNkfDpIF7Yu7DZCz1Xr71rTsMIdilaWps/JU0p5LLkl0BI/iIPtLoofxVn8WCjZ7 zclA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Cn/m2hnb"; 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 wi23-20020a170906fd5700b007263fb9f792sor86898ejb.71.2022.07.08.02.55.01 for (Google Transport Security); Fri, 08 Jul 2022 02:55:01 -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:f84:b0:711:eda5:db31 with SMTP id q4-20020a1709060f8400b00711eda5db31mr2583139ejj.397.1657274100765; Fri, 08 Jul 2022 02:55:00 -0700 (PDT) Received: from panicking.amarulasolutions.com ([62.18.232.106]) by smtp.gmail.com with ESMTPSA id m14-20020a1709061ece00b007121361d54asm20011230ejj.25.2022.07.08.02.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 02:54:59 -0700 (PDT) From: Michael Trimarchi To: Dario Binacchi Cc: linux-amarula@amarulasolutions.com Subject: [PATCH 1/2] mtd: nand: Fix ecc in mxs_nand_spl onfi mode Date: Fri, 8 Jul 2022 11:54:53 +0200 Message-Id: <20220708095454.123808-1-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 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="Cn/m2hnb"; 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: , We need to calculate the ecc parameters in a way that are the same in uboot and spl. The parameters are connected to the onfi computation. We need to assign all the value of chip in order to have same ecc strength parameters before calling mxs_nand_set_geometry that calculate the ecc layout /* use the legacy bch setting by default */ if ((!nand_info->use_minimum_ecc && mtd->oobsize < 1024) || !(chip->ecc_strength_ds > 0 && chip->ecc_step_ds > 0)) { dev_dbg(mtd->dev, "use legacy bch geometry\n"); err = mxs_nand_legacy_calc_ecc_layout(geo, mtd); if (!err) return 0; } Signed-off-by: Michael Trimarchi --- drivers/mtd/nand/raw/mxs_nand_spl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c index 3daacbb330..683071c1cb 100644 --- a/drivers/mtd/nand/raw/mxs_nand_spl.c +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c @@ -139,6 +139,10 @@ static int mxs_flash_onfi_ident(struct mtd_info *mtd) mtd->writesize = le32_to_cpu(p->byte_per_page); mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize; mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page); + if (p->ecc_bits != 0xff) { + chip->ecc_strength_ds = p->ecc_bits; + chip->ecc_step_ds = 512; + } chip->chipsize = le32_to_cpu(p->blocks_per_lun); chip->chipsize *= (uint64_t)mtd->erasesize * p->lun_count; /* Calculate the address shift from the page size */ @@ -152,6 +156,8 @@ static int mxs_flash_onfi_ident(struct mtd_info *mtd) debug("writesize=%d (>>%d)\n", mtd->writesize, chip->page_shift); debug("oobsize=%d\n", mtd->oobsize); debug("chipsize=%lld\n", chip->chipsize); + debug("ecc_strength_ds=%d\n", chip->ecc_strength_ds); + debug("ecc_step_ds = %d\n", chip->ecc_step_ds); return 0; } From patchwork Fri Jul 8 09:54:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2099 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 447AE3F047 for ; Fri, 8 Jul 2022 11:55:05 +0200 (CEST) Received: by mail-ej1-f72.google.com with SMTP id l2-20020a170906078200b006fed42bfeacsf5542238ejc.16 for ; Fri, 08 Jul 2022 02:55:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657274105; cv=pass; d=google.com; s=arc-20160816; b=PhsefZ0R4n/WgLtC5uRoAJlVTbK2JaIWktFr7s6btK5BrWJVcr0hz7g1j2+ZM2Dk5E ZGYYl5Db8IpgXZjlIkp4YjcUbg3qChoQA2PdKSd6UUjH6qGvstzgUzJV49ESpMGCyBX9 4yHhdhP7zJFd+Va+JGaeOIU5hA2MRp4K0dPca75bT6W7iloQJeMfcw7l4Wx5iCpw+xHW 310rr9hVIS3YnmNyCL+NoEqeQ1JjpY8gkkY4YnXxrzOl1688nC3NWNNIvyoKXtC0ixQF xZOXGDIzGFnB40Zo3KVmCn+EIlW4Gf8t8RhpHRfGbF3yfMtDnw3t0sJUSADbMinWtH9f 5ZiA== 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=UIl9iiO4djRyDq0NCMQbsJJhKKl4p/LrxD5YrJhi3XE=; b=hx4OfmZ+AljqkTIhNYWyh4nt4Def/7N+an/73lzZlTpNsAvVlwphpf8z+GZmHKrrFx /7vIywEZdFRkSwdiqtuZeAP76/Tr+2uvN7yFdbdhzyuI9E0BlQYX4//IQlrmqv9aKzW3 y7vfGGmIjSIzA/q8+KEoHYiYepFcEceCKCag0H79aNXV8gf/NUHBRCaBY7Oso268yb3C ja57DNxbvFEnW2CwhMFuzmQjdTuNiYF/1DUNleI7N6gBB5wJIevbnoA4+S4gbylsxXfj 3YWSGLM869gSBzyNLNHt3BUetSBT89ckhM6TCcLhTg/OWa2hPpljoLGoU30REZBeJd2q WynQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=czrJdVZ0; 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=UIl9iiO4djRyDq0NCMQbsJJhKKl4p/LrxD5YrJhi3XE=; b=pT1Z0cG1+/87Fk0bcBn4grEwfXzZrmImaagR/nf4Yldv4Vr7FF+WSXRbpDEMehN0dq BKaV1orWUBVomKRu1cjNnNe1+j6T/9Dexwf82wHjO2gxECjGXaQwjxcVjEQOsrC+B0rQ rJT7UWI4x5XKjzJ1a45VBt/YacyLRAV+Y1LsU= 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=UIl9iiO4djRyDq0NCMQbsJJhKKl4p/LrxD5YrJhi3XE=; b=1zk7PEZBmNjmSrazDjtKERtY2lK5PqMIgqVMHAdDmqYR7P+CqgjYDYxQd5MM5vZQG3 9yzkn5mistdlf63i/zKbBZttRDc3a3xcSzqPSwZpDg6/5XvM1zyfp3pkwS5Dz0v2Hj57 ySGZVcrLzUmPHs8vF52NB3EhFqcDOg7SCFtgMSDhetYxui5CpBbIwdTxaWfb1B5nPy/U ejF6DJHwu6KKKB9Ta2v1gzQoLt8q182oeaX7Q62mVgAcAFIA6SVyFaJ/uO7DCFnEmGPj Medkp0RCan4LtPu1+Za1eeReN7nNFEsd3Wz7nWjlJNmn4LCZ83guWlTZmCIEjd8i2bcM cYkQ== X-Gm-Message-State: AJIora/Q7jvofQiO+Xzo0tPAAFBQb9ZBjZf+VJEYq+f4NY5mc3Noscsx k1nMcHYLR7Uu/1vIHXubkXe9JcoW X-Google-Smtp-Source: AGRyM1vsItqDkKYyHonh88fwkTAA798p4U8YjGCAkrvM1xYoJJAPaXqmy2bqF8GA+YFflWkZY57uiQ== X-Received: by 2002:a05:6402:5388:b0:435:71b:5d44 with SMTP id ew8-20020a056402538800b00435071b5d44mr3523184edb.364.1657274105096; Fri, 08 Jul 2022 02:55:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:2ad6:b0:6fe:976a:7a5 with SMTP id m22-20020a1709062ad600b006fe976a07a5ls546000eje.7.gmail; Fri, 08 Jul 2022 02:55:04 -0700 (PDT) X-Received: by 2002:a17:907:2cd3:b0:72a:b4a4:2fc4 with SMTP id hg19-20020a1709072cd300b0072ab4a42fc4mr2750279ejc.70.1657274103846; Fri, 08 Jul 2022 02:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657274103; cv=none; d=google.com; s=arc-20160816; b=VR7jKAZZ6Dv9HDdPuOOZa4gY3lBHFmLQtqlbIPXgaWQqAhY0asxgu51sDNpPDrilHQ TQX8ofd6HT1tQIoGpGnewOlUS9iIxcauBqA7cOOAFjh3JCMXEi3TZfNt8Q5tvMVryfc0 XmECe4msQbSWDr+DXgGbu488pbRU8CCydYeyHovy103ywFC1dzjhap1VTRT7j8yo9r96 P/PyKETJBvlayneLmNY8cjnVLlQIaqJ8wTPCwc1GHU0bzbGOY3XIsrzLLF4wZFxgrhbi GCmxAGxRV2rs+Tu9nD409tWdgxC8CZS2mAPzlniVqKhkqIykRMBv24RnWFt3qmaFsH8K CZ2w== 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=noSRT8Q0yAZJZaXA/1jRBZjtJWtmRPAt4HnjHk6RmL0=; b=iTT35nCEkRdYzfEBZqNF2XXbq8Pk0pKNxIVrZuA6h9t0vLv4CbL/rqmxYTtuH5x93z qjQDoAWMBONnjENI1Po12f0Ei8zz1oj8+LjrURVfEFa8ZYvOq59ZS1inrRxMPgNy2IQt aJ3iIs2q4urZ0+sYUSvBNOs5CVyml30qcpoPX/F+g2OCJhSjRLmp83ZkGB1FhBfT36Ky XTmHR5suhPwB1aMYEz+EMMl+oZgzLsHbv9ClG8pSIlhRPNcaaQpHqM9RcPDb2jxHtHZT vnbYSujd6SyqbVyWHlImfrWCA3PG5aJRjg0FIdcC3+qvcnuaIcp3/pf1D3/HfaRwqstI nGrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=czrJdVZ0; 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 kw26-20020a170907771a00b0072a9a56d2a1sor6367427ejc.129.2022.07.08.02.55.03 for (Google Transport Security); Fri, 08 Jul 2022 02:55:03 -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:847a:b0:72b:1c75:1e69 with SMTP id hx26-20020a170906847a00b0072b1c751e69mr2700033ejc.153.1657274103451; Fri, 08 Jul 2022 02:55:03 -0700 (PDT) Received: from panicking.amarulasolutions.com ([62.18.232.106]) by smtp.gmail.com with ESMTPSA id m14-20020a1709061ece00b007121361d54asm20011230ejj.25.2022.07.08.02.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 02:55:02 -0700 (PDT) From: Michael Trimarchi To: Dario Binacchi Cc: linux-amarula@amarulasolutions.com Subject: [PATCH 2/2] mtd: nand: mxs_nand_spl Fix loop exit condition Date: Fri, 8 Jul 2022 11:54:54 +0200 Message-Id: <20220708095454.123808-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220708095454.123808-1-michael@amarulasolutions.com> References: <20220708095454.123808-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=czrJdVZ0; 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: , When size is 0 we need to stop the inner loop or we just waste time to load all the block of the eraseblock Signed-off-by: Michael Trimarchi --- drivers/mtd/nand/raw/mxs_nand_spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c index 683071c1cb..05886fa025 100644 --- a/drivers/mtd/nand/raw/mxs_nand_spl.c +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c @@ -263,7 +263,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst) while (block <= lastblock && size > 0) { if (!is_badblock(mtd, mtd->erasesize * block, 1)) { /* Skip bad blocks */ - while (page < nand_page_per_block) { + while (page < nand_page_per_block && size > 0) { int curr_page = nand_page_per_block * block + page; if (mxs_read_page_ecc(mtd, page_buf, curr_page) < 0) {