From patchwork Sat May 19 12:44:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 916837 X-Patchwork-Delegate: miquel.raynal@bootlin.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="q1ipy2tO"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=googlemail.com header.i=@googlemail.com header.b="rJrPAqec"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40p4Wj2lb0z9s4w for ; Sat, 19 May 2018 22:45:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=C0gtFEdoeqDH+FWlNKCLqkSMMfxNEgWE7s+jQpapDWc=; b=q1ipy2tOowSg7GZjmRwr+2gfAE TuHvJ4ll93orgFtOj48+C89AiSO0QZ/g+HDgFyXluRl5T6twkc8b75/nWCpc61WvoyJSESk458CF5 q7ngP6jmUUJfbyhde6MVnbvGqLmdCvCzoKuG91t54gSpvrJrSsfe11Kb+iDvvyH//5l1tDb0tY6mt vhxfXO4fxIPeZM3pxlDAC4lyJt7l+wtkSUaNEEDEI0b+1Yxv586GKxy23cgBSNoA00E+rUaoaYxTW +Q5MMRXvzrhcUxt+ka02NtwueYYFP/akucRslDE5DXp7eekP4i/qN4VpLM31cDOPxzUZzpV11Szpp 6uyiFbAg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fK1EW-0003DD-J3; Sat, 19 May 2018 12:45:12 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fK1EC-0002SR-VE for linux-mtd@lists.infradead.org; Sat, 19 May 2018 12:44:54 +0000 Received: by mail-wr0-x244.google.com with SMTP id a15-v6so4431811wrm.0 for ; Sat, 19 May 2018 05:44:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=41AtmR+Ol9f2n/QuMdrU+i4hRXmdLzeHtaW7ii/QmEQ=; b=rJrPAqec7oPuPagwWqOrQHTENAbS+Qz7mFQ3NEItlvqUkom2eTiBdsR1cMHX7D2uuS YtpNLekswATZ3mCsxFzlEDq4QJADZZRcXimwxwN2RRR+zaa+dQriX92Pj1Du6Z7Ih1oS 3UdDY0jZbhQ+ZI9PUW8BEnrsougz4JzspxZIOgBIhC33YJk8d+yINr1NreFEaDTcrEz4 VxrAhzHUGBVnC8T/HRYROqQsBrVo7izXEvSTK7P7ogE6kGyB/R0L7oBy01n5/bkqu6IM w2P2mfsU4/zr+YR9tGDouk/sNw85HJ9YYCHq1V50h1tlFr8ECBqXuctvGVxCMYm0exLk dI3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=41AtmR+Ol9f2n/QuMdrU+i4hRXmdLzeHtaW7ii/QmEQ=; b=LFVd6m5ZdxG4PfnFVg0SWFssIePCF22Yu95dQzHWWEaN0bn66boDsrezQXDQIB73BO AsnPIbZUUzbeZsYfHufMfdt2BF6Cw4tagFtYHf6m9p5kdkWsB9NdtWIGMPlFJFeqjV41 6/hG3UTIJcc/oFFHDJGaDWZwbSGVNgtyXPwHtwj+nqTQZ/bld6KQLcrnxosNb3V3ziCf UOyaKUSvJiuz3AZWvTc41o1MyWBrgNzCSjW9IVv/1Q7FOncFNJvvGUz9mJP7jVQGwGBp npaVtRPvWilIdAqkMXcurLUGiTdya6BfhLDWwW8VKdNwfbzCcNzRsMvZ2OqpNWCotmDB TQWw== X-Gm-Message-State: ALKqPwc7e9CLqg3D1JpmO7v1n9GPxdyHTybmB6H66I921gMIPJ5kZgp2 jiPQiwyPtXqvcuPTHtMHJLt/KN+B X-Google-Smtp-Source: AB8JxZoo3UvK7Zk9IE6KmOQuTXBcbw5YZUDGd4RJ7LOze6o2kaEGDKRSAAO25Zfbj1jZt0W6G5wXFQ== X-Received: by 2002:adf:9162:: with SMTP id j89-v6mr10627427wrj.196.1526733880467; Sat, 19 May 2018 05:44:40 -0700 (PDT) Received: from blackbox.darklights.net (p5DD9B53E.dip0.t-ipconnect.de. [93.217.181.62]) by smtp.googlemail.com with ESMTPSA id k23-v6sm11982558wrc.59.2018.05.19.05.44.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 May 2018 05:44:39 -0700 (PDT) From: Martin Blumenstingl To: linux-mtd@lists.infradead.org, boris.brezillon@bootlin.com, richard@nod.at Subject: [PATCH 1/1] mtd: rawnand: hynix: fix decoding the OOB size on H27UCG8T2BTR Date: Sat, 19 May 2018 14:44:31 +0200 Message-Id: <20180519124431.16000-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180519124431.16000-1-martin.blumenstingl@googlemail.com> References: <20180519124431.16000-1-martin.blumenstingl@googlemail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180519_054453_069384_076920ED X-CRM114-Status: GOOD ( 13.40 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c0c:0:0:0:244 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (martin.blumenstingl[at]googlemail.com) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Blumenstingl , marek.vasut@gmail.com, computersforpeace@gmail.com, dwmw2@infradead.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The datasheet of the H27UCG8T2BTR states that this chip has a page size of "16,384 + 1,280(Spare) bytes". The description of the "4th Byte of Device Identifier Description" indicates that bits 6, 3 and 2 are encoding the "Redundant Area Size / 8KB", where 640 bytes is a value of 0x6 (110 in binary notation). hynix_nand_extract_oobsize decodes an OOB size of 640 bytes for this chip. Kernel boot log extract before this patch: nand: Could not find valid ONFI parameter page; aborting nand: device found, Manufacturer ID: 0xad, Chip ID: 0xde nand: Hynix NAND 8GiB 3,3V 8-bit nand: 8192 MiB, MLC, erase size: 4096 KiB, page size: 16384, OOB size: 640 However, based on the description in the datasheet we need to multiply the OOB size with 2, because it's "640 spare bytes per 8192 bytes page size" and this NAND chip has a page size of 16384 (= 2 * 8192). After this patch the kernel boot log reports: nand: Could not find valid ONFI parameter page; aborting nand: device found, Manufacturer ID: 0xad, Chip ID: 0xde nand: Hynix NAND 8GiB 3,3V 8-bit nand: 8192 MiB, MLC, erase size: 4096 KiB, page size: 16384, OOB size: 1280 Signed-off-by: Martin Blumenstingl --- drivers/mtd/nand/raw/nand_hynix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/nand/raw/nand_hynix.c b/drivers/mtd/nand/raw/nand_hynix.c index d542908a0ebb..60d9c54b769f 100644 --- a/drivers/mtd/nand/raw/nand_hynix.c +++ b/drivers/mtd/nand/raw/nand_hynix.c @@ -473,6 +473,10 @@ static void hynix_nand_extract_oobsize(struct nand_chip *chip, WARN(1, "Invalid OOB size"); break; } + + /* Reference: H27UCG8T2BTR - "Redundant Area Size / 8KB" */ + if (mtd->writesize == SZ_16K) + mtd->oobsize *= 2; } }