Re: [PATCH v2 4/6] spi: axi-spi-engine: support SPI_MULTI_BUS_MODE_STRIPE

From: Marcelo Schmitt

Date: Sat Nov 15 2025 - 09:15:15 EST


On 11/12, David Lechner wrote:
> On 11/11/25 9:12 AM, Marcelo Schmitt wrote:
> > Hi David,
> >
> > The updates to spi-engine driver look good.
> > Only one comment about what happens if we have conflicting bus modes for the
> > offload case. Just to check I'm getting how this is working.
> >
>
> ...
>
> >> @@ -284,6 +316,24 @@ static int spi_engine_precompile_message(struct spi_message *msg)
> >> min_bits_per_word = min(min_bits_per_word, xfer->bits_per_word);
> >> max_bits_per_word = max(max_bits_per_word, xfer->bits_per_word);
> >> }
> >> +
> >> + if (xfer->rx_buf || xfer->offload_flags & SPI_OFFLOAD_XFER_RX_STREAM ||
> >> + xfer->tx_buf || xfer->offload_flags & SPI_OFFLOAD_XFER_TX_STREAM) {
> >> + switch (xfer->multi_bus_mode) {
> >> + case SPI_MULTI_BUS_MODE_SINGLE:
> >> + case SPI_MULTI_BUS_MODE_STRIPE:
> >> + break;
> >> + default:
> >> + /* Other modes, like mirror not supported */
> >> + return -EINVAL;
> >> + }
> >> +
> >> + /* If all xfers have the same multi-bus mode, we can optimize. */
> >> + if (multi_bus_mode == SPI_ENGINE_MULTI_BUS_MODE_UNKNOWN)
> >> + multi_bus_mode = xfer->multi_bus_mode;
> >> + else if (multi_bus_mode != xfer->multi_bus_mode)
> >> + multi_bus_mode = SPI_ENGINE_MULTI_BUS_MODE_CONFLICTING;
> >
> > Here we check all xfers have the same multi-bus mode and keep the mode that has
> > been set. Otherwise, we set this conflicting mode and the intent is to generate
> > SDI and SDO mask commands on demand on spi_engine_precompile_message(). OTOH,
>
> s/spi_engine_precompile_message/spi_engine_compile_message/
>
> Probably just a typo, but just to be clear, the "on demand" bit happens in the
> compile function rather than precompile.

Yes, I wanted to say spi_engine_compile_message() but miss pasted the other when
replying.

>
> > if all xfers have the same multi-bus mode, we can add just one pair of SDI/SDO
> > mask commands in spi_engine_trigger_enable() and one pair latter in
> > spi_engine_trigger_disable(). I guess this is the optimization mentioned in the
> > comment.
> >
> Your understanding is correct.

Awesome. Thanks for clarifying that out.