mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Alexander Shiyan <eagle.alexander923@gmail.com>,
	John Watts <contact@jookia.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] I2C: i.MX: early: Use internal udelay
Date: Wed, 1 Feb 2023 20:44:36 +0100	[thread overview]
Message-ID: <45011e51-4e6f-b2d7-e7b8-c1b2e935bbba@pengutronix.de> (raw)
In-Reply-To: <CAP1tNvRo98Xoo2z3GmacoYZ-vR6FTnKcJYxrop3HJZi-QnFt6Q@mail.gmail.com>

Hello Alexander,

On 01.02.23 18:50, Alexander Shiyan wrote:
> Hello!
> 
> Just a nitpick, udelay means milliseconds (udelay_(us)),
> which isn't quite right in this case,
> so I think we should use the "loops" value here (delay_loops() or so)).

udelay is already defined used ARMv8 architected timer, so what John is
doingvis providing an implementation for i.MX6. So even if it uses a loop,
the iterations are chosen to be roughly the amount of microseconds
in the argument and thus the name is ok IMO. See his latest revision
of the patch.

Cheers,
Ahmad

> 
> Thanks!
> 
> чт, 26 янв. 2023 г. в 21:57, John Watts <contact@jookia.org>:
>>
>> 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
>>
>>
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




      parent reply	other threads:[~2023-02-01 19:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 18:56 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45011e51-4e6f-b2d7-e7b8-c1b2e935bbba@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=contact@jookia.org \
    --cc=eagle.alexander923@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox