From: Robin Gong <yibin.gong@nxp.com>
To: broonie@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de,
festevam@gmail.com, robin.murphy@arm.com,
matthias.schiffer@ew.tq-group.com
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-imx@nxp.com,
kernel@pengutronix.de, linux-spi@vger.kernel.org
Subject: [PATCH v1 RFC 2/2] spi: spi-imx: add fallback feature
Date: Thu, 11 Jun 2020 20:58:30 +0800 [thread overview]
Message-ID: <1591880310-1813-3-git-send-email-yibin.gong@nxp.com> (raw)
In-Reply-To: <1591880310-1813-1-git-send-email-yibin.gong@nxp.com>
Add fallback pio feature for dma transfer failed. Since another whole
pio transfer including setup_transfer will be issued by spi core, no
need to restore jobs like commit bcd8e7761ec9 ("spi: imx: fallback to PIO
if dma setup failure").
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
---
drivers/spi/spi-imx.c | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index b7a85e3..afd31d7 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -224,7 +224,7 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
{
struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
- if (!use_dma)
+ if (!use_dma || master->fallback)
return false;
if (!master->dma_rx)
@@ -1302,7 +1302,8 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx,
master->can_dma = spi_imx_can_dma;
master->max_dma_len = MAX_SDMA_BD_BYTES;
spi_imx->bitbang.master->flags = SPI_MASTER_MUST_RX |
- SPI_MASTER_MUST_TX;
+ SPI_MASTER_MUST_TX |
+ SPI_MASTER_FALLBACK;
return 0;
err:
@@ -1507,7 +1508,6 @@ static int spi_imx_transfer(struct spi_device *spi,
struct spi_transfer *transfer)
{
struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master);
- int ret;
/* flush rxfifo before transfer */
while (spi_imx->devtype_data->rx_available(spi_imx))
@@ -1516,21 +1516,8 @@ static int spi_imx_transfer(struct spi_device *spi,
if (spi_imx->slave_mode)
return spi_imx_pio_transfer_slave(spi, transfer);
- /*
- * fallback PIO mode if dma setup error happen, for example sdma
- * firmware may not be updated as ERR009165 required.
- */
- if (spi_imx->usedma) {
- ret = spi_imx_dma_transfer(spi_imx, transfer);
- if (ret != -EINVAL)
- return ret;
-
- spi_imx->devtype_data->disable_dma(spi_imx);
-
- spi_imx->usedma = false;
- spi_imx->dynamic_burst = spi_imx->devtype_data->dynamic_burst;
- dev_dbg(&spi->dev, "Fallback to PIO mode\n");
- }
+ if (spi_imx->usedma)
+ return spi_imx_dma_transfer(spi_imx, transfer);
return spi_imx_pio_transfer(spi, transfer);
}
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-06-11 4:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-11 12:58 [PATCH v1 RFC 0/2] introduce fallback to pio in spi core Robin Gong
2020-06-11 12:58 ` [PATCH v1 RFC 1/2] spi: introduce fallback to pio Robin Gong
2020-06-11 13:40 ` Mark Brown
2020-06-12 2:18 ` Robin Gong
2020-06-12 10:13 ` Mark Brown
2020-06-12 13:48 ` Robin Gong
2020-06-12 14:16 ` Mark Brown
2020-06-14 13:04 ` Robin Gong
2020-06-15 7:19 ` Vinod Koul
2020-06-15 8:59 ` Robin Gong
2020-06-15 11:25 ` Vinod Koul
2020-06-16 3:05 ` Robin Gong
2020-06-15 12:35 ` Mark Brown
2020-06-15 13:35 ` Robin Gong
2020-06-15 13:39 ` Mark Brown
2020-06-15 14:18 ` Robin Gong
2020-06-15 14:36 ` Mark Brown
2020-06-15 14:53 ` Robin Gong
2020-06-15 14:55 ` Mark Brown
2020-06-16 2:03 ` Robin Gong
2020-06-16 9:59 ` Mark Brown
2020-06-16 10:13 ` Robin Gong
2020-06-16 10:26 ` Mark Brown
2020-06-16 12:29 ` Robin Gong
2020-06-11 12:58 ` Robin Gong [this message]
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=1591880310-1813-3-git-send-email-yibin.gong@nxp.com \
--to=yibin.gong@nxp.com \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=matthias.schiffer@ew.tq-group.com \
--cc=robin.murphy@arm.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.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