imx6ul read the i2c register when i2c clk is disabled.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6ul read the i2c register when i2c clk is disabled.

509 Views
caozou
Contributor II

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

0 Kudos
1 Reply

354 Views
igorpadykov
NXP Employee
NXP Employee

Hi cao

for accessing module registers clock to this module should be

enabled by ccm. Otherwise one can expect issues, as clock

is used for normal module operation.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos