Skip to contentSkip to conversation

spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

PATCH New Kuldeep Singh 2 participants 5 messages Apr 21, 2020 – Apr 27, 2020 SPI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

Board gets reset when performing burst read/write operations. On the other hand, no such behaviour is observed on small size operations.

In Linux, readl_poll_timeout API already add delay of 1us which is skipped in U-boot. Since, NXP Flexspi U-boot driver is a ported version of Linux driver and U-boot poll_timeout API lacks delay functionality, add 1us delay so as to make controller ready for other transactions.

---
v1: Add comments above udelay(1) change.

 drivers/spi/nxp_fspi.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/spi/nxp_fspi.c +7 -0
index 0e6c7be..1c6538c 100644
@@ -757,6 +757,13 @@ static int nxp_fspi_exec_op(struct spi_slave *slave,
 				   FSPI_STS0_ARB_IDLE, 1, POLL_TOUT, true);
 	WARN_ON(err);
 
+	/*
+	 * Watchdog gets triggered for large read/write/erase since this
+	 * delay is not present in this API(readl_poll_timeout), add
+	 * this delay here.
+	 */
+	udelay(1);
+
 	nxp_fspi_prepare_lut(f, op);
 	/*
 	 * If we have large chunks of data, we read them through the AHB bus
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

Quoted 8 lines · Kuldeep Singh

Board gets reset when performing burst read/write operations. On the other hand, no such behaviour is observed on small size operations.

In Linux, readl_poll_timeout API already add delay of 1us which is skipped in U-boot. Since, NXP Flexspi U-boot driver is a ported version of Linux driver and U-boot poll_timeout API lacks delay functionality, add 1us delay so as to make controller ready for other transactions.

Can you link me, where does Linux add this delay?

Jagan.

#2 lore raw
Quoted 18 lines

-----Original Message-----
From: Jagan Teki <[email protected]>
Sent: Tuesday, April 21, 2020 1:45 PM
To: Kuldeep Singh <[email protected]>
Cc: U-Boot-Denx <[email protected]>
Subject: [EXT] Re: [Patch v2] spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

Caution: EXT Email

Quoted 4 lines · Kuldeep Singh

Board gets reset when performing burst read/write operations. On the other hand, no such behaviour is observed on small size operations.

Quoted 7 lines
Quoted 4 lines

In Linux, readl_poll_timeout API already add delay of 1us which is skipped in U-boot. Since, NXP Flexspi U-boot driver is a ported version of Linux driver and U-boot poll_timeout API lacks delay functionality, add 1us delay so as to make controller ready for other

transactions.

Can you link me, where does Linux add this delay?

Please see[1] for Linux nxp flexspi driver code.
fspi_readl_poll_tout, line: 795

If you see implementation of " fspi_readl_poll_tout ", it further calls "readl_poll_timeout" which includes delay of 1us. And also please see the difference of "readl_poll_timeout" api implementation in uboot and Linux. This api adds delay in Linux but skips it in uboot.

Thanks
Kuldeep
[1] https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi-nxp-fspi.c

#3 lore raw
Quoted 25 lines · Kuldeep Singh
Quoted 25 lines

-----Original Message-----
From: Jagan Teki <[email protected]>
Sent: Tuesday, April 21, 2020 1:45 PM
To: Kuldeep Singh <[email protected]>
Cc: U-Boot-Denx <[email protected]>
Subject: [EXT] Re: [Patch v2] spi: nxp-fspi: Add 1us delay to make controller ready for next transaction

Caution: EXT Email

Quoted 8 lines · Kuldeep Singh

Board gets reset when performing burst read/write operations. On the other hand, no such behaviour is observed on small size operations.

In Linux, readl_poll_timeout API already add delay of 1us which is skipped in U-boot. Since, NXP Flexspi U-boot driver is a ported version of Linux driver and U-boot poll_timeout API lacks delay functionality, add 1us delay so as to make controller ready for other

transactions.

Quoted 8 lines
Quoted 1 line

Can you link me, where does Linux add this delay?

Please see[1] for Linux nxp flexspi driver code.
fspi_readl_poll_tout, line: 795

If you see implementation of " fspi_readl_poll_tout ", it further calls "readl_poll_timeout" which includes delay of 1us. And also please see the difference of "readl_poll_timeout" api implementation in uboot and Linux. This api adds delay in Linux but skips it in uboot.

Yes, it worked for myself also. so please use the new api which I have introduced on this series [2]

[2] https://patchwork.ozlabs.org/project/uboot/patch/20200425110354.12381-3-jagan at amarulasolutions.com/

#4 lore raw
Quoted 8 lines
Quoted 1 line

If you see implementation of " fspi_readl_poll_tout ", it further calls

"readl_poll_timeout" which includes delay of 1us.

Quoted 1 line

And also please see the difference of "readl_poll_timeout" api

implementation in uboot and Linux.

Quoted 1 line

This api adds delay in Linux but skips it in uboot.

Yes, it worked for myself also. so please use the new api which I have introduced on this series [2]

Thanks Jagan for the new API. I will respin this patch.

-Kuldeep