* [PATCH 0/3] Add OSPI NAND support
@ 2025-01-02 11:51 Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 1/3] mtd: spinand: Define OctalIO ops Santhosh Kumar K
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Santhosh Kumar K @ 2025-01-02 11:51 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr, quic_sridsn, quic_mdalam
Cc: linux-mtd, linux-kernel, p-mantena, s-k6
This series adds the OSPI NAND support to K3 devices such as
AM62Ax, AM62x LP SK in 1S-8S-8S mode.
Due to ERRATA-i2383, switching to DDR mode is not possible. So, we
stay in SDR mode during probe. [1]
The upcoming series will contain the Device Tree changes.
Repo: https://github.com/santhosh21/linux/tree/uL_next
Test results: https://gist.github.com/santhosh21/71ab6646dccc238a0b3c47c0382f219a
[1] https://www.ti.com/lit/er/sprz544b/sprz544b.pdf?ts=1734605642081&ref_url=https%253A%252F%252Fwww.google.com%252F
Regards,
Santhosh.
Santhosh Kumar K (3):
mtd: spinand: Define OctalIO ops
mtd: spinand: winbond: Add support for W35N01JW
mtd: spinand: winbond: Fix oob_layout for W25N01JW
drivers/mtd/nand/spi/winbond.c | 72 +++++++++++++++++++++++++++++++++-
include/linux/mtd/spinand.h | 12 ++++++
2 files changed, 83 insertions(+), 1 deletion(-)
--
2.34.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] mtd: spinand: Define OctalIO ops
2025-01-02 11:51 [PATCH 0/3] Add OSPI NAND support Santhosh Kumar K
@ 2025-01-02 11:51 ` Santhosh Kumar K
2025-01-15 19:19 ` Miquel Raynal
2025-01-02 11:51 ` [PATCH 2/3] mtd: spinand: winbond: Add support for W35N01JW Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW Santhosh Kumar K
2 siblings, 1 reply; 8+ messages in thread
From: Santhosh Kumar K @ 2025-01-02 11:51 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr, quic_sridsn, quic_mdalam
Cc: linux-mtd, linux-kernel, p-mantena, s-k6
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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] mtd: spinand: winbond: Add support for W35N01JW
2025-01-02 11:51 [PATCH 0/3] Add OSPI NAND support Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 1/3] mtd: spinand: Define OctalIO ops Santhosh Kumar K
@ 2025-01-02 11:51 ` Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW Santhosh Kumar K
2 siblings, 0 replies; 8+ messages in thread
From: Santhosh Kumar K @ 2025-01-02 11:51 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr, quic_sridsn, quic_mdalam
Cc: linux-mtd, linux-kernel, p-mantena, s-k6
Add support for Winbond's W35N01JW OSPI NAND flash of size 1G-bit. [1]
[1] https://www.winbond.com/export/sites/winbond/datasheet/W35N01JW_Datasheet_Brief.pdf
Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
---
drivers/mtd/nand/spi/winbond.c | 41 ++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index 7180e615ac97..fbe41e76ad64 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -18,6 +18,7 @@
#define W25N04KV_STATUS_ECC_5_8_BITFLIPS (3 << 4)
static SPINAND_OP_VARIANTS(read_cache_variants,
+ SPINAND_PAGE_READ_FROM_CACHE_OCTALIO_OP(0, 16, NULL, 0),
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),
@@ -26,10 +27,12 @@ static SPINAND_OP_VARIANTS(read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
static SPINAND_OP_VARIANTS(write_cache_variants,
+ SPINAND_PROG_LOAD_OCTALIO(true, 0, NULL, 0),
SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
SPINAND_PROG_LOAD(true, 0, NULL, 0));
static SPINAND_OP_VARIANTS(update_cache_variants,
+ SPINAND_PROG_LOAD_OCTALIO(false, 0, NULL, 0),
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
SPINAND_PROG_LOAD(false, 0, NULL, 0));
@@ -112,6 +115,30 @@ static int w25n02kv_ooblayout_free(struct mtd_info *mtd, int section,
return 0;
}
+static int w35n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section > 7)
+ return -ERANGE;
+
+ region->offset = (16 * section) + 12;
+ region->length = 4;
+
+ return 0;
+}
+
+static int w35n01jw_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section > 7)
+ return -ERANGE;
+
+ region->offset = (16 * section) + 2;
+ region->length = 10;
+
+ return 0;
+}
+
static const struct mtd_ooblayout_ops w25n01kv_ooblayout = {
.ecc = w25n01kv_ooblayout_ecc,
.free = w25n02kv_ooblayout_free,
@@ -122,6 +149,11 @@ static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
.free = w25n02kv_ooblayout_free,
};
+static const struct mtd_ooblayout_ops w35n01jw_ooblayout = {
+ .ecc = w35n01jw_ooblayout_ecc,
+ .free = w35n01jw_ooblayout_free,
+};
+
static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
u8 status)
{
@@ -208,6 +240,15 @@ static const struct spinand_info winbond_spinand_table[] = {
&update_cache_variants),
0,
SPINAND_ECCINFO(&w25n01kv_ooblayout, w25n02kv_ecc_get_status)),
+ SPINAND_INFO("W35N01JW", /* high-speed 1.8V */
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xdc, 0x21),
+ NAND_MEMORG(1, 4096, 128, 64, 512, 20, 1, 1, 1),
+ NAND_ECCREQ(1, 512),
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(&w35n01jw_ooblayout, NULL)),
/* 2G-bit densities */
SPINAND_INFO("W25M02GV", /* 2x1G-bit 3.3V */
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xab, 0x21),
--
2.34.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW
2025-01-02 11:51 [PATCH 0/3] Add OSPI NAND support Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 1/3] mtd: spinand: Define OctalIO ops Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 2/3] mtd: spinand: winbond: Add support for W35N01JW Santhosh Kumar K
@ 2025-01-02 11:51 ` Santhosh Kumar K
2025-01-15 19:16 ` Miquel Raynal
2 siblings, 1 reply; 8+ messages in thread
From: Santhosh Kumar K @ 2025-01-02 11:51 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr, quic_sridsn, quic_mdalam
Cc: linux-mtd, linux-kernel, p-mantena, s-k6
Fix the W25N01JW's oob_layout according to the datasheet. [1]
[1] https://www.winbond.com/hq/product/code-storage-flash-memory/qspinand-flash/?__locale=en&partNo=W25N01JW
Fixes: 6a804fb72de5 ("mtd: spinand: winbond: add support for serial NAND flash")
CC: Sridharan S N <quic_sridsn@quicinc.com>
Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
---
Hi, Sridharan,
Do you have a different revision of W25N01JW with a different oob_layout?
If yes, can you please provide the datasheet of that?
Regards,
Santhosh.
drivers/mtd/nand/spi/winbond.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index fbe41e76ad64..de05b3e2b9df 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -115,6 +115,30 @@ static int w25n02kv_ooblayout_free(struct mtd_info *mtd, int section,
return 0;
}
+static int w25n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section > 3)
+ return -ERANGE;
+
+ region->offset = (16 * section) + 12;
+ region->length = 4;
+
+ return 0;
+}
+
+static int w25n01jw_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section > 3)
+ return -ERANGE;
+
+ region->offset = (16 * section) + 2;
+ region->length = 10;
+
+ return 0;
+}
+
static int w35n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
@@ -154,6 +178,11 @@ static const struct mtd_ooblayout_ops w35n01jw_ooblayout = {
.free = w35n01jw_ooblayout_free,
};
+static const struct mtd_ooblayout_ops w25n01jw_ooblayout = {
+ .ecc = w25n01jw_ooblayout_ecc,
+ .free = w25n01jw_ooblayout_free,
+};
+
static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
u8 status)
{
@@ -230,7 +259,7 @@ static const struct spinand_info winbond_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
0,
- SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
+ SPINAND_ECCINFO(&w25n01jw_ooblayout, NULL)),
SPINAND_INFO("W25N01KV", /* 3.3V */
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xae, 0x21),
NAND_MEMORG(1, 2048, 96, 64, 1024, 20, 1, 1, 1),
--
2.34.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW
2025-01-02 11:51 ` [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW Santhosh Kumar K
@ 2025-01-15 19:16 ` Miquel Raynal
2025-01-27 6:48 ` Santhosh Kumar K
0 siblings, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2025-01-15 19:16 UTC (permalink / raw)
To: Santhosh Kumar K
Cc: richard, vigneshr, quic_sridsn, quic_mdalam, linux-mtd,
linux-kernel, p-mantena
Hello Santhosh,
On 02/01/2025 at 17:21:10 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:
> Fix the W25N01JW's oob_layout according to the datasheet. [1]
>
> [1] https://www.winbond.com/hq/product/code-storage-flash-memory/qspinand-flash/?__locale=en&partNo=W25N01JW
>
> Fixes: 6a804fb72de5 ("mtd: spinand: winbond: add support for serial NAND flash")
> CC: Sridharan S N <quic_sridsn@quicinc.com>
> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
There have been changes in this driver, I'd suggest to rebase your work
once -rc1 is out.
Also, Please add Cc: stable in copy and either move this patch first in
the series, or even detach it because it has little to do with the two
other patches.
Thanks!
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] mtd: spinand: Define OctalIO ops
2025-01-02 11:51 ` [PATCH 1/3] mtd: spinand: Define OctalIO ops Santhosh Kumar K
@ 2025-01-15 19:19 ` Miquel Raynal
2025-01-27 6:48 ` Santhosh Kumar K
0 siblings, 1 reply; 8+ messages in thread
From: Miquel Raynal @ 2025-01-15 19:19 UTC (permalink / raw)
To: Santhosh Kumar K
Cc: richard, vigneshr, quic_sridsn, quic_mdalam, linux-mtd,
linux-kernel, p-mantena
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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] mtd: spinand: Define OctalIO ops
2025-01-15 19:19 ` Miquel Raynal
@ 2025-01-27 6:48 ` Santhosh Kumar K
0 siblings, 0 replies; 8+ messages in thread
From: Santhosh Kumar K @ 2025-01-27 6:48 UTC (permalink / raw)
To: Miquel Raynal
Cc: richard, vigneshr, quic_sridsn, quic_mdalam, linux-mtd,
linux-kernel, p-mantena, s-k6
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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW
2025-01-15 19:16 ` Miquel Raynal
@ 2025-01-27 6:48 ` Santhosh Kumar K
0 siblings, 0 replies; 8+ messages in thread
From: Santhosh Kumar K @ 2025-01-27 6:48 UTC (permalink / raw)
To: Miquel Raynal
Cc: richard, vigneshr, quic_sridsn, quic_mdalam, linux-mtd,
linux-kernel, p-mantena, s-k6
Hello, Miquel,
On 16/01/25 00:46, Miquel Raynal wrote:
> Hello Santhosh,
>
> On 02/01/2025 at 17:21:10 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:
>
>> Fix the W25N01JW's oob_layout according to the datasheet. [1]
>>
>> [1] https://www.winbond.com/hq/product/code-storage-flash-memory/qspinand-flash/?__locale=en&partNo=W25N01JW
>>
>> Fixes: 6a804fb72de5 ("mtd: spinand: winbond: add support for serial NAND flash")
>> CC: Sridharan S N <quic_sridsn@quicinc.com>
>> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
>
> There have been changes in this driver, I'd suggest to rebase your work
> once -rc1 is out.
>
> Also, Please add Cc: stable in copy and either move this patch first in
> the series, or even detach it because it has little to do with the two
> other patches.
Got it, I'll detach this one.
Regards,
Santhosh.
>
> Thanks!
> Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-01-27 6:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-02 11:51 [PATCH 0/3] Add OSPI NAND support Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 1/3] mtd: spinand: Define OctalIO ops Santhosh Kumar K
2025-01-15 19:19 ` Miquel Raynal
2025-01-27 6:48 ` Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 2/3] mtd: spinand: winbond: Add support for W35N01JW Santhosh Kumar K
2025-01-02 11:51 ` [PATCH 3/3] mtd: spinand: winbond: Fix oob_layout for W25N01JW Santhosh Kumar K
2025-01-15 19:16 ` Miquel Raynal
2025-01-27 6:48 ` Santhosh Kumar K
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).