linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g
@ 2022-05-22  5:48 Jiaqing Zhao
  2022-05-22  5:48 ` [PATCH 2/2] mtd: spi-nor: micron: Add SPI_NOR_DUAL_READ flag on mt25ql02g Jiaqing Zhao
  2022-05-23  7:54 ` [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g Michael Walle
  0 siblings, 2 replies; 9+ messages in thread
From: Jiaqing Zhao @ 2022-05-22  5:48 UTC (permalink / raw)
  To: linux-mtd, Tudor Ambarus, Pratyush Yadav, Michael Walle
  Cc: linux-kernel, Jiaqing Zhao

Macronix mx66l2g45g is a 3V, 2Gbit (256MB) NOR flash that supports
x1, x2, and x4 operation modes.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
---
 drivers/mtd/spi-nor/macronix.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index d81a4cb2812b..1c45829be5ef 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -95,6 +95,9 @@ static const struct flash_info macronix_nor_parts[] = {
 	{ "mx66l1g45g",  INFO(0xc2201b, 0, 64 * 1024, 2048)
 		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
 			      SPI_NOR_QUAD_READ) },
+	{ "mx66l2g45g",  INFO(0xc2201c, 0, 64 * 1024, 4096)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
+			      SPI_NOR_QUAD_READ) },
 	{ "mx66l1g55g",  INFO(0xc2261b, 0, 64 * 1024, 2048)
 		NO_SFDP_FLAGS(SPI_NOR_QUAD_READ) },
 	{ "mx66u2g45g",	 INFO(0xc2253c, 0, 64 * 1024, 4096)
-- 
2.34.1


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

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

* [PATCH 2/2] mtd: spi-nor: micron: Add SPI_NOR_DUAL_READ flag on mt25ql02g
  2022-05-22  5:48 [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g Jiaqing Zhao
@ 2022-05-22  5:48 ` Jiaqing Zhao
  2022-07-21  7:59   ` Tudor.Ambarus
  2022-05-23  7:54 ` [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g Michael Walle
  1 sibling, 1 reply; 9+ messages in thread
From: Jiaqing Zhao @ 2022-05-22  5:48 UTC (permalink / raw)
  To: linux-mtd, Tudor Ambarus, Pratyush Yadav, Michael Walle
  Cc: linux-kernel, Jiaqing Zhao

The Micron mt25ql02g supports x2 width dual mode operation. This patch
adds the SPI_NOR_DUAL_READ flag to its flash_info entry.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
---
 drivers/mtd/spi-nor/micron-st.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
index 8a20475ce77a..da0251c1a263 100644
--- a/drivers/mtd/spi-nor/micron-st.c
+++ b/drivers/mtd/spi-nor/micron-st.c
@@ -233,7 +233,7 @@ static const struct flash_info st_nor_parts[] = {
 	},
 	{ "mt25ql02g",   INFO(0x20ba22, 0, 64 * 1024, 4096)
 		FLAGS(NO_CHIP_ERASE)
-		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
 		MFR_FLAGS(USE_FSR)
 	},
 	{ "mt25qu02g",   INFO(0x20bb22, 0, 64 * 1024, 4096)
-- 
2.34.1


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

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

* Re: [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g
  2022-05-22  5:48 [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g Jiaqing Zhao
  2022-05-22  5:48 ` [PATCH 2/2] mtd: spi-nor: micron: Add SPI_NOR_DUAL_READ flag on mt25ql02g Jiaqing Zhao
@ 2022-05-23  7:54 ` Michael Walle
  2022-05-23  8:50   ` Jiaqing Zhao
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Walle @ 2022-05-23  7:54 UTC (permalink / raw)
  To: Jiaqing Zhao; +Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav, linux-kernel

Hi,

Am 2022-05-22 07:48, schrieb Jiaqing Zhao:
> Macronix mx66l2g45g is a 3V, 2Gbit (256MB) NOR flash that supports
> x1, x2, and x4 operation modes.

I presume this one supports SFDP? Please provide an SFDP dump, see [1].
If it supports SFDP please try to use the SNOR_ID3() macro [2].

Also please add what was tested in your commit message.

Same goes for your patch 2/2.

-michael

[1] 
https://lore.kernel.org/linux-mtd/4304e19f3399a0a6e856119d01ccabe0@walle.cc/
[2] 
https://lore.kernel.org/linux-mtd/20220510140232.3519184-1-michael@walle.cc/

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

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

* Re: [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g
  2022-05-23  7:54 ` [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g Michael Walle
@ 2022-05-23  8:50   ` Jiaqing Zhao
  2022-05-23  8:56     ` Michael Walle
  0 siblings, 1 reply; 9+ messages in thread
From: Jiaqing Zhao @ 2022-05-23  8:50 UTC (permalink / raw)
  To: Michael Walle; +Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav

Hi,

Yes this one supports SFDP according to its spec.

On my setup, I cannot see the sysfs object. Do I need to enable some specific
kernel config or it's SPI controller related? My setup is running kernel 5.15.

Jiaqing

On 2022-05-23 15:54, Michael Walle wrote:
> Hi,
> 
> Am 2022-05-22 07:48, schrieb Jiaqing Zhao:
>> Macronix mx66l2g45g is a 3V, 2Gbit (256MB) NOR flash that supports
>> x1, x2, and x4 operation modes.
> 
> I presume this one supports SFDP? Please provide an SFDP dump, see [1].
> If it supports SFDP please try to use the SNOR_ID3() macro [2].
> 
> Also please add what was tested in your commit message.
> 
> Same goes for your patch 2/2.
> 
> -michael
> 
> [1] https://lore.kernel.org/linux-mtd/4304e19f3399a0a6e856119d01ccabe0@walle.cc/
> [2] https://lore.kernel.org/linux-mtd/20220510140232.3519184-1-michael@walle.cc/

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

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

* Re: [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g
  2022-05-23  8:50   ` Jiaqing Zhao
@ 2022-05-23  8:56     ` Michael Walle
  2022-05-23 10:12       ` Jiaqing Zhao
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Walle @ 2022-05-23  8:56 UTC (permalink / raw)
  To: Jiaqing Zhao; +Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav

Am 2022-05-23 10:50, schrieb Jiaqing Zhao:
> Hi,
> 
> Yes this one supports SFDP according to its spec.
> 
> On my setup, I cannot see the sysfs object. Do I need to enable some 
> specific
> kernel config or it's SPI controller related? My setup is running 
> kernel 5.15.

No, it should be there since v5.14. See commit 36ac02286265. And you 
shouldn't
need to enable any special configuration option.

Did you do a "find /sys -name sfdp"?

-michael

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

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

* Re: [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g
  2022-05-23  8:56     ` Michael Walle
@ 2022-05-23 10:12       ` Jiaqing Zhao
  2022-05-23 11:59         ` Michael Walle
  0 siblings, 1 reply; 9+ messages in thread
From: Jiaqing Zhao @ 2022-05-23 10:12 UTC (permalink / raw)
  To: Michael Walle; +Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav

> Am 2022-05-23 10:50, schrieb Jiaqing Zhao:
>> Hi,
>>
>> Yes this one supports SFDP according to its spec.
>>
>> On my setup, I cannot see the sysfs object. Do I need to enable some specific
>> kernel config or it's SPI controller related? My setup is running kernel 5.15.
> 
> No, it should be there since v5.14. See commit 36ac02286265. And you shouldn't
> need to enable any special configuration option.
> 
> Did you do a "find /sys -name sfdp"?
> 
> -michael 

I tried, it give empty result. The system I'm working on disables kernel module,
and the SPI controller driver calls spi_nor_probe() directly, will this be the
issue?

And is it possible to manually load the spi-nor driver via the bind interface?
If it is possible, what should the parameters be?

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

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

* Re: [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g
  2022-05-23 10:12       ` Jiaqing Zhao
@ 2022-05-23 11:59         ` Michael Walle
  2022-05-23 12:18           ` Jiaqing Zhao
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Walle @ 2022-05-23 11:59 UTC (permalink / raw)
  To: Jiaqing Zhao; +Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav

Hi,

Am 2022-05-23 12:12, schrieb Jiaqing Zhao:
>> Am 2022-05-23 10:50, schrieb Jiaqing Zhao:
>>> Yes this one supports SFDP according to its spec.
>>> 
>>> On my setup, I cannot see the sysfs object. Do I need to enable some 
>>> specific
>>> kernel config or it's SPI controller related? My setup is running 
>>> kernel 5.15.
>> 
>> No, it should be there since v5.14. See commit 36ac02286265. And you 
>> shouldn't
>> need to enable any special configuration option.
>> 
>> Did you do a "find /sys -name sfdp"?
>> 
>> -michael
> 
> I tried, it give empty result. The system I'm working on disables 
> kernel module,
> and the SPI controller driver calls spi_nor_probe() directly, will this 
> be the
> issue?
> 
> And is it possible to manually load the spi-nor driver via the bind 
> interface?
> If it is possible, what should the parameters be?

Is your spi flash probed at all?

-michael

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

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

* Re: [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g
  2022-05-23 11:59         ` Michael Walle
@ 2022-05-23 12:18           ` Jiaqing Zhao
  0 siblings, 0 replies; 9+ messages in thread
From: Jiaqing Zhao @ 2022-05-23 12:18 UTC (permalink / raw)
  To: Michael Walle; +Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav, linux-kernel

Okay I've found this was a driver issue. After switching to the new aspeed
spi-mem driver[1], the sysfs interface works.

# xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450060102ff00060110300000ffc2000104100100ff84000102c000
00ffffffffffffffffffffffffffffffffffe520fbffffffff7f44eb086b
083b04bbfeffffffffff00ffffff44eb0c200f5210d800ff8749bd0084d2
04e24403673830b030b0f7bdff5c4a9e29fff050f985ffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffff7f8fffff215cdcffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffff003600279df9c06485cbffffffffffff
# md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
bc3c1443db0c6359432c3cccb6f97943  /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
# cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c2201c
# cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
mx66l2g45g
# cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix

Since I'm using kernel 5.15, I copied the /drivers/mtd/spi-nor from 5.18-rc7
(I know this it not a clean way, but it works), and applied the SNOR_ID3()
patch. Verified using SNOR_ID3() macro works with this mx66l2g45g and the
values dumped from sysfs are the same.

[    1.696350] spi spi0.0: setup: ignoring unsupported mode bits 200
[    1.703786] spi-nor spi0.0: mx66l2g45g (262144 Kbytes)
[    1.764440] spi-aspeed-smc 1e620000.spi: CE0 read buswidth:2 [0x203c0641]

Due to the lockdown in Shanghai, I am unable to test my 2nd patch at this
time, please temporarily ignore it.

I will perform more tests and update the patch later.

[1] https://lore.kernel.org/linux-mtd/a17b2446-f5a6-d606-8ef4-3931b8bc94da@kaod.org/

Thanks,
Jiaqing

On 2022-05-23 19:59, Michael Walle wrote:
> Hi,
> 
> Am 2022-05-23 12:12, schrieb Jiaqing Zhao:
>>> Am 2022-05-23 10:50, schrieb Jiaqing Zhao:
>>>> Yes this one supports SFDP according to its spec.
>>>>
>>>> On my setup, I cannot see the sysfs object. Do I need to enable some specific
>>>> kernel config or it's SPI controller related? My setup is running kernel 5.15.
>>>
>>> No, it should be there since v5.14. See commit 36ac02286265. And you shouldn't
>>> need to enable any special configuration option.
>>>
>>> Did you do a "find /sys -name sfdp"?
>>>
>>> -michael
>>
>> I tried, it give empty result. The system I'm working on disables kernel module,
>> and the SPI controller driver calls spi_nor_probe() directly, will this be the
>> issue?
>>
>> And is it possible to manually load the spi-nor driver via the bind interface?
>> If it is possible, what should the parameters be?
> 
> Is your spi flash probed at all?
> 
> -michael

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

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

* Re: [PATCH 2/2] mtd: spi-nor: micron: Add SPI_NOR_DUAL_READ flag on mt25ql02g
  2022-05-22  5:48 ` [PATCH 2/2] mtd: spi-nor: micron: Add SPI_NOR_DUAL_READ flag on mt25ql02g Jiaqing Zhao
@ 2022-07-21  7:59   ` Tudor.Ambarus
  0 siblings, 0 replies; 9+ messages in thread
From: Tudor.Ambarus @ 2022-07-21  7:59 UTC (permalink / raw)
  To: jiaqing.zhao, linux-mtd, p.yadav, michael; +Cc: linux-kernel

On 5/22/22 08:48, Jiaqing Zhao wrote:
> [You don't often get email from jiaqing.zhao@linux.intel.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification.]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The Micron mt25ql02g supports x2 width dual mode operation. This patch
> adds the SPI_NOR_DUAL_READ flag to its flash_info entry.

can't the dual mode be retrieved from SFDP?
Can you dump the sysfs sfdp table please?

> 
> Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
> ---
>  drivers/mtd/spi-nor/micron-st.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
> index 8a20475ce77a..da0251c1a263 100644
> --- a/drivers/mtd/spi-nor/micron-st.c
> +++ b/drivers/mtd/spi-nor/micron-st.c
> @@ -233,7 +233,7 @@ static const struct flash_info st_nor_parts[] = {
>         },
>         { "mt25ql02g",   INFO(0x20ba22, 0, 64 * 1024, 4096)
>                 FLAGS(NO_CHIP_ERASE)
> -               NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ)
> +               NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
>                 MFR_FLAGS(USE_FSR)
>         },
>         { "mt25qu02g",   INFO(0x20bb22, 0, 64 * 1024, 4096)
> --
> 2.34.1
> 

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

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

end of thread, other threads:[~2022-07-21  8:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22  5:48 [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g Jiaqing Zhao
2022-05-22  5:48 ` [PATCH 2/2] mtd: spi-nor: micron: Add SPI_NOR_DUAL_READ flag on mt25ql02g Jiaqing Zhao
2022-07-21  7:59   ` Tudor.Ambarus
2022-05-23  7:54 ` [PATCH 1/2] mtd: spi-nor: macronix: Add support for mx66l2g45g Michael Walle
2022-05-23  8:50   ` Jiaqing Zhao
2022-05-23  8:56     ` Michael Walle
2022-05-23 10:12       ` Jiaqing Zhao
2022-05-23 11:59         ` Michael Walle
2022-05-23 12:18           ` Jiaqing Zhao

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