linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: Add Puya Semiconductor chips driver
@ 2024-02-26  9:23 Dmitry Dunaev
  2024-02-26  9:28 ` Tudor Ambarus
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Dunaev @ 2024-02-26  9:23 UTC (permalink / raw)
  Cc: dunaich, Dmitry Dunaev, Tudor Ambarus, Pratyush Yadav,
	Michael Walle, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-kernel, linux-mtd

Add a SPI NOR manufacturer driver for Puya Semiconductor chips

Signed-off-by: Dmitry Dunaev <dunaev@tecon.ru>
---
 drivers/mtd/spi-nor/Makefile |  1 +
 drivers/mtd/spi-nor/puya.c   | 64 ++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 drivers/mtd/spi-nor/puya.c

diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index 5e68468b72fc..3e22039d0432 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -10,6 +10,7 @@ spi-nor-objs			+= intel.o
 spi-nor-objs			+= issi.o
 spi-nor-objs			+= macronix.o
 spi-nor-objs			+= micron-st.o
+spi-nor-objs			+= puya.o
 spi-nor-objs			+= spansion.o
 spi-nor-objs			+= sst.o
 spi-nor-objs			+= winbond.o
diff --git a/drivers/mtd/spi-nor/puya.c b/drivers/mtd/spi-nor/puya.c
new file mode 100644
index 000000000000..2198a9ed7101
--- /dev/null
+++ b/drivers/mtd/spi-nor/puya.c
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024, Tecon MT LLC.
+ */
+
+#include <linux/mtd/spi-nor.h>
+
+#include "core.h"
+
+/* Puya Semiconductor (Shanghai) Co., Ltd */
+static const struct flash_info puya_nor_parts[] = {
+	{
+		.id = SNOR_ID(0x85, 0x60, 0x10),
+		.name = "p25q05h",
+		.size = SZ_64K,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x11),
+		.name = "p25q10h",
+		.size = SZ_128K,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x12),
+		.name = "p25q20h",
+		.size = SZ_256K,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x13),
+		.name = "p25q40h",
+		.size = SZ_512K,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x14),
+		.name = "p25q80h",
+		.size = SZ_1M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x15),
+		.name = "p25q16h",
+		.size = SZ_2M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x16),
+		.name = "p25q32h",
+		.size = SZ_4M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x17),
+		.name = "p25q64h",
+		.size = SZ_8M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x18),
+		.name = "p25q128h",
+		.size = SZ_8M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}
+};
+
+const struct spi_nor_manufacturer spi_nor_puya = {
+	.name = "puya",
+	.parts = puya_nor_parts,
+	.nparts = ARRAY_SIZE(puya_nor_parts),
+};
-- 
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mtd: spi-nor: Add Puya Semiconductor chips driver
  2024-02-26  9:23 [PATCH] mtd: spi-nor: Add Puya Semiconductor chips driver Dmitry Dunaev
@ 2024-02-26  9:28 ` Tudor Ambarus
  2024-02-26 10:40   ` [PATCH v2] " Dmitry Dunaev
  0 siblings, 1 reply; 6+ messages in thread
From: Tudor Ambarus @ 2024-02-26  9:28 UTC (permalink / raw)
  To: Dmitry Dunaev
  Cc: dunaich, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, linux-kernel, linux-mtd

Hi,

Please read the review feedback from
https://lore.kernel.org/linux-mtd/4d117770-6e0c-412f-ac1a-d9ba84b5b4ba@linaro.org/T/#mbcfaac90f123410a35db7dbeb0464dcb0816e7c7,
it applies to this patch as well.


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] mtd: spi-nor: Add Puya Semiconductor chips driver
  2024-02-26  9:28 ` Tudor Ambarus
@ 2024-02-26 10:40   ` Dmitry Dunaev
  2024-02-26 10:43     ` Tudor Ambarus
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Dunaev @ 2024-02-26 10:40 UTC (permalink / raw)
  Cc: dunaich, Dmitry Dunaev, Tudor Ambarus, Pratyush Yadav,
	Michael Walle, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-kernel, linux-mtd

Add a SPI NOR manufacturer driver for Puya Semiconductor chips

Signed-off-by: Dmitry Dunaev <dunaev@tecon.ru>
---
 drivers/mtd/spi-nor/Makefile |  1 +
 drivers/mtd/spi-nor/core.c   |  1 +
 drivers/mtd/spi-nor/core.h   |  1 +
 drivers/mtd/spi-nor/puya.c   | 64 ++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+)
 create mode 100644 drivers/mtd/spi-nor/puya.c

diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index 5e68468b72fc..3e22039d0432 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -10,6 +10,7 @@ spi-nor-objs			+= intel.o
 spi-nor-objs			+= issi.o
 spi-nor-objs			+= macronix.o
 spi-nor-objs			+= micron-st.o
+spi-nor-objs			+= puya.o
 spi-nor-objs			+= spansion.o
 spi-nor-objs			+= sst.o
 spi-nor-objs			+= winbond.o
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 4129764fad8c..09ad2142d004 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2045,6 +2045,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = {
 	&spi_nor_issi,
 	&spi_nor_macronix,
 	&spi_nor_micron,
+	&spi_nor_puya,
 	&spi_nor_st,
 	&spi_nor_spansion,
 	&spi_nor_sst,
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index d36c0e072954..93df7a6328ca 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -609,6 +609,7 @@ extern const struct spi_nor_manufacturer spi_nor_intel;
 extern const struct spi_nor_manufacturer spi_nor_issi;
 extern const struct spi_nor_manufacturer spi_nor_macronix;
 extern const struct spi_nor_manufacturer spi_nor_micron;
+extern const struct spi_nor_manufacturer spi_nor_puya;
 extern const struct spi_nor_manufacturer spi_nor_st;
 extern const struct spi_nor_manufacturer spi_nor_spansion;
 extern const struct spi_nor_manufacturer spi_nor_sst;
diff --git a/drivers/mtd/spi-nor/puya.c b/drivers/mtd/spi-nor/puya.c
new file mode 100644
index 000000000000..2198a9ed7101
--- /dev/null
+++ b/drivers/mtd/spi-nor/puya.c
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024, Tecon MT LLC.
+ */
+
+#include <linux/mtd/spi-nor.h>
+
+#include "core.h"
+
+/* Puya Semiconductor (Shanghai) Co., Ltd */
+static const struct flash_info puya_nor_parts[] = {
+	{
+		.id = SNOR_ID(0x85, 0x60, 0x10),
+		.name = "p25q05h",
+		.size = SZ_64K,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x11),
+		.name = "p25q10h",
+		.size = SZ_128K,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x12),
+		.name = "p25q20h",
+		.size = SZ_256K,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x13),
+		.name = "p25q40h",
+		.size = SZ_512K,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x14),
+		.name = "p25q80h",
+		.size = SZ_1M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x15),
+		.name = "p25q16h",
+		.size = SZ_2M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x16),
+		.name = "p25q32h",
+		.size = SZ_4M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x17),
+		.name = "p25q64h",
+		.size = SZ_8M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}, {
+		.id = SNOR_ID(0x85, 0x60, 0x18),
+		.name = "p25q128h",
+		.size = SZ_8M,
+		.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
+	}
+};
+
+const struct spi_nor_manufacturer spi_nor_puya = {
+	.name = "puya",
+	.parts = puya_nor_parts,
+	.nparts = ARRAY_SIZE(puya_nor_parts),
+};
-- 
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: Add Puya Semiconductor chips driver
  2024-02-26 10:40   ` [PATCH v2] " Dmitry Dunaev
@ 2024-02-26 10:43     ` Tudor Ambarus
       [not found]       ` <ZdxxZb+fbzXv7ZNk@tm38l>
  0 siblings, 1 reply; 6+ messages in thread
From: Tudor Ambarus @ 2024-02-26 10:43 UTC (permalink / raw)
  To: Dmitry Dunaev
  Cc: dunaich, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, linux-kernel, linux-mtd



On 26.02.2024 12:40, Dmitry Dunaev wrote:
> Add a SPI NOR manufacturer driver for Puya Semiconductor chips
> 
> Signed-off-by: Dmitry Dunaev <dunaev@tecon.ru>
> ---
>  drivers/mtd/spi-nor/Makefile |  1 +
>  drivers/mtd/spi-nor/core.c   |  1 +
>  drivers/mtd/spi-nor/core.h   |  1 +
>  drivers/mtd/spi-nor/puya.c   | 64 ++++++++++++++++++++++++++++++++++++
>  4 files changed, 67 insertions(+)
>  create mode 100644 drivers/mtd/spi-nor/puya.c

what changed in v2? why do you need these entries? Can you rely instead
on SFDP to initialize these flashes?

Please read: https://docs.kernel.org/driver-api/mtd/spi-nor.html

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: Add Puya Semiconductor chips driver
       [not found]       ` <ZdxxZb+fbzXv7ZNk@tm38l>
@ 2024-02-26 11:27         ` Tudor Ambarus
  2024-02-26 12:11           ` Dmitry Dunaev
  0 siblings, 1 reply; 6+ messages in thread
From: Tudor Ambarus @ 2024-02-26 11:27 UTC (permalink / raw)
  To: Dmitry Dunaev, open list:SPI NOR SUBSYSTEM

+ linux-mtd

Please do not send private emails on matters that are not private.

On 26.02.2024 13:09, Dmitry Dunaev wrote:
> On Mon, Feb 26, 2024 at 12:43:58PM +0200, Tudor Ambarus wrote:
>>
>>
>> On 26.02.2024 12:40, Dmitry Dunaev wrote:
>>> Add a SPI NOR manufacturer driver for Puya Semiconductor chips
>>>
>>> Signed-off-by: Dmitry Dunaev <dunaev@tecon.ru>
>>> ---
>>>  drivers/mtd/spi-nor/Makefile |  1 +
>>>  drivers/mtd/spi-nor/core.c   |  1 +
>>>  drivers/mtd/spi-nor/core.h   |  1 +
>>>  drivers/mtd/spi-nor/puya.c   | 64 ++++++++++++++++++++++++++++++++++++
>>>  4 files changed, 67 insertions(+)
>>>  create mode 100644 drivers/mtd/spi-nor/puya.c
>>
>> what changed in v2? why do you need these entries? Can you rely instead
>> on SFDP to initialize these flashes?
> 
> In first patch I missed core.{c,h} with Puya flashes structures.
> 
> And about SFDP on Puya flashes. We try to call DP command on p25q16uc

what's DP command? SFDP read?

> flash and got no answer. It may be a bad chip pack or other matter but
> now we need a manual description for this chips.
> 
> If this issue occured only in my case we can skip this patch.

It's first time I hear about puya semiconductor. Please follow the
documentation that I've sent in the previous email and dump all the
required data.

Cheers,
ta

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: Add Puya Semiconductor chips driver
  2024-02-26 11:27         ` Tudor Ambarus
@ 2024-02-26 12:11           ` Dmitry Dunaev
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Dunaev @ 2024-02-26 12:11 UTC (permalink / raw)
  To: Tudor Ambarus; +Cc: open list:SPI NOR SUBSYSTEM

On Mon, Feb 26, 2024 at 01:27:35PM +0200, Tudor Ambarus wrote:
> + linux-mtd
> 
> Please do not send private emails on matters that are not private.
> 
> On 26.02.2024 13:09, Dmitry Dunaev wrote:
> > On Mon, Feb 26, 2024 at 12:43:58PM +0200, Tudor Ambarus wrote:
> >>
> >>
> >> On 26.02.2024 12:40, Dmitry Dunaev wrote:
> >>> Add a SPI NOR manufacturer driver for Puya Semiconductor chips
> >>>
> >>> Signed-off-by: Dmitry Dunaev <dunaev@tecon.ru>
> >>> ---
> >>>  drivers/mtd/spi-nor/Makefile |  1 +
> >>>  drivers/mtd/spi-nor/core.c   |  1 +
> >>>  drivers/mtd/spi-nor/core.h   |  1 +
> >>>  drivers/mtd/spi-nor/puya.c   | 64 ++++++++++++++++++++++++++++++++++++
> >>>  4 files changed, 67 insertions(+)
> >>>  create mode 100644 drivers/mtd/spi-nor/puya.c
> >>
> >> what changed in v2? why do you need these entries? Can you rely instead
> >> on SFDP to initialize these flashes?
> > 
> > In first patch I missed core.{c,h} with Puya flashes structures.
> > 
> > And about SFDP on Puya flashes. We try to call DP command on p25q16uc
> 
> what's DP command? SFDP read?

Yes, SFDP (0x5A)

> 
> > flash and got no answer. It may be a bad chip pack or other matter but
> > now we need a manual description for this chips.
> > 
> > If this issue occured only in my case we can skip this patch.
> 
> It's first time I hear about puya semiconductor. Please follow the
> documentation that I've sent in the previous email and dump all the
> required data.

I can't send sfdp data block because I can't get it from my Puya chips.
The datasheets for Puya chips can be found at it's original site https://www.puyasemi.com/h_xilie715.html
but at now there is an error to access to any pdf files on this site. The saved datasheets can be
downloaded from sellers, for example https://datasheet.lcsc.com/lcsc/2304140030_PUYA--P25Q16H-SUH-IR_C559219.pdf


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-26 12:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-26  9:23 [PATCH] mtd: spi-nor: Add Puya Semiconductor chips driver Dmitry Dunaev
2024-02-26  9:28 ` Tudor Ambarus
2024-02-26 10:40   ` [PATCH v2] " Dmitry Dunaev
2024-02-26 10:43     ` Tudor Ambarus
     [not found]       ` <ZdxxZb+fbzXv7ZNk@tm38l>
2024-02-26 11:27         ` Tudor Ambarus
2024-02-26 12:11           ` Dmitry Dunaev

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).