I2C
Each CPU supports a number of I2C bus interfaces. In some cases, more I2C interfaces exist on the CPU and can be enabled in the device tree file. The table below is a mapping between the bus numbering in U-Boot / Linux and the I2C channel name (A/B/C/) used on the SOM Carrier board. Note that the bus numbering in U-Boot/Linux is not necessarily the same as the peripheral number on the processor.
| Board | I2C-A | I2C-B | I2C-C | I2C-D |
|---|---|---|---|---|
| RX/G3E SOM | i2c-8 | i2c-3 | i2c-1 | i3c - see I3C |
Which I2C devices that can be found varies depending on SOM board, SOM Carrier Board and connected peripherals like displays (typically the touch controller uses I2C).
The 7-bit address of all I2C devices on the SOM Carrier board can be found in the schematics for the SOM Carrier board.
U-Boot
i2c
i2c - I2C sub-system
Usage:
i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info
i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
i2c dev [dev] - show or set current I2C bus
i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device
i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device
i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)
i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)
i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)
i2c probe [address] - test for and show device(s) on the I2C bus
i2c read chip address[.0, .1, .2] length memaddress - read to memory
i2c write memaddress chip address[.0, .1, .2] length [-s] - write memory
to I2C; the -s option selects bulk write in a single transaction
i2c flags chip [flags] - set or get chip flags
i2c olen chip [offset_length] - set or get chip offset length
i2c reset - re-init the I2C Controller
i2c speed [speed] - show or set I2C bus speed
To see the available busses.
i2c bus
Bus 3: i2c@14401000
Bus 8: i2c@11C01000 (active 8)
21: gpio@21, offset len 1, flags 0
23: gpio@23, offset len 1, flags 0
22: gpio@22, offset len 1, flags 0
38: generic_38, offset len 1, flags 0
To list all devices on bus 8.
i2c dev 8
Setting bus to 8
i2c probe
Valid chip addresses: 12 1A 52 55 6F
The scan found the following devices.
- 0x12 – PMIC on the SOM board
- 0x1a – Audio Codec on the SOM Carrier Board
- 0x52 – EUI-48 EEPROM on the SOM Carrier Board
- 0x55 – EEPROM on the SOM Board
- 0x6F – PMIC on the SOM board
Note that your result may be different depending on which combination of SOM board, SOM Carrier Board and external peripherals you use.
Linux
To see which I2C busses are available list content in dev directory.
ls /dev/i2c*
/dev/i2c-1 /dev/i2c-3 /dev/i2c-8
You can also use the i2cdetect command.
i2cdetect -l
i2c-1 i2c Renesas RIIC adapter I2C adapter
i2c-3 i2c Renesas RIIC adapter I2C adapter
i2c-8 i2c Renesas RIIC adapter I2C adapter
To scan for all devices on i2c-8.
i2cdetect -y 8
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- 12 -- -- -- -- -- -- -- UU -- -- -- -- --
20: -- UU UU UU -- -- -- -- 28 -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- UU -- -- UU -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- 6f
70: -- -- -- -- -- -- -- --
The scan above uses UU to indicate that a device was not probed as it was marked as being in use by a driver. The address to device mapping is described in the U-Boot section above.