This patch is a port of the below Linux fix done for IO timeout issue with Designware I2C controllers in AMD platforms.
Issue is, AMD I2C controller can't trigger pending interrupt if interrupt status has been changed after clearing interrupt status bits, due to some hardware limitation. So, I2C will lose the interrupt and IO will be timed out. This patch implements a workaround to disable I2C controller interrupt and re-enable I2C interrupt before existing interrupt handler.
In FreeBSD Designware I2C driver, the INTR_MASK is cleared and re-enabled during every transfer (using set_controller). But chances are likely that, if interrupt status changes while handling the previous interrupt (where the interrupts are cleared), interrupt may not be triggered due to the same limitation. It may have to wait until the next I2C transfer happens to re-enable the interrupts.