aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-mxs.c
diff options
context:
space:
mode:
authorJuha Lumme <juha.lumme@gmail.com>2012-12-26 00:48:51 -0500
committerGrant Likely <grant.likely@secretlab.ca>2013-02-05 07:45:24 -0500
commitba486a2a29b629413f89e0490edb02a8ccc3bb8f (patch)
treeb1a9273542e5d139975317b6d02bbf718444c123 /drivers/spi/spi-mxs.c
parentf3b8a8ecc5922d9dff303ae2fadc1eae608a6f7c (diff)
mxs/spi: clear XFER_COUNT in ctrl0 field in DMA descriptor
On MX23 the XFER_COUNT part in ctrl0 field in DMA descriptor was improperly OR'd during the construction of DMA descriptor chain, instead of being freshly set. Because of that too many bytes were being expected from SPI during the last DMA cycle. This caused a timeout (SSP_TIMEOUT) to happen in the processing of the last DMA descriptor, and thus reads and writes were failing. This is a fix for the problem, by clearing XFER_COUNT bytes in ctrl0 before setting the new XFER_COUNT for DMA descriptor. Signed-off-by: Juha Lumme <juha.lumme@gmail.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-mxs.c')
-rw-r--r--drivers/spi/spi-mxs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index a3ede249d05d..e3d8b3197d22 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -241,6 +241,7 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs,
241 INIT_COMPLETION(spi->c); 241 INIT_COMPLETION(spi->c);
242 242
243 ctrl0 = readl(ssp->base + HW_SSP_CTRL0); 243 ctrl0 = readl(ssp->base + HW_SSP_CTRL0);
244 ctrl0 &= ~BM_SSP_CTRL0_XFER_COUNT;
244 ctrl0 |= BM_SSP_CTRL0_DATA_XFER | mxs_spi_cs_to_reg(cs); 245 ctrl0 |= BM_SSP_CTRL0_DATA_XFER | mxs_spi_cs_to_reg(cs);
245 246
246 if (*first) 247 if (*first)
@@ -256,8 +257,10 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs,
256 if ((sg_count + 1 == sgs) && *last) 257 if ((sg_count + 1 == sgs) && *last)
257 ctrl0 |= BM_SSP_CTRL0_IGNORE_CRC; 258 ctrl0 |= BM_SSP_CTRL0_IGNORE_CRC;
258 259
259 if (ssp->devid == IMX23_SSP) 260 if (ssp->devid == IMX23_SSP) {
261 ctrl0 &= ~BM_SSP_CTRL0_XFER_COUNT;
260 ctrl0 |= min; 262 ctrl0 |= min;
263 }
261 264
262 dma_xfer[sg_count].pio[0] = ctrl0; 265 dma_xfer[sg_count].pio[0] = ctrl0;
263 dma_xfer[sg_count].pio[3] = min; 266 dma_xfer[sg_count].pio[3] = min;