[PATCH v1 1/1] soft_spi performance enhancement

verdun at hpe.com verdun at hpe.com
Tue Jun 10 18:38:35 CEST 2025


From: Jean-Marie Verdun <verdun at hpe.com>

Add a test when delay is set to 0 to improve performances
by 20% on ARM based systems

Signed-off-by: Jean-Marie Verdun <verdun at hpe.com>
---
 drivers/spi/soft_spi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c
index 50bd7be5640..e97352000f8 100644
--- a/drivers/spi/soft_spi.c
+++ b/drivers/spi/soft_spi.c
@@ -173,7 +173,8 @@ static int soft_spi_xfer(struct udevice *dev, unsigned int bitlen,
 			soft_spi_scl(dev, !cidle);
 		if ((txrx & SPI_MASTER_NO_TX) == 0)
 			soft_spi_sda(dev, !!(tmpdout & 0x80));
-		udelay(plat->spi_delay_us);
+		if (plat->spi_delay_us)
+			udelay(plat->spi_delay_us);
 
 		/*
 		 * sample bit
@@ -190,7 +191,8 @@ static int soft_spi_xfer(struct udevice *dev, unsigned int bitlen,
 							    &plat->mosi :
 							    &plat->miso);
 		tmpdout	<<= 1;
-		udelay(plat->spi_delay_us);
+		if (plat->spi_delay_us)
+			udelay(plat->spi_delay_us);
 
 		/*
 		 * drive bit
-- 
2.43.0



More information about the U-Boot mailing list