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

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Tue Jul 26 07:19:08 CEST 2016


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 at 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



More information about the U-Boot mailing list