Title: [3922] trunk/drivers/spi/spi_bfin5xx.c: [#3678]
fix bug - SPI duplex operation can read a dummy byte at the first transfer
- Revision
- 3922
- Author
- cooloney
- Date
- 2007-11-21 23:28:53 -0600 (Wed, 21 Nov 2007)
Log Message
[#3678] fix bug - SPI duplex operation can read a dummy byte at the first transfer
Patch from Jean-Christian de Rivaz <[EMAIL PROTECTED]>
revert spi_bfin5xx.c duplex operation before commit
Task[#3508] Fix SPI driver to work with SPI flash ST25P16 on bf548
Current SPI driver enables SPI controller and set the SPI baud register
for each SPI transfer. But, they should never be changed within a SPI
message session, in which seveal SPI transfers are pumped. This patch
move move SPI setting to the begining of a message session. And never
disables SPI controller until an error occurs.
Diffstat
spi_bfin5xx.c | 18 +++---------------
1 files changed, 3 insertions(+), 15 deletions(-)
Modified Paths
Diff
Modified: trunk/drivers/spi/spi_bfin5xx.c (3921 => 3922)
--- trunk/drivers/spi/spi_bfin5xx.c 2007-11-22 05:12:17 UTC (rev 3921)
+++ trunk/drivers/spi/spi_bfin5xx.c 2007-11-22 05:28:53 UTC (rev 3922)
@@ -358,14 +358,10 @@
static void u8_duplex(struct driver_data *drv_data)
{
- /* poll for SPI completion before start */
- while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
- cpu_relax();
-
/* in duplex mode, clk is triggered by writing of TDBR */
while (drv_data->rx < drv_data->rx_end) {
write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
- while (read_STAT(drv_data) & BIT_STAT_TXS)
+ while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
cpu_relax();
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
cpu_relax();
@@ -495,14 +491,10 @@
static void u16_duplex(struct driver_data *drv_data)
{
- /* poll for SPI completion before start */
- while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
- cpu_relax();
-
/* in duplex mode, clk is triggered by writing of TDBR */
while (drv_data->tx < drv_data->tx_end) {
write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
- while (read_STAT(drv_data) & BIT_STAT_TXS)
+ while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
cpu_relax();
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
cpu_relax();
@@ -516,15 +508,11 @@
{
struct chip_data *chip = drv_data->cur_chip;
- /* poll for SPI completion before start */
- while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
- cpu_relax();
-
while (drv_data->tx < drv_data->tx_end) {
cs_active(drv_data, chip);
write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
- while (read_STAT(drv_data) & BIT_STAT_TXS)
+ while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
cpu_relax();
while (!(read_STAT(drv_data) & BIT_STAT_RXS))
cpu_relax();
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits