[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3583116.sQuhbGJ8Bu@benoit.monin>
Date: Tue, 25 Nov 2025 11:45:35 +0100
From: Benoît Monin <benoit.monin@...tlin.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Andi Shyti <andi.shyti@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Jan Dabros <jsd@...ihalf.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Clark Williams <clrkwllms@...nel.org>, Steven Rostedt <rostedt@...dmis.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Gregory CLEMENT <gregory.clement@...tlin.com>,
Théo Lebrun <theo.lebrun@...tlin.com>,
Tawfik Bayouk <tawfik.bayouk@...ileye.com>,
Vladimir Kondratiev <vladimir.kondratiev@...ileye.com>,
Dmitry Guzman <dmitry.guzman@...ileye.com>, linux-i2c@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-rt-devel@...ts.linux.dev
Subject:
Re: [PATCH v3 7/7] i2c: designware: Support of controller with
IC_EMPTYFIFO_HOLD_MASTER disabled
Hi Andy,
Thanks for the reviews.
(ack on other comments)
On Wednesday, 19 November 2025 at 21:15:16 CET, Andy Shevchenko wrote:
> On Wed, Nov 19, 2025 at 04:05:36PM +0100, Benoît Monin wrote:
[...]
> > i2c_dw_msg_is_valid(struct dw_i2c_dev *dev, const struct i2c_msg *msgs, size_t i
>
> > + /*
> > + * Make sure we don't need explicit RESTART between two messages
> > + * in the same direction for controllers that cannot emit them.
> > + */
> > + if (dev->flags & NO_EMPTYFIFO_HOLD_MASTER &&
> > + (msgs[idx - 1].flags & I2C_M_RD) == (msgs[idx].flags & I2C_M_RD)) {
> > + dev_err(dev->dev, "cannot emit RESTART\n");
> > + return false;
> > + }
>
> Ah, Now I see the point of checking the idx first, but can we rather call it
> with idx >= 1 to begin with?
>
We would still have to check it when calling i2c_dw_msg_is_valid(), as the
first message after a STOP don't have any limitation. It is not just for
protecting against an out-of-bound access to msgs. The validity of a
message is in relation to the previous message in the same transaction.
I will change the comment to make this clearer.
> > return true;
> > }
[...]
> > { .compatible = "baikal,bt1-sys-i2c", .data = (void *)MODEL_BAIKAL_BT1 },
> > + { .compatible = "mobileye,eyeq6lplus-i2c", .data = (void *)NO_EMPTYFIFO_HOLD_MASTER },
>
> Are you expecting more with this? I would rather use a compatible matching
> instead of the flag,
>
The IC_EMPTYFIFO_HOLD_MASTER_EN parameter is part of the DesignWare IP, it
is not specific to Mobileye. Given that typical i2c accesses (single read,
single write, write-then-read) work on non-PREMPT_RT without this patch, I
suspect there are other controllers that lack the ability to hold the clock
when the FIFO is empty that could benefit from this flag.
> > { .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT },
> > { .compatible = "snps,designware-i2c" },
>
>
Best regards,
--
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists