I2c1 and ds2460 driver Linux 2.6.27 on I2C not 2.6.29 on maturity, can not follow that set to do, such as in the board-smartarm.c to add: 499 // static struct i2c_board_info _ initdata smartarm3250_i2c_ds2460_info [] = {500 // {501 // i2c_board_info ("epc-ds2460", 0x40), 502 //}, 503 //}; 698/* I2C based ds2460 on i2c1 */699 // i2c_register_board_info (0, smartarm3250_i2c_ds2460_info, 700 // array_size (bytes); this does not work. Can only be hard, add I2C device binding directly in I2C DRIVER: Drivers/I2C/busses/i2c-pnx.c656 if (pdev-> id = 1) {// i2c2
657 struct i2c_board_info info = {
658 i2c_board_info ("pcf8563", 0xa3> 1 ),
659 };
660 client = i2c_new_device (i2c_pnx-> adapter, & info );
661
662 if (client = NULL ){
663 printk ("Check pcf8563 failed \ n ");
664}
665}
666
667 if (pdev-> id = 0) {// i2c1
668 struct i2c_board_info info2 = {
669 i2c_board_info ("ds2460", 0x80> 1 ),
670 };
671 client = i2c_new_device (i2c_pnx-> adapter, & info2 );
672
673 if (client = NULL ){
674 printk ("Check ds2460 failed \ n ");
675}
676} note that the name in i2c_board_info must be consistent with that in the ID table of ds2460.c; otherwise, registration fails. In addition, the depressing thing is still behind. When I read the EEPROM, I used the i2c_transfer function, and the result was always reading errors. However, this reading function has no problem on omap3530. The Code is as follows: 25 int read_from_ds2460 (unsigned char * kbuf, int start_addr, int Len)
26 {
27 unsigned char tempbuf [8] = {start_addr };
28 int I;
29 int ret = 0;
30
31 // printk ("### abing in % S % d \ n", _ FUNCTION __, _ line __);
32 # If 0
33 struct i2c_msg msgs [] = {
34 {ds2460_client-> ADDR, 0, 1, tempbuf},/* setup read PTR -- start_addr */
35 {ds2460_client-> ADDR, i2c_m_rd, Len, kbuf},/* read from ds2460 */
36 };
37
38 If (kbuf = NULL ){
39 printk ("a null pointer found! \ N ");
40 return-enosys;
41}
42
43 return i2c_transfer (ds2460_client-> adapter, msgs, 2 );
44 # else
45
46 ret = i2c_master_send (ds2460_client, tempbuf, 1 );
47 If (Ret <0 ){
48 printk ("I2C err: % s, % d send data to I2C bus failed \ n", _ FUNCTION __,__ line __);
49 return ret;
50}
51
52 ret = i2c_master_recv (ds2460_client, kbuf, Len );
53 If (Ret <0 ){
54 printk ("I2C err: % s, % d get I2C bus data failed \ n", _ FUNCTION __,__ line __);
55 return ret;
56}
57
58 return 0;
59 # endif
60} changed to i2c_master_send and i2c_master_recv.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.