Files
huaming.jiang 745c35085c driver:dw_i2c:detect rx fifo over and do retry
1. dw_i2c for hw not enable IC_EMPTYFIFO_HOLD_MASTER_EN,RX FIFO may
over if SW not read RX FIFO day timely.So enabel RX OVER INT,when
receive RX OVER ,i2c_dw_xfer return -EAGAIN,to trigger retry.
2. for large i2c read, set DW_IC_RX_TL to rx_fifo_depth / 2, to make more
efficient irq process.
3.skip isr once rx over by disable INT
4. merge fix from upstream
commit 301c8f5c32c8fb79c67539bc23972dc3ef48024c
Author: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Date:   Tue Sep 27 16:56:44 2022 +0300

    i2c: designware: Fix handling of real but unexpected device interrupts

    Commit c7b79a752871 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI
    IDs") caused a regression on certain Gigabyte motherboards for Intel
    Alder Lake-S where system crashes to NULL pointer dereference in
    i2c_dw_xfer_msg() when system resumes from S3 sleep state ("deep").

    I was able to debug the issue on Gigabyte Z690 AORUS ELITE and made
    following notes:

    - Issue happens when resuming from S3 but not when resuming from
      "s2idle"
    - PCI device 00:15.0 == i2c_designware.0 is already in D0 state when
      system enters into pci_pm_resume_noirq() while all other i2c_designware
      PCI devices are in D3. Devices were runtime suspended and in D3 prior
      entering into suspend
    - Interrupt comes after pci_pm_resume_noirq() when device interrupts are
      re-enabled
    - According to register dump the interrupt really comes from the
      i2c_designware.0. Controller is enabled, I2C target address register
      points to a one detectable I2C device address 0x60 and the
      DW_IC_RAW_INTR_STAT register START_DET, STOP_DET, ACTIVITY and
      TX_EMPTY bits are set indicating completed I2C transaction.

    My guess is that the firmware uses this controller to communicate with
    an on-board I2C device during resume but does not disable the controller
    before giving control to an operating system.

    I was told the UEFI update fixes this but never the less it revealed the
    driver is not ready to handle TX_EMPTY (or RX_FULL) interrupt when device
    is supposed to be idle and state variables are not set (especially the
    dev->msgs pointer which may point to NULL or stale old data).

    Introduce a new software status flag STATUS_ACTIVE indicating when the
    controller is active in driver point of view. Now treat all interrupts
    that occur when is not set as unexpected and mask all interrupts from
    the controller.

Change-Id: If81c92a03b9be8699742184b46c03df34f922a28
2024-07-21 00:17:45 +08:00
..
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00
2022-09-13 11:05:52 +08:00