aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/atmel_spi.c
diff options
context:
space:
mode:
authorJean-Christophe Lallemand <jcl@develtech.com>2008-11-12 16:27:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-12 20:17:17 -0500
commit50d7d5bf3168db5d04566dd7ffb9a820e9fdf484 (patch)
tree55eba6757e8068e2a85d886d99701118f73f9170 /drivers/spi/atmel_spi.c
parent79b92f2bab0dc5ac70e8391548f75ac3268426e4 (diff)
atmel_spi: work-around required for new HW bug in AT91SAM9263 Rev.B SPI controller
We're working with an AT91SAM9263 Rev B in our design and I experienced some inconsistency in spi-based touchscreen usage between our board and the Atmel evaluation kit we have that runs on a Rev A chip. The data was apparently delayed by 1 byte and got ridiculous data out of the touchscreen driver, very strange. As everything looked normal in the spi, touchscreen and dma logs, I contacted the Atmel support and they triggered me on a new HW bug that appeared in the Rev B SPI controller. The problem is that the SPI controller on the Rev B needs that the software reset is performed two times so that it's performed correctly. Applying the patch below solves the issue on my Rev B board. I've tested it as well on my Rev A evaluation kit and it has apparently no unwanted side effect, things continue to work as expected. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/atmel_spi.c')
-rw-r--r--drivers/spi/atmel_spi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 02f9320f3efc..8abae4ad0fa5 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -766,6 +766,7 @@ static int __init atmel_spi_probe(struct platform_device *pdev)
766 /* Initialize the hardware */ 766 /* Initialize the hardware */
767 clk_enable(clk); 767 clk_enable(clk);
768 spi_writel(as, CR, SPI_BIT(SWRST)); 768 spi_writel(as, CR, SPI_BIT(SWRST));
769 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
769 spi_writel(as, MR, SPI_BIT(MSTR) | SPI_BIT(MODFDIS)); 770 spi_writel(as, MR, SPI_BIT(MSTR) | SPI_BIT(MODFDIS));
770 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); 771 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
771 spi_writel(as, CR, SPI_BIT(SPIEN)); 772 spi_writel(as, CR, SPI_BIT(SPIEN));
@@ -782,6 +783,7 @@ static int __init atmel_spi_probe(struct platform_device *pdev)
782 783
783out_reset_hw: 784out_reset_hw:
784 spi_writel(as, CR, SPI_BIT(SWRST)); 785 spi_writel(as, CR, SPI_BIT(SWRST));
786 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
785 clk_disable(clk); 787 clk_disable(clk);
786 free_irq(irq, master); 788 free_irq(irq, master);
787out_unmap_regs: 789out_unmap_regs:
@@ -805,6 +807,7 @@ static int __exit atmel_spi_remove(struct platform_device *pdev)
805 spin_lock_irq(&as->lock); 807 spin_lock_irq(&as->lock);
806 as->stopping = 1; 808 as->stopping = 1;
807 spi_writel(as, CR, SPI_BIT(SWRST)); 809 spi_writel(as, CR, SPI_BIT(SWRST));
810 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
808 spi_readl(as, SR); 811 spi_readl(as, SR);
809 spin_unlock_irq(&as->lock); 812 spin_unlock_irq(&as->lock);
810 813