public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Aniket Limaye <a-limaye@ti.com>
To: Andi Shyti <andi.shyti@kernel.org>, Nishanth Menon <nm@ti.com>
Cc: Andreas Kemnade <andreas@kemnade.info>, <vigneshr@ti.com>,
	<aaro.koskinen@iki.fi>, <khilman@baylibre.com>,
	<rogerq@kernel.org>, <tony@atomide.com>, <jmkrzyszt@gmail.com>,
	<reidt@ti.com>, <wsa@kernel.org>, <linux-omap@vger.kernel.org>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stable@kernel.org>
Subject: Re: [PATCH v2] i2c: omap: fix IRQ storms
Date: Wed, 12 Mar 2025 14:55:38 +0530	[thread overview]
Message-ID: <91b9752c-38e9-453d-90cb-3466e18a15b6@ti.com> (raw)
In-Reply-To: <t43j7wmwsqvs5f6utld72enobqwkendgtpzfu3mth3bdgpxhsh@qeok5d2ujdm2>

Hi,

On 12/03/25 03:55, Andi Shyti wrote:
> Hi,
> 
> On Tue, Mar 11, 2025 at 07:39:47AM -0500, Nishanth Menon wrote:
>> On 15:04-20250228, Andreas Kemnade wrote:
>>> On the GTA04A5 writing a reset command to the gyroscope causes IRQ
>>> storms because NACK IRQs are enabled and therefore triggered but not
>>> acked.
>>>
>>> Sending a reset command to the gyroscope by
>>> i2cset 1 0x69 0x14 0xb6
>>> with an additional debug print in the ISR (not the thread) itself
>>> causes
>>>
>>> [ 363.353515] i2c i2c-1: ioctl, cmd=0x720, arg=0xbe801b00
>>> [ 363.359039] omap_i2c 48072000.i2c: addr: 0x0069, len: 2, flags: 0x0, stop: 1
>>> [ 363.366180] omap_i2c 48072000.i2c: IRQ LL (ISR = 0x1110)
>>> [ 363.371673] omap_i2c 48072000.i2c: IRQ (ISR = 0x0010)
>>> [ 363.376892] omap_i2c 48072000.i2c: IRQ LL (ISR = 0x0102)
>>> [ 363.382263] omap_i2c 48072000.i2c: IRQ LL (ISR = 0x0102)
>>> [ 363.387664] omap_i2c 48072000.i2c: IRQ LL (ISR = 0x0102)
>>> repeating till infinity
>>> [...]
>>> (0x2 = NACK, 0x100 = Bus free, which is not enabled)
>>> Apparently no other IRQ bit gets set, so this stalls.
>>>
>>> Do not ignore enabled interrupts and make sure they are acked.
>>> If the NACK IRQ is not needed, it should simply not enabled, but
>>> according to the above log, caring about it is necessary unless
>>> the Bus free IRQ is enabled and handled. The assumption that is
>>> will always come with a ARDY IRQ, which was the idea behind
>>> ignoring it, proves wrong.
>>> It is true for simple reads from an unused address.
>>>
>>> To still avoid the i2cdetect trouble which is the reason for
>>> commit c770657bd261 ("i2c: omap: Fix standard mode false ACK readings"),
>>> avoid doing much about NACK in omap_i2c_xfer_data() which is used
>>> by both IRQ mode and polling mode, so also the false detection fix
>>> is extended to polling usage and IRQ storms are avoided.
>>>
>>> By changing this, the hardirq handler is not needed anymore to filter
>>> stuff.
>>>
>>> The mentioned gyro reset now just causes a -ETIMEDOUT instead of
>>> hanging the system.
>>>
>>> Fixes: c770657bd261 ("i2c: omap: Fix standard mode false ACK readings").
>>> CC: <stable@kernel.org>
>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
>>> ---
>>> This needs at least to be tested on systems where false acks were
>>> detected.
>>
>> At least on BeaglePlay, I have not been able to reproduce the original
>> bug which was the trigger for commit c770657bd261
>>
>> I also ran basic boot tests on other K3 platforms and none seem to show
>> regressions at the very least.
>>
>> Tested-by: Nishanth Menon <nm@ti.com>
> 
> Thanks for testing it! I asked some OMAP folks to check this
> patch, but no one took action. With Nishanth's test, I can now
> sleep soundly. :-)
> 
> Merged to i2c/i2c-host-fixes.
> 
> Thanks,
> Andi
> 

I see that the patch got merged so don't know if this is useful at all 
at this point, but yeah looks good to me. Apologies for the slow 
response. Nishanth, Thanks for testing it too!

Reviewed-by: Aniket Limaye <a-limaye@ti.com>

Thanks,
Aniket

  reply	other threads:[~2025-03-12  9:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 14:04 [PATCH v2] i2c: omap: fix IRQ storms Andreas Kemnade
2025-03-11 12:39 ` Nishanth Menon
2025-03-11 22:25   ` Andi Shyti
2025-03-12  9:25     ` Aniket Limaye [this message]
2025-03-12 11:26       ` Andi Shyti
2025-03-11 18:29 ` Wolfram Sang
2025-03-11 19:14   ` Andreas Kemnade
2025-03-11 21:12     ` Wolfram Sang

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=91b9752c-38e9-453d-90cb-3466e18a15b6@ti.com \
    --to=a-limaye@ti.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=andi.shyti@kernel.org \
    --cc=andreas@kemnade.info \
    --cc=jmkrzyszt@gmail.com \
    --cc=khilman@baylibre.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=reidt@ti.com \
    --cc=rogerq@kernel.org \
    --cc=stable@kernel.org \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.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