[PATCH 1/3] mtd: spinand: Define OctalIO ops

Santhosh Kumar K posted 3 patches 1 year, 1 month ago
[PATCH 1/3] mtd: spinand: Define OctalIO ops
Posted by Santhosh Kumar K 1 year, 1 month ago
Define the macros for Octal-based read and load operations on OSPI
NAND flashes.

Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
---
 include/linux/mtd/spinand.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index cbbcd44ac225..b730e334e399 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -122,6 +122,12 @@
 		   SPI_MEM_OP_DUMMY(ndummy, 4),				\
 		   SPI_MEM_OP_DATA_IN(len, buf, 4))
 
+#define SPINAND_PAGE_READ_FROM_CACHE_OCTALIO_OP(addr, ndummy, buf, len) \
+	SPI_MEM_OP(SPI_MEM_OP_CMD(0xcb, 1),				\
+		   SPI_MEM_OP_ADDR(2, addr, 8),				\
+		   SPI_MEM_OP_DUMMY(ndummy, 8),				\
+		   SPI_MEM_OP_DATA_IN(len, buf, 8))
+
 #define SPINAND_PROG_EXEC_OP(addr)					\
 	SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1),				\
 		   SPI_MEM_OP_ADDR(3, addr, 1),				\
@@ -140,6 +146,12 @@
 		   SPI_MEM_OP_NO_DUMMY,					\
 		   SPI_MEM_OP_DATA_OUT(len, buf, 4))
 
+#define SPINAND_PROG_LOAD_OCTALIO(reset, addr, buf, len)		\
+	SPI_MEM_OP(SPI_MEM_OP_CMD(reset ? 0xc2 : 0xc4, 1),		\
+		   SPI_MEM_OP_ADDR(2, addr, 8),				\
+		   SPI_MEM_OP_NO_DUMMY,					\
+		   SPI_MEM_OP_DATA_OUT(len, buf, 8))
+
 /**
  * Standard SPI NAND flash commands
  */
-- 
2.34.1
Re: [PATCH 1/3] mtd: spinand: Define OctalIO ops
Posted by Miquel Raynal 1 year ago
Hello Santhosh,

On 02/01/2025 at 17:21:08 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:

> Define the macros for Octal-based read and load operations on OSPI
> NAND flashes.

Following a recent discussion with the SPI-NOR maintainers, I plan on
renaming some of these macros to make them more clear regarding what
they do. There are many ways to do octal transfers (data only, address
and data, all cycles, sdr vs dtr...) and we want to clarify that.

Also, I believe there are frequency limitations which are not correctly
declared and possibly some issues with the dummy cycles which need to be
clarified, especially in the Winbond driver.

I plan on working on this in the next weeks, once my head is clear about
the specificities with these chips. I will add you in Cc.

Cheers,
Miquèl
Re: [PATCH 1/3] mtd: spinand: Define OctalIO ops
Posted by Santhosh Kumar K 1 year ago
Hello, Miquel,

On 16/01/25 00:49, Miquel Raynal wrote:
> Hello Santhosh,
> 
> On 02/01/2025 at 17:21:08 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:
> 
>> Define the macros for Octal-based read and load operations on OSPI
>> NAND flashes.
> 
> Following a recent discussion with the SPI-NOR maintainers, I plan on
> renaming some of these macros to make them more clear regarding what
> they do. There are many ways to do octal transfers (data only, address
> and data, all cycles, sdr vs dtr...) and we want to clarify that.
> 
> Also, I believe there are frequency limitations which are not correctly
> declared and possibly some issues with the dummy cycles which need to be
> clarified, especially in the Winbond driver.
> 
> I plan on working on this in the next weeks, once my head is clear about
> the specificities with these chips. I will add you in Cc.

Sounds good!!

Regards,
Santhosh.

> 
> Cheers,
> Miquèl