linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mtd: spi-nor: siliconkaiser: add support for sk25lp128
@ 2022-06-03 14:16 Tom Fitzhenry
  2022-07-21  8:08 ` Tudor.Ambarus
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Fitzhenry @ 2022-06-03 14:16 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra
  Cc: Tom Fitzhenry, linux-kernel, linux-mtd

Add support for the siliconkaiser sk25lp128 chip.

This is the flash chip used in the PinePhone Pro[0], found by physical
inspection of the board.[1]

I cannot find a datasheet, but this chip supports SFDP.

This patch depends on SNOR_ID3().[2]

Tested done: checked that the Pinephone Pro boots when a ROM is written to
/dev/mtdblock0.

$ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450060101ff00060110300000ff9d05010380000002ffffffffffff
ffffffffffffffffffffffffffffffffffffe520f9ffffffff0744eb086b
083b80bbfeffffffffff00ffffff44eb0c200f5210d800ff234ac90082d8
11c7cccd68467a757a75f7a2d55c4a422cfff030c080ffffffffffffffff
ffffffffffffffff501950169cf9c0648fecffff
$ md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
de4d6be54e479d60859b0ca8a0ee9216
/sys/bus/spi/devices/spi0.0/spi-nor/sfdp
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
257018
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
sk25lp128
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
siliconkaiser

0. https://wiki.pine64.org/wiki/PinePhone_Pro#Specifications
1. Thanks to https://github.com/Biktorgj for finding that.
2. https://lore.kernel.org/all/20220510140232.3519184-1-michael@walle.cc/

Link: https://lore.kernel.org/all/28d3925a-983a-fcb8-19af-6e6baf892d53@tom-fitzhenry.me.uk/
Signed-off-by: Tom Fitzhenry <tom@tom-fitzhenry.me.uk>
---
 drivers/mtd/spi-nor/Makefile        |  1 +
 drivers/mtd/spi-nor/core.c          |  1 +
 drivers/mtd/spi-nor/core.h          |  1 +
 drivers/mtd/spi-nor/siliconkaiser.c | 15 +++++++++++++++
 4 files changed, 18 insertions(+)
 create mode 100644 drivers/mtd/spi-nor/siliconkaiser.c

diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index e347b435a038..314ac7773369 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -12,6 +12,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			+= siliconkaiser.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 fdde80d9f388..e542d3009915 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1624,6 +1624,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = {
 	&spi_nor_issi,
 	&spi_nor_macronix,
 	&spi_nor_micron,
+	&spi_nor_siliconkaiser,
 	&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 87183cff3251..8997099f6c5e 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -625,6 +625,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_siliconkaiser;
 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/siliconkaiser.c b/drivers/mtd/spi-nor/siliconkaiser.c
new file mode 100644
index 000000000000..c3ca157244b8
--- /dev/null
+++ b/drivers/mtd/spi-nor/siliconkaiser.c
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/mtd/spi-nor.h>
+
+#include "core.h"
+
+static const struct flash_info siliconkaiser_nor_parts[] = {
+	{ "sk25lp128", SNOR_ID3(0x257018) },
+};
+
+const struct spi_nor_manufacturer spi_nor_siliconkaiser = {
+	.name = "siliconkaiser",
+	.parts = siliconkaiser_nor_parts,
+	.nparts = ARRAY_SIZE(siliconkaiser_nor_parts),
+};
-- 
2.36.0


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

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

* Re: [PATCH v2] mtd: spi-nor: siliconkaiser: add support for sk25lp128
  2022-06-03 14:16 [PATCH v2] mtd: spi-nor: siliconkaiser: add support for sk25lp128 Tom Fitzhenry
@ 2022-07-21  8:08 ` Tudor.Ambarus
  2022-08-06 15:22   ` Tom Fitzhenry
  0 siblings, 1 reply; 4+ messages in thread
From: Tudor.Ambarus @ 2022-07-21  8:08 UTC (permalink / raw)
  To: tom, p.yadav, michael, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd

On 6/3/22 17:16, Tom Fitzhenry wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Add support for the siliconkaiser sk25lp128 chip.
> 
> This is the flash chip used in the PinePhone Pro[0], found by physical
> inspection of the board.[1]
> 
> I cannot find a datasheet, but this chip supports SFDP.
> 
> This patch depends on SNOR_ID3().[2]
> 
> Tested done: checked that the Pinephone Pro boots when a ROM is written to
> /dev/mtdblock0.
> 
> $ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
> 53464450060101ff00060110300000ff9d05010380000002ffffffffffff
> ffffffffffffffffffffffffffffffffffffe520f9ffffffff0744eb086b
> 083b80bbfeffffffffff00ffffff44eb0c200f5210d800ff234ac90082d8
> 11c7cccd68467a757a75f7a2d55c4a422cfff030c080ffffffffffffffff
> ffffffffffffffff501950169cf9c0648fecffff
> $ md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
> de4d6be54e479d60859b0ca8a0ee9216
> /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
> $ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
> 257018
> $ cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
> sk25lp128
> $ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
> siliconkaiser
> 
> 0. https://wiki.pine64.org/wiki/PinePhone_Pro#Specifications
> 1. Thanks to https://github.com/Biktorgj for finding that.
> 2. https://lore.kernel.org/all/20220510140232.3519184-1-michael@walle.cc/
> 
> Link: https://lore.kernel.org/all/28d3925a-983a-fcb8-19af-6e6baf892d53@tom-fitzhenry.me.uk/
> Signed-off-by: Tom Fitzhenry <tom@tom-fitzhenry.me.uk>
> ---
>  drivers/mtd/spi-nor/Makefile        |  1 +
>  drivers/mtd/spi-nor/core.c          |  1 +
>  drivers/mtd/spi-nor/core.h          |  1 +
>  drivers/mtd/spi-nor/siliconkaiser.c | 15 +++++++++++++++
>  4 files changed, 18 insertions(+)
>  create mode 100644 drivers/mtd/spi-nor/siliconkaiser.c
> 
> diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
> index e347b435a038..314ac7773369 100644
> --- a/drivers/mtd/spi-nor/Makefile
> +++ b/drivers/mtd/spi-nor/Makefile
> @@ -12,6 +12,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                   += siliconkaiser.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 fdde80d9f388..e542d3009915 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1624,6 +1624,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = {
>         &spi_nor_issi,
>         &spi_nor_macronix,
>         &spi_nor_micron,
> +       &spi_nor_siliconkaiser,
>         &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 87183cff3251..8997099f6c5e 100644
> --- a/drivers/mtd/spi-nor/core.h
> +++ b/drivers/mtd/spi-nor/core.h
> @@ -625,6 +625,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_siliconkaiser;
>  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/siliconkaiser.c b/drivers/mtd/spi-nor/siliconkaiser.c
> new file mode 100644
> index 000000000000..c3ca157244b8
> --- /dev/null
> +++ b/drivers/mtd/spi-nor/siliconkaiser.c
> @@ -0,0 +1,15 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <linux/mtd/spi-nor.h>
> +
> +#include "core.h"
> +
> +static const struct flash_info siliconkaiser_nor_parts[] = {
> +       { "sk25lp128", SNOR_ID3(0x257018) },

Does this flash implement the manufacturer ID continuation codes?
Can you read more bytes of manufacturer ID and dump them?

This manufacturer ID collides with Tristar manufacturer ID from bank 1.
Check JEP106 standard please.
If the flash does not define the continuation codes, we'll need to
add this flash in a ID collisions driver.

ta

> +};
> +
> +const struct spi_nor_manufacturer spi_nor_siliconkaiser = {
> +       .name = "siliconkaiser",
> +       .parts = siliconkaiser_nor_parts,
> +       .nparts = ARRAY_SIZE(siliconkaiser_nor_parts),
> +};
> --
> 2.36.0
> 

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

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

* Re: [PATCH v2] mtd: spi-nor: siliconkaiser: add support for sk25lp128
  2022-07-21  8:08 ` Tudor.Ambarus
@ 2022-08-06 15:22   ` Tom Fitzhenry
  2022-08-07 16:01     ` Tudor.Ambarus
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Fitzhenry @ 2022-08-06 15:22 UTC (permalink / raw)
  To: Tudor.Ambarus, p.yadav, michael, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd

On 21/7/22 18:08, Tudor.Ambarus@microchip.com wrote:
> Does this flash implement the manufacturer ID continuation codes?
> Can you read more bytes of manufacturer ID and dump them?

I'm not sure how to do this, but from what I can gather, flash chips 
that implement manufacturer ID continuation codes return >3 bytes in 
response to RDID. Is this correct?

To do this, in tools/spi/spidex_fdx.c I set buf[0] = 0x9F, and then 
executed this with a large recvbuf:

$ sudo ./a.out -m 6 /dev/spidev0.0
/dev/spidev0.0: spi mode 0x0, 8 bits per word, 10000000 Hz max
response( 6,  7):  25 70 18 25 70 18

It looks like the 3-byte response has cycled, suggesting this flash chip 
does not implement continuation codes.

> If the flash does not define the continuation codes, we'll need to
> add this flash in a ID collisions driver.

I will do this in v3.

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

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

* Re: [PATCH v2] mtd: spi-nor: siliconkaiser: add support for sk25lp128
  2022-08-06 15:22   ` Tom Fitzhenry
@ 2022-08-07 16:01     ` Tudor.Ambarus
  0 siblings, 0 replies; 4+ messages in thread
From: Tudor.Ambarus @ 2022-08-07 16:01 UTC (permalink / raw)
  To: tom, p.yadav, michael, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd

On 8/6/22 18:22, Tom Fitzhenry wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On 21/7/22 18:08, Tudor.Ambarus@microchip.com wrote:
>> Does this flash implement the manufacturer ID continuation codes?
>> Can you read more bytes of manufacturer ID and dump them?
> 
> I'm not sure how to do this, but from what I can gather, flash chips
> that implement manufacturer ID continuation codes return >3 bytes in
> response to RDID. Is this correct?
> 
> To do this, in tools/spi/spidex_fdx.c I set buf[0] = 0x9F, and then
> executed this with a large recvbuf:
> 
> $ sudo ./a.out -m 6 /dev/spidev0.0
> /dev/spidev0.0: spi mode 0x0, 8 bits per word, 10000000 Hz max
> response( 6,  7):  25 70 18 25 70 18

indeed it seems there are no continuation codes.
> 
> It looks like the 3-byte response has cycled, suggesting this flash chip
> does not implement continuation codes.
> 
>> If the flash does not define the continuation codes, we'll need to
>> add this flash in a ID collisions driver.
> 
> I will do this in v3.

Not yet, please. Looks like your flash does not need some special handling,
you used just the SNOR_ID3. If so, then you won't need a flash entry at all,
we can init the flash solely by parsing SFDP. See:
https://lore.kernel.org/linux-mtd/20220513133520.3945820-1-michael@walle.cc/

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

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

end of thread, other threads:[~2022-08-07 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 14:16 [PATCH v2] mtd: spi-nor: siliconkaiser: add support for sk25lp128 Tom Fitzhenry
2022-07-21  8:08 ` Tudor.Ambarus
2022-08-06 15:22   ` Tom Fitzhenry
2022-08-07 16:01     ` Tudor.Ambarus

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