Message ID | 20220728171744.1761739-5-michael@amarulasolutions.com |
---|---|
State | New |
Headers | show
Return-Path: <linux-amarula+bncBCXK73FY3AFRBSEJROLQMGQEZS44ZTI@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id CC9413F081 for <linux-amarula@patchwork.amarulasolutions.com>; Thu, 28 Jul 2022 19:18:00 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 189-20020a1c02c6000000b003a2d01897e4sf1173351wmc.9 for <linux-amarula@patchwork.amarulasolutions.com>; Thu, 28 Jul 2022 10:18:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1659028680; cv=pass; d=google.com; s=arc-20160816; b=eL7JCbmaEJ4PW682f8Ids/VizWmFMFzz/ezNm0RzwwEEwIe7flF2JQZh/p1s3ti4Hn UeTmPouGkBF2ACFNhGUZC/BbwJgps8EVsn5cJ9h4pbkDv4AfMclGy5werJBSk+93jf1q MVd0j5BIoiXruLJse6LKv2nRahSIu271mEgauut7E3XoKU7uEeV+XooD3UpjKoCSTefZ yHA0MLUtVDgAwrLVg+nLWRszn4P9cx9oa5GB2+gJr8Jnn3vU3YtlHfaWHqvbaUNAwnle kBXMMFCgqQxdb1c2VBE2/RJGE8CaxyKB4E4F9YJesL5m/ARnJOQHZ0byB3CnYfAuSKHk 3Ojw== 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=5ddosn4/bJZT7jBt2EfL5ixz/9xuydVCf9J/kAMK6ac=; b=GFPPaokm74nA+m+ez2gkqEJ8H2pb9tVln9glnWq0FINdpEmJSooUJQo9qXI9jgSLfU vPW+X6un6wlbM98PiwZxlxt/PbCu7OTW4e2R58ApWdh0Xx8Vk866zWi9uY31PfGCSi9O gvl7DPVWi/3JsxThxdT1aFSlhZ062ZahNjoGUhPJSFYtLkholYDojzoD5vlhxUPkNyjQ ILd3MHFhglZz9dtDm4WfQrkuqvJY41EQ44CQ9lCRvbVk7KYnV0vQ/jnIGFeQoFhvVDvN TB0Gb8lnSd0Hzz+OpOi5aA4e+jhtt3KtVetz2QGMrqX1H5kEO6iS4g0gfnzFTG3uIiZC LY9g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kber122+; 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=5ddosn4/bJZT7jBt2EfL5ixz/9xuydVCf9J/kAMK6ac=; b=UxpdsVFU09E4evWqfRlwLruKGmhzQxEQuMyIjoeMGyufurKkwC1+DFVNTr8vuSvxfJ 8U7mR50nvgU+FX+udMc4eMvZlsfvlM24W89YBBmgu6tzqtaqRDTrtSSe3w3KuXRCSr2t XJ/5H2W5dhYxj+hWtCO3qRY/MeVrWCZPU7vGM= 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=5ddosn4/bJZT7jBt2EfL5ixz/9xuydVCf9J/kAMK6ac=; b=DMN+Y9fT9XU0TsGf8WpSQkfU1EVUPRPeQMf075DusYaOZC4uNpnqyd+rosZqKcC5rs 1svoaBvblvQjqDdz0Y/t/1GZsZ6WzHhd18/ZRck51pTfaZmI4piBuDdDP0QyQUXvFLRx CHefR4bQu7CzEEm9/v8DXJD+uQrVS46IamZSrCcSuSJy0l+CDhqXNZxW42rYbOs3oE8P 76rKYrw/J2WiuyneOlje9cmf2WTytt48oQkcpAApLngwxn9LjCRaJnzKbJqsQxjqbvuN xnCCV9ZXxAz3x+RbYKLoF1GzvK7oRRl0YtenF9m510uMwqj29WHXLhApcaXhSb9g6GQ0 GlTg== X-Gm-Message-State: AJIora9CXjTIG36ZYfsvjeE/lXOhahaga2BnLFyPTnh+TqIIh1gXDMwN lTuvlWFbHdn3ZnOEyUWUA4cTRXl7 X-Google-Smtp-Source: AGRyM1v2zExPB817tkRoOFjCXw/Ty4jJSYSzSjhgbr4xmMQWSwQwnAjitfGriXysrWADmCPGXhYE4w== X-Received: by 2002:a5d:620b:0:b0:21e:5b97:c826 with SMTP id y11-20020a5d620b000000b0021e5b97c826mr17212612wru.600.1659028680383; Thu, 28 Jul 2022 10:18:00 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:e18b:0:b0:21d:9636:a730 with SMTP id az11-20020adfe18b000000b0021d9636a730ls2531255wrb.0.-pod-prod-gmail; Thu, 28 Jul 2022 10:17:59 -0700 (PDT) X-Received: by 2002:adf:e19b:0:b0:21e:4bb9:9a14 with SMTP id az27-20020adfe19b000000b0021e4bb99a14mr18315874wrb.354.1659028679027; Thu, 28 Jul 2022 10:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659028679; cv=none; d=google.com; s=arc-20160816; b=wlp/TjvwoRVjI5DI/RaWa2wvbdXzkkMfZdkGsJz57rqbq0c7cFKkhbEYMmwT/71IY6 QwlK9K7+swwJAXVFf5RPNRIHMbp1713wtG0c4z7P00tFrefbmQbbjhX5yEg123hgYwn5 r3lKy93x7VLINCdXuydqXvoiFayWUW1IJAgl7KtwNvNNqO8MIZ4onAn2xAcl1qnXlryX wXCIIDS/YyX4fBZCx8jhWqfN35bStbI3KOw8q0vVJYlKEao6EUj4ew2+t1LqDlT5o4xq vmJA7jTLmoruIAENRO3/PErofuZ+r8hjOh7PfiAZrHLnLe7J3FJzDQyej5ILulJCtZHK ENrw== 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=+Kmdd9fm+cOxM+5ZJRvmWU6Fbc3fNB7QutxwJjisqyQ=; b=nFLgrThQj3ePH7F9rr22i2AnAvgh5bYAAY4ZfAEo0mL3e9uy/qOqrMHJwhHncnbr5a 9TbN0UATGtbLTr78gc2hB6COF+l9A+U4Hk0ZXcOx1Bh2aYFWE5LTrIAYL0lqMF4Mh59e DFDsGphy4dV9GZA5EYzUU9FMqxlgcgkI2WtrmY7oY6NlWDhkfQr/AyVcfb/5g6pii2Vo bk3C+oVVJjB2dd3Wo03Zae3MMTh9gvX9uF3KQzNn5hwDDMTBdHUqCFExfuvvn1Jit27B lysNFRBHB7f0oNOD8aNNeASiBa5LmzCF2PDLCdVn5LcEGcbHI5QS7nF/jiSR4xkv1l+t pYEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kber122+; 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 f20-20020adfc994000000b0021d6be62c2dsor799904wrh.53.2022.07.28.10.17.59 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Thu, 28 Jul 2022 10:17: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:adf:f911:0:b0:21e:c0f6:fd26 with SMTP id b17-20020adff911000000b0021ec0f6fd26mr6870960wrr.361.1659028678724; Thu, 28 Jul 2022 10:17:58 -0700 (PDT) Received: from panicking.amarulasolutions.com ([2.196.208.4]) by smtp.gmail.com with ESMTPSA id h3-20020a5d4fc3000000b0021eba590ad1sm1667850wrw.90.2022.07.28.10.17.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 10:17:56 -0700 (PDT) From: Michael Trimarchi <michael@amarulasolutions.com> To: Dario Binacchi <dario.binacchi@amarulasolutions.com>, u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Tommaso Merciai <tommaso.merciai@amarulasolutions.com> Subject: [PATCH 4/5] mtd: nand: samsung: Retrieve ECC requirements from extended Date: Thu, 28 Jul 2022 19:17:42 +0200 Message-Id: <20220728171744.1761739-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220728171744.1761739-1-michael@amarulasolutions.com> References: <20220728171744.1761739-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=kber122+; 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: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
Series |
|
Related |
show
|
diff --git a/drivers/mtd/nand/raw/nand_samsung.c b/drivers/mtd/nand/raw/nand_samsung.c index 0ab8062193..36ef48e5ec 100644 --- a/drivers/mtd/nand/raw/nand_samsung.c +++ b/drivers/mtd/nand/raw/nand_samsung.c @@ -64,6 +64,26 @@ static void samsung_nand_decode_id(struct nand_chip *chip) extid >>= 2; mtd->erasesize = (128 * 1024) << (((extid >> 1) & 0x04) | (extid & 0x03)); + + /* Extract ECC requirements from 5th id byte*/ + extid = (chip->id.data[4] >> 4) & 0x07; + if (extid < 5) { + chip->ecc_step_ds = 512; + chip->ecc_strength_ds = 1 << extid; + } else { + chip->ecc_step_ds = 1024; + switch (extid) { + case 5: + chip->ecc_strength_ds = 24; + break; + case 6: + chip->ecc_strength_ds = 40; + break; + case 7: + chip->ecc_strength_ds = 60; + break; + } + } } else { nand_decode_ext_id(chip); }
Upstream linux commit 8fc82d456e40a0. On some nand controllers with hw-ecc the controller code wants to know the ecc strength and size and having these as 0, 0 is not accepted. Specifying these in devicetree is possible but undesirable as the nand may be different in different production runs of the same board, so it is better to get this info from the nand id where possible. This commit adds code to read the ecc strength and size from the nand for Samsung extended-id nands. This code is based on the info for the 5th id byte in the datasheets for the following Samsung nands: K9GAG08U0E, K9GAG08U0F, K9GAG08X0D, K9GBG08U0A, K9GBG08U0B. These all use these bits in the exact same way. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> --- drivers/mtd/nand/raw/nand_samsung.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)