From patchwork Fri Jul 8 14:14:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2101 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 92AD83F081 for ; Fri, 8 Jul 2022 16:14:44 +0200 (CEST) Received: by mail-ej1-f72.google.com with SMTP id sh39-20020a1709076ea700b0072aa3156a68sf4527985ejc.19 for ; Fri, 08 Jul 2022 07:14:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657289684; cv=pass; d=google.com; s=arc-20160816; b=Kr9OfkLzubQha5xvn3/ymQSPWJq0ee1lxKmZFxVozxoCWTTRo3qvt0WQ5RLFrdenUm bY/SpO/RYiCzVm2VX5e11p1Qkhi4NvFUPu4AbBZuza3jgHbVilbhW1grWsK8dRgps4Hn LNA2crVJBFRodsfrF1Flqts5n2faKe06SabWO08BPGVdPfUs2QENZLi18q+RfcH2sY+I YeKrFGzz6z6YlK1cKZVvFLjhIWQWYQ/Kcd85XLGcB03EwsfvZOLZFvHSxKGq1rXkl9RS 9A8zhHYUsnoC8mr3OCW18jP9gQkiJAUvNpTU8QZpbwJeXNDGI/pL5MoM3vCnXYePYWZv xhOQ== 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=gt606r4A9SPNu7wM2WDhomAz98TOkV+Llq+U2ziAqw6OuUijQE1+k9bxHopVnThEV8 tTdmyzTSLxc15QNnAmSnJ6WqTOnqkbLAIjbVNk19Cvca9/XBeYWG8k418CqoiCt+R6/H ntw6eq/bmxkwS+VUcp4h0Dw551I7wK1KE8CNPCllFA6+DY6BG5MVeKW+2cfbMHNGhqAL QS8xsuozWyM/qGLjnenIahYS9soLYRLiEXlkzrc21m3Kah4YLJD0K5bpWx3lJDoRJ15p 7w62cGXCFFfpo0Zyr0oGstS+WnLgyCTE/CDl5ifrzAFnNTG/xPleZeL+kbsyZnJrRdnu fc/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=nWfNVjgN; 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=TC/4jCkuizbxGjDD1Z6AbuAT/Q9hvA1W37JXHPA8Ja22Gv+D0qf3BLHD9oCXGAh/vG ktWaQVO7TfEWhpbak3K8yRXFy1DIBMdq48+etEVyihr8A5wq4X7cxvP3gMSaeJhVtSjb zDSn1k+oq5UDGda4QPDaK8neFDMu+KvwjPCDw= 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=rGRoLblSbusHk7LYKHuharTvejwxuUD4xWiLmGIWbIdenN75NJjAuPNZTZYE73JIzi lUDAl8DY5Uj2P5DrNLaF7C3x45Ck6azHyeCXDJnnOEb2BXtiVTOU/qpcZkrTWHlnYPHj euDfgL1gD4RQUHR5r/GCxY4XE2PoPD2iNNmbxnVMn9A/5fBpQmPCFNmHvlUvd62aCKZI yDoTNB7HcBY0aEQfugeK+Sb+w3a6Qy+S/5QF1rZVGxdM0g9/TEfG6eN+McGjwFg2q+HF LrhahlKKAqcrCXI81M6rofvRa0+4mvIGmoqznubzvca0ys8PbFmnFFmY+vdPU7WcZpdM S65Q== X-Gm-Message-State: AJIora9NZaC5QxbkQ1vWVgA3yNIeijlNuEgh016G1xJwSJ8xC0yLZFEQ 3W/CEvZDeAw5qHXBdHkcJZX1F9t9 X-Google-Smtp-Source: AGRyM1uEprnHxKh1Bk9rhATm2EiKxfAHYxVIWFmJd/TW2KHgyY4h6C0ZDzIIOVmXnS1k2QXQ6LHHiQ== X-Received: by 2002:a17:907:6d14:b0:726:34db:89fc with SMTP id sa20-20020a1709076d1400b0072634db89fcmr3813780ejc.406.1657289684318; Fri, 08 Jul 2022 07:14:44 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:3f8e:b0:726:b004:f241 with SMTP id hr14-20020a1709073f8e00b00726b004f241ls890452ejc.1.gmail; Fri, 08 Jul 2022 07:14:43 -0700 (PDT) X-Received: by 2002:a17:906:8479:b0:72a:5610:f151 with SMTP id hx25-20020a170906847900b0072a5610f151mr3828183ejc.125.1657289683014; Fri, 08 Jul 2022 07:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657289683; cv=none; d=google.com; s=arc-20160816; b=bNuai5SJD77ksZd6gCs+//R0aXh7tRR4IPVpXYvudBfzOqTobZqvGgLJzqRkAgoUk7 c73XylyK7OR5leiHUFYB3iMtHdjnf7DuW0KBTH2ZFM86kgX2+28Zs5G5GLM96t3xb4kH sn9qTLo0oDUvxzt0wrP7y4RUAAsjxJiOPblTkuxmLK+6eFcFLJ/xJYGnQPesN0aKNWJG 1PZ5O7h4ymD2oqKkyUJHD5C9Z5z++p8dgdo2/rrsvyb6ERro6UmFgtO2cbEH134iz5si K4ncHoCVVgW4VIP81xgB866Hap8a7r4lfgHa/+CeJR5e88OrkYwJJsjafj0l81IJZHXj GBQg== 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=geqIdEirpdHjuUNK9YETGk1CUKpCcMmD0jcO6uvvOQBBkPHONaCVCcVCl7EtmAj/kM mAEYtYF19LqtbaOmUT+ywnzuSCBt9XhyokUS9sbWpqwVb0kxZZGfRr23Qxd1iEjn6bVz d8rN2mcbJ59CNK6Xc0Y855r1fU+6pP+uSq2zd2uK3ZMzkVJPDb23vgbi6E0WfMDof1Kf ZUFS2B0H11x1wirHBsx8b8Ms71Zz8WXjs0jnafDi5b8EvIuZqCl1eC3tFKCwIp132FdU 4R3XLRMVF6Vq7tSEeVUphJVK/2flGNggMS0piihhwg6WerbH7zRctx2PPm9Crgyn6wsr lrjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=nWfNVjgN; 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 a6-20020a1709066d4600b00726c533ea73sor11719327ejt.31.2022.07.08.07.14.42 for (Google Transport Security); Fri, 08 Jul 2022 07:14:43 -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:907:72c4:b0:726:9406:f760 with SMTP id du4-20020a17090772c400b007269406f760mr3654764ejc.247.1657289682147; Fri, 08 Jul 2022 07:14:42 -0700 (PDT) Received: from panicking.amarulasolutions.com ([62.18.232.106]) by smtp.gmail.com with ESMTPSA id s3-20020a1709067b8300b0070efa110afcsm20419074ejo.83.2022.07.08.07.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 07:14:41 -0700 (PDT) From: Michael Trimarchi To: linux-amarula@amarulasolutions.com, Dario Binacchi , u-boot@lists.denx.de (open list) Cc: u-boot@lists.denx.de (open list) Subject: [PATCH 1/2] mtd: nand: Fix ecc in mxs_nand_spl onfi mode Date: Fri, 8 Jul 2022 16:14:38 +0200 Message-Id: <20220708141439.164394-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=nWfNVjgN; 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 14:14:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2102 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id DDA823F081 for ; Fri, 8 Jul 2022 16:14:46 +0200 (CEST) Received: by mail-ej1-f69.google.com with SMTP id hq41-20020a1709073f2900b00722e5ad076csf5831680ejc.20 for ; Fri, 08 Jul 2022 07:14:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657289686; cv=pass; d=google.com; s=arc-20160816; b=NmsGVefY1ex28/5rFBfzg48GZWVjdASBHCpzzWpQcp1NVIDWcj95TDqb6FGelBDf7w whtaIWyaRqxTKRIbB5wJEzINk/rvtJw0e2JoOq0NEZH+PSBQBbkD50277OsW//uUlC5p +iDv/4Oo1s1T74mkArCm7ZGvezaDwWNsJbnwmljBObIPpYjgoUtIBFYE8x0WrvXIWO7m JI3EXjd25Fj0otz5DgTeq8QPcWhnDPQ15dw/JcdIPRsaaU1q7eOqGhulE5PQ5YeYzGi2 82HXtdSvAsIlc7HJ3WIaku2yZvz6mfxSv2YboK0pofBB7H3z82YuSEE5CcJtl7tuRKUQ Ha1Q== 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=gwkObwSp7vVwlfsYef5064Eaq3fcCOrLmgGEJnB9iOh9zksCrN95ZTWjhFyjMGPhrR iizdZjd/ukGv+36CTNipgDYaYnWBGvXCJvmUWXUdOHkcJzOPkNZmQegBcfKnIqvLi0Gb gewEBzI2+L5LLS1o7JWtyZilKXuikliL7mSsEVw4gyCtAvZ+P7UzPt/fvA9v0v972kVm uk2VZ/Eyx/aHAlrQtF+8qy7ElBbzzFD56lqz0EwCkFaoi2X1EOS9AMYrn0KEHgVb6der lXQenqMQ4sYc22yDTliUp5DMwen4bzYgsi5O1Nz86Ep3hm4CIzj2Cbq2BpVk5joyRkZq 2VGA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oEuVJkFe; 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=VC+HKSkTk7lzvZMDSHuuzhgWeWKhR/xKN5dEWOv6DeDdtwMoJY+ogFFuBO7w2VNZwi cp34kd8mt0wd9bNgN97pLQFwreFSFDjOn+nYVwdVo5YnnikF0hE16dazOOZ6ly490VeJ OlnShy0XzXTjIPyTUNfydH77xXKzpHHn6LeG4= 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=jJxdVDAHq5Pl/pSEPN5OkpBS+SFv1gHzJkjFr758ulhK5Lt+h4190l4I1itEVXBLPn hwtVmoqwFsTHy9xVC9KrED4Ggi6lKfm5V/VnT02cmpq4Z5hxCskhiwkwKdRNu0ACXLWg 8TO/25FdfcYmkaskebomb17QJvQYWKLdfxnUgJTrjsuganTV1rFqzW5l6KUuxo8Bawkk 1m+QYH0AhqZ9gsAmtXQthB9Awf3t/8v4Yp1ODEAVHwS6usx7Say19HXBT+nU6OnMD1EI uTrmdfRLWtSdgBJFOqD8mGN/s64zMpuzkGdeiCoUdi56u1+V2vUFsV7JG9dQWLueNgYA gZdA== X-Gm-Message-State: AJIora+gHjDq4Zv0OMvPhGNGPoPzXMFfKsSXaCvgmcG4FgkYg29WOlUU nyRCx56YP+yr3d7pj+Wrtgz6l9NA X-Google-Smtp-Source: AGRyM1tbK4TfS9lyBMFo5q5wFJLqsPip0fO0fpYdVC66/V0blGI+ov97W9/gvngGaVuocV489EuWZw== X-Received: by 2002:a05:6402:3785:b0:435:5d0e:2a2e with SMTP id et5-20020a056402378500b004355d0e2a2emr5274411edb.307.1657289686679; Fri, 08 Jul 2022 07:14:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:42c7:b0:43a:82dc:c2a2 with SMTP id i7-20020a05640242c700b0043a82dcc2a2ls240673edc.3.gmail; Fri, 08 Jul 2022 07:14:45 -0700 (PDT) X-Received: by 2002:a05:6402:1844:b0:43a:7c15:c626 with SMTP id v4-20020a056402184400b0043a7c15c626mr5216255edy.17.1657289685175; Fri, 08 Jul 2022 07:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657289685; cv=none; d=google.com; s=arc-20160816; b=nJV/fQEfOnZ1U4eW0xPDxLIhuvWpWYUH05MDRNGhNYHd/x1Qjsd+vNNyKsfAt3VbjW vpRSiNdTfm4NOMBw47+n8hHoAaGlJnRMEOad82aCpckQDgKf3OMQ3ZHrnJq1kzGkNGty sfUUybQKEMOlzUllMG4Lg+ZdkCfUONuiO7hhV5+RVsXQnPM3DQqfb121+SEtidzBgW/P P+7i7SlsbjERyyoUfqIkNs77JXv/Ae2YbFT28g66aqBzK6kjK/2jF8A/tZ2Z411wxhGs uMI+cA6fVNGR7BdMOATUhGNbuAA3Q0nfaQBzKHmHtlNhpRbfMIz7+FlCnzg+6prYWZT2 KInA== 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=refn3x7TCajxtVUJO1I1Toh7kVG1KuWBlgysxR+8neNEgPhBv+eq69/Q2loiiy31in Q+CoFHXZ7DSx9q5zbxPbytHPNer7pk+VA+Qtkjovt0oT3PWUc5gXolp8wdk2hJ5S2qbK T+N/j6JNzqUPwH4SFf0eV8sgKvG7haMXLmNTA79fee5V9VZZrGt1WZYvbakdGCvGHDZO iFGifzFlahRDK0jbPSrDDYoX4zW/JhTn8odn6N2etdBzzFawaiRsPUxLx5qEMuPSeLXo E68jRwiqYYmskB5I4MexSGh4wsZ+wroJLQreVoT764igTfD6bVzY/rFgmcoFKzaHSfqt CunA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oEuVJkFe; 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 sa25-20020a170906edb900b0072b130dbadcsor1656914ejb.114.2022.07.08.07.14.45 for (Google Transport Security); Fri, 08 Jul 2022 07:14:45 -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:dc93:b0:726:a75b:f60f with SMTP id cs19-20020a170906dc9300b00726a75bf60fmr3769606ejc.564.1657289684498; Fri, 08 Jul 2022 07:14:44 -0700 (PDT) Received: from panicking.amarulasolutions.com ([62.18.232.106]) by smtp.gmail.com with ESMTPSA id s3-20020a1709067b8300b0070efa110afcsm20419074ejo.83.2022.07.08.07.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 07:14:43 -0700 (PDT) From: Michael Trimarchi To: linux-amarula@amarulasolutions.com, Dario Binacchi , u-boot@lists.denx.de (open list) Cc: u-boot@lists.denx.de (open list) Subject: [PATCH 2/2] mtd: nand: mxs_nand_spl Fix loop exit condition Date: Fri, 8 Jul 2022 16:14:39 +0200 Message-Id: <20220708141439.164394-2-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220708141439.164394-1-michael@amarulasolutions.com> References: <20220708141439.164394-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=oEuVJkFe; 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) {