xilinx_spi: Move timeout calculation out of the loop
Subsystems (2)
PATCH 1/1 xilinx_spi: Move timeout calculation out of the loop
Timeout calculation should be out of the data loop. This patch increase spi bandwidth for 30%.
---
drivers/spi/xilinx_spi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/spi/xilinx_spi.c +5 -3
@@ -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);
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140122/8727475f/attachment.pgp>
PATCH 1/1 xilinx_spi: Move timeout calculation out of the loop
Quoted 8 lines · Michal Simek
Timeout calculation should be out of the data loop. This patch increase spi bandwidth for 30%.
Signed-off-by Michal Simek <[email protected]>---
drivers/spi/xilinx_spi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Jagan: Can you please add this patch to your custodian tree?
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140204/b5dc2367/attachment.pgp>
PATCH 1/1 xilinx_spi: Move timeout calculation out of the loop
In reply to Michal SimekQuoted 38 lines · Michal Simek
Timeout calculation should be out of the data loop. This patch increase spi bandwidth for 30%.
Signed-off-by Michal Simek <[email protected]>---
drivers/spi/xilinx_spi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/spi/xilinx_spi.c +5
-4@@ -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); --
Quoted 2 lines
1.8.2.3
Applied to u-boot-spi/master
thanks!
Signature · 1 line
Jagan.