Set speed to default value of 100KHz if received
as zero from framework. Setting it to zero results
in wrong timeout calculation during spi_xfer.

Signed-off-by: Siva Durga Prasad Paladugu <siva...@xilinx.com>
---
 drivers/spi/xilinx_spi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index c557529..df6b146 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -81,6 +81,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #define XILINX_SPI_QUAD_MODE   2
+#define XILINX_SPI_DFLT_FREQ   100000
 
 /* xilinx spi register set */
 struct xilinx_spi_regs {
@@ -257,7 +258,10 @@ static int xilinx_spi_set_speed(struct udevice *bus, uint 
speed)
 {
        struct xilinx_spi_priv *priv = dev_get_priv(bus);
 
-       priv->freq = speed;
+       if (speed)
+               priv->freq = speed;
+       else
+               priv->freq = XILINX_SPI_DFLT_FREQ;
 
        debug("xilinx_spi_set_speed: regs=%p, speed=%d\n", priv->regs,
              priv->freq);
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to