]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
Xilinx: ARM: I2C: Support for TI PMBus Controllers on ZC702
authorSuneel <suneelg@xilinx.com>
Thu, 30 Aug 2012 11:57:05 +0000 (17:27 +0530)
committerJohn Linn <john.linn@xilinx.com>
Thu, 30 Aug 2012 15:55:39 +0000 (08:55 -0700)
This patch adds support for I2C_M_RECV_LEN flag and
SMBUS Block Read call in I2C Controller driver.
This support is required by TI PMBus controller driver.

Signed-off-by: Suneel <suneelg@xilinx.com>
drivers/i2c/busses/i2c-xilinx_ps.c

index bb117b5e48269eb016c877f8e11a7d3cbf91174b..2a98a1fc71f09290b2d35764eb1cdab4fed32dec 100644 (file)
@@ -316,6 +316,9 @@ static void xi2cps_mrecv(struct xi2cps *id)
        ctrl_reg = xi2cps_readreg(XI2CPS_CR_OFFSET);
        ctrl_reg |= (XI2CPS_CR_RW_MASK | XI2CPS_CR_CLR_FIFO_MASK);
 
+       if ((id->p_msg->flags & I2C_M_RECV_LEN) == I2C_M_RECV_LEN)
+               id->recv_count = I2C_SMBUS_BLOCK_MAX + 1;
+
        if (id->recv_count > XI2CPS_FIFO_DEPTH)
                ctrl_reg |= XI2CPS_CR_HOLD_BUS_MASK;
 
@@ -341,7 +344,8 @@ static void xi2cps_mrecv(struct xi2cps *id)
        /*
         * Clear the bus hold flag if bytes to receive is less than FIFO size.
         */
-               if (id->bus_hold_flag == 0) {
+               if (id->bus_hold_flag == 0 &&
+               ((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN)) {
                        /* Clear the hold bus bit */
                        ctrl_reg = xi2cps_readreg(XI2CPS_CR_OFFSET);
                        if ((ctrl_reg & XI2CPS_CR_HOLD_BUS_MASK)
@@ -542,7 +546,8 @@ retry:
 static u32 xi2cps_func(struct i2c_adapter *adap)
 {
        return I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR | \
-               (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
+               (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK) | \
+               I2C_FUNC_SMBUS_BLOCK_DATA;
 }
 
 static const struct i2c_algorithm xi2cps_algo = {