Hi,
has anyone tried i2c on bpi-r4 yet?
i try to access the i2c-mux and further the eeprom on its channel 0, but i do not see the mux on the i2c bus…am i missing something (just used the linux device tree nodes for pinctrl and i2cmux - i2c controller itself was already in u-boot)?
BPI-R4> fatload usb 0:1 $loadaddr u-boot-r4-2025.04-i2c.bin
903816 bytes read in 80 ms (10.8 MiB/s)
BPI-R4> go $loadaddr
## Starting application at 0x46000000 ...
U-Boot 2025.04-bpi-i2cmux-00032-g935c239f9e94-dirty (May 29 2025 - 13:05:36 +0200)
CPU: MediaTek MT7988
Model: mt7988-rfb
DRAM: 8 GiB
Core: 54 devices, 21 uclasses, devicetree: separate
MMC: mmc@11230000: 0
Loading Environment from nowhere... OK
In: serial@11000000
Out: serial@11000000
Err: serial@11000000
=> board_late_init...
bootmedia:sd
Net: MediaTek MT7988 built-in switch
Warning: ethernet@15110100 (eth0) using random MAC address - f2:f2:2c:2a:fe:8c
eth0: ethernet@15110100
Hit any key to stop autoboot: 0
BPI-R4> 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
BPI-R4> eeprom
eeprom - EEPROM sub-system
Usage:
eeprom list
eeprom read [device_specifier] addr off cnt
eeprom write [device_specifier] addr off cnt
- read/write `cnt' bytes from `devaddr` EEPROM at offset `off'
DEVICE SPECIFIER - the eeprom device can be specified
[dev_name] - by device name (devices can listed with the eeprom list command)
[[bus] devaddr] - or by I2C bus and I2C device address
If no device specifier is given, the first driver-model found device is used.
BPI-R4> eeprom list
BPI-R4> i2c bus 0
Bus 0: i2c@11004000 (active 0)
BPI-R4> i2c bus 1
Bus 1: i2c@11005000 (active 1)
BPI-R4> i2c dev 1
Setting bus to 1
BPI-R4> i2c probe
Valid chip addresses:
i2c bus 1 seems to be the i2c2 (i2c2: i2c@11005000), so basicly i2c seems to be probed correctly, but does not show any devices
source:
@hackpascal have you an idea?
edit: got a bit further…noticed that the pca954x driver misses the compatible for pca9545 after adding this and its config i see the eeprom
BPI-R4> i2c bus
Bus 0: i2c@11004000
Bus 1: i2c@11005000
70: i2c-mux@70, offset len 1, flags 0
Bus 2: i2c@11005000->i2c-mux@70->i2c@0
57: eeprom@57, offset len 1, flags 0
BPI-R4> eeprom list
eeprom@57 (i2c_eeprom)
BPI-R4> eeprom read eeprom@57 0x0 100
EEPROM @0x0 read: addr 0xffffffffffffffff off 0x0000 count 256 ... done
exit not allowed from main input shell.
not sure if i do it right, but it seems read was working (my eeprom is currentl empty)
also tried using i2c read, but this seems not working (maybe because device is bound to driver)
BPI-R4> i2c dev 2
Setting bus to 2
BPI-R4> i2c read 0x57 0 100 $loadaddr
Error reading the chip: -19
BPI-R4> i2c md 0x57 0 100
Error reading the chip: -19
it looks like it does read on main i2c bus not on bus 2 because when i probe the current bus i see the i2c-mux
BPI-R4> i2c probe
Valid chip addresses: 70
but after this i see this strange device below bus 2 and not the rtc i expected on 0x51
BPI-R4> i2c bus
Bus 0: i2c@11004000
Bus 1: i2c@11005000 (active 1)
70: i2c-mux@70, offset len 1, flags 0
Bus 2: i2c@11005000->i2c-mux@70->i2c@0 (active 2)
57: eeprom@57, offset len 1, flags 0
70: generic_70, offset len 1, flags 0
verified from linux that my 8g-phy board still has the rtc…ans yes it has
root@bpi-r4-phy-8G:~# dmesg | grep at24
[ 1.148263] at24 2-0057: supply vcc not found, using dummy regulator
[ 1.155171] at24 2-0057: 256 byte 24c02 EEPROM, writable, 1 bytes/write
root@bpi-r4-phy-8G:~# dmesg | grep rtc
[ 1.119439] rtc-pcf8563 2-0051: low voltage detected, date/time is not reliable.
[ 1.126919] rtc-pcf8563 2-0051: registered as rtc0
[ 1.132914] rtc-pcf8563 2-0051: low voltage detected, date/time is not reliable.
[ 1.140304] rtc-pcf8563 2-0051: hctosys: unable to read the hardware clock
root@bpi-r4-phy-8G:~# i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- -- -- -- -- UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: UU -- -- -- -- -- -- --
root@bpi-r4-phy-8G:~# dmesg | grep pca
[ 1.110017] pca954x 1-0070: supply vdd not found, using dummy regulator
[ 1.181250] pca954x 1-0070: registered 4 multiplexed busses for I2C switch pca9545
and seems adress 70 is also there (i guess its the mux itself as it is also bound to driver)
maybe there is any trick to see i2c devices in uboot without driver too