diff options
author | Tom Rini <trini@ti.com> | 2014-02-21 08:00:22 -0500 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-02-21 08:00:22 -0500 |
commit | 4c89a369c7cd6e7ad3adec4601cfa69fec476164 (patch) | |
tree | 79beb1aa83998aa8beb9fe29b5930deb1235d68e /drivers/spi/xilinx_spi.c | |
parent | 36ae5cd2a824597b4c53b045ac0f4c1e3b4eaf65 (diff) | |
parent | 9ea09e20376abbca21760ed4ba87d6b5c4df465c (diff) | |
download | u-boot-imx-4c89a369c7cd6e7ad3adec4601cfa69fec476164.zip u-boot-imx-4c89a369c7cd6e7ad3adec4601cfa69fec476164.tar.gz u-boot-imx-4c89a369c7cd6e7ad3adec4601cfa69fec476164.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-spi
Diffstat (limited to 'drivers/spi/xilinx_spi.c')
-rw-r--r-- | drivers/spi/xilinx_spi.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 5ac0184..56d99d1 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -149,6 +149,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, const unsigned char *txp = dout; unsigned char *rxp = din; unsigned rxecount = 17; /* max. 16 elements in FIFO, leftover 1 */ + unsigned global_timeout; debug("%s: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", __func__, slave->bus, slave->cs, bitlen, bytes, flags); @@ -176,11 +177,12 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, if (flags & SPI_XFER_BEGIN) spi_cs_activate(slave); - while (bytes--) { - unsigned timeout = /* at least 1usec or greater, leftover 1 */ - xilspi->freq > XILSPI_MAX_XFER_BITS * 1000000 ? 2 : + /* at least 1usec or greater, leftover 1 */ + global_timeout = xilspi->freq > XILSPI_MAX_XFER_BITS * 1000000 ? 2 : (XILSPI_MAX_XFER_BITS * 1000000 / xilspi->freq) + 1; + while (bytes--) { + unsigned timeout = global_timeout; /* get Tx element from data out buffer and count up */ unsigned char d = txp ? *txp++ : CONFIG_XILINX_SPI_IDLE_VAL; debug("%s: tx:%x ", __func__, d); |