aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2016-03-11 02:28:07 -0500
committerMark Brown <broonie@kernel.org>2016-03-11 02:28:07 -0500
commitbad0ae3f3c5cf0eceae5bb1def341efb5b972ce7 (patch)
tree799c3aeda11614dce6abd8dbaec50d9255100f38
parentf6cede5b49e822ebc41a099fe41ab4989f64e2cb (diff)
parent3ee20abb063acc57a45ccb2fdab2eb3ce29e85fa (diff)
Merge tag 'spi-fix-v4.5-rc7' into spi-linus
spi: Fixes for v4.5 A few driver specific fixes for the Rockchip and i.MX SPI controllers, especially for the i.MX they're annoying bugs if you run into them. # gpg: Signature made Thu 10 Mar 2016 11:09:57 ICT using RSA key ID 5D5487D0 # gpg: key CD7BEEBC: no public key for trusted key - skipped # gpg: key CD7BEEBC marked as ultimately trusted # gpg: key AF88CD16: no public key for trusted key - skipped # gpg: key AF88CD16 marked as ultimately trusted # gpg: key 16005C11: no public key for trusted key - skipped # gpg: key 16005C11 marked as ultimately trusted # gpg: key 5621E907: no public key for trusted key - skipped # gpg: key 5621E907 marked as ultimately trusted # gpg: key 5C6153AD: no public key for trusted key - skipped # gpg: key 5C6153AD marked as ultimately trusted # gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" # gpg: aka "Mark Brown <broonie@debian.org>" # gpg: aka "Mark Brown <broonie@kernel.org>" # gpg: aka "Mark Brown <broonie@tardis.ed.ac.uk>" # gpg: aka "Mark Brown <broonie@linaro.org>" # gpg: aka "Mark Brown <Mark.Brown@linaro.org>"
-rw-r--r--drivers/spi/spi-imx.c17
-rw-r--r--drivers/spi/spi-rockchip.c3
2 files changed, 5 insertions, 15 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 6a4ff27f4357..c688efa95e29 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -204,8 +204,8 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
204{ 204{
205 struct spi_imx_data *spi_imx = spi_master_get_devdata(master); 205 struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
206 206
207 if (spi_imx->dma_is_inited && 207 if (spi_imx->dma_is_inited && transfer->len >= spi_imx->wml &&
208 transfer->len > spi_imx->wml * sizeof(u32)) 208 (transfer->len % spi_imx->wml) == 0)
209 return true; 209 return true;
210 return false; 210 return false;
211} 211}
@@ -919,8 +919,6 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
919 struct dma_async_tx_descriptor *desc_tx = NULL, *desc_rx = NULL; 919 struct dma_async_tx_descriptor *desc_tx = NULL, *desc_rx = NULL;
920 int ret; 920 int ret;
921 unsigned long timeout; 921 unsigned long timeout;
922 u32 dma;
923 int left;
924 struct spi_master *master = spi_imx->bitbang.master; 922 struct spi_master *master = spi_imx->bitbang.master;
925 struct sg_table *tx = &transfer->tx_sg, *rx = &transfer->rx_sg; 923 struct sg_table *tx = &transfer->tx_sg, *rx = &transfer->rx_sg;
926 924
@@ -954,13 +952,6 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
954 /* Trigger the cspi module. */ 952 /* Trigger the cspi module. */
955 spi_imx->dma_finished = 0; 953 spi_imx->dma_finished = 0;
956 954
957 dma = readl(spi_imx->base + MX51_ECSPI_DMA);
958 dma = dma & (~MX51_ECSPI_DMA_RXT_WML_MASK);
959 /* Change RX_DMA_LENGTH trigger dma fetch tail data */
960 left = transfer->len % spi_imx->wml;
961 if (left)
962 writel(dma | (left << MX51_ECSPI_DMA_RXT_WML_OFFSET),
963 spi_imx->base + MX51_ECSPI_DMA);
964 /* 955 /*
965 * Set these order to avoid potential RX overflow. The overflow may 956 * Set these order to avoid potential RX overflow. The overflow may
966 * happen if we enable SPI HW before starting RX DMA due to rescheduling 957 * happen if we enable SPI HW before starting RX DMA due to rescheduling
@@ -992,10 +983,6 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
992 spi_imx->devtype_data->reset(spi_imx); 983 spi_imx->devtype_data->reset(spi_imx);
993 dmaengine_terminate_all(master->dma_rx); 984 dmaengine_terminate_all(master->dma_rx);
994 } 985 }
995 dma &= ~MX51_ECSPI_DMA_RXT_WML_MASK;
996 writel(dma |
997 spi_imx->wml << MX51_ECSPI_DMA_RXT_WML_OFFSET,
998 spi_imx->base + MX51_ECSPI_DMA);
999 } 986 }
1000 987
1001 spi_imx->dma_finished = 1; 988 spi_imx->dma_finished = 1;
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 79a8bc4f6cec..7cb1b2d710c1 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -749,6 +749,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
749 return 0; 749 return 0;
750 750
751err_register_master: 751err_register_master:
752 pm_runtime_disable(&pdev->dev);
752 if (rs->dma_tx.ch) 753 if (rs->dma_tx.ch)
753 dma_release_channel(rs->dma_tx.ch); 754 dma_release_channel(rs->dma_tx.ch);
754 if (rs->dma_rx.ch) 755 if (rs->dma_rx.ch)
@@ -778,6 +779,8 @@ static int rockchip_spi_remove(struct platform_device *pdev)
778 if (rs->dma_rx.ch) 779 if (rs->dma_rx.ch)
779 dma_release_channel(rs->dma_rx.ch); 780 dma_release_channel(rs->dma_rx.ch);
780 781
782 spi_master_put(master);
783
781 return 0; 784 return 0;
782} 785}
783 786