This sounds like a dumb question (to me...) but does anyone have a known-working example set of commands for an iMX8 Nano talking to a PCA9450B PMIC, via I2C?
I have 2 devices on I2C bus 0: the PMIC (at address 25) and an RTC chip (at address 51).
I can do:
u-boot=> i2c dev 0
Setting bus to 0
u-boot=> i2c probe
Valid chip addresses: 25 51
Looks great right? I can read and write the registers in the RTC chip using the i2c md and mw commands, no problem. It works great. But if I try to read the registers from the PMIC, I get junk:
u-boot=> i2c md 25 0 8
0000: 30 30 30 30 30 30 30 30 00000000
Seems so simple... I feel like I'm missing something obvious here. Any suggestions?
Problem found. I'm posting here in case anyone else bumps across this.
The PCA9450B datasheet is very light when it comes to describing its I2C interface. Most I2C devices have fairly detailed information. By comparision the PCA9450B datasheet, section 8, simply states that it implements an I2C interface and provides a link to the official I2C bus specification. Hence some trial & error is necessary to determine what the PCA9450B supports and doesn't support.
In my case, it turns out the PCA9450B apparently does not support auto-increment when accessing its registers. Which is why the U-Boot command I listed did not work. The solution is very simple - only access a single register at a time. Then it works.
u-boot=> i2c md 25 0 1
0000: 30 0
0001: c0 .
0002: ff .
0003: c0 .
0004: 04 .
0005: 80 .
You may try to add the printf into the driver to see if it is really read/write the pmic register by this I2C command in u-boot.