From: Anatolij Gustschin Date: Sat, 3 Aug 2024 16:15:03 +0000 (+0200) Subject: board: shc: convert to DM_I2C X-Git-Url: http://git.dujemihanovic.xyz/html/static/git-favicon.png?a=commitdiff_plain;h=62ce9f7fffc132cde06899a3c60ae6c47337d829;p=u-boot.git board: shc: convert to DM_I2C Conversion to DM_I2C is mandatory, rework to remove use of legacy I2C API. Signed-off-by: Anatolij Gustschin Reviewed-by: Heiko Schocher --- diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c index 59628ce6f5..1f9dc2d8df 100644 --- a/board/bosch/shc/board.c +++ b/board/bosch/shc/board.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -51,21 +52,21 @@ static int shc_eeprom_valid; /* * Read header information from EEPROM into global structure. */ -#define EEPROM_ADDR 0x50 static int read_eeprom(void) { + struct udevice *dev; + int ret; + /* Check if baseboard eeprom is available */ - if (i2c_probe(EEPROM_ADDR)) { - puts("Could not probe the EEPROM; something fundamentally wrong on the I2C bus.\n"); - return -ENODEV; + ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev); + if (ret) { + puts("Could not find EEPROM.\n"); + return ret; } - /* read the eeprom using i2c */ - if (i2c_read(EEPROM_ADDR, 0, 2, (uchar *)&header, - sizeof(header))) { - puts("Could not read the EEPROM; something fundamentally wrong on the I2C bus.\n"); - return -EIO; - } + ret = i2c_eeprom_read(dev, 0, (uint8_t *)&header, sizeof(header)); + if (ret) + return ret; if (header.magic != HDR_MAGIC) { printf("Incorrect magic number (0x%x) in EEPROM\n", @@ -445,7 +446,6 @@ int board_init(void) #if defined(CONFIG_HW_WATCHDOG) hw_watchdog_init(); #endif - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); if (read_eeprom() < 0) puts("EEPROM Content Invalid.\n"); diff --git a/configs/am335x_shc_defconfig b/configs/am335x_shc_defconfig index 8fb6e1a5a9..72933ba1a6 100644 --- a/configs/am335x_shc_defconfig +++ b/configs/am335x_shc_defconfig @@ -65,10 +65,12 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_VERSION_VARIABLE=y CONFIG_NET_RETRY_COUNT=10 CONFIG_BOOTP_SEND_HOSTNAME=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_SLAVE=0x1 CONFIG_SYS_I2C_SPEED=400000 +CONFIG_MISC=y +CONFIG_I2C_EEPROM=y CONFIG_MMC_OMAP_HS=y CONFIG_HSMMC2_8BIT=y CONFIG_PHY_ADDR_ENABLE=y diff --git a/configs/am335x_shc_ict_defconfig b/configs/am335x_shc_ict_defconfig index b9f5db2305..b8a3227557 100644 --- a/configs/am335x_shc_ict_defconfig +++ b/configs/am335x_shc_ict_defconfig @@ -63,10 +63,12 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_VERSION_VARIABLE=y CONFIG_NET_RETRY_COUNT=10 CONFIG_BOOTP_SEND_HOSTNAME=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_SLAVE=0x1 CONFIG_SYS_I2C_SPEED=400000 +CONFIG_MISC=y +CONFIG_I2C_EEPROM=y CONFIG_MMC_OMAP_HS=y CONFIG_HSMMC2_8BIT=y CONFIG_PHY_ADDR_ENABLE=y diff --git a/configs/am335x_shc_netboot_defconfig b/configs/am335x_shc_netboot_defconfig index 5c42bf423f..b25a4de30c 100644 --- a/configs/am335x_shc_netboot_defconfig +++ b/configs/am335x_shc_netboot_defconfig @@ -66,10 +66,12 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_VERSION_VARIABLE=y CONFIG_NET_RETRY_COUNT=10 CONFIG_BOOTP_SEND_HOSTNAME=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_SLAVE=0x1 CONFIG_SYS_I2C_SPEED=400000 +CONFIG_MISC=y +CONFIG_I2C_EEPROM=y CONFIG_MMC_OMAP_HS=y CONFIG_HSMMC2_8BIT=y CONFIG_PHY_ADDR_ENABLE=y diff --git a/configs/am335x_shc_sdboot_defconfig b/configs/am335x_shc_sdboot_defconfig index 9375bc93a2..8486ccb6d5 100644 --- a/configs/am335x_shc_sdboot_defconfig +++ b/configs/am335x_shc_sdboot_defconfig @@ -65,10 +65,12 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_VERSION_VARIABLE=y CONFIG_NET_RETRY_COUNT=10 CONFIG_BOOTP_SEND_HOSTNAME=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_SLAVE=0x1 CONFIG_SYS_I2C_SPEED=400000 +CONFIG_MISC=y +CONFIG_I2C_EEPROM=y CONFIG_MMC_OMAP_HS=y CONFIG_HSMMC2_8BIT=y CONFIG_PHY_ADDR_ENABLE=y