spi: Introduce driver-model support for SPI EEPROMs
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v7 Latest3 patches 1 replyIn review
- v63 patches 2 repliesSuperseded
- v53 patches 2 repliesSuperseded
Changes in v7 from the cover letter
- Patch 2: the status-register read in probe() is diagnostic only and can no longer fail probe(); comment explains why SPI cannot detect presence this way.
- Patch 2: fix the comment above spi_eeprom_read_status(), which described the return value wrongly.
- Patch 2: commit message nit, "the faster of the two".
- Patches 1 and 2: add Simon's Reviewed-by.
Patches in v7 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | test: dm: sf: Get the emulator attached to the flash slavetest/ | +7 | 0 replies | |
| 2/3 | spi: Introduce initial driver-model support for SPI EEPROMsMAINTAINERS configs/ drivers/ +5 more | +404 | 0 replies | |
| 3/3 | sandbox: spi: Add SPI EEPROM emulator and DM testMAINTAINERS arch/ drivers/ +4 more | +231 | 0 replies |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Simon Glass |
|---|---|
| 1/3 | R-b |
| 2/3 | R-b |
| 3/3 | R-b T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v7 0/3] spi: Introduce driver-model support for SPI EEPROMs
This series adds a UCLASS_SPI_EEPROM uclass, a driver for AT25-style parts, a sandbox emulator and a DM test.
v7 addresses Simon's review of v6 2/3 and picks up his Reviewed-by on patches 1 and 2. Thanks, Simon.
On the status-register read in probe(): it was diagnostic, not a presence check - and on SPI it cannot be one. There is no acknowledge, so an unpopulated socket does not make the transfer fail; MISO just floats and the read returns 0x00 or 0xff. The only way the read could fail is a controller or bus-claim error, and failing probe() for that was, as you say, too strong. probe() now ignores a failed read and only logs the value at debug level, with a comment saying why. Any real bus problem still surfaces on the first spi_eeprom_read().
Testing on sandbox, against unpatched v2026.10-rc5: "ut dm" runs 583 tests to rc5's 582 with an identical list of failures (all environment/fixture related), and the new spi_eeprom test passes. The sandbox_vpl CI selection ("vpl or test_spl") passes 12/12 on both.
Changes in v7:
- Patch 2: the status-register read in probe() is diagnostic only and can no longer fail probe(); comment explains why SPI cannot detect presence this way.
- Patch 2: fix the comment above spi_eeprom_read_status(), which described the return value wrongly.
- Patch 2: commit message nit, "the faster of the two".
- Patches 1 and 2: add Simon's Reviewed-by.
Changes in v6:
- Patch 3: build the sandbox SPI EEPROM emulator only in U-Boot proper (not in TPL/VPL/SPL), fixing the sandbox_vpl CI failure.
- Resent as a new, correctly threaded series.
Changes in v5:
- New patch 1: test/dm/sf.c now asks for the emulator attached to its own slave rather than the first one in UCLASS_SPI_EMUL, fixing a heap corruption once a second SPI emulator exists.
- Patch 2 commit message reworded: imperative mood, "driver model" rather than "driver mode", and it now explains the motivation.
- SPI_EEPROM_CMD_SIZE removed. Address length is an addr_len field in driver data, overridable from the device tree, so 8-, 16- and 24-bit addressed parts are handled.
- AT25_CMD_* opcodes moved to a private header, drivers/misc/spi_eeprom_priv.h.
- Read path no longer computes "offset + size"; probe() rejects a "size" that does not fit the configured address width.
- of_to_plat() dropped; geometry read in probe().
- "size", "pagesize" and "address-width" follow the in-tree atmel,at25 binding (dts/upstream/Bindings/eeprom/at25.yaml).
- Compatible list taken from that binding, plus the "atmel,at25" fallback.
- Kconfig: "depends on MISC" dropped, help text expanded.
- include/spi_eeprom.h converted to kerneldoc.
- Sandbox EEPROM node in test.dts follows the binding.
Changes in v4:
- Emulator frees its backing store in a remove() method.
- Full kerneldoc for sandbox_spi_emul_get().
Changes in v3:
- Reindented with tabs; the series is now checkpatch-clean.
- Dropped the no-op write stub in favour of returning -ENOSYS.
- Removed dead code, fixed the read bounds check, corrected the AT25160 geometry, switched to u8 types and added a MAINTAINERS entry.
- Added the sandbox emulator and the DM test.
João Loureiro (3):
test: dm: sf: Get the emulator attached to the flash slave
spi: Introduce initial driver-model support for SPI EEPROMs
sandbox: spi: Add SPI EEPROM emulator and DM test
MAINTAINERS | 9 ++ arch/sandbox/dts/test.dts | 16 +- configs/sandbox_defconfig | 1 + drivers/misc/Kconfig | 15 ++ drivers/misc/Makefile | 2 + drivers/misc/spi_eeprom.c | 266 +++++++++++++++++++++++++++++++++ drivers/misc/spi_eeprom_emul.c | 130 ++++++++++++++++ drivers/misc/spi_eeprom_priv.h | 18 +++ drivers/spi/sandbox_spi.c | 37 ++++- include/dm/uclass-id.h | 1 + include/spi_eeprom.h | 95 ++++++++++++ test/dm/Makefile | 1 + test/dm/sf.c | 9 +- test/dm/spi_eeprom.c | 46 ++++++ 14 files changed, 642 insertions(+), 4 deletions(-) create mode 100644 drivers/misc/spi_eeprom.c create mode 100644 drivers/misc/spi_eeprom_emul.c create mode 100644 drivers/misc/spi_eeprom_priv.h create mode 100644 include/spi_eeprom.h create mode 100644 test/dm/spi_eeprom.c
base-commit: a06e89ab05eaa2b8344d521319399333cd760ae5
Signature · 1 line
2.55.0