diff options
Diffstat (limited to 'drivers/spi/atmel_spi.c')
-rw-r--r-- | drivers/spi/atmel_spi.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 0c7165660853..95190c619c10 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -184,7 +184,8 @@ static void atmel_spi_next_xfer(struct spi_master *master, | |||
184 | { | 184 | { |
185 | struct atmel_spi *as = spi_master_get_devdata(master); | 185 | struct atmel_spi *as = spi_master_get_devdata(master); |
186 | struct spi_transfer *xfer; | 186 | struct spi_transfer *xfer; |
187 | u32 len, remaining, total; | 187 | u32 len, remaining; |
188 | u32 ieval; | ||
188 | dma_addr_t tx_dma, rx_dma; | 189 | dma_addr_t tx_dma, rx_dma; |
189 | 190 | ||
190 | if (!as->current_transfer) | 191 | if (!as->current_transfer) |
@@ -197,6 +198,8 @@ static void atmel_spi_next_xfer(struct spi_master *master, | |||
197 | xfer = NULL; | 198 | xfer = NULL; |
198 | 199 | ||
199 | if (xfer) { | 200 | if (xfer) { |
201 | spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); | ||
202 | |||
200 | len = xfer->len; | 203 | len = xfer->len; |
201 | atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len); | 204 | atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len); |
202 | remaining = xfer->len - len; | 205 | remaining = xfer->len - len; |
@@ -234,6 +237,8 @@ static void atmel_spi_next_xfer(struct spi_master *master, | |||
234 | as->next_transfer = xfer; | 237 | as->next_transfer = xfer; |
235 | 238 | ||
236 | if (xfer) { | 239 | if (xfer) { |
240 | u32 total; | ||
241 | |||
237 | total = len; | 242 | total = len; |
238 | atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len); | 243 | atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len); |
239 | as->next_remaining_bytes = total - len; | 244 | as->next_remaining_bytes = total - len; |
@@ -250,9 +255,11 @@ static void atmel_spi_next_xfer(struct spi_master *master, | |||
250 | " next xfer %p: len %u tx %p/%08x rx %p/%08x\n", | 255 | " next xfer %p: len %u tx %p/%08x rx %p/%08x\n", |
251 | xfer, xfer->len, xfer->tx_buf, xfer->tx_dma, | 256 | xfer, xfer->len, xfer->tx_buf, xfer->tx_dma, |
252 | xfer->rx_buf, xfer->rx_dma); | 257 | xfer->rx_buf, xfer->rx_dma); |
258 | ieval = SPI_BIT(ENDRX) | SPI_BIT(OVRES); | ||
253 | } else { | 259 | } else { |
254 | spi_writel(as, RNCR, 0); | 260 | spi_writel(as, RNCR, 0); |
255 | spi_writel(as, TNCR, 0); | 261 | spi_writel(as, TNCR, 0); |
262 | ieval = SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) | SPI_BIT(OVRES); | ||
256 | } | 263 | } |
257 | 264 | ||
258 | /* REVISIT: We're waiting for ENDRX before we start the next | 265 | /* REVISIT: We're waiting for ENDRX before we start the next |
@@ -265,7 +272,7 @@ static void atmel_spi_next_xfer(struct spi_master *master, | |||
265 | * | 272 | * |
266 | * It should be doable, though. Just not now... | 273 | * It should be doable, though. Just not now... |
267 | */ | 274 | */ |
268 | spi_writel(as, IER, SPI_BIT(ENDRX) | SPI_BIT(OVRES)); | 275 | spi_writel(as, IER, ieval); |
269 | spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN)); | 276 | spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN)); |
270 | } | 277 | } |
271 | 278 | ||
@@ -396,7 +403,7 @@ atmel_spi_interrupt(int irq, void *dev_id) | |||
396 | 403 | ||
397 | ret = IRQ_HANDLED; | 404 | ret = IRQ_HANDLED; |
398 | 405 | ||
399 | spi_writel(as, IDR, (SPI_BIT(ENDTX) | SPI_BIT(ENDRX) | 406 | spi_writel(as, IDR, (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) |
400 | | SPI_BIT(OVRES))); | 407 | | SPI_BIT(OVRES))); |
401 | 408 | ||
402 | /* | 409 | /* |
@@ -418,7 +425,7 @@ atmel_spi_interrupt(int irq, void *dev_id) | |||
418 | if (xfer->delay_usecs) | 425 | if (xfer->delay_usecs) |
419 | udelay(xfer->delay_usecs); | 426 | udelay(xfer->delay_usecs); |
420 | 427 | ||
421 | dev_warn(master->dev.parent, "fifo overrun (%u/%u remaining)\n", | 428 | dev_warn(master->dev.parent, "overrun (%u/%u remaining)\n", |
422 | spi_readl(as, TCR), spi_readl(as, RCR)); | 429 | spi_readl(as, TCR), spi_readl(as, RCR)); |
423 | 430 | ||
424 | /* | 431 | /* |
@@ -442,7 +449,7 @@ atmel_spi_interrupt(int irq, void *dev_id) | |||
442 | spi_readl(as, SR); | 449 | spi_readl(as, SR); |
443 | 450 | ||
444 | atmel_spi_msg_done(master, as, msg, -EIO, 0); | 451 | atmel_spi_msg_done(master, as, msg, -EIO, 0); |
445 | } else if (pending & SPI_BIT(ENDRX)) { | 452 | } else if (pending & (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX))) { |
446 | ret = IRQ_HANDLED; | 453 | ret = IRQ_HANDLED; |
447 | 454 | ||
448 | spi_writel(as, IDR, pending); | 455 | spi_writel(as, IDR, pending); |