From patchwork Tue Sep 3 01:36:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng Ming Lin X-Patchwork-Id: 1979797 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=0Y7Bznzs; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Npk7gBuO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WySvl4b4Jz1yXY for ; Tue, 3 Sep 2024 11:38:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4tQ21QPybt3WFxwDsV0gGX0uAwcq04LuvMY/W6fVj6E=; b=0Y7BznzsCwmv+Q isMR931XgvEU7ebszQsXsIpg6JyMy/ovKoKHTLtAdFrw3TAgBvobV2Nm45qcFGQX91lKMnjm2OixP wVUp/8S+QGS34rIJ/dG8WuI4ErugwdamY+u878CwLCQxq+eFE0hfp8ngOTOexivBFvCkLVb3BkecS /PnfY6N9gc/9O12arEYXE2nLYX3ZlnewJz+u689g/6Q+jYFrqaXkzTBggFu80UELa17P08OwY5tkE xdkykDJLkdgZnHZLuOd01WlEdQEjD5RdsGNjU1/IhI0H6RYZ3jFACziNXgyAvrziS1ttxO5cIIg+C Xv3O6VOOg527IRVHRObQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slIVL-0000000Fxab-238s; Tue, 03 Sep 2024 01:38:47 +0000 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slIVI-0000000FxZl-3gjh for linux-mtd@lists.infradead.org; Tue, 03 Sep 2024 01:38:46 +0000 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-2703967b10cso2258828fac.0 for ; Mon, 02 Sep 2024 18:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725327524; x=1725932324; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G6E7ALM61L5GXDCpe2fwl5R6dNU8EMojsouVXbwTg9g=; b=Npk7gBuOeLjo6IXIGqgaBCQOjDvOKhdZBGIWTlsXMlziB1/V4pFuHNISJnD1Tbs2UR 5DF54bmMu5hAzT1oBowH77N4h3L61SjXggt7cw+BcHLv8VOVvXsSeoFVjns/COqODNkn FRCCzj3E6qqISoQaQmoP/1B6ODlrb+q6wQlcoQNQ+TV8nAqy7gKqUwE2TJhdhRVXkvuL c5+i7A1lP4psPtHVdYCEMzdwdo0pjix7YabaMrBcRhEV1YcbaMKHX5aZYdNGZSOdp2Y3 adE34zReEMnxpElzMLVAEsOQhqU9Fp16zmfaUybiWnPraEbbN6xHjdLZgceRs4la+XXy O50g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725327524; x=1725932324; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G6E7ALM61L5GXDCpe2fwl5R6dNU8EMojsouVXbwTg9g=; b=bI2/1AAFujMlq6/0KcNu1VeglL9qdLhMpC6hMpLvyZBbpHbN+1iPGvftOaI+cqsPFN 88ySyMjxFPIkWz4knQQCkXx05ZgfmpM2Cis3os5c/1JvQJzSgcTn+Hzd4JS2KZtx6bhV R1QOfdVWUPJtZ/+O24ouwkiOm0s5j1w9q1+TGS36AHdycjTtJ8wJ/vBeiwL6kRznfiH+ YvOacK0w9duKgddT1ep+jQPb8tDF/B4vHe/OWPvJs0EOdGDF4+dvkVPjRW65NSdltB+0 XROfqQZgXxaxTYLJUhfTap/xdQ325y8bIDZU1a/ifrho1gfIkmz2cv2HvHqrls09g7yl F/NA== X-Forwarded-Encrypted: i=1; AJvYcCWOAHVwuHswyzRsH7D9JwgrWdVMVvpPVJkwUYnSi4/Qh7HXHw6qQ8YmNnd+cw8VIldi5HAE6ZpOHJw=@lists.infradead.org X-Gm-Message-State: AOJu0YzZ5UAbBOxDxtsBKQvZaqEr4C4lNmteLmlu4CKl1LgO4vvwKV3p kSMiYSqdedWCzB1ZxFTbezbOafeULrrabzefQ9nQjTz7MCkTu6cN X-Google-Smtp-Source: AGHT+IFH7BOn7Ydiv3r3QpGrT8jgHuvBDLr4r/TxUf+m57OlNIDZlwFnzLVzLLof2Py7nhd2QdxFSg== X-Received: by 2002:a05:6870:a7aa:b0:277:e6fc:4a69 with SMTP id 586e51a60fabf-277e6fc4eb8mr6024916fac.2.1725327523444; Mon, 02 Sep 2024 18:38:43 -0700 (PDT) Received: from twhmp6px (mxsmtp211.mxic.com.tw. [211.75.127.162]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-715e56d7804sm7405114b3a.154.2024.09.02.18.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 18:38:41 -0700 (PDT) Received: from hqs-appsw-a2o.mp600.macronix.com (linux-patcher [172.17.236.67]) by twhmp6px (Postfix) with ESMTPS id DE1E080526; Tue, 3 Sep 2024 09:47:09 +0800 (CST) From: Cheng Ming Lin To: miquel.raynal@bootlin.com, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: richard@nod.at, alvinzhou@mxic.com.tw, leoyu@mxic.com.tw, Cheng Ming Lin Subject: [PATCH v6 1/2] mtd: spinand: Add support for setting plane select bits Date: Tue, 3 Sep 2024 09:36:24 +0800 Message-Id: <20240903013625.1658825-2-linchengming884@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240903013625.1658825-1-linchengming884@gmail.com> References: <20240903013625.1658825-1-linchengming884@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_183844_945428_577F432F X-CRM114-Status: GOOD ( 11.80 ) X-Spam-Score: -1.9 (-) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Cheng Ming Lin Add two flags for inserting the Plane Select bit into the column address during the write_to_cache and the read_from_cache operation. Add the SPINAND_HAS_PROG_PLANE_SELECT_BIT flag for serial NAND flash that require inserting the Plane Select bit into the column address during the write_to_cache operation. Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [linchengming884(at)gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [linchengming884(at)gmail.com] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:4860:4864:20:0:0:0:2c listed in] [list.dnswl.org] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Cheng Ming Lin Add two flags for inserting the Plane Select bit into the column address during the write_to_cache and the read_from_cache operation. Add the SPINAND_HAS_PROG_PLANE_SELECT_BIT flag for serial NAND flash that require inserting the Plane Select bit into the column address during the write_to_cache operation. Add the SPINAND_HAS_READ_PLANE_SELECT_BIT flag for serial NAND flash that require inserting the Plane Select bit into the column address during the read_from_cache operation. Signed-off-by: Cheng Ming Lin --- drivers/mtd/nand/spi/core.c | 6 ++++++ include/linux/mtd/spinand.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index e0b6715e5dfe..e7b592cdbb4c 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -386,6 +386,9 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand, else rdesc = spinand->dirmaps[req->pos.plane].rdesc_ecc; + if (spinand->flags & SPINAND_HAS_READ_PLANE_SELECT_BIT) + column |= req->pos.plane << fls(nanddev_page_size(nand)); + while (nbytes) { ret = spi_mem_dirmap_read(rdesc, column, nbytes, buf); if (ret < 0) @@ -460,6 +463,9 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, else wdesc = spinand->dirmaps[req->pos.plane].wdesc_ecc; + if (spinand->flags & SPINAND_HAS_PROG_PLANE_SELECT_BIT) + column |= req->pos.plane << fls(nanddev_page_size(nand)); + while (nbytes) { ret = spi_mem_dirmap_write(wdesc, column, nbytes, buf); if (ret < 0) diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h index 5c19ead60499..0e0df620da53 100644 --- a/include/linux/mtd/spinand.h +++ b/include/linux/mtd/spinand.h @@ -312,6 +312,8 @@ struct spinand_ecc_info { #define SPINAND_HAS_QE_BIT BIT(0) #define SPINAND_HAS_CR_FEAT_BIT BIT(1) +#define SPINAND_HAS_PROG_PLANE_SELECT_BIT BIT(2) +#define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3) /** * struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure