From patchwork Sun Sep 13 16:15:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thirumalesha Narasimhappa X-Patchwork-Id: 1363114 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 (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=VfXV8TTj; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=JyPL2Pql; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BqF494x8hz9sT6 for ; Mon, 14 Sep 2020 02:16:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=2cOXsiDNNOaBWjBC6PDzi8NQ6Kl8H00cW4Md7TBaUWA=; b=VfXV8TTjJin+HfhF9eCBIK6pm fzmfElcFngCGEqduX6Ce0Dx1gA/+mZiiWCL1EeB2kTCLbownIgRrJgWoZrAXEaG6Yjt3/PdiaOaOW zt/knX2Hkn2auEGVHJ3hChsHUpcsMVaxpRU+Hd2PvvundUUo+FGDdEoaWsxcIf4QdksSLAQY5uSjo 2bgcfcEyqPKEBeuQcZ9aCaag3V2FLtMug4eKPRvyMpQU89kkbjHOZ3TReDdIgiH2RPQceavqObShU ry0yc2ERx2UjsUZ/qki8xNYNc3lsWSYBcMrbxcy7tIJ8vmGKl/qe2qCrAiwnFn2etJp3HHZIZ1npO cMEfEMt8g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHUfO-0004kV-GY; Sun, 13 Sep 2020 16:15:50 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHUfL-0004jV-5D for linux-mtd@lists.infradead.org; Sun, 13 Sep 2020 16:15:48 +0000 Received: by mail-pl1-x643.google.com with SMTP id g21so2020618plq.1 for ; Sun, 13 Sep 2020 09:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=95c6QPsz7bPnVQEayO8hHcHLwY3gkWsLTvnzG7IV4QE=; b=JyPL2PqlbFDejFLHfPHBZRJ3A0g45iKSb5MizjskJkzz2pwhCaupLh0WcVNnNSf7J+ pSxBNIZ+sM/I4tmzqcsjZwyvlPz8zmn3rDILaZ/2bD8Db8wqvaS1/bK2ILewkquiYRtO Zy334qin3biNCs588Ynpqfkzr8hsZS6XJQ3WQxKuFxArsa6ZJIPyDtv0OG+S39TTLblx DWT1HeNlY9H+uzzdquZ7eFQovmVce3yiFR1ilyMh0OQULp6eC8JpUoFEOrx9zzhdZwXu lqQhXHKVmjhFEgLxelpdc2Lv6Fa30i01M5e7X9NDlmwg1m5+KEB40yujPGr9GcwUBS9D VDaw== 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:mime-version:content-transfer-encoding; bh=95c6QPsz7bPnVQEayO8hHcHLwY3gkWsLTvnzG7IV4QE=; b=TLm/B7fCj8zy34Wm1cq4sq0rDkwS77wv1wjDysduFiiTmnEggv/DStstwdrNsXnb29 UvXMLdz2XOBXH0Y09Js8oXYtUtJnq006LlqIYHeahCXwELCKYV2zvZaD5+uOJk5w2/7b 66b0GXZLrBCkgvnjkR2kaDs7lFq7ke7+wQhWFbq8ksjPN1oWPubSUeWbxNLz3FNmQ5tg kaj2jXpAp0jMLHS5/l8t2nYyixuvUPoa7EpLPGnrEicZj7NlxAbW74k9T26sxF6GGJhJ eXYgFPc9GxDxmTWy/Cutci+zhuG3xdkodtFzlJi1zBwL4H8BFDaYT7gXK3C7GhNO5a2u vPEQ== X-Gm-Message-State: AOAM532Q0YBAlPSdRNG4XQumd7TnXgfXQeHIZvNNyMTR4M9hyxfDyFNC +TmPvu5QnE5HfsCzOrlNkVk= X-Google-Smtp-Source: ABdhPJx1r6Cu5JCuNHrhMT9Pw2HGd3WfDv59A0SscaK1bShHv9zwyWcGn56yI4//KftEM+fpFyiryQ== X-Received: by 2002:a17:902:8c96:b029:d0:ad87:6668 with SMTP id t22-20020a1709028c96b02900d0ad876668mr10819429plo.2.1600013745022; Sun, 13 Sep 2020 09:15:45 -0700 (PDT) Received: from Thiru.localdomain ([27.104.143.83]) by smtp.gmail.com with ESMTPSA id c202sm7833953pfc.15.2020.09.13.09.15.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2020 09:15:44 -0700 (PDT) From: Thirumalesha Narasimhappa To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Shivamurthy Shastri , Boris Brezillon , Chuanhong Guo , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/2] mtd: spinand: micron: Generalize the function and structure names Date: Mon, 14 Sep 2020 00:15:32 +0800 Message-Id: <20200913161533.10655-2-nthirumalesha7@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200913161533.10655-1-nthirumalesha7@gmail.com> References: <20200913161533.10655-1-nthirumalesha7@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200913_121547_421033_D29A5AA7 X-CRM114-Status: GOOD ( 12.13 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [nthirumalesha7[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [nthirumalesha7[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thirumalesha Narasimhappa Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Rename the oob structure and read/write/update function names to a generic names Signed-off-by: Thirumalesha Narasimhappa --- drivers/mtd/nand/spi/micron.c | 80 +++++++++++++++++------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c index 5d370cfcdaaa..d1b1073d1a55 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -28,7 +28,7 @@ #define MICRON_SELECT_DIE(x) ((x) << 6) -static SPINAND_OP_VARIANTS(read_cache_variants, +static SPINAND_OP_VARIANTS(quadio_read_cache_variants, SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), @@ -36,11 +36,11 @@ static SPINAND_OP_VARIANTS(read_cache_variants, SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); -static SPINAND_OP_VARIANTS(write_cache_variants, +static SPINAND_OP_VARIANTS(x4_write_cache_variants, SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), SPINAND_PROG_LOAD(true, 0, NULL, 0)); -static SPINAND_OP_VARIANTS(update_cache_variants, +static SPINAND_OP_VARIANTS(x4_update_cache_variants, SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), SPINAND_PROG_LOAD(false, 0, NULL, 0)); @@ -69,7 +69,7 @@ static int micron_8_ooblayout_free(struct mtd_info *mtd, int section, return 0; } -static const struct mtd_ooblayout_ops micron_8_ooblayout = { +static const struct mtd_ooblayout_ops micron_grouped_ooblayout = { .ecc = micron_8_ooblayout_ecc, .free = micron_8_ooblayout_free, }; @@ -120,55 +120,55 @@ static const struct spinand_info micron_spinand_table[] = { SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x24), NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), 0, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status)), /* M79A 2Gb 1.8V */ SPINAND_INFO("MT29F2G01ABBGD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x25), NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), 0, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status)), /* M78A 1Gb 3.3V */ SPINAND_INFO("MT29F1G01ABAFD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x14), NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), 0, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status)), /* M78A 1Gb 1.8V */ SPINAND_INFO("MT29F1G01ABAFD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x15), NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), 0, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status)), /* M79A 4Gb 3.3V */ SPINAND_INFO("MT29F4G01ADAGD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x36), NAND_MEMORG(1, 2048, 128, 64, 2048, 80, 2, 1, 2), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), 0, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status), SPINAND_SELECT_TARGET(micron_select_target)), /* M70A 4Gb 3.3V */ @@ -176,33 +176,33 @@ static const struct spinand_info micron_spinand_table[] = { SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x34), NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), SPINAND_HAS_CR_FEAT_BIT, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status)), /* M70A 4Gb 1.8V */ SPINAND_INFO("MT29F4G01ABBFD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x35), NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), SPINAND_HAS_CR_FEAT_BIT, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status)), /* M70A 8Gb 3.3V */ SPINAND_INFO("MT29F8G01ADAFD", SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x46), NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), SPINAND_HAS_CR_FEAT_BIT, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status), SPINAND_SELECT_TARGET(micron_select_target)), /* M70A 8Gb 1.8V */ @@ -210,11 +210,11 @@ static const struct spinand_info micron_spinand_table[] = { SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x47), NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2), NAND_ECCREQ(8, 512), - SPINAND_INFO_OP_VARIANTS(&read_cache_variants, - &write_cache_variants, - &update_cache_variants), + SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants, + &x4_write_cache_variants, + &x4_update_cache_variants), SPINAND_HAS_CR_FEAT_BIT, - SPINAND_ECCINFO(µn_8_ooblayout, + SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status), SPINAND_SELECT_TARGET(micron_select_target)), }; From patchwork Sun Sep 13 16:15:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thirumalesha Narasimhappa X-Patchwork-Id: 1363113 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 (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=UrZaDWl5; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jpJ2LY7D; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BqF495QmBz9sTR for ; Mon, 14 Sep 2020 02:16:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=UZiG5G9FoK797OcunLnSsMWbVJejUFG4vJNXS6ArEU4=; b=UrZaDWl5bFOgzbUAS5mXGQ0LK oWvraxpszou7ggRtdA4JqJcIu5HQxZlGpyZHBT4saUPRkqWgxyyIwgm/pvONPRuGQFbqAF1Zt9gzB Cvt6T8r1wMCzYtK8KNK4gq+3KW+xgFmOKKjybwxC3JOhzaSTcXg/DUa6G3JGonTsDbTGpeOkN4uye MKho55Ab/YsbehJodjCnaufsdEUTjPKbbxWGIOY0UKZHSPvQ04bBUaWNO2lpLp2RwHGXGMU9zY43a +uQ2MAu6bgF4YPG3H39IYarqJT8pph+PtM5PQ4HN5aZLDsx7na+8+Pbsv5ylZPbtODhtukM8hiA5h 5re+PYFTQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHUfQ-0004kw-Sf; Sun, 13 Sep 2020 16:15:52 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHUfN-0004k5-Rf for linux-mtd@lists.infradead.org; Sun, 13 Sep 2020 16:15:50 +0000 Received: by mail-pf1-x444.google.com with SMTP id x123so10499578pfc.7 for ; Sun, 13 Sep 2020 09:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KwZK3cynzlKs4fDm6cpdhaPJl7Rn30I8P2QHQetryVE=; b=jpJ2LY7DRgcUiKFMO8Y4KMDyC0lbaQYduYjpnt+fP5Bim8bTzxhH8Ex4Wy0iKo2e27 pt9JxY8NAMXQvLffRT477rhzGcNxhovFdexnc030KOgSJQRMODRHsc8Sd4z6wIKYgUG8 4heSQTBewf1ce7l0IOL7x1QFwKOHBDVLsVjAxMqV6ajkL0Ac+jsCythA2kXSALDAfZE0 lJBql1yDeR8x9dcA8t815TYqLH5G/enKWuGmEhJjLdza7jqZVrQ2o+e1mamJq1o/v51d cCY4ieRaxCklTZaYrKyNisSsHtFGBDGwN6jbuhnfIq2zElJ5NuoJLFj9jYkUkS3mqAcK QO5A== 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:mime-version:content-transfer-encoding; bh=KwZK3cynzlKs4fDm6cpdhaPJl7Rn30I8P2QHQetryVE=; b=i0loNO84W9N3OrjMjIZRZEERIzmBQlN6fmiG6oWulg7I2cAeUfJ8KV6e7tDxaoNxoZ FelPWjc9BT1tPivSKQJYgD1YALaX2AMx7z70Wh1QLEd2uyy8p74L+bbiQr8cNrrfZ7we wt30ErVpKMZTW5YnAV5kUrFajczHeCT2HagN7xHwPLXOlNfecf8oc7/FdA9DXb6UB6cG PukpOTAZrnylvQ2yBwdJ24dSd6KB2g5pJCV17S1CTHJhYM7drRYy0ABMYN00H0SwcGQK Dv+aFfheOylx8pC0n2z74aEfaHDjjdYmCqP5JREXiODLY1qzpYSVNWvBUrw88HiEbq8T KsQg== X-Gm-Message-State: AOAM531JJtg9ZdWoegtX6Dzfds/7K62Wb57lFllJuuW4gJFN0psW/WEB XblPhedAIGDp5lk0u/1iwxEhNWPerpeslA== X-Google-Smtp-Source: ABdhPJyAzttJgtBOiaVhGFDYmCSgIOJsaHRKVzXqP07zpGCZOHyZvdNB88neUBHUg9D1hThHOQUvhg== X-Received: by 2002:a62:1984:: with SMTP id 126mr10112286pfz.17.1600013747817; Sun, 13 Sep 2020 09:15:47 -0700 (PDT) Received: from Thiru.localdomain ([27.104.143.83]) by smtp.gmail.com with ESMTPSA id c202sm7833953pfc.15.2020.09.13.09.15.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2020 09:15:47 -0700 (PDT) From: Thirumalesha Narasimhappa To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Shivamurthy Shastri , Boris Brezillon , Chuanhong Guo , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/2] mtd: spinand: micron: add support for MT29F2G01AAAED Date: Mon, 14 Sep 2020 00:15:33 +0800 Message-Id: <20200913161533.10655-3-nthirumalesha7@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200913161533.10655-1-nthirumalesha7@gmail.com> References: <20200913161533.10655-1-nthirumalesha7@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200913_121549_923373_049B0EFA X-CRM114-Status: GOOD ( 15.44 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [nthirumalesha7[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [nthirumalesha7[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thirumalesha Narasimhappa Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The MT29F2G01AAAED is a single die, 2Gb Micron SPI NAND Flash with 4-bit ECC Signed-off-by: Thirumalesha Narasimhappa --- drivers/mtd/nand/spi/micron.c | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c index d1b1073d1a55..dae3f7189880 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -44,6 +44,19 @@ static SPINAND_OP_VARIANTS(x4_update_cache_variants, SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), SPINAND_PROG_LOAD(false, 0, NULL, 0)); +/* Micron MT29F2G01AAAED Device */ +static SPINAND_OP_VARIANTS(x4_read_cache_variants, + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); + +static SPINAND_OP_VARIANTS(x1_write_cache_variants, + SPINAND_PROG_LOAD(true, 0, NULL, 0)); + +static SPINAND_OP_VARIANTS(x1_update_cache_variants, + SPINAND_PROG_LOAD(false, 0, NULL, 0)); + static int micron_8_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *region) { @@ -74,6 +87,47 @@ static const struct mtd_ooblayout_ops micron_grouped_ooblayout = { .free = micron_8_ooblayout_free, }; +static int micron_4_ooblayout_ecc(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + struct spinand_device *spinand = mtd_to_spinand(mtd); + + if (section >= spinand->base.memorg.pagesize / + mtd->ecc_step_size) + return -ERANGE; + + region->offset = (section * 16) + 8; + region->length = 8; + + return 0; +} + +static int micron_4_ooblayout_free(struct mtd_info *mtd, int section, + struct mtd_oob_region *region) +{ + struct spinand_device *spinand = mtd_to_spinand(mtd); + + if (section >= spinand->base.memorg.pagesize / + mtd->ecc_step_size) + return -ERANGE; + + if (section) { + region->offset = 16 * section; + region->length = 8; + } else { + /* section 0 has two bytes reserved for the BBM */ + region->offset = 2; + region->length = 6; + } + + return 0; +} + +static const struct mtd_ooblayout_ops micron_interleaved_ooblayout = { + .ecc = micron_4_ooblayout_ecc, + .free = micron_4_ooblayout_free, +}; + static int micron_select_target(struct spinand_device *spinand, unsigned int target) { @@ -217,6 +271,16 @@ static const struct spinand_info micron_spinand_table[] = { SPINAND_ECCINFO(µn_grouped_ooblayout, micron_8_ecc_get_status), SPINAND_SELECT_TARGET(micron_select_target)), + /* M69A 2Gb 3.3V */ + SPINAND_INFO("MT29F2G01AAAED", + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x9F), + NAND_MEMORG(1, 2048, 64, 64, 2048, 80, 2, 1, 1), + NAND_ECCREQ(4, 512), + SPINAND_INFO_OP_VARIANTS(&x4_read_cache_variants, + &x1_write_cache_variants, + &x1_update_cache_variants), + 0, + SPINAND_ECCINFO(µn_interleaved_ooblayout, NULL)), }; static int micron_spinand_init(struct spinand_device *spinand)