atmel_spi driver
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 015e01c838d5$6b2b2bc0$2b00a8c0@ARV127
Quoted 7 lines · On Fri, 7 Dec 2007 14:31:04 +0100 "Rini van Zetten"…
Dear Haavard,
I think i found a bug in the
atmel_spidriver which is maintained by you. Let me describe.We have a wifi module connected to the spi bus and got sometimes FIFO overrun errors on the spi bus.
After some investigation i found that the driver loads the TCR (transmit count) register before the RCR (receive count). When the transfer list is not empty theatmel_spi_next_messageis called while tx and rx are enabled. As soon as the TCR is loaded, hardware starts transfer and causes a rx fifo overrun because the RCR is not loaded yet. Atached is a patch (for the 2.6.23.9 kernel) which loads the RCR before the TCR. After this patch the fifo overrun disapears at out setup.
Ah, nice catch. Thanks.
Quoted 1 line
Please review it and let me know if you need more details.
Makes sense to me. David, do you think this one should go in before 2.6.24? It may solve some of the other overrun problems people have been seeing as well, especially those happening at low speed.
Btw, Rini, could you sign off the patch as well? Please see Documentation/SubmittingPatches if you don't know what this means.
Haavard
===========[cut here]==============
From: Rini van Zetten <[email protected]>
Date: Fri, 7 Dec 2007 14:41:56 +0100
Subject: [PATCH] atmel_spi: Reload RCR before TCR
We have a wifi module connected to the spi bus and got sometimes FIFO overrun errors on the spi bus.
After some investigation i found that the driver loads the TCR (transmit count) register before the RCR (receive count). When the transfer list is not empty the atmel_spi_next_message is called while tx and rx are enabled. As soon as the TCR is loaded, hardware starts transfer and causes a rx fifo overrun because the RCR is not loaded yet.
Below is a patch (for the 2.6.23.9 kernel) which loads the RCR before the TCR. After this patch the fifo overrun disapears at out setup.
--- drivers/spi/atmel_spi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/atmel_spi.c +1 -1
@@ -195,8 +195,8 @@ static void atmel_spi_next_xfer(struct spi_master *master, xfer, xfer->len, xfer->tx_buf, xfer->tx_dma, xfer->rx_buf, xfer->rx_dma, spi_readl(as, IMR)); -spi_writel (as,TCR , len);spi_writel (as,RCR , len); +spi_writel (as,TCR , len);spi_writel (as,PTCR ,SPI_BIT (TXTEN ) |SPI_BIT (RXTEN )); }
Signature · 9 lines
1.5.3.4 ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php
PATCH 1/1 atmel_spi: Reload RCR before TCR
From: Rini van Zetten <[email protected]>
Date: Fri, 7 Dec 2007 14:41:56 +0100
Subject: [PATCH] atmel_spi: Reload RCR before TCR
We have a wifi module connected to the spi bus and got sometimes FIFO overrun errors on the spi bus.
After some investigation i found that the driver loads the TCR (transmit count) register before the RCR (receive count). When the transfer list is not empty the atmel_spi_next_message is called while tx and rx are enabled. As soon as the TCR is loaded, hardware starts transfer and causes a rx fifo overrun because the RCR is not loaded yet.
Below is a patch (for the 2.6.23.9 kernel) which loads the RCR before the TCR. After this patch the fifo overrun disapears at out setup.
--- drivers/spi/atmel_spi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/atmel_spi.c +0 -0
@@ -195,8 +195,8 @@ static void atmel_spi_next_xfer(struct spi_master
*master,
xfer, xfer->len, xfer->tx_buf, xfer->tx_dma, xfer->rx_buf, xfer->rx_dma, spi_readl(as, IMR));
- spi_writel(as, TCR, len);
spi_writel(as, RCR, len);
+ spi_writel(as, TCR, len);
spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN));
}
Signature · 9 lines
1.5.3.4 ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php
A message that is not in the archive (sent off-list or not yet received): 20071207144955.54cf14e4-STKoQgiEtS/[email protected]
Quoted 5 lines
Quoted 2 lines
Atached is a patch (for the 2.6.23.9 kernel) which loads the RCR before the TCR. After this patch the fifo overrun disapears at out setup.
Ah, nice catch. Thanks.
Quoted 8 lines
Quoted 1 line
Please review it and let me know if you need more details.
Makes sense to me. David, do you think this one should go in before 2.6.24? It may solve some of the other overrun problems people have been seeing as well, especially those happening at low speed.
Btw, Rini, could you sign off the patch as well? Please see
Documentation/SubmittingPatchesif you don't know what this means.
Yes, bugfixes like this are clear 2.6.24 material.
I'll forward it for such merge as son as I get a copy with signoff from Rini.
- Dave
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php