aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-01 12:15:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-01 12:15:15 -0500
commitac0f6f927db539e03e1f3f61bcd4ed57d5cde7a9 (patch)
tree816e5ac643b15c2050c64a7075f0f7e13d86ea09 /drivers/spi
parentb1bf9368407ae7e89d8a005bb40beb70a41df539 (diff)
parent9f33be2c3a80bdc2cc08342dd77fac87652e0548 (diff)
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (100 commits) ARM: Eliminate decompressor -Dstatic= PIC hack ARM: 5958/1: ARM: U300: fix inverted clk round rate ARM: 5956/1: misplaced parentheses ARM: 5955/1: ep93xx: move timer defines into core.c and document ARM: 5954/1: ep93xx: move gpio interrupt support to gpio.c ARM: 5953/1: ep93xx: fix broken build of clock.c ARM: 5952/1: ARM: MM: Add ARM_L1_CACHE_SHIFT_6 for handle inside each ARCH Kconfig ARM: 5949/1: NUC900 add gpio virtual memory map ARM: 5948/1: Enable timer0 to time4 clock support for nuc910 ARM: 5940/2: ARM: MMCI: remove custom DBG macro and printk ARM: make_coherent(): fix problems with highpte, part 2 MM: Pass a PTE pointer to update_mmu_cache() rather than the PTE itself ARM: 5945/1: ep93xx: include correct irq.h in core.c ARM: 5933/1: amba-pl011: support hardware flow control ARM: 5930/1: Add PKMAP area description to memory.txt. ARM: 5929/1: Add checks to detect overlap of memory regions. ARM: 5928/1: Change type of VMALLOC_END to unsigned long. ARM: 5927/1: Make delimiters of DMA area globally visibly. ARM: 5926/1: Add "Virtual kernel memory..." printout. ARM: 5920/1: OMAP4: Enable L2 Cache ... Fix up trivial conflict in arch/arm/mach-mx25/clock.c
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/amba-pl022.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index ff5bbb9c43c9..9aeb68113100 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -363,6 +363,7 @@ struct pl022 {
363 void *rx_end; 363 void *rx_end;
364 enum ssp_reading read; 364 enum ssp_reading read;
365 enum ssp_writing write; 365 enum ssp_writing write;
366 u32 exp_fifo_level;
366}; 367};
367 368
368/** 369/**
@@ -501,6 +502,9 @@ static int flush(struct pl022 *pl022)
501 while (readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RNE) 502 while (readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RNE)
502 readw(SSP_DR(pl022->virtbase)); 503 readw(SSP_DR(pl022->virtbase));
503 } while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_BSY) && limit--); 504 } while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_BSY) && limit--);
505
506 pl022->exp_fifo_level = 0;
507
504 return limit; 508 return limit;
505} 509}
506 510
@@ -583,10 +587,9 @@ static void readwriter(struct pl022 *pl022)
583 * errons in 8bit wide transfers on ARM variants (just 8 words 587 * errons in 8bit wide transfers on ARM variants (just 8 words
584 * FIFO, means only 8x8 = 64 bits in FIFO) at least. 588 * FIFO, means only 8x8 = 64 bits in FIFO) at least.
585 * 589 *
586 * FIXME: currently we have no logic to account for this. 590 * To prevent this issue, the TX FIFO is only filled to the
587 * perhaps there is even something broken in HW regarding 591 * unused RX FIFO fill length, regardless of what the TX
588 * 8bit transfers (it doesn't fail on 16bit) so this needs 592 * FIFO status flag indicates.
589 * more investigation...
590 */ 593 */
591 dev_dbg(&pl022->adev->dev, 594 dev_dbg(&pl022->adev->dev,
592 "%s, rx: %p, rxend: %p, tx: %p, txend: %p\n", 595 "%s, rx: %p, rxend: %p, tx: %p, txend: %p\n",
@@ -613,11 +616,12 @@ static void readwriter(struct pl022 *pl022)
613 break; 616 break;
614 } 617 }
615 pl022->rx += (pl022->cur_chip->n_bytes); 618 pl022->rx += (pl022->cur_chip->n_bytes);
619 pl022->exp_fifo_level--;
616 } 620 }
617 /* 621 /*
618 * Write as much as you can, while keeping an eye on the RX FIFO! 622 * Write as much as possible up to the RX FIFO size
619 */ 623 */
620 while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_TNF) 624 while ((pl022->exp_fifo_level < pl022->vendor->fifodepth)
621 && (pl022->tx < pl022->tx_end)) { 625 && (pl022->tx < pl022->tx_end)) {
622 switch (pl022->write) { 626 switch (pl022->write) {
623 case WRITING_NULL: 627 case WRITING_NULL:
@@ -634,6 +638,7 @@ static void readwriter(struct pl022 *pl022)
634 break; 638 break;
635 } 639 }
636 pl022->tx += (pl022->cur_chip->n_bytes); 640 pl022->tx += (pl022->cur_chip->n_bytes);
641 pl022->exp_fifo_level++;
637 /* 642 /*
638 * This inner reader takes care of things appearing in the RX 643 * This inner reader takes care of things appearing in the RX
639 * FIFO as we're transmitting. This will happen a lot since the 644 * FIFO as we're transmitting. This will happen a lot since the
@@ -660,6 +665,7 @@ static void readwriter(struct pl022 *pl022)
660 break; 665 break;
661 } 666 }
662 pl022->rx += (pl022->cur_chip->n_bytes); 667 pl022->rx += (pl022->cur_chip->n_bytes);
668 pl022->exp_fifo_level--;
663 } 669 }
664 } 670 }
665 /* 671 /*