Forum Discussion
driver for HPS I2C Hardware in u-boot 04.2020 deactivates clocks
- 4 years ago
Hello,
We had a similar problem trying to migrate to the socfpga_v2021.04 branch of uBoot. We have an on-board EEPROM (I2C) that contains factory configuration data that is needed during the uBoot TPL phase.
We are seeing that the designware_i2c I2C controller is resetting the l4_sp_clk when it is removed prior to starting the linux kernel. The result is that there is a bus hang when the kernel tries to access the UART peripheral (which needs that clock). The kernel we are trying to use is from 4.9.78-ltsi. It's possible that later versions of the kernel properly re-enable the l4_sp_clk, but this doesn't seem to be the case for our particular configuration (which works fine with uboot 2014.10). We also had to set the socfpga_legacy_reset_compat=1 uBoot environment variable as well, as without it this version of uBoot will reset all the peripherals as it switches to linux, resulting in a similar hang.
Our work-around can be found in this patch here:
Critical Link LLC git repositories. - u-boot-socfpga.git/blobdiff - drivers/i2c/designware_i2c.c
-Mike
Hi Silvan,
We found the root cause of the issue, it seems to be an issue when disabling the l4_sp_clk when Starting the Kernel. So, when I2C is removed before Kernel, it removes the l4_sp_clk, then this would impact other peripherals running, triggering the hang in Uboot when dessaserting the peripherals.
To fix the issue, together with enabling the I2C in U-boot, please use the patch (attached) following the steps from:
https://rocketboards.org/foswiki/Documentation/BuildingBootloader#Arria_10_SoC_45_Boot_from_SD_Card
How to apply the patch, after following "Build U-boot” steps after:
git checkout -b test-bootloader -t origin/socfpga_v2021.04
Copy the patch file in the “software/bootloader” folder, and run:
patch -p1 < ../enable_i2c_uboot_kernel_fix.patch