diff mbox

[U-Boot] spi: xilinx_spi: Set the speed to default value

Message ID 1469510348-26678-1-git-send-email-sivadur@xilinx.com
State Rejected
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Siva Durga Prasad Paladugu July 26, 2016, 5:19 a.m. UTC
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 <sivadur@xilinx.com>
---
 drivers/spi/xilinx_spi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

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);