RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

From: Robin Gong
Date: Mon Jun 15 2020 - 10:53:36 EST


On 2020/06/15 22:36 Mark Brown <broonie@xxxxxxxxxx> wrote:
> On Mon, Jun 15, 2020 at 02:18:54PM +0000, Robin Gong wrote:
> > Seems not easy to find a suitable error value, how about EBADR which
> > sounds like no any available dma_async_tx_descriptor got by calling
> dmaengine_prep_slave_sg?
>
> > #define EBADR 53 /* Invalid request descriptor */
>
> We could also pass in a flag that could be set separately to the error code to
> indicate that nothing had happened to the hardware yet.
Do you mean spi-imx.c checking 'ctlr->flags' before return such error code?
Or just like below done in spi.c.
+fallback_pio:
ret = ctlr->transfer_one(ctlr, msg->spi, xfer);
if (ret < 0) {
+ if (ret == - EBADR && ctlr->cur_msg_mapped &&
+ (ctlr->flags & SPI_CONTROLLER_FALLBACK)) {
+ __spi_unmap_msg(ctlr, msg);
+ ctlr->fallback = true;
+ goto fallback_pio;
+ }
+