i2c: s3c2410: do not generate STOP for QUIRK_HDMIPHY
authorDaniel Kurtz <djkurtz@chromium.org>
Thu, 15 Nov 2012 12:13:31 +0000 (17:43 +0530)
committerWolfram Sang <w.sang@pengutronix.de>
Fri, 16 Nov 2012 12:08:55 +0000 (13:08 +0100)
commit0da2e7768b4c2b4dbbb148ebe1606b6b4698fca2
tree7041036334f71612cc64c4e8b322db396989084c
parent9bcd04bfbbd5599de011176b846ed00ac15a234c
i2c: s3c2410: do not generate STOP for QUIRK_HDMIPHY

The datasheet says that the STOP sequence should be:
 1) I2CSTAT.5 = 0 - Clear BUSY (or 'generate STOP')
 2) I2CCON.4 = 0 - Clear IRQPEND
 3) Wait until the stop condition takes effect.
 4*) I2CSTAT.4 = 0  - Clear TXRXEN

Where, step "4*" is only for buses with the "HDMIPHY" quirk.

However, after much experimentation, it appears that:
 a) normal buses automatically clear BUSY and transition from
    Master->Slave when they complete generating a STOP condition.
    Therefore, step (3) can be done in doxfer() by polling I2CCON.4
    after starting the STOP generation here.
 b) HDMIPHY bus does neither, so there is no way to do step 3.
    There is no indication when this bus has finished generating STOP.

In fact, we have found that as soon as the IRQPEND bit is cleared in
step 2, the HDMIPHY bus generates the STOP condition, and then immediately
starts transferring another data byte, even though the bus is supposedly
stopped.  This is presumably because the bus is still in "Master" mode,
and its BUSY bit is still set.

To avoid these extra post-STOP transactions on HDMI phy devices, we just
disable Serial Output on the bus (I2CSTAT.4 = 0) directly, instead of
first generating a proper STOP condition.  This should float SDA & SCK
terminating the transfer.  Subsequent transfers start with a proper START
condition, and proceed normally.

The HDMIPHY bus is an internal bus that always has exactly two devices,
the host as Master and the HDMIPHY device as the slave. Skipping the STOP
condition has been tested on this bus and works.

Also, since we disable the bus directly from the isr, we can skip the bus
idle polling loop at the end of doxfer().

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
drivers/i2c/busses/i2c-s3c2410.c