新路程------hi3516a i2c设备reset

  之前怀疑sdk的i2c bus的read和write有问题,因为一直出现read失败的log如下:

~ # i2c_read 0x02 0x40 0x00 0x1 1 1
*** Board tools : ver0.0.1_20121120 ***
[debug]: {source/utils/cmdshell.c:166}cmdstr:i2c_read
i2c_num:0x2, dev_addr:0x40; reg_addr:0x 0; reg_addr_end:0x 1; reg_width: 1; data
_width: 1.


hi_i2c_wait_rxfifo_notempty->283:
wait timeout! auto_status: 0xc0b00000


hi_i2c_wait_rxfifo_notempty->297:
transmit error, int_raw_status: 0x750!


hi_i2c_wait_rxfifo_notempty->299:
tx_abrt_cause is 1.


CMD_I2C_READ error!


do errro
[END]

于是翻来覆去看了一堆内核i2c控制器的代码,结果呵呵

由于没有i2cdetect这个趁手的工具

导致没有确认i2c设备是否正常上电和reset

到最后来才想到去看,果然没有reset,于是加了下面几行代码就搞定了

/*void  adv7180_Reset()
{
writel(0x00000000, IO_ADDRESS(0x200f00f4)); //这个是内核态修改寄存器的办法,非常偶然发现了
writel(0x00000008, IO_ADDRESS(0x201f0400));
writel(0x00000000, IO_ADDRESS(0x201f0020));
msleep(10);
writel(0x000000FF, IO_ADDRESS(0x201f0020));
}*/

还是换了平台疏忽大意了,没有养成先check device的习惯

你可能感兴趣的:(linux驱动)