• Shinya Kuribayashi's avatar
    i2c-designware: Process i2c_msg messages in the interrupt handler · 07745399
    Shinya Kuribayashi authored
    Symptom:
    --------
    When we're going to send/receive the longer size of data than the Tx
    FIFO length, the I2C transaction will be divided into several separated
    transactions, limited by the Tx FIFO length.
    
    Details:
    --------
    As a hardware feature, DW I2C core generates a STOP condition whenever
    the Tx FIFO becomes empty (strictly speaking, whenever the last byte in
    the Tx FIFO is sent out), even if we have more bytes to be written.
    Then, once a new transmit data is written to the Tx FIFO, DW I2C core
    will initiate a new transaction, which leads to another START condition.
    
    This explains how the transaction in question goes, and implies that
    current tasklet-based dw_i2c_pump_msg() strategy couldn't meet the
    timing constraint required for avoiding Tx FIFO underrun.
    
    To avoid this scenario, we must keep providing new transmit data within
    a given time period.  In case of Fast-mode + 32-byte Tx FIFO, for
    instance, it takes about 22.5[us] to process single byte, and 720[us] in
    total.
    
    This patch removes the existing tasklet-based "pump" system, and move
    its jobs into the interrupt handler.
    Signed-off-by: default avatarShinya Kuribayashi <shinya.kuribayashi@necel.com>
    Acked-by: default avatarBaruch Siach <baruch@tkos.co.il>
    Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
    07745399
i2c-designware.c 19.8 KB