Skip to contentSkip to conversation

Enhance soft spi performance

PATCH In review [email protected] 3 participants 4 messages Jun 10, 2025 – Feb 14 SPI

lore
Share & tools
lore
#0 lore raw

cover Enhance soft spi performance

From: Jean-Marie Verdun <[email protected]>

v1
Add a test to enhance soft spi performance when delay is set to 0

Jean-Marie Verdun (1):
soft_spi performance enhancement

 drivers/spi/soft_spi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 soft_spi performance enhancement

From: Jean-Marie Verdun <[email protected]>

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

---
 drivers/spi/soft_spi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/soft_spi.c +4 -2
index 50bd7be5640..e97352000f8 100644
@@ -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
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH v1 1/1] soft_spi performance enhancement

Quoted 25 lines · On 10/06/2025 18:38, [email protected] wrote:

From: Jean-Marie Verdun <[email protected]>

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

---
  drivers/spi/soft_spi.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/soft_spi.c +2 -1
index 50bd7be5640..e97352000f8 100644
@@ -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

drivers/spi/soft_spi.c static int soft_spi_xfer(struct udevice *dev, unsigned int bitlen, · line 198

Quoted 9 lines
drivers/spi/soft_spi.c +2 -1
@@ -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
#3 lore raw

Re: [PATCH v1 1/1] soft_spi performance enhancement

In reply to [email protected]
Quoted 4 lines · On Tue, 10 Jun 2025 16:38:35 +0000, [email protected] wrote:

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

Applied to u-boot/next, thanks!

[1/1] soft_spi performance enhancement

      commit: 6caff66ce4692b78faf0c5c654f223eaa3aec774
Signature · 1 line
Tom