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; }