From: "João Loureiro" <joaofl@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: "Tom Rini" <trini@konsulko.com>, "Simon Glass" <sjg@chromium.org>,
"João Loureiro" <joaofl@gmail.com>
Subject: [PATCH v7 0/3] spi: Introduce driver-model support for SPI EEPROMs
Date: Sat, 3 Oct 2026 16:45:04 +0200 [thread overview]
Message-ID: <cover.1791038319.git.joaofl@gmail.com> (raw)
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
--
2.55.0
next reply other threads:[~2026-10-03 15:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-03 14:45 João Loureiro [this message]
2026-10-03 14:45 ` [PATCH v7 1/3] test: dm: sf: Get the emulator attached to the flash slave João Loureiro
2026-10-03 14:45 ` [PATCH v7 2/3] spi: Introduce initial driver-model support for SPI EEPROMs João Loureiro
2026-10-03 14:45 ` [PATCH v7 3/3] sandbox: spi: Add SPI EEPROM emulator and DM test João Loureiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1791038319.git.joaofl@gmail.com \
--to=joaofl@gmail.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.