From: "João Loureiro" <joaofl@gmail.com>
To: u-boot@lists.u-boot-project.org
Cc: trini@konsulko.com, sjg@chromium.org, "João Loureiro" <joaofl@gmail.com>
Subject: [PATCH v6 0/3] spi: Introduce driver-model support for SPI EEPROMs
Date: Wed, 23 Sep 2026 23:40:27 +0200 [thread overview]
Message-ID: <cover.1790198142.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.
v6 is a resend that fixes two problems with v5, and makes no other
functional change.
Tom reported that v5 broke the sandbox_vpl CI job. Patch 3 added the
sandbox SPI EEPROM emulator to drivers/misc/Makefile with
obj-$(CONFIG_SANDBOX), which is not phase-aware, so the emulator was
also linked into TPL, VPL and SPL. With it in the image, sandbox_vpl
stops right after "Trying to boot from sandbox_file", and the CI log
shows nothing useful. The emulator now sits in the existing
"ifndef CONFIG_XPL_BUILD" block next to the other sandbox emulators,
as i2c_eeprom_emul.o does. The "vpl or test_spl" test.py selection
used by the sandbox_vpl CI job fails 12 tests with v5 applied on
v2026.10-rc5 and passes all 12 with v6.
Simon pointed out that v5 was threaded wrongly on patchwork. I had
sent it with --in-reply-to pointing at the v4 cover letter, so the
patches ended up in the old thread. v6 is a fresh thread with all
three patches replying to this cover letter.
Testing on sandbox: "ut dm" gives the same set of failures as
unpatched v2026.10-rc5 here (all environment/fixture related), and the
new spi_eeprom test passes along with spi_flash. The sandbox_vpl
test.py selection passes, as above.
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 | 267 +++++++++++++++++++++++++++++++++
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, 643 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.43.0
next reply other threads:[~2026-09-24 2:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 21:40 João Loureiro [this message]
2026-09-23 21:40 ` [PATCH v6 1/3] test: dm: sf: Get the emulator attached to the flash slave João Loureiro
2026-09-27 16:41 ` Simon Glass
2026-09-23 21:40 ` [PATCH v6 2/3] spi: Introduce initial driver-model support for SPI EEPROMs João Loureiro
2026-09-27 16:42 ` Simon Glass
2026-09-23 21:40 ` [PATCH v6 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.1790198142.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox