mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] I2C: i.MX: early: Use internal udelay
@ 2023-01-26 18:56 John Watts
  2023-01-30 10:27 ` Sascha Hauer
  2023-02-01 17:50 ` Alexander Shiyan
  0 siblings, 2 replies; 16+ messages in thread
From: John Watts @ 2023-01-26 18:56 UTC (permalink / raw)
  To: barebox; +Cc: John Watts

udelay isn't provided in the PBL, so use our own definition.

This avoids boards having to define udelay in their code.

Signed-off-by: John Watts <contact@jookia.org>
---
 drivers/i2c/busses/i2c-imx-early.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-imx-early.c b/drivers/i2c/busses/i2c-imx-early.c
index 6c8bdc7904..fcf279eff8 100644
--- a/drivers/i2c/busses/i2c-imx-early.c
+++ b/drivers/i2c/busses/i2c-imx-early.c
@@ -90,6 +90,13 @@ static int i2c_fsl_acked(struct fsl_i2c *fsl_i2c)
 	return i2c_fsl_poll_status(fsl_i2c, 0, I2SR_RXAK);
 }
 
+static void __udelay(int us)
+{
+	volatile int i;
+
+	for (i = 0; i < us * 1000; i++);
+}
+
 static int i2c_fsl_start(struct fsl_i2c *fsl_i2c)
 {
 	unsigned int temp = 0;
@@ -104,7 +111,7 @@ static int i2c_fsl_start(struct fsl_i2c *fsl_i2c)
 			  fsl_i2c, FSL_I2C_I2CR);
 
 	/* Wait controller to be stable */
-	udelay(100);
+	__udelay(100);
 
 	/* Start I2C transaction */
 	temp = fsl_i2c_read_reg(fsl_i2c, FSL_I2C_I2CR);
-- 
2.39.1




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-02-02 14:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 18:56 [PATCH] I2C: i.MX: early: Use internal udelay John Watts
2023-01-30 10:27 ` Sascha Hauer
2023-01-30 10:42   ` John Watts
2023-01-30 12:17     ` Sascha Hauer
2023-01-30 12:24       ` John Watts
2023-01-30 12:31         ` Sascha Hauer
2023-01-30 12:56           ` John Watts
2023-01-30 16:36             ` Sascha Hauer
2023-01-30 18:42               ` John Watts
2023-01-31  6:14                 ` Sascha Hauer
2023-01-31  6:33                   ` John Watts
2023-02-02 14:21   ` Jules Maselbas
2023-02-02 14:27     ` Ahmad Fatoum
2023-02-01 17:50 ` Alexander Shiyan
2023-02-01 18:12   ` Jookia
2023-02-01 19:44   ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox