[U-Boot] [PATCH 2/4] spi: atmel: add WDRBT bit to avoid receive overrun

Bo Shen voice.shen at atmel.com
Mon Aug 20 08:32:22 CEST 2012


The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

Signed-off-by: Bo Shen <voice.shen at atmel.com>
---
 drivers/spi/atmel_spi.c |    3 +++
 drivers/spi/atmel_spi.h |    1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 83ef8e8..c7a51f7 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -92,6 +92,9 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	as->slave.cs = cs;
 	as->regs = regs;
 	as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS
+#if defined(CONFIG_AT91SAM9X5)
+			| ATMEL_SPI_MR_WDRBT
+#endif
 			| ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf);
 	spi_writel(as, CSR(cs), csrx);
 
diff --git a/drivers/spi/atmel_spi.h b/drivers/spi/atmel_spi.h
index 8b69a6d..057de9a 100644
--- a/drivers/spi/atmel_spi.h
+++ b/drivers/spi/atmel_spi.h
@@ -26,6 +26,7 @@
 #define ATMEL_SPI_MR_PCSDEC		(1 << 2)
 #define ATMEL_SPI_MR_FDIV		(1 << 3)
 #define ATMEL_SPI_MR_MODFDIS		(1 << 4)
+#define ATMEL_SPI_MR_WDRBT		(1 << 5)
 #define ATMEL_SPI_MR_LLB		(1 << 7)
 #define ATMEL_SPI_MR_PCS(x)		(((x) & 15) << 16)
 #define ATMEL_SPI_MR_DLYBCS(x)		((x) << 24)
-- 
1.7.9.5



More information about the U-Boot mailing list