From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Atif Ashhar <atifashhar@google.com>,
Andi Shyti <andi.shyti@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Wolfram Sang <wsa@kernel.org>,
Luis Oliveira <Luis.Oliveira@synopsys.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] i2c: designware: Release slave SCL hold in __i2c_dw_disable()
Date: Fri, 20 Nov 2026 13:56:31 +0100 [thread overview]
Message-ID: <20261120125631.GJ229695@black.igk.intel.com> (raw)
In-Reply-To: <awBCclrtdWSNHl67@black.igk.intel.com>
On Fri, Nov 20, 2026 at 01:52:02PM +0100, Heikki Krogerus wrote:
> On Thu, Nov 12, 2026 at 02:52:38PM +0000, Atif Ashhar wrote:
> > When an external I2C master initiates a read to the Synopsys DW_apb_i2c
> > adapter in slave mode during kexec teardown, runtime suspend, or driver
> > unbind, the slave hardware stretches SCL low (0V) waiting for TX data,
> > setting DW_IC_STATUS_SLAVE_HOLD_TX_FIFO_EMPTY.
> >
> > In master mode, __i2c_dw_disable() issues DW_IC_ENABLE_ABORT to release
> > the bus. However, according to the Synopsys DW_apb_i2c Databook, the
> > ABORT bit applies only to master transfers and has no effect in slave
> > mode. Because the slave cannot disable while stretching SCL,
> > __i2c_dw_disable() times out, leaving DW_IC_ENABLE_STATUS[0] = 1 across
> > kexec or rebind. Subsequent writes to DW_IC_SAR are write-protected and
> > silently dropped by hardware, wedging the slave and blocking any other
> > devices sharing the physical bus.
> >
> > Fix this by:
> >
> > 1. In __i2c_dw_disable(), if DW_IC_STATUS_SLAVE_HOLD_TX_FIFO_EMPTY is
> > set while disabling, temporarily re-enable the controller so the APB
> > interface accepts data commands without racing with the slave ISR,
> > clear pending RD_REQ/TX_ABRT interrupts, write a dummy 0xff byte to
> > DW_IC_DATA_CMD to release the SCL stretch, and immediately request
> > disable via __i2c_dw_disable_nowait(). Also drain the RX FIFO if RFNE
> > is set during SLAVE_ACTIVITY.
> >
> > 2. In i2c_dw_reg_slave(), replace __i2c_dw_disable_nowait() with
> > __i2c_dw_disable() to ensure the controller is fully disabled before
> > calling i2c_dw_set_mode(), which programs DW_IC_SAR and DW_IC_CON.
> >
> > Fixes: 9f3e065c54b0 ("i2c: designware: add SLAVE mode functions")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Atif Ashhar <atifashhar@google.com>
>
> I don't have time to test this unfortunately :( But it LGTM. FWIW, if
> it's okay by Mika:
>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Yes it's okay, thanks Heikki!
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
prev parent reply other threads:[~2026-11-20 12:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 13:37 [PATCH] " Atif Ashhar
2026-11-09 10:20 ` Mika Westerberg
2026-11-10 19:05 ` Atif Ashhar
2026-11-12 8:46 ` Heikki Krogerus
2026-11-12 14:52 ` [PATCH v2] " Atif Ashhar
2026-11-20 12:52 ` Heikki Krogerus
2026-11-20 12:56 ` Mika Westerberg [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=20261120125631.GJ229695@black.igk.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=Luis.Oliveira@synopsys.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=atifashhar@google.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--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
all inboxes | Powered by JetHome®