How to enable and access i2c bus 3 in kernel?

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

How to enable and access i2c bus 3 in kernel?

3,931 Views
naveennvn
Contributor III

Hi all,

     I'm using LS2085A board. By default i2c bus 0 is selected , there we can able to read and write the register values.

     I need to read the register values from i2c bus 3.

     In u-boot i can able to read those registers. For selecting i2c bus 3 i used "i2c dev 3" command.

     But in kernel i can't able to select and read the i2c bus 3.I tried via accessing /dev/i2c-3 but i'm not getting.  I don't know how to select the bus 3.

     Can any one help me on this?

     Thanks in advance,

-Naveen

Labels (1)
Tags (2)
4 Replies

2,412 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello naveennvn,

You could use i2c-tools package to do verification, please add "i2c-tools" in IMAGE_INSTALL variable of recipe meta-fsl-networking/image/fsl-image-core.bb and rebuild image with "bitbake fsl-image-kernelitb".

root@ls2085aqds:~# i2cdetect 3

WARNING! This program can confuse your I2C bus, cause data loss and worse!

I will probe file /dev/i2c-3.

I will probe address range 0x03-0x77.

Continue? [Y/n] Y

    0  1  2  3  4  5  6 7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: 60 -- -- -- -- -- 66 67 -- -- -- -- 6c 6d -- --

70: -- -- -- -- -- -- -- UU

root@ls2085aqds:~# i2cget -y 3 0x66 0x2 b

0x07

root@ls2085aqds:~# i2cdump 3 0x66

No size specified (using byte-data access)

WARNING! This program can confuse your I2C bus, cause data loss and worse!

I will probe file /dev/i2c-3, address 0x66, mode byte

Continue? [Y/n] Y

    0  1  2  3  4  5  6 7  8  9  a  b  c  d  e f    0123456789abcdef

00: 33 12 07 01 b7 04 00 00 00 00 00 3b df 00 00 00 3?????.....;?...

10: 20 00 00 11 00 00 00 8c 00 00 00 00 00 50 a0 7f ..?...?.....P??

20: 00 00 62 00 cb ff 7f ff 00 00 00 00 00 00 00 00 ..b.?.?.........

30: 32 00 00 12 04 0b 18 ff 18 ff 00 00 00 00 00 00 2..????.?.......

40: 30 00 06 00 00 00 00 00 61 00 00 00 00 00 00 00 0.?.....a.......

50: 80 32 af 03 02 30 a1 08 06 c5 c0 28 7b 20 35 08 ?2???0?????({ 5?

60: 12 ff ff ff ff ff ff ff 00 00 00 ff ff ff ff ff ?...............

70: 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 .........?......

80: ee c0 ff ff 00 00 00 00 ff ff ff c0 00 00 00 00 ??.........?....

90: ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

a0: 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 .........?......

b0: 00 09 09 00 00 00 00 00 00 00 00 00 00 00 00 00 .??.............

c0: 2f af 3f 95 00 01 00 00 00 00 00 00 03 00 20 00 /???.?......?. .

d0: 00 00 00 00 38 40 00 00 00 0c 00 00 05 c0 00 80 ....8@...?..??.?

e0: 00 00 00 00 cb 17 da 1d 00 00 00 00 00 00 00 11 ....????.......?

f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................


Have a great day,
Yiping

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

2,412 Views
naveennvn
Contributor III

Hi Yiping,

     Thanks for your response,

     Actually in my setup i had connected the some peripherals in i2c bus 3.

     In u-boot it shows properly :

          => i2c dev 3 

          Setting bus to 3

          => i2c probe

          Valid chip addresses: 00 4C 50

     But in kernel those slave addresses are not showing :

          root@ls2085aissd:~# i2cdetect -y 3

               0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

          00:          -- -- -- -- -- -- -- -- -- -- -- -- --

          10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

          20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

          30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

          40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

          50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

          60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

          70: -- -- -- -- -- -- -- UU    

     Why those slave addresses are not showing on kernel ? How to enable in kernel ?

     Can you help me on this ?

Thanks,

-Naveen

0 Kudos
Reply

2,412 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello naveennvn,

Please check whether Kernel configuration contains the following.

CONFIG_I2C=y

CONFIG_I2C_BOARDINFO=y

CONFIG_I2C_COMPAT=y

CONFIG_I2C_CHARDEV=y

CONFIG_I2C_MUX=y

CONFIG_I2C_IMX=y

For the dts file, please enable fsl-ls2085a.dtsi and with i2cx node enabled.

If your problem remains, would you please also attach Kernel boot log.


Have a great day,
Yiping

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

2,412 Views
naveennvn
Contributor III

Hi Yiping,

     Above kernel configurations all are already enabled and i2c node also enabled in fsl-ls2085a.dtsi file.

     Now also the problem remains same. I'm not able to access the i2c bus 3 in kernel.

     Is there any modifications in board files?

Here is the i2c related kernel log :

[    2.388000] SCSI subsystem initialized

[    2.391937] usbcore: registered new interface driver usbfs

[    2.397486] usbcore: registered new interface driver hub

[    2.402894] usbcore: registered new device driver usb

[    2.408250] i2c i2c-0: IMX I2C adapter registered

[    2.413012] i2c i2c-0: can't use DMA

[    2.416646] genirq: Flags mismatch irq 14. 00000000 (2010000.i2c) vs. 00000000 (2000000.i2c)

[    2.425170] imx-i2c 2010000.i2c: can't claim irq 14

[    2.430092] imx-i2c: probe of 2010000.i2c failed with error -16

[    2.436149] i2c i2c-1: IMX I2C adapter registered

[    2.440888] i2c i2c-1: can't use DMA

[    2.444509] genirq: Flags mismatch irq 15. 00000000 (2030000.i2c) vs. 00000000 (2020000.i2c)

[    2.453032] imx-i2c 2030000.i2c: can't claim irq 15

[    2.457950] imx-i2c: probe of 2030000.i2c failed with error -16

[    2.463968] pps_core: LinuxPPS API ver. 1 registered

[    2.468974] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>

[    4.449215] i2c /dev entries driver

[    4.453471] i2c i2c-0: Added multiplexed i2c bus 2

[    4.458348] i2c i2c-0: Added multiplexed i2c bus 3

[    4.463238] i2c i2c-0: Added multiplexed i2c bus 4

[    4.468247] i2c i2c-0: Added multiplexed i2c bus 5

[    4.473127] i2c i2c-0: Added multiplexed i2c bus 6

[    4.477998] i2c i2c-0: Added multiplexed i2c bus 7

[    4.482908] i2c i2c-0: Added multiplexed i2c bus 8

[    4.487783] i2c i2c-0: Added multiplexed i2c bus 9

[    4.492579] pca954x 0-0077: registered 8 multiplexed busses for I2C mux pca9547

Thanks,

-Naveen

0 Kudos
Reply