From patchwork Wed Jul 27 09:37:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2267 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4E69F3F1F7 for ; Wed, 27 Jul 2022 11:38:03 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id q16-20020a056402519000b0043bd73ad1basf7768257edd.3 for ; Wed, 27 Jul 2022 02:38:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658914683; cv=pass; d=google.com; s=arc-20160816; b=YY0bKiAjB6plh9A6CWvvbVipAdoRbmQEwgpo85HIq8nCQrBzx24kdhjpMk9mc6Zh0Y S64sILGA9w7c0Me8BHizpf6nbGueRy0iwytT2B1M/139a64zAdGWTZlo6JWe+YAYq3JP PoU7v0diFS3mMpbTWhP1Y+cJM7JTCSb4e4GpP2MjCNvxM74lvVzMhZw3K2mjvdb95OF+ AQMuwmasozJtddISkINsO0s0nVNa05sp4pZm3S1CPvS89PLLbICVgEIYIT0zMRySDfnK k+MOgNX8coWlFNAR/AbkqXW/yGNHx7UbvYbPvmWm9mdX7qZIIUNVRHt0SjFGQE9XeiIl X0iw== 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:to:from:dkim-signature; bh=RjGNs6MxOeqpLZbGd0XkMBKG81qp0kIMZLGuWK2gHX0=; b=u9XPPdswoRROFjF6zWIiQU1QvZULdtwa8lvin7l71N8IR5Wv3kv2yE72JDB64RsCNX DUwcC+e+zS2lEQ6bO3Wj5zH0+++NYu3lzXsxkXFAeI00qTdO5HcDEjlJxjbhBVgr9qoK K5DyjgUBhk2ucHgejd8SdkAvKgi2+zmQ5toKkukW1OyaFO6ZLmguKoqvc1Eb2Pc+ZSMY OLuTA7hwdz10nqDeWBox9uOsEExX4ri/fJGQQgvD0DKSL7XHXVFWTNbVm6+kvq7ZIaDm Xz/ljzASpfawPcarwxmTtjQ27QMVigZ6FeG1VbWIzV6cGYJJpGCu9SM4CmAG2ytqg94X B7YQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gHcl8wBk; 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: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=RjGNs6MxOeqpLZbGd0XkMBKG81qp0kIMZLGuWK2gHX0=; b=gppQFCu/rT9Rlw8ybRmMFHTqgIrl7E1u7l9n0XLRWpddscLsoJ1RdwxUyJ5QRwWdNV y5VEtqKQxA+c3Be00ZoPQpBvZ2EWTcZicD7ahrPo2+CaxdVbdon92U5OxmCePLMXB56N 4FMXKwsIh4f7CCYtzxkerxQ/GF2lyZpwGZdEw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to: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=RjGNs6MxOeqpLZbGd0XkMBKG81qp0kIMZLGuWK2gHX0=; b=4Rn+Nu9lPrtyqGrsameT4yqZzYZENZZl8TRI5XrATt7CeL16zJRh4vY4TlPOh48oxt /kvcB8InlfEExqmU5jMv8XkzgEwTPRv78W2cjhr1pvjcZTUFuiSKN1IRsIpk6AYc6gO7 kcQE5MN7Mb7saKEYI/FNxik2X7QfZzPGxDvTaz4JCFXZ/PHdS1Hyb4bNGdO13Az8uzOV 3QfMZ5yVD7nHWmagP6/Zs84PgEc89Z2xX5OWa8+u26SBH8XPxFMlQJbkRobOo6wtQ2+E 0gjdpDOXobViKZfarY7yPZmYXHEgrqmy+ZWLbs1dPdVKCD21RQsL9iFmMrTyeGMsCc6a bwgQ== X-Gm-Message-State: AJIora9jJZ8aDVoFnu6LZHMP1hZVU9eq2q5uOvqzUn0sy1WTvTBRdJl/ ce+QVFPDig7NDYChNqvuVaCiSS2p X-Google-Smtp-Source: AGRyM1vZOyexRKnC9uiO9HjmJvW9FIEo7bK+YJw22bpLySZjga+v6KHj5GllxiSxRScym7ouijuMuA== X-Received: by 2002:a17:907:3e0e:b0:72b:568f:7fa7 with SMTP id hp14-20020a1709073e0e00b0072b568f7fa7mr17702393ejc.119.1658914680672; Wed, 27 Jul 2022 02:38:00 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:680f:b0:72b:564b:c25b with SMTP id k15-20020a170906680f00b0072b564bc25bls1900920ejr.7.-pod-prod-gmail; Wed, 27 Jul 2022 02:37:59 -0700 (PDT) X-Received: by 2002:a17:906:844c:b0:72b:4d77:fd83 with SMTP id e12-20020a170906844c00b0072b4d77fd83mr17541035ejy.151.1658914679478; Wed, 27 Jul 2022 02:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658914679; cv=none; d=google.com; s=arc-20160816; b=H3ppfeJdfKLL6wikkln5N38tNP7yNpJoIOCvyhQSo8pOOrJcxF3hzJaMTYKHwwpyBd 5aFM+433e/Knzy/tRV2yenikKoMmwT2KJ1JC/lOumOAcWx7EnaXgonqzQVSKW4/8eTJ7 FGXDUqPxDzlYMxdHvNxb0sHbhwszb04op9Ns2sXrdSp4uq5c7OxDezO79hqqhltOk+M3 N26inbkf1COlLmRatigfZPvKzvz0C9HwF68q5B4R6NubErjGPAFSp1F4VsPE3p7LixsJ z/fodcMWGoXxLxUaXKyQHz+liwrdoWRzZf0cjI9rAQI2+3U3IhVGIsxwhatQLSEXZh4O RlvA== 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:to:from:dkim-signature; bh=ZlSwORXpfbA7ZP6exhkpLuqHtEFhtBdAE2uTkn1B4uo=; b=TdNSbUcjMuQVrgAPozDYiQL1vYsNLDke0Z79r114QNrl3w4cNcZ4PA56RVwvqrOFYX ktSEz9CXycWCadwIVHU5eHsFBvDHL/4GFQ1H4zktFF3i2rcC6b/wevC/4gB+DpeDmmpH UKbiYDvDIsxUpiENr5dYo2ka2cZo+1eTwvqWpF1eoOlQ0QxPniAhxBCYtOMe5bbKcra4 t/oU+SYplL0Dv4RYpsFqIo9dquK3a3Q0vXvUHJCCoBwOVRsUyPqc/3g1Dgok3a5zixTm 6l9T8zGZh3qFnI9+fAcVkwIpfdzNJbVzR1t1kgn1fF4vPXCEN3YktMwmrKRKbSMqXWn2 fKCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gHcl8wBk; 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 d16-20020a50f690000000b0043ba4f8d2e5sor8286709edn.52.2022.07.27.02.37.59 for (Google Transport Security); Wed, 27 Jul 2022 02:37:59 -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:aa7:ccc8:0:b0:43b:e3b4:bc0a with SMTP id y8-20020aa7ccc8000000b0043be3b4bc0amr18562103edt.289.1658914679064; Wed, 27 Jul 2022 02:37:59 -0700 (PDT) Received: from panicking.amarulasolutions.com (mob-37-181-33-55.net.vodafone.it. [37.181.33.55]) by smtp.gmail.com with ESMTPSA id q22-20020a17090676d600b006fece722508sm7317678ejn.135.2022.07.27.02.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 02:37:58 -0700 (PDT) From: Michael Trimarchi To: dario.binacchi@amarulasolutions.com, Tommaso Merciai , linux-amarula@amarulasolutions.com Subject: [PATCH 5/7] mtd: nand: Fix ecc in mxs_nand_spl onfi mode Date: Wed, 27 Jul 2022 11:37:46 +0200 Message-Id: <20220727093748.1415135-6-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220727093748.1415135-1-michael@amarulasolutions.com> References: <20220727093748.1415135-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=gHcl8wBk; 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 4dffa76eaf..6d8ec5b3cb 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; }