
On 2024-09-25 12:18, Svyatoslav Ryhel wrote:
Hello there! I was digging this when I had some free time and found that with patches from Marek the only difference is that function i2c_get_chip_for_busnum is not called for PMIC's main i2c address which results in issues with i2c you have seen in logs before. I assume this is not a tegra specific issue and not even related to these regulator patches itself.
The i2c_get_chip_for_busnum call is typically protected by CONFIG_IS_ENABLED(DM_I2C), do you have DM_I2C and SPL_DM_I2C enabled?
grep DM_I2C .config
To verify my suspicions, Tom and Marek my you please dump u-boot log with and without patches and with enabled debug logging from i2c-uclass and i2c driver of your SoC.
Here are logs from my device (Tegra SoC)
What board target / defconfig is used? Would like to understand what bootph- props are used in the built control fdt.
Not working (bootloader) i2c: controller bus 0 at 7000d000, speed 0: i2c_init_controller: speed=400000 (bootloader) i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 (bootloader) i2c_get_chip: Searching bus 'i2c@7000d000' for address 59: (bootloader) not found (bootloader) pmic_reg_read: reg=37 priv->trans_len:1i2c_xfer: 2 messages (bootloader) (bootloader) i2c_xfer: chip=0x58, len=0x1 (bootloader) i2c_write_data: chip=0x58, len=0x1 (bootloader) write_data: 0x37 (bootloader) pkt header 1 sent (0x10010) (bootloader) pkt header 2 sent (0x0) (bootloader) pkt header 3 sent (0x100b0) (bootloader) pkt data sent (0x37) (bootloader) tegra_i2c_write_data: Error (-1) !!!
Is this at SPL, U-Boot pre-reloc or after relocation? A more complete boot log may help us understand when this happens.
Working (bootloader) i2c: controller bus 0 at 7000d000, speed 0: i2c_init_controller: speed=400000 (bootloader) i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25 (bootloader) pkt header 1 sent (0x10010) (bootloader) pkt header 2 sent (0x0) (bootloader) pkt header 3 sent (0xb0) (bootloader) pkt data sent (0x0) (bootloader) i2c_get_chip: Searching bus 'i2c@7000d000' for address 58: (bootloader) i2c_get_chip: Searching bus 'i2c@7000d000' for address 59: (bootloader) not found (bootloader) found, ret=0 (bootloader) i2c_xfer: 2 messages (bootloader) i2c_xfer: chip=0x58, len=0x1 (bootloader) i2c_write_data: chip=0x58, len=0x1 (bootloader) write_data: 0xfb (bootloader) pkt header 1 sent (0x10010) (bootloader) pkt header 2 sent (0x0) (bootloader) pkt header 3 sent (0x100b0) (bootloader) pkt data sent (0xfb) (bootloader) i2c_xfer: chip=0x58, len=0x1
Is the working scenario happening at same call site as not working?
Try with #define LOG_DEBUG in lib/initcall.c and compare/include a longer part of the boot log.
Regards, Jonas
As you can see this part
(bootloader) pkt header 1 sent (0x10010) (bootloader) pkt header 2 sent (0x0) (bootloader) pkt header 3 sent (0xb0) (bootloader) pkt data sent (0x0) (bootloader) i2c_get_chip: Searching bus 'i2c@7000d000' for address 58:
is missing in log from u-boot where Marek's patches are applied and this log fragment co-responds to i2c_get_chip_for_busnum call