[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VE1PR04MB66380FD8FB7FCE79AF4B6CD4899D0@VE1PR04MB6638.eurprd04.prod.outlook.com>
Date: Tue, 16 Jun 2020 02:03:40 +0000
From: Robin Gong <yibin.gong@....com>
To: Mark Brown <broonie@...nel.org>
CC: Vinod Koul <vkoul@...nel.org>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"festevam@...il.com" <festevam@...il.com>,
"robin.murphy@....com" <robin.murphy@....com>,
"matthias.schiffer@...tq-group.com"
<matthias.schiffer@...tq-group.com>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
dl-linux-imx <linux-imx@....com>,
"linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio
On 2020/06/15 22:56 Mark Brown <broonie@...nel.org> wrote:
> On Mon, Jun 15, 2020 at 02:53:29PM +0000, Robin Gong wrote:
> > Do you mean spi-imx.c checking 'ctlr->flags' before return such error code?
> > Or just like below done in spi.c.
>
> No, I mean passing in an additional argument which can provide richer data
> than trying to smash things into the return value.
Okay, how about adding this additional argument in struct spi_transfer like below?
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 95291fe4..7c19099 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -943,6 +943,9 @@ struct spi_transfer {
bool timestamped;
struct list_head transfer_list;
+
+#define SPI_TRANS_DMA_PREP_FAIL BIT(3) /* prepare dma failed */
+ u16 flags;
};
While spi core checking it as below after it set in spi-imx.c:
fallback_pio:
ret = ctlr->transfer_one(ctlr, msg->spi, xfer);
if (ret < 0) {
if (ctlr->cur_msg_mapped &&
(xfer->flags & SPI_TRANS_DMA_PREP_FAIL)) {
__spi_unmap_msg(ctlr, msg);
ctlr->fallback = true;
xfer->flags &= ~SPI_TRANS_DMA_PREP_FAIL;
goto fallback_pio;
}
Powered by blists - more mailing lists