public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	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>,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH v3 8/8] i2c: riic: Add `riic_bus_barrier()` to check bus availability
Date: Sun, 29 Dec 2024 01:40:00 +0200	[thread overview]
Message-ID: <Z3CMUDX4evaVdizJ@surfacebook.localdomain> (raw)
In-Reply-To: <20241227115154.56154-9-prabhakar.mahadev-lad.rj@bp.renesas.com>

Fri, Dec 27, 2024 at 11:51:54AM +0000, Prabhakar kirjoitti:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Introduce a new `riic_bus_barrier()` function to verify bus availability
> before initiating an I2C transfer. This function enhances the bus
> arbitration check by ensuring that the SDA and SCL lines are not held low,
> in addition to checking the BBSY flag using `readb_poll_timeout()`.
> 
> Previously, only the BBSY flag was checked to determine bus availability.
> However, it is possible for the SDA line to remain low even when BBSY = 0.
> This new implementation performs an additional check on the SDA and SCL
> lines to avoid potential bus contention issues.

...

> +	/*
> +	 * The SDA line can still be low even when BBSY = 0. Therefore, after checking
> +	 * the BBSY flag, also verify that the SDA and SCL lines are not being held low.
> +	 */
> +	ret = readb_poll_timeout(riic->base + riic->info->regs[RIIC_ICCR2], val,
> +				 !(val & ICCR2_BBSY), 10, riic->adapter.timeout);
> +	if (ret)
> +		return -EBUSY;

Why the return code is shadowed? Is it requirement by ABI?

> +	if ((riic_readb(riic, RIIC_ICCR1) & (ICCR1_SDAI | ICCR1_SCLI)) !=
> +	     (ICCR1_SDAI | ICCR1_SCLI))
> +		return -EBUSY;
> +
> +	return 0;
> +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2024-12-28 23:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-27 11:51 [PATCH v3 0/8] i2c: riic: driver cleanup and improvements Prabhakar
2024-12-27 11:51 ` [PATCH v3 1/8] i2c: riic: Use dev_err_probe in probe and riic_init_hw functions Prabhakar
2024-12-28 23:32   ` Andy Shevchenko
2024-12-31 14:20     ` Lad, Prabhakar
2024-12-27 11:51 ` [PATCH v3 2/8] i2c: riic: Use local `dev` pointer in `dev_err_probe()` Prabhakar
2024-12-27 11:51 ` [PATCH v3 3/8] i2c: riic: Use BIT macro consistently Prabhakar
2024-12-28 23:34   ` Andy Shevchenko
2025-01-02  9:07     ` Lad, Prabhakar
2024-12-27 11:51 ` [PATCH v3 4/8] i2c: riic: Use GENMASK() macro for bitmask definitions Prabhakar
2024-12-28 23:36   ` Andy Shevchenko
2025-01-02  9:09     ` Lad, Prabhakar
2025-01-01 12:11   ` David Laight
2025-01-02  8:53     ` Lad, Prabhakar
2024-12-27 11:51 ` [PATCH v3 5/8] i2c: riic: Make use of devres helper to request deasserted reset line Prabhakar
2024-12-27 11:51 ` [PATCH v3 6/8] i2c: riic: Mark riic_irqs array as const Prabhakar
2024-12-27 11:51 ` [PATCH v3 7/8] i2c: riic: Use predefined macro and simplify clock tick calculation Prabhakar
2024-12-28 23:37   ` Andy Shevchenko
2025-01-02 10:05     ` Lad, Prabhakar
2024-12-27 11:51 ` [PATCH v3 8/8] i2c: riic: Add `riic_bus_barrier()` to check bus availability Prabhakar
2024-12-28 23:40   ` Andy Shevchenko [this message]
2025-01-02 10:32     ` Lad, Prabhakar
2024-12-27 22:10 ` [PATCH v3 0/8] i2c: riic: driver cleanup and improvements Andi Shyti
2024-12-28 23:40   ` Andy Shevchenko
2024-12-29 23:42     ` 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=Z3CMUDX4evaVdizJ@surfacebook.localdomain \
    --to=andy.shevchenko@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=chris.brandt@renesas.com \
    --cc=claudiu.beznea.uj@bp.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+renesas@sang-engineering.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