Re: [PATCH v2] i2c: designware: Handle active slave and shutdown cleanly

From: Andy Shevchenko

Date: Thu Apr 23 2026 - 03:45:46 EST


On Wed, Apr 22, 2026 at 05:51:05PM -0700, William A. Kennington III wrote:
> When the I2C master attempts a new transaction while the slave
> controller is shutting down or restarting, it can lead to bus lockups
> and system bootloops if the hardware enters an inconsistent state.
>
> Address this by ensuring that the internal state machines are properly
> cleared when disabling the controller if slave activity is detected.
>
> Additionally, add a shutdown hook that gracefully sets the slave
> disable bit before disabling the controller. This guarantees that any
> incoming requests from the master are immediately NACKed during
> shutdown, preventing the bus from hanging.


Do not send a new version:
- inside the same email thread as the previous one(s)
- too early, give 24h+ _at least_ to others to have a chance to look into it

According to the split I think you can do it in a way that it goes like this
- introducing shutdown exported function (and use it as is)
- convert PCI driver to use it
- convert platform driver to use it
- do something for target case

...

> static struct pci_driver dw_i2c_driver = {
> .name = DRIVER_NAME,
> .probe = i2c_dw_pci_probe,
> .remove = i2c_dw_pci_remove,

> - .driver = {
> + .driver = {

Stray change.

...

--
With Best Regards,
Andy Shevchenko