aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/dw_spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/dw_spi.c')
-rw-r--r--drivers/spi/dw_spi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c
index f713af8309e3..d948ef4f3910 100644
--- a/drivers/spi/dw_spi.c
+++ b/drivers/spi/dw_spi.c
@@ -831,6 +831,22 @@ static void spi_hw_init(struct dw_spi *dws)
831 spi_mask_intr(dws, 0xff); 831 spi_mask_intr(dws, 0xff);
832 spi_enable_chip(dws, 1); 832 spi_enable_chip(dws, 1);
833 flush(dws); 833 flush(dws);
834
835 /*
836 * Try to detect the FIFO depth if not set by interface driver,
837 * the depth could be from 2 to 256 from HW spec
838 */
839 if (!dws->fifo_len) {
840 u32 fifo;
841 for (fifo = 2; fifo <= 257; fifo++) {
842 dw_writew(dws, txfltr, fifo);
843 if (fifo != dw_readw(dws, txfltr))
844 break;
845 }
846
847 dws->fifo_len = (fifo == 257) ? 0 : fifo;
848 dw_writew(dws, txfltr, 0);
849 }
834} 850}
835 851
836int __devinit dw_spi_add_host(struct dw_spi *dws) 852int __devinit dw_spi_add_host(struct dw_spi *dws)