You are not logged in.

#1 2022-06-13 00:15:01

Brocellous
Member
Registered: 2017-11-27
Posts: 147

How to determine which SPI flash chip I have?

Hi. I have some persistent errors in my journal:

$ journalctl -b -t kernel -p3
Jun 11 10:48:47 rdtw kernel: proc_thermal_pci 0000:00:04.0: error: proc_thermal_add, will continue
Jun 11 10:48:52 rdtw kernel: spi-nor spi0.0: BFPT parsing failed. Please consider using SPI_NOR_SKIP_SFDP when declaring the flash

Today I'm interested in the second message, because it has a specific instruction to avoid it. I want to declare my flash chip with SPI_NOR_SKIP_SFDP. I'm pretty sure it means these structs from drivers/mtd/spi-nor/spansion.c:

$ grep -B1 -A3 SPI_NOR_SKIP_SFDP drivers/mtd/spi-nor/spansion.c
	{ "s25fl256s0", INFO6(0x010219, 0x4d0080, 256 * 1024, 128)
		NO_SFDP_FLAGS(SPI_NOR_SKIP_SFDP | SPI_NOR_DUAL_READ |
			      SPI_NOR_QUAD_READ)
		MFR_FLAGS(USE_CLSR)
	},

IIUC, the INFO6 macro declares for which chip the flags apply. How can I identify my chip? I tried:

$ cat /proc/mtd
dev:    size   erasesize  name
$ ls /sys/class/mtd/*
zsh: no matches found: /sys/class/mtd/*
$ ls -R /sys/bus/spi/devices/spi*
/sys/bus/spi/devices/spi0.0:
driver_override  modalias  power  statistics  subsystem  uevent

/sys/bus/spi/devices/spi0.0/power:
autosuspend_delay_ms  control  runtime_active_time  runtime_status  runtime_suspended_time

/sys/bus/spi/devices/spi0.0/statistics:
bytes                     transfer_bytes_histo_1024-2047    transfer_bytes_histo_4-7
bytes_rx                  transfer_bytes_histo_128-255      transfer_bytes_histo_512-1023
bytes_tx                  transfer_bytes_histo_16-31        transfer_bytes_histo_64-127
errors                    transfer_bytes_histo_16384-32767  transfer_bytes_histo_65536+
messages                  transfer_bytes_histo_2048-4095    transfer_bytes_histo_8-15
spi_async                 transfer_bytes_histo_2-3          transfer_bytes_histo_8192-16383
spi_sync                  transfer_bytes_histo_256-511      transfers
spi_sync_immediate        transfer_bytes_histo_32-63        transfers_split_maxsize
timedout                  transfer_bytes_histo_32768-65535
transfer_bytes_histo_0-1  transfer_bytes_histo_4096-8191

which didn't reveal anything helpful.

Last edited by Brocellous (2022-06-13 15:58:06)

Offline

#2 2022-06-13 06:34:56

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 268

Re: How to determine which SPI flash chip I have?

Is your goal to get rid of error message or get access to flash chip? Are you sure any SPI chip is really connected to spi0.0?
What controller provides this SPI bus and what driver is used?

$ realpath /sys/class/spi_master/spi0/device/driver
$ cat /sys/bus/spi/devices/spi0.0/modalias
$ cat /sys/bus/spi/devices/spi0.0/driver_override

If its BIOS chip, you can found SPI chip on motherboard and read its label.

Offline

#3 2022-06-13 16:09:08

Brocellous
Member
Registered: 2017-11-27
Posts: 147

Re: How to determine which SPI flash chip I have?

Thanks. My goal is to get rid of the error, correcting it if possible.

$ realpath /sys/class/spi_master/spi0/device/driver
/sys/bus/pci/drivers/intel-spi
$ cat /sys/bus/spi/devices/spi0.0/modalias         
spi:spi-nor
$ xxd -ps /sys/bus/spi/devices/spi0.0/driver_override
0a

I also found

$ lspci -s:1f.5 -knnvv     
0000:00:1f.5 Serial bus controller [0c80]: Intel Corporation Alder Lake-S PCH SPI Controller [8086:7aa4] (rev 11)
	DeviceName: Onboard - Other
	Subsystem: Dell Device [1028:0aac]
	Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Region 0: Memory at 80400000 (32-bit, non-prefetchable) [size=4K]
	Kernel driver in use: intel-spi
	Kernel modules: spi_intel_pci

I'll examine the motherboard and see if I can find it.

Last edited by Brocellous (2022-06-13 16:12:08)

Offline

#4 2022-06-13 19:45:54

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 268

Re: How to determine which SPI flash chip I have?

Brocellous wrote:

My goal is to get rid of the error, correcting it if possible.

Easiest way is to blacklist spi-intel-pci unless you want to dump/update BIOS from Linux.

Perhaps some non-standard chip is connected or access is disabled by BIOS. Are there other SPI-related messages (info, warnings etc) around this error in dmesg?

Offline

#5 2022-06-13 21:43:35

Brocellous
Member
Registered: 2017-11-27
Posts: 147

Re: How to determine which SPI flash chip I have?

blacklisting the driver does sound reasonable. fwupd doesn't seem to find anything for this pc anyway...

There's not much else related in the journal:

$ journalctl -b -t kernel -g spi
Jun 11 10:48:52 rdtw kernel: spi-nor spi0.0: BFPT parsing failed. Please consider using SPI_NOR_SKIP_SFDP when declaring the flash
Jun 11 10:48:52 rdtw kernel: spi-nor: probe of spi0.0 failed with error -524

I think my question has been answered, so if I don't run into problems blacklisting the driver I'll mark this as solved.

Offline

Board footer

Powered by FluxBB