Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/5] spi: spi-mux: error handling and delay fixes
@ 2026-11-03 22:53 Joseph CT Chan
  2026-11-03 22:53 ` [PATCH v2 1/5] spi: spi-mux: release mux when parent setup fails Joseph CT Chan
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Joseph CT Chan @ 2026-11-03 22:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, David Lechner, Bart Van Assche, Joseph CT Chan

From: Joseph CT Chan <josephctchan@google.com>

Hi Mark,

This series fixes four problems in spi-mux:
- If spi_setup() on the parent fails, the mux stays locked and every
  later message on that mux blocks.
- When the selected child changes its settings and calls spi_setup(),
  the new settings never reach the parent.
- If selecting the mux or spi_async() on the parent fails, the message
  is never finalized and spi_sync() on the child waits forever. -EBUSY
  while mmc_spi holds the parent bus lock is one easy way to hit this.
- The child's CS setup, hold, inactive and word delays are not passed
  to the parent.
Patch 5 adds KUnit tests for all four. Tested with KUnit on ARCH=um:
the 9 spi_mux cases pass with patches 1-4 and fail without them. Not
tested on hardware.

Changes in v2:
- Split out of the v1 14-patch series, as David suggested.
- Patches 3 and 4: updated the patch references in the commit messages.
- Patch 5: designated initializers, trimmed the comments.
- Moved the AI assistance note from an Assisted-by tag into the commit message.

v1: https://lore.kernel.org/all/20261102163023.2574632-1-jctchan@gmail.com/

This series depends on the SPI core series v2: without "spi: unoptimize
message when queuing it fails", a failed spi_async() on the parent
leaves the message optimized. It is also based on the spi-ti-qspi series
v2, because both add lines at the end of the same KUnit Makefile and
.kunitconfig. Patches 1-4 apply on their own.

SPI core series v2: https://lore.kernel.org/linux-spi/20261103224753.3610049-1-jctchan@gmail.com/
spi-ti-qspi series v2: https://lore.kernel.org/linux-spi/20261103225116.3624270-1-jctchan@gmail.com/

Walkthrough: https://gist.github.com/joectchan/9a14b5e6facb75058ebc5a6ff1757131

Please consider this patch series for the next merge window.

Thanks,
Joseph

Joseph CT Chan (5):
  spi: spi-mux: release mux when parent setup fails
  spi: spi-mux: re-apply settings after child calls spi_setup()
  spi: spi-mux: finalize message when forwarding fails
  spi: spi-mux: pass child CS and word delays to the parent
  spi: spi-mux: add KUnit tests for forwarding errors and settings

 drivers/spi/Kconfig                  |  14 +
 drivers/spi/Makefile                 |   1 +
 drivers/spi/spi-mux.c                | 124 ++++++-
 drivers/spi/tests/.kunitconfig       |   4 +
 drivers/spi/tests/Makefile           |   2 +
 drivers/spi/tests/kunit_spi_mux.dtso |  42 +++
 drivers/spi/tests/spi-mux-kunit.c    | 506 +++++++++++++++++++++++++++
 7 files changed, 689 insertions(+), 4 deletions(-)
 create mode 100644 drivers/spi/tests/kunit_spi_mux.dtso
 create mode 100644 drivers/spi/tests/spi-mux-kunit.c


base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
prerequisite-patch-id: 6999a3baa2d32de8fa42f2626a845fe3cb63b0b2
prerequisite-patch-id: 686a62b9223209bf1e83740a0874e20d7607f69a
prerequisite-patch-id: 616b18b757805a6f1520177e1a3e572ac95be582
prerequisite-patch-id: 0d46943b5bec4900701286d93b8b3e975701fb3d
-- 
2.56.0.385.gac671c819a-goog


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

end of thread, other threads:[~2026-11-05  4:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 22:53 [PATCH v2 0/5] spi: spi-mux: error handling and delay fixes Joseph CT Chan
2026-11-03 22:53 ` [PATCH v2 1/5] spi: spi-mux: release mux when parent setup fails Joseph CT Chan
2026-11-03 22:53 ` [PATCH v2 2/5] spi: spi-mux: re-apply settings after child calls spi_setup() Joseph CT Chan
2026-11-03 22:53 ` [PATCH v2 3/5] spi: spi-mux: finalize message when forwarding fails Joseph CT Chan
2026-11-03 22:53 ` [PATCH v2 4/5] spi: spi-mux: pass child CS and word delays to the parent Joseph CT Chan
2026-11-03 22:53 ` [PATCH v2 5/5] spi: spi-mux: add KUnit tests for forwarding errors and settings Joseph CT Chan
2026-11-04 15:00 ` [PATCH v2 0/5] spi: spi-mux: error handling and delay fixes Mark Brown
2026-11-05  4:03   ` Joseph CT Chan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox