Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A13 => Topic started by: thom_nic on July 11, 2022, 09:25:03 PM

Title: u-boot BOOTCOUNT I2C EEPROM support
Post by: thom_nic on July 11, 2022, 09:25:03 PM
I am trying to enable I2C-EEPROM based bootcount support. I have what I believe are the relevant config flags however I get the following compile error:

arch/arm/mach-sunxi/built-in.o: In function `pmic_bus_read':
/root/etx8-linux/modules/a13-som/u-boot-olimex/arch/arm/mach-sunxi/pmic_bus.c:68: undefined reference to `i2c_read'
arch/arm/mach-sunxi/built-in.o: In function `pmic_bus_write':
/root/etx8-linux/modules/a13-som/u-boot-olimex/arch/arm/mach-sunxi/pmic_bus.c:87: undefined reference to `i2c_write'
Makefile:1703: recipe for target 'u-boot' failed
make: *** [u-boot] Error 1

The only reference I can find to this error is this issue (https://gitlab.com/linux-sunxi/u-boot-sunxi/-/issues/95) which says to add CONFIG_SPL_I2C_SUPPORT=y (it is already.)

Here is my diff vs A13-OLinuXino_defconfig (mostly reordered lines):
# diff defconfig configs/A13-OLinuXino_defconfig
3d2
< CONFIG_BOOTCOUNT_BOOTLIMIT=100
6,7c5
< CONFIG_TARGET_A13_OLINUXINO=y
< CONFIG_DRAM_ODT_EN=y
---
> CONFIG_DRAM_CLK=360
8a7
> CONFIG_DRAM_ODT_EN=y
19d17
< CONFIG_OF_BOARD_FIXUP=y
21,22d18
< CONFIG_FIT_BEST_MATCH=y
< CONFIG_SPL_BOARD_INIT=y
26,36d21
< CONFIG_OF_LIST="sun5i-a13-olinuxino sun5i-a13-som-256 sun5i-a13-som-512"
< CONFIG_MULTI_DTB_FIT=y
< CONFIG_ENV_OVERWRITE=y
< CONFIG_ENV_IS_IN_EXT4=y
< CONFIG_ENV_FAT_DEVICE_AND_PART=""
< CONFIG_ENV_EXT4_INTERFACE="mmc"
< CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto"
< CONFIG_ENV_ACCESS_IGNORE_FORCE=y
< CONFIG_BOOTCOUNT_LIMIT=y
< CONFIG_DM_BOOTCOUNT=y
< CONFIG_DM_BOOTCOUNT_I2C_EEPROM=y
39,45d23
< CONFIG_DM_I2C=y
< CONFIG_MISC=y
< CONFIG_I2C_EEPROM=y
< CONFIG_SYS_I2C_EEPROM_ADDR=0x50
< CONFIG_SYS_I2C_EEPROM_BUS=2
< CONFIG_SYS_EEPROM_SIZE=1024
< CONFIG_MMC_BROKEN_CD=y
47a26,32
> CONFIG_TARGET_A13_OLINUXINO=y
> CONFIG_SPL_BOARD_INIT=y
> CONFIG_BOARD_LATE_INIT=y
> CONFIG_OF_BOARD_FIXUP=y
> CONFIG_MMC_BROKEN_CD=y
> CONFIG_MULTI_DTB_FIT=y
> CONFIG_OF_LIST="sun5i-a13-olinuxino sun5i-a13-som-256 sun5i-a13-som-512"
50a36,45
> CONFIG_ENV_FAT_DEVICE_AND_PART=""
>
> CONFIG_ENV_OVERWRITE=y
> CONFIG_ENV_IS_IN_EXT4=y
> CONFIG_ENV_EXT4_INTERFACE="mmc"
> CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto"
> CONFIG_ENV_EXT4_FILE="/uboot.env"
> CONFIG_FIT_BEST_MATCH=y
>
> CONFIG_ENV_ACCESS_IGNORE_FORCE=y

By process of elimination, it appears to be the CONFIG_I2C_EEPROM option that is causing the compiler errors to occur.

More info: The issue appears in mainline u-boot 2021.04, and appears to have been fixed (at least, it compiles without error) between release 2021.10 and 2022.01. 
Title: Re: u-boot BOOTCOUNT I2C EEPROM support
Post by: thom_nic on August 18, 2022, 04:00:08 PM
well, I ported the A13 commits to v2022.01 and it seems to work well, along with bootcount.  It would be nice if more of the Olimex code was added to the mainline so we don't have to cherry-pick commits and work out differences between changes that *have* been added to mainline for the same functionality.