[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240710011541.342682-4-linchengming884@gmail.com>
Date: Wed, 10 Jul 2024 09:15:41 +0800
From: Cheng Ming Lin <linchengming884@...il.com>
To: miquel.raynal@...tlin.com,
vigneshr@...com,
linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: richard@....at,
alvinzhou@...c.com.tw,
leoyu@...c.com.tw,
Cheng Ming Lin <chengminglin@...c.com.tw>
Subject: [PATCH 3/3] mtd: spinand: Insert Plane Select bit for the column address
From: Cheng Ming Lin <chengminglin@...c.com.tw>
In the function spinand_read_from_cache_op and
spinand_write_to_cache_op, add an if statement
to determine whether the device has fixups and
their corresponding functions. If so, give the
Plane Select bit to the column address.
In the function spinand_match_and_init, add
spinand_info in spinand_device for determining
whether Plane Select bit should be inserted.
Signed-off-by: Cheng Ming Lin <chengminglin@...c.com.tw>
---
drivers/mtd/nand/spi/core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index e0b6715e5dfe..d6d6f3832f9d 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->info->fixups && spinand->info->fixups->read_from_cache)
+ column = spinand->info->fixups->read_from_cache(spinand, req, column);
+
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->info->fixups && spinand->info->fixups->write_to_cache)
+ column = spinand->info->fixups->write_to_cache(spinand, req, column);
+
while (nbytes) {
ret = spi_mem_dirmap_write(wdesc, column, nbytes, buf);
if (ret < 0)
@@ -1095,6 +1101,7 @@ int spinand_match_and_init(struct spinand_device *spinand,
spinand->flags = table[i].flags;
spinand->id.len = 1 + table[i].devid.len;
spinand->select_target = table[i].select_target;
+ spinand->info = info;
op = spinand_select_op_variant(spinand,
info->op_variants.read_cache);
--
2.25.1
Powered by blists - more mailing lists