AnsweredAssumed Answered

imx6ul read the i2c register when i2c clk is disabled.

Question asked by cao zou on May 10, 2016

Hi :

 

     I am using the  3.14.52 sdk for platform imx6ul, i meet a issue, 

when i2c clk is disable, reading i2c register cause the cpu stopping, it

mean the cpu don't get any instruction,  like cpu is stopped.

i don't know why, it is soc hw issue?  summary information as follow:

    at the file: drivers/i2c/busses/i2c-imx.c, add a workround patch for

ls1/ls2:

 

static int i2c_imx_xfer(struct i2c_adapter *adapter,

                         struct i2c_msg *msgs, int num)

{

     unsigned int i, temp;

     int result;

     bool is_lastmsg = false;

     struct imx_i2c_struct *i2c_imx = i2c_get_adapdata(adapter);

 

     dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);

 

+    /* workround for ERR010027: ensure that the I2C BUS is idle

+    * before switching to master mode and attempting a Start cycle

+     */

+   result = i2c_imx_bus_busy(i2c_imx, 0);         -


> it will call

the imx_i2c_read_reg, and stop in the code "return readb(i2c_imx->base +

(reg << i2c_imx->hwdata->regshift));"

+   if (result) no any calltrace, like cpu stop here. if you remove

these add code, then it work well, or enable the i2c clk and control

before the add code.

+      goto fail0;

 

     /* Start I2C transfer */

     result = i2c_imx_start(i2c_imx);

     if (result)

         goto fail0;

 

     /* read/write data */

     for (i = 0; i < num; i++) {

         if (i == num - 1)

             is_lastmsg = true;

...........

}

 

   attach is the booting log.

 

Regards,

czou

 

 

 

Original Attachment has been moved to: imx6ul-i2c-read-failed-.zip

Outcomes