From nobody Tue Sep 16 21:34:10 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D193AC4332F for ; Thu, 29 Dec 2022 19:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233936AbiL2TJW (ORCPT ); Thu, 29 Dec 2022 14:09:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbiL2TJM (ORCPT ); Thu, 29 Dec 2022 14:09:12 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B37C14D3F for ; Thu, 29 Dec 2022 11:09:11 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 91F0D3200786; Thu, 29 Dec 2022 14:09:10 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 29 Dec 2022 14:09:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672340950; x=1672427350; bh=26 OVl7pfPjUCuTagaZGOenKInbPyTJjQTgFy1rxtBYQ=; b=1rOqAIpmu7OJxRRrWD Zg9QX/bWx2jqDmeTQg3mXE+S3f2iXjFA5VRSEYIAKhz3TqC1z26C4Ww69up8ZmPI sAFbYpTbj4XjE82+7HRPJmkrWsDAY7t9pWPGOi+hY7LPXwPadAX+hkjjl6U5g/YP C0B7LCvVGZYkNsGOdZN8ckXgmT2mBpC7wFKCTKE0ww04ERxhn/xhZNKQnzUFggkq 3hJ2CCCKCykSl+qCPV/zrRMrtO90oE5qdv/16rVX8NZCe2ZWNyi9DWVlT+3AF51b 1q283Y3XLHuT1p3igWKEJP6aR7oJJ12kkjFLJ1ca0ZOZIGYEwEnWlXKENOm0IRrx sXYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672340950; x=1672427350; bh=26OVl7pfPjUCu TagaZGOenKInbPyTJjQTgFy1rxtBYQ=; b=oein5zp1XyEl9w8dNi+CcdsUJs+9s 4zovpuXNQAL3KwV+y3rdjurP34r7N2Ir6vaJxZ3FgxYIKhH3Rg99wFYM6dGwWLXl ZQytwE5bqCqUSVh9F6coLVSmSs5eJKnnL05mNDhfFcT/jmuIxcnQaDeBwHpWEzcl n+X1cjJL6WG4optJpEitcTzqSV/1y+USov9vX20L9p5TzXeJzyAU1D8+2DwQxluY uMUmwiR4gtrN+Y0/gfo0JJnJ45OCccYZnlUitU+A9H84ss2EqbfwzX779phnNvFQ 8zWQj6YHDTdcw+Tu6U4xY+FCAlY3olP78XbvJ0GkCf2nc9G4eBHhBCKVw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrieeggdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Dec 2022 14:09:09 -0500 (EST) From: Samuel Holland To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 1/3] mtd: rawnand: hynix: Add support for H27UCG8T2FTR-BC MLC NAND Date: Thu, 29 Dec 2022 13:09:03 -0600 Message-Id: <20221229190906.6467-2-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221229190906.6467-1-samuel@sholland.org> References: <20221229190906.6467-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" H27UCG8T2FTR-BC is similar to the already-supported H27UCG8T2ETR-BC, but reports a different ID. Signed-off-by: Samuel Holland --- drivers/mtd/nand/raw/nand_hynix.c | 4 ++++ drivers/mtd/nand/raw/nand_ids.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/mtd/nand/raw/nand_hynix.c b/drivers/mtd/nand/raw/nand_= hynix.c index 0d4d4bbfdece..836f152612ab 100644 --- a/drivers/mtd/nand/raw/nand_hynix.c +++ b/drivers/mtd/nand/raw/nand_hynix.c @@ -721,6 +721,10 @@ static int hynix_nand_init(struct nand_chip *chip) sizeof("H27UCG8T2ETR-BC") - 1)) h27ucg8t2etrbc_init(chip); =20 + if (!strncmp("H27UCG8T2FTR-BC", chip->parameters.model, + sizeof("H27UCG8T2FTR-BC") - 1)) + h27ucg8t2etrbc_init(chip); + ret =3D hynix_nand_rr_init(chip); if (ret) hynix_nand_cleanup(chip); diff --git a/drivers/mtd/nand/raw/nand_ids.c b/drivers/mtd/nand/raw/nand_id= s.c index dacc5529b3df..167183ccb9e9 100644 --- a/drivers/mtd/nand/raw/nand_ids.c +++ b/drivers/mtd/nand/raw/nand_ids.c @@ -55,6 +55,10 @@ struct nand_flash_dev nand_flash_ids[] =3D { { .id =3D {0xad, 0xde, 0x14, 0xa7, 0x42, 0x4a} }, SZ_16K, SZ_8K, SZ_4M, NAND_NEED_SCRAMBLING, 6, 1664, NAND_ECC_INFO(40, SZ_1K) }, + {"H27UCG8T2FTR-BC 64G 3.3V 8-bit", + { .id =3D {0xad, 0xde, 0x14, 0xab, 0x42, 0x4a} }, + SZ_16K, SZ_8K, SZ_4M, NAND_NEED_SCRAMBLING, 6, 1664, + NAND_ECC_INFO(40, SZ_1K) }, {"TH58NVG2S3HBAI4 4G 3.3V 8-bit", { .id =3D {0x98, 0xdc, 0x91, 0x15, 0x76} }, SZ_2K, SZ_512, SZ_128K, 0, 5, 128, NAND_ECC_INFO(8, SZ_512) }, --=20 2.37.4 From nobody Tue Sep 16 21:34:10 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0FFAC4332F for ; Thu, 29 Dec 2022 19:09:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233920AbiL2TJT (ORCPT ); Thu, 29 Dec 2022 14:09:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233614AbiL2TJO (ORCPT ); Thu, 29 Dec 2022 14:09:14 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AB4D14D3C for ; Thu, 29 Dec 2022 11:09:13 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 6DCB432005B5; Thu, 29 Dec 2022 14:09:12 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 29 Dec 2022 14:09:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672340952; x=1672427352; bh=g5 qIXCdzDVSxDpcNOdyuqgoqHDHz1BqdbXW1iSCF4RQ=; b=kId0KHA/Yh/Tao9yLi sVxAs6/QCg5Hh8jzHO0IxjRVrXCnNkAybj4+8mPbwCGiQq5f/HfGPkhgnVei3/MZ nyN3cWblK5XqrHIZ5ryOpVBecaHw+8V7WboS3jjnv0L6UQvTeLi9oM3MJxFf2iIS bQDTeBHO4YDoKsgINIHWAoVMoD9Lbj9omyLHV+NO+9Op8MWsMay1RJozwMerrJ/J HCxJT7L1bhg9wBM3jIkkm4ZOmwblOcX/esNnLj2JBeYszamhfbocSYQypldGfBSl XEmFpzGx/AMZ16f1jkvgem3N4c3JfEkknWYykkgzFX4QY4Xk8Xgm6hHBibQJktdS rGnQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672340952; x=1672427352; bh=g5qIXCdzDVSxD pcNOdyuqgoqHDHz1BqdbXW1iSCF4RQ=; b=GscAcTS8q4m6HwlCdc3FoLVACmKZy 4Xg8WgSFCMxf4DBfQoqQvpEufdjsVyBdbbZ6wKBiQLT2em7FTezVIvWiuZqvXRD/ QrKlPM4faGsEEVipnhmWaqSNeWxcGHxbmnV36rGgNRQAw0wDSyDwspAb0m3SKaSl azSw+oKts8o3R/NvDNbvXAk6wBeQuJI0SPG0sxj4n6Sg6E6naVJcl/hHV2qviPLv o7gTlSGreKJwnIwfFxIPvDU36gs28yeZkIUnEyhqgOqrbisQRiPIRb9wx7VBMiFO bTV4igaPTGGzmb1uZ0SRzLsYVj+lzR3pTCnfSm+LGBB2zgxM1ioxQG1CA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrieeggdduvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Dec 2022 14:09:11 -0500 (EST) From: Samuel Holland To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Holland Subject: [RFC PATCH 2/3] mtd: rawnand: Support non-power-of-two chip sizes Date: Thu, 29 Dec 2022 13:09:04 -0600 Message-Id: <20221229190906.6467-3-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221229190906.6467-1-samuel@sholland.org> References: <20221229190906.6467-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Some NAND chips have a number of pages that is not exactly a power of two. Support this by calculating the shifts and masks for the next larger power of two. Signed-off-by: Samuel Holland --- drivers/mtd/nand/raw/nand_base.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_b= ase.c index c3cc66039925..f46bad7796ed 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -5003,6 +5003,7 @@ static int nand_detect(struct nand_chip *chip, struct= nand_flash_dev *type) u8 *id_data =3D chip->id.data; u8 maf_id, dev_id; u64 targetsize; + u32 chip_page_shift; =20 /* * Let's start by initializing memorg fields that might be left @@ -5148,18 +5149,13 @@ static int nand_detect(struct nand_chip *chip, stru= ct nand_flash_dev *type) chip->page_shift =3D ffs(mtd->writesize) - 1; /* Convert chipsize to number of pages per chip -1 */ targetsize =3D nanddev_target_size(&chip->base); - chip->pagemask =3D (targetsize >> chip->page_shift) - 1; + chip_page_shift =3D order_base_2(targetsize >> chip->page_shift); + chip->pagemask =3D BIT(chip_page_shift) - 1; =20 chip->bbt_erase_shift =3D chip->phys_erase_shift =3D ffs(mtd->erasesize) - 1; - if (targetsize & 0xffffffff) - chip->chip_shift =3D ffs((unsigned)targetsize) - 1; - else { - chip->chip_shift =3D ffs((unsigned)(targetsize >> 32)); - chip->chip_shift +=3D 32 - 1; - } - - if (chip->chip_shift - chip->page_shift > 16) + chip->chip_shift =3D chip_page_shift + chip->page_shift; + if (chip_page_shift > 16) chip->options |=3D NAND_ROW_ADDR_3; =20 chip->badblockbits =3D 8; --=20 2.37.4 From nobody Tue Sep 16 21:34:10 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0CB8C3DA79 for ; Thu, 29 Dec 2022 19:09:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233956AbiL2TJ0 (ORCPT ); Thu, 29 Dec 2022 14:09:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233854AbiL2TJP (ORCPT ); Thu, 29 Dec 2022 14:09:15 -0500 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DA6F14D21 for ; Thu, 29 Dec 2022 11:09:15 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 4B0AC32005D8; Thu, 29 Dec 2022 14:09:14 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 29 Dec 2022 14:09:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672340953; x=1672427353; bh=Oe tE2bxovRIangZAcEXPm1k/wwprZFIdljerdmOvL5k=; b=z4sXU0z9KwQ/Kg83h7 sbWlXjkOurNEooNA217bA08r//0RDtspxbBwOI6NO2K2bO8YGsEogxjq7Sdm2D5J OthmUOnInOWy0KgHpxmmCyVsD9a7kyQfkcTBXnAg16WaNulvbj0kfw3VmqXt6VK6 0esUtXoh0aVSTboM6pvjNskn6+mItOwiG8GoEyM8XaMBTm1oMdk6k0YLOLKF1CmT QtvIOdOPGP7afW9NhjL3+UVDPNiDyu2kXDWMjtbL25U44YX0qyOHxIKa7jaTUrFc Z+YuOcJ4sgqDdSOVOma3CMPNtpHKQtzfM1xcSvPwNjhc/8Dlf3tZY1+vVm7Pfm2p kA+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672340953; x=1672427353; bh=OetE2bxovRIan gZAcEXPm1k/wwprZFIdljerdmOvL5k=; b=o0eLNsmvWdbUeeogoD51FWyjlsD9v rx55U86WMdn8eGJu5EqpwMO6CzwKf7t6P7+e4DYKAA+jBlB1i+lKV8XfhfeJQ+5/ yo6izADBmkdcfly8pQMad9+hAfFRKx6XVtYhSBxTHQrEH3sM4kdlaSV49BXdkaeP uO55arWu254q9/LQz4XbzeXSDdm+3tJj2D6EAHy1br3zCn005s2oiiwqs9pnqT7N Xv6owK4TxV5xRt7J8rZJ4gpXLtURDY7/kVeXQJRuPv2/qzrG3u0bXvrM7eKLLR1j qGrYnCVqK86rX1Qn9hQkNC3btIvPCDY1XW5+5zOXc7CHZz34iLJa+6rRQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrieeggdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Dec 2022 14:09:13 -0500 (EST) From: Samuel Holland To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Holland Subject: [RFC PATCH 3/3] mtd: rawnand: hynix: Expose the full H27UCG8T2FTR-BC chip size Date: Thu, 29 Dec 2022 13:09:05 -0600 Message-Id: <20221229190906.6467-4-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221229190906.6467-1-samuel@sholland.org> References: <20221229190906.6467-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This chip has slightly more than 8K pages. Now that non-power-of-two chip sizes are supported, make the full chip available for use. Signed-off-by: Samuel Holland --- drivers/mtd/nand/raw/nand_ids.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/nand_ids.c b/drivers/mtd/nand/raw/nand_id= s.c index 167183ccb9e9..f20a65aa090f 100644 --- a/drivers/mtd/nand/raw/nand_ids.c +++ b/drivers/mtd/nand/raw/nand_ids.c @@ -57,7 +57,7 @@ struct nand_flash_dev nand_flash_ids[] =3D { NAND_ECC_INFO(40, SZ_1K) }, {"H27UCG8T2FTR-BC 64G 3.3V 8-bit", { .id =3D {0xad, 0xde, 0x14, 0xab, 0x42, 0x4a} }, - SZ_16K, SZ_8K, SZ_4M, NAND_NEED_SCRAMBLING, 6, 1664, + SZ_16K, 8448, SZ_4M, NAND_NEED_SCRAMBLING, 6, 1664, NAND_ECC_INFO(40, SZ_1K) }, {"TH58NVG2S3HBAI4 4G 3.3V 8-bit", { .id =3D {0x98, 0xdc, 0x91, 0x15, 0x76} }, --=20 2.37.4