public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Wolfram Sang <wsa@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2 9/9] i2c: riic: Implement bus recovery
Date: Wed, 16 Apr 2025 09:43:03 +0200	[thread overview]
Message-ID: <Z_9fh2nfwAaUnhVV@shikoro> (raw)
In-Reply-To: <CA+V-a8s4-g9vxyfYMgnKMK=Oej9kDBwWsWehWLYTkxw-06w-2g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1596 bytes --]

Hi Prabhakar,

finally some time for this!

> Based on the feedback from the HW engineer the restriction is valid
> see attached image (i2c-pullup.png). The SCL and SDA are Schmitt
> input/open-drain output pins for both master and slave operations.
> Because the output is open drain, an external pull-up resistor is
> required.

That confirms what I was saying. It is required. There is no difference
between setting the bit manually and the IP core doing it internally.

> Assuming there is an external pull-up resistor for all the platforms I
> implemented the I2C bus recovery using the generic recovery algorithm
> and I'm seeing issues, as the required number of clock pulses are not
> being triggered (Note, the i2c clock frequency is 400000Hz where the
> below tests are run).

So, my take is to check further why this is the case. The code looks
mostly good, except for bus_free:

> +static int riic_get_bus_free(struct i2c_adapter *adap)
> +{
> +       struct riic_dev *riic = i2c_get_adapdata(adap);
> +
> +       udelay(5);

I wonder about the udelay here. Both, why this is necessary and where
the value comes from.

> +
> +       /* Check if the bus is busy or SDA is not high */
> +       if ((riic_readb(riic, RIIC_ICCR2) & ICCR2_BBSY) ||
> +           !(riic_readb(riic, RIIC_ICCR1) & ICCR1_SDAI))

And maybe if we can't skip reading SDAI here?

> +               return -EBUSY;
> +
> +       return 1;
> +}

Have you already played with these options? If you didn't and don't have
time to do so, I can also check it. I luckily got a G3S meanwhile.

Happy hacking,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-04-16  7:43 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  0:16 [PATCH v2 0/9] Add support for I2C bus recovery for riic driver Prabhakar
2024-12-18  0:16 ` [PATCH v2 1/9] i2c: riic: Replace dev_err with dev_err_probe in probe function Prabhakar
2024-12-20 21:17   ` Wolfram Sang
2024-12-18  0:16 ` [PATCH v2 2/9] i2c: riic: Use local `dev` pointer in `dev_err_probe()` Prabhakar
2024-12-19 12:21   ` Andi Shyti
2024-12-19 12:44     ` Lad, Prabhakar
2024-12-19 21:08       ` Andi Shyti
2024-12-20 21:18   ` Wolfram Sang
2024-12-26  1:19   ` Andi Shyti
2024-12-26  7:39     ` Lad, Prabhakar
2024-12-26 10:06       ` Andi Shyti
2024-12-18  0:16 ` [PATCH v2 3/9] i2c: riic: Use BIT macro consistently Prabhakar
2024-12-20 21:19   ` Wolfram Sang
2024-12-18  0:16 ` [PATCH v2 4/9] i2c: riic: Use GENMASK() macro for bitmask definitions Prabhakar
2024-12-20 21:20   ` Wolfram Sang
2024-12-20 21:21   ` Wolfram Sang
2024-12-18  0:16 ` [PATCH v2 5/9] i2c: riic: Make use of devres helper to request deasserted reset line Prabhakar
2024-12-18 13:30   ` Geert Uytterhoeven
2024-12-18  0:16 ` [PATCH v2 6/9] i2c: riic: Mark riic_irqs array as const Prabhakar
2024-12-18  0:16 ` [PATCH v2 7/9] i2c: riic: Use predefined macro and simplify clock tick calculation Prabhakar
2024-12-20 21:23   ` Wolfram Sang
2024-12-18  0:16 ` [PATCH v2 8/9] i2c: riic: Add `riic_bus_barrier()` to check bus availability Prabhakar
2024-12-18 13:31   ` Geert Uytterhoeven
2024-12-20 21:26   ` Wolfram Sang
2024-12-22  4:16     ` Lad, Prabhakar
2024-12-18  0:16 ` [PATCH v2 9/9] i2c: riic: Implement bus recovery Prabhakar
2024-12-20 21:16   ` Wolfram Sang
2024-12-22  4:12     ` Lad, Prabhakar
2024-12-22 12:44       ` Wolfram Sang
2024-12-23  6:35         ` Lad, Prabhakar
2024-12-26  1:21           ` Andi Shyti
2024-12-27 11:27             ` Wolfram Sang
2024-12-27 22:05               ` Andi Shyti
2025-01-06 17:45         ` Lad, Prabhakar
2025-04-16  7:43           ` Wolfram Sang [this message]
2025-04-16 13:04             ` Wolfram Sang
2024-12-21  9:13   ` Claudiu Beznea
2024-12-22  4:14     ` Lad, Prabhakar
2024-12-20 12:02 ` [PATCH v2 0/9] Add support for I2C bus recovery for riic driver Wolfram Sang
2024-12-20 21:28   ` Wolfram Sang
2024-12-21  9:42 ` Claudiu Beznea
2024-12-26  1:24 ` Andi Shyti

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=Z_9fh2nfwAaUnhVV@shikoro \
    --to=wsa+renesas@sang-engineering.com \
    --cc=andi.shyti@kernel.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=chris.brandt@renesas.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=wsa@kernel.org \
    /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