aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 42c0b9108c7f..ef73483efb84 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -756,6 +756,27 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
756#define omap_i2c_rev1_isr NULL 756#define omap_i2c_rev1_isr NULL
757#endif 757#endif
758 758
759/*
760 * OMAP3430 Errata 1.153: When an XRDY/XDR is hit, wait for XUDF before writing
761 * data to DATA_REG. Otherwise some data bytes can be lost while transferring
762 * them from the memory to the I2C interface.
763 */
764static int errata_omap3_1p153(struct omap_i2c_dev *dev, u16 *stat, int *err)
765{
766 while (!(*stat & OMAP_I2C_STAT_XUDF)) {
767 if (*stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
768 omap_i2c_ack_stat(dev, *stat & (OMAP_I2C_STAT_XRDY |
769 OMAP_I2C_STAT_XDR));
770 *err |= OMAP_I2C_STAT_XUDF;
771 return -ETIMEDOUT;
772 }
773 cpu_relax();
774 *stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
775 }
776
777 return 0;
778}
779
759static irqreturn_t 780static irqreturn_t
760omap_i2c_isr(int this_irq, void *dev_id) 781omap_i2c_isr(int this_irq, void *dev_id)
761{ 782{
@@ -885,25 +906,9 @@ complete:
885 break; 906 break;
886 } 907 }
887 908
888 /* 909 if ((dev->rev <= OMAP_I2C_REV_ON_3430) &&
889 * OMAP3430 Errata 1.153: When an XRDY/XDR 910 errata_omap3_1p153(dev, &stat, &err))
890 * is hit, wait for XUDF before writing data 911 goto complete;
891 * to DATA_REG. Otherwise some data bytes can
892 * be lost while transferring them from the
893 * memory to the I2C interface.
894 */
895
896 if (dev->rev <= OMAP_I2C_REV_ON_3430) {
897 while (!(stat & OMAP_I2C_STAT_XUDF)) {
898 if (stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
899 omap_i2c_ack_stat(dev, stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
900 err |= OMAP_I2C_STAT_XUDF;
901 goto complete;
902 }
903 cpu_relax();
904 stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
905 }
906 }
907 912
908 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w); 913 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
909 } 914 }