All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] board: shc: convert to DM_I2C
@ 2024-08-03 16:15 Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 02/11] board: chiliboard: " Anatolij Gustschin
                   ` (10 more replies)
  0 siblings, 11 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Heiko Schocher, Tom Rini

Conversion to DM_I2C is mandatory, rework to remove
use of legacy I2C API.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
 board/bosch/shc/board.c              | 22 +++++++++++-----------
 configs/am335x_shc_defconfig         |  4 +++-
 configs/am335x_shc_ict_defconfig     |  4 +++-
 configs/am335x_shc_netboot_defconfig |  4 +++-
 configs/am335x_shc_sdboot_defconfig  |  4 +++-
 5 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index ab68874593..92c7b20f75 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -34,6 +34,7 @@
 #include <asm/emif.h>
 #include <asm/gpio.h>
 #include <i2c.h>
+#include <i2c_eeprom.h>
 #include <miiphy.h>
 #include <cpsw.h>
 #include <linux/delay.h>
@@ -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 47c08e5054..dbce4611de 100644
--- a/configs/am335x_shc_defconfig
+++ b/configs/am335x_shc_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_ict_defconfig b/configs/am335x_shc_ict_defconfig
index c7618c5c79..24c6d44840 100644
--- a/configs/am335x_shc_ict_defconfig
+++ b/configs/am335x_shc_ict_defconfig
@@ -64,10 +64,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 934265815b..0971d64afb 100644
--- a/configs/am335x_shc_netboot_defconfig
+++ b/configs/am335x_shc_netboot_defconfig
@@ -67,10 +67,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 439f9b8188..14d4fa4d6d 100644
--- a/configs/am335x_shc_sdboot_defconfig
+++ b/configs/am335x_shc_sdboot_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
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 02/11] board: chiliboard: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 03/11] board: cm-t43: " Anatolij Gustschin
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Marcin Niestroj, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Marcin Niestroj <m.niestroj@grinn-global.com>
Cc: Tom Rini <trini@konsulko.com>
---
 configs/chiliboard_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/chiliboard_defconfig b/configs/chiliboard_defconfig
index c574d93806..0e8737565f 100644
--- a/configs/chiliboard_defconfig
+++ b/configs/chiliboard_defconfig
@@ -53,7 +53,7 @@ CONFIG_NET_RETRY_COUNT=10
 CONFIG_BOOTP_SEND_HOSTNAME=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_BE=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_MISC=y
 CONFIG_MMC_OMAP_HS=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 03/11] board: cm-t43: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 02/11] board: chiliboard: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 04/11] board: igep003x: " Anatolij Gustschin
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Nikita Kiryanov, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Tom Rini <trini@konsulko.com>
---
 board/compulab/cm_t43/cm_t43.c | 2 --
 configs/cm_t43_defconfig       | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/board/compulab/cm_t43/cm_t43.c b/board/compulab/cm_t43/cm_t43.c
index 181581926c..983991ea46 100644
--- a/board/compulab/cm_t43/cm_t43.c
+++ b/board/compulab/cm_t43/cm_t43.c
@@ -48,8 +48,6 @@ int board_init(void)
 	gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
 	gpmc_init();
 	set_i2c_pin_mux();
-	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-	i2c_probe(TPS65218_CHIP_PM);
 
 	return 0;
 }
diff --git a/configs/cm_t43_defconfig b/configs/cm_t43_defconfig
index 32f126a517..1c9ae335e9 100644
--- a/configs/cm_t43_defconfig
+++ b/configs/cm_t43_defconfig
@@ -38,6 +38,7 @@ CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x480
 CONFIG_SPL_FS_EXT4=y
 CONFIG_SPL_I2C=y
+# CONFIG_SPL_DM_I2C is not set
 CONFIG_SPL_MTD=y
 # CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_SPL_NAND_DRIVERS=y
@@ -72,7 +73,7 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_BOOTP_SEND_HOSTNAME=y
 CONFIG_SYS_RX_ETH_BUFFER=64
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_HSMMC2_8BIT=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 04/11] board: igep003x: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 02/11] board: chiliboard: " Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 03/11] board: cm-t43: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 05/11] board: sl50: " Anatolij Gustschin
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Javier Martínez Canillas, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Javier Martínez Canillas <javier@dowhile0.org>
Cc: Tom Rini <trini@konsulko.com>
---
 configs/am335x_igep003x_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/am335x_igep003x_defconfig b/configs/am335x_igep003x_defconfig
index ddffd4f46f..25fa7818fa 100644
--- a/configs/am335x_igep003x_defconfig
+++ b/configs/am335x_igep003x_defconfig
@@ -76,7 +76,7 @@ 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_MMC_OMAP_HS=y
 CONFIG_MTD=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 05/11] board: sl50: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
                   ` (2 preceding siblings ...)
  2024-08-03 16:15 ` [PATCH 04/11] board: igep003x: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 06/11] board: rut: " Anatolij Gustschin
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Enric Balletbo i Serra, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Tom Rini <trini@konsulko.com>
---
 configs/am335x_sl50_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/am335x_sl50_defconfig b/configs/am335x_sl50_defconfig
index 88122bd052..158458f532 100644
--- a/configs/am335x_sl50_defconfig
+++ b/configs/am335x_sl50_defconfig
@@ -66,7 +66,7 @@ CONFIG_NET_RETRY_COUNT=10
 CONFIG_BOOTP_SEND_HOSTNAME=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_BE=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_EEPROM_ADDR=0x50
 CONFIG_MMC_OMAP_HS=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 06/11] board: rut: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
                   ` (3 preceding siblings ...)
  2024-08-03 16:15 ` [PATCH 05/11] board: sl50: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 07/11] board: novena: " Anatolij Gustschin
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Enrico Leto, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Enrico Leto <enrico.leto@siemens.com>
Cc: Tom Rini <trini@konsulko.com>
---
 configs/rut_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/rut_defconfig b/configs/rut_defconfig
index 7e78f1d649..fb57565e06 100644
--- a/configs/rut_defconfig
+++ b/configs/rut_defconfig
@@ -90,7 +90,7 @@ CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
 CONFIG_DFU_NAND=y
 CONFIG_SYS_DFU_DATA_BUF_SIZE=0x100000
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 # CONFIG_SPL_DM_MMC is not set
 CONFIG_MMC_OMAP_HS=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 07/11] board: novena: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
                   ` (4 preceding siblings ...)
  2024-08-03 16:15 ` [PATCH 06/11] board: rut: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-04  0:21   ` Marek Vasut
  2024-08-03 16:15 ` [PATCH 08/11] board: vining_2000: " Anatolij Gustschin
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Fabio Estevam, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning. Convert EEPROM
and IT6251 access to use DM_I2C API.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
 board/kosagi/novena/novena.c |  10 +--
 board/kosagi/novena/video.c  | 140 +++++++++++++++++++----------------
 configs/novena_defconfig     |   2 +-
 3 files changed, 81 insertions(+), 71 deletions(-)

diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 3220727f23..f65551ece5 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -137,23 +137,23 @@ struct novena_eeprom_data {
 int misc_init_r(void)
 {
 	struct novena_eeprom_data data;
-	uchar *datap = (uchar *)&data;
+	uint8_t *datap = (uint8_t *)&data;
 	const char *signature = "Novena";
+	struct udevice *eeprom;
 	int ret;
 
 	/* If 'ethaddr' is already set, do nothing. */
 	if (env_get("ethaddr"))
 		return 0;
 
-	/* EEPROM is at bus 2. */
-	ret = i2c_set_bus_num(2);
+	/* EEPROM is at bus 2, address 0x56 */
+	ret = i2c_get_chip_for_busnum(2, 0x56, 1, &eeprom);
 	if (ret) {
 		puts("Cannot select EEPROM I2C bus.\n");
 		return 0;
 	}
 
-	/* EEPROM is at address 0x56. */
-	ret = eeprom_read(0x56, 0, datap, sizeof(data));
+	ret = dm_i2c_read(eeprom, 0, datap, sizeof(data));
 	if (ret) {
 		puts("Cannot read I2C EEPROM.\n");
 		return 0;
diff --git a/board/kosagi/novena/video.c b/board/kosagi/novena/video.c
index be5a737a31..67f98431b5 100644
--- a/board/kosagi/novena/video.c
+++ b/board/kosagi/novena/video.c
@@ -58,28 +58,29 @@
 
 #define IT6521_RETRY_MAX				20
 
+static struct udevice *it6251_chip;
+static struct udevice *it6251_lvds;
+
 static int it6251_is_stable(void)
 {
-	const unsigned int caddr = NOVENA_IT6251_CHIPADDR;
-	const unsigned int laddr = NOVENA_IT6251_LVDSADDR;
 	int status;
 	int clkcnt;
 	int rpclkcnt;
 	int refstate;
 
-	rpclkcnt = (i2c_reg_read(caddr, 0x13) & 0xff) |
-		   ((i2c_reg_read(caddr, 0x14) << 8) & 0x0f00);
+	rpclkcnt = (dm_i2c_reg_read(it6251_chip, 0x13) & 0xff) |
+		   ((dm_i2c_reg_read(it6251_chip, 0x14) << 8) & 0x0f00);
 	debug("RPCLKCnt: %d\n", rpclkcnt);
 
-	status = i2c_reg_read(caddr, IT6251_SYSTEM_STATUS);
+	status = dm_i2c_reg_read(it6251_chip, IT6251_SYSTEM_STATUS);
 	debug("System status: 0x%02x\n", status);
 
-	clkcnt = (i2c_reg_read(laddr, IT6251_REG_PCLK_CNT_LOW) & 0xff) |
-		 ((i2c_reg_read(laddr, IT6251_REG_PCLK_CNT_HIGH) << 8) &
+	clkcnt = (dm_i2c_reg_read(it6251_lvds, IT6251_REG_PCLK_CNT_LOW) & 0xff) |
+		 ((dm_i2c_reg_read(it6251_lvds, IT6251_REG_PCLK_CNT_HIGH) << 8) &
 		  0x0f00);
 	debug("Clock: 0x%02x\n", clkcnt);
 
-	refstate = i2c_reg_read(laddr, IT6251_REF_STATE);
+	refstate = dm_i2c_reg_read(it6251_lvds, IT6251_REF_STATE);
 	debug("Ref Link State: 0x%02x\n", refstate);
 
 	if ((refstate & 0x1f) != 0)
@@ -97,16 +98,14 @@ static int it6251_is_stable(void)
 
 static int it6251_ready(void)
 {
-	const unsigned int caddr = NOVENA_IT6251_CHIPADDR;
-
 	/* Test if the IT6251 came out of reset by reading ID regs. */
-	if (i2c_reg_read(caddr, IT6251_VENDOR_ID_LOW) != 0x15)
+	if (dm_i2c_reg_read(it6251_chip, IT6251_VENDOR_ID_LOW) != 0x15)
 		return 0;
-	if (i2c_reg_read(caddr, IT6251_VENDOR_ID_HIGH) != 0xca)
+	if (dm_i2c_reg_read(it6251_chip, IT6251_VENDOR_ID_HIGH) != 0xca)
 		return 0;
-	if (i2c_reg_read(caddr, IT6251_DEVICE_ID_LOW) != 0x51)
+	if (dm_i2c_reg_read(it6251_chip, IT6251_DEVICE_ID_LOW) != 0x51)
 		return 0;
-	if (i2c_reg_read(caddr, IT6251_DEVICE_ID_HIGH) != 0x62)
+	if (dm_i2c_reg_read(it6251_chip, IT6251_DEVICE_ID_HIGH) != 0x62)
 		return 0;
 
 	return 1;
@@ -114,116 +113,112 @@ static int it6251_ready(void)
 
 static void it6251_program_regs(void)
 {
-	const unsigned int caddr = NOVENA_IT6251_CHIPADDR;
-	const unsigned int laddr = NOVENA_IT6251_LVDSADDR;
-
-	i2c_reg_write(caddr, 0x05, 0x00);
+	dm_i2c_reg_write(it6251_chip, 0x05, 0x00);
 	mdelay(1);
 
 	/* set LVDSRX address, and enable */
-	i2c_reg_write(caddr, 0xfd, 0xbc);
-	i2c_reg_write(caddr, 0xfe, 0x01);
+	dm_i2c_reg_write(it6251_chip, 0xfd, 0xbc);
+	dm_i2c_reg_write(it6251_chip, 0xfe, 0x01);
 
 	/*
 	 * LVDSRX
 	 */
 	/* This write always fails, because the chip goes into reset */
 	/* reset LVDSRX */
-	i2c_reg_write(laddr, 0x05, 0xff);
-	i2c_reg_write(laddr, 0x05, 0x00);
+	dm_i2c_reg_write(it6251_lvds, 0x05, 0xff);
+	dm_i2c_reg_write(it6251_lvds, 0x05, 0x00);
 
 	/* reset LVDSRX PLL */
-	i2c_reg_write(laddr, 0x3b, 0x42);
-	i2c_reg_write(laddr, 0x3b, 0x43);
+	dm_i2c_reg_write(it6251_lvds, 0x3b, 0x42);
+	dm_i2c_reg_write(it6251_lvds, 0x3b, 0x43);
 
 	/* something with SSC PLL */
-	i2c_reg_write(laddr, 0x3c, 0x08);
+	dm_i2c_reg_write(it6251_lvds, 0x3c, 0x08);
 	/* don't swap links, but writing reserved registers */
-	i2c_reg_write(laddr, 0x0b, 0x88);
+	dm_i2c_reg_write(it6251_lvds, 0x0b, 0x88);
 
 	/* JEIDA, 8-bit depth  0x11, orig 0x42 */
-	i2c_reg_write(laddr, 0x2c, 0x01);
+	dm_i2c_reg_write(it6251_lvds, 0x2c, 0x01);
 	/* "reserved" */
-	i2c_reg_write(laddr, 0x32, 0x04);
+	dm_i2c_reg_write(it6251_lvds, 0x32, 0x04);
 	/* "reserved" */
-	i2c_reg_write(laddr, 0x35, 0xe0);
+	dm_i2c_reg_write(it6251_lvds, 0x35, 0xe0);
 	/* "reserved" + clock delay */
-	i2c_reg_write(laddr, 0x2b, 0x24);
+	dm_i2c_reg_write(it6251_lvds, 0x2b, 0x24);
 
 	/* reset LVDSRX pix clock */
-	i2c_reg_write(laddr, 0x05, 0x02);
-	i2c_reg_write(laddr, 0x05, 0x00);
+	dm_i2c_reg_write(it6251_lvds, 0x05, 0x02);
+	dm_i2c_reg_write(it6251_lvds, 0x05, 0x00);
 
 	/*
 	 * DPTX
 	 */
 	/* set for two lane mode, normal op, no swapping, no downspread */
-	i2c_reg_write(caddr, 0x16, 0x02);
+	dm_i2c_reg_write(it6251_chip, 0x16, 0x02);
 
 	/* some AUX channel EDID magic */
-	i2c_reg_write(caddr, 0x23, 0x40);
+	dm_i2c_reg_write(it6251_chip, 0x23, 0x40);
 
 	/* power down lanes 3-0 */
-	i2c_reg_write(caddr, 0x5c, 0xf3);
+	dm_i2c_reg_write(it6251_chip, 0x5c, 0xf3);
 
 	/* enable DP scrambling, change EQ CR phase */
-	i2c_reg_write(caddr, 0x5f, 0x06);
+	dm_i2c_reg_write(it6251_chip, 0x5f, 0x06);
 
 	/* color mode RGB, pclk/2 */
-	i2c_reg_write(caddr, 0x60, 0x02);
+	dm_i2c_reg_write(it6251_chip, 0x60, 0x02);
 	/* dual pixel input mode, no EO swap, no RGB swap */
-	i2c_reg_write(caddr, 0x61, 0x04);
+	dm_i2c_reg_write(it6251_chip, 0x61, 0x04);
 	/* M444B24 video format */
-	i2c_reg_write(caddr, 0x62, 0x01);
+	dm_i2c_reg_write(it6251_chip, 0x62, 0x01);
 
 	/* vesa range / not interlace / vsync high / hsync high */
-	i2c_reg_write(caddr, 0xa0, 0x0F);
+	dm_i2c_reg_write(it6251_chip, 0xa0, 0x0F);
 
 	/* hpd event timer set to 1.6-ish ms */
-	i2c_reg_write(caddr, 0xc9, 0xf5);
+	dm_i2c_reg_write(it6251_chip, 0xc9, 0xf5);
 
 	/* more reserved magic */
-	i2c_reg_write(caddr, 0xca, 0x4d);
-	i2c_reg_write(caddr, 0xcb, 0x37);
+	dm_i2c_reg_write(it6251_chip, 0xca, 0x4d);
+	dm_i2c_reg_write(it6251_chip, 0xcb, 0x37);
 
 	/* enhanced framing mode, auto video fifo reset, video mute disable */
-	i2c_reg_write(caddr, 0xd3, 0x03);
+	dm_i2c_reg_write(it6251_chip, 0xd3, 0x03);
 
 	/* "vidstmp" and some reserved stuff */
-	i2c_reg_write(caddr, 0xd4, 0x45);
+	dm_i2c_reg_write(it6251_chip, 0xd4, 0x45);
 
 	/* queue number -- reserved */
-	i2c_reg_write(caddr, 0xe7, 0xa0);
+	dm_i2c_reg_write(it6251_chip, 0xe7, 0xa0);
 	/* info frame packets  and reserved */
-	i2c_reg_write(caddr, 0xe8, 0x33);
+	dm_i2c_reg_write(it6251_chip, 0xe8, 0x33);
 	/* more AVI stuff */
-	i2c_reg_write(caddr, 0xec, 0x00);
+	dm_i2c_reg_write(it6251_chip, 0xec, 0x00);
 
 	/* select PC master reg for aux channel? */
-	i2c_reg_write(caddr, 0x23, 0x42);
+	dm_i2c_reg_write(it6251_chip, 0x23, 0x42);
 
 	/* send PC request commands */
-	i2c_reg_write(caddr, 0x24, 0x00);
-	i2c_reg_write(caddr, 0x25, 0x00);
-	i2c_reg_write(caddr, 0x26, 0x00);
+	dm_i2c_reg_write(it6251_chip, 0x24, 0x00);
+	dm_i2c_reg_write(it6251_chip, 0x25, 0x00);
+	dm_i2c_reg_write(it6251_chip, 0x26, 0x00);
 
 	/* native aux read */
-	i2c_reg_write(caddr, 0x2b, 0x00);
+	dm_i2c_reg_write(it6251_chip, 0x2b, 0x00);
 	/* back to internal */
-	i2c_reg_write(caddr, 0x23, 0x40);
+	dm_i2c_reg_write(it6251_chip, 0x23, 0x40);
 
 	/* voltage swing level 3 */
-	i2c_reg_write(caddr, 0x19, 0xff);
+	dm_i2c_reg_write(it6251_chip, 0x19, 0xff);
 	/* pre-emphasis level 3 */
-	i2c_reg_write(caddr, 0x1a, 0xff);
+	dm_i2c_reg_write(it6251_chip, 0x1a, 0xff);
 
 	/* start link training */
-	i2c_reg_write(caddr, 0x17, 0x01);
+	dm_i2c_reg_write(it6251_chip, 0x17, 0x01);
 }
 
 static int it6251_init(void)
 {
-	const unsigned int caddr = NOVENA_IT6251_CHIPADDR;
 	int reg;
 	int tries, retries = 0;
 
@@ -233,7 +228,7 @@ static int it6251_init(void)
 
 		/* Wait for video stable. */
 		for (tries = 0; tries < 100; tries++) {
-			reg = i2c_reg_read(caddr, 0x17);
+			reg = dm_i2c_reg_read(it6251_chip, 0x17);
 			/* Test Link CFG, STS, LCS read done. */
 			if ((reg & 0xe0) != 0xe0) {
 				/* Not yet, wait a bit more. */
@@ -285,10 +280,14 @@ static int detect_lvds(struct display_info_t const *dev)
 
 	enable_lvds(dev);
 
-	ret = i2c_set_bus_num(NOVENA_IT6251_I2C_BUS);
-	if (ret) {
-		puts("Cannot select IT6251 I2C bus.\n");
-		return 0;
+	if (!it6251_chip) {
+		ret = i2c_get_chip_for_busnum(NOVENA_IT6251_I2C_BUS,
+					      NOVENA_IT6251_CHIPADDR,
+					      1, &it6251_chip);
+		if (ret) {
+			puts("Cannot select IT6251 I2C bus.\n");
+			return 0;
+		}
 	}
 
 	/* Wait up-to ~250 mS for the LVDS to come up. */
@@ -435,9 +434,20 @@ void setup_display_lvds(void)
 {
 	int ret;
 
-	ret = i2c_set_bus_num(NOVENA_IT6251_I2C_BUS);
+	if (!it6251_chip) {
+		ret = i2c_get_chip_for_busnum(NOVENA_IT6251_I2C_BUS,
+					      NOVENA_IT6251_CHIPADDR,
+					      1, &it6251_chip);
+		if (ret) {
+			puts("Cannot select LVDS-to-eDP I2C bus.\n");
+			return;
+		}
+	}
+
+	ret = i2c_get_chip_for_busnum(NOVENA_IT6251_I2C_BUS,
+				      NOVENA_IT6251_LVDSADDR, 1, &it6251_lvds);
 	if (ret) {
-		puts("Cannot select LVDS-to-eDP I2C bus.\n");
+		puts("Cannot find IT6251 LVDS bus.\n");
 		return;
 	}
 
diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index 322689ef3a..dd3541bc59 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -67,7 +67,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_DWC_AHSATA=y
 CONFIG_LBA48=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_FSL_USDHC=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 08/11] board: vining_2000: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
                   ` (5 preceding siblings ...)
  2024-08-03 16:15 ` [PATCH 07/11] board: novena: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-07 22:34   ` [PATCH v2 " Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 09/11] board: sniper: " Anatolij Gustschin
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Silvio Fricke, Fabio Estevam, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Silvio Fricke <open-source@softing.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
 board/softing/vining_2000/vining_2000.c | 25 -------------------------
 configs/vining_2000_defconfig           |  4 +---
 2 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c
index a0dbf97524..bd430cfaa7 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -18,7 +18,6 @@
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/io.h>
-#include <asm/mach-imx/mxc_i2c.h>
 #include <asm/sections.h>
 #include <env.h>
 #include <linux/bitops.h>
@@ -27,7 +26,6 @@
 #include <config.h>
 #include <fsl_esdhc_imx.h>
 #include <mmc.h>
-#include <i2c.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <power/pmic.h>
@@ -53,10 +51,6 @@ DECLARE_GLOBAL_DATA_PTR;
 	PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_HIGH |		\
 	PAD_CTL_SRE_FAST)
 
-#define I2C_PAD_CTRL  (PAD_CTL_HYS | PAD_CTL_PUS_100K_UP |	\
-	PAD_CTL_PKE | PAD_CTL_ODE | PAD_CTL_SPEED_MED |		\
-	PAD_CTL_DSE_40ohm)
-
 #define USDHC_CLK_PAD_CTRL  (PAD_CTL_HYS | PAD_CTL_SPEED_MED |	\
 	PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST)
 
@@ -120,21 +114,6 @@ eth_fail:
 	return ret;
 }
 
-#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
-/* I2C1 for PMIC */
-static struct i2c_pads_info i2c_pad_info1 = {
-	.scl = {
-		.i2c_mode = MX6_PAD_GPIO1_IO00__I2C1_SCL | PC,
-		.gpio_mode = MX6_PAD_GPIO1_IO00__GPIO1_IO_0 | PC,
-		.gp = IMX_GPIO_NR(1, 0),
-	},
-	.sda = {
-		.i2c_mode = MX6_PAD_GPIO1_IO01__I2C1_SDA | PC,
-		.gpio_mode = MX6_PAD_GPIO1_IO01__GPIO1_IO_1 | PC,
-		.gp = IMX_GPIO_NR(1, 1),
-	},
-};
-
 static struct pmic *pfuze_init(unsigned char i2cbus)
 {
 	struct pmic *p;
@@ -400,10 +379,6 @@ int board_init(void)
 	/* Address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-#ifdef CONFIG_SYS_I2C_MXC
-	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
-#endif
-
 	return board_net_init();
 }
 
diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index c39597cdf5..45012365e0 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -12,8 +12,6 @@ CONFIG_ENV_OFFSET=0x80000
 CONFIG_MX6SX=y
 CONFIG_MX6_DDRCAL=y
 CONFIG_TARGET_SOFTING_VINING_2000=y
-CONFIG_SYS_I2C_MXC_I2C1=y
-CONFIG_SYS_I2C_MXC_I2C3=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6sx-softing-vining-2000"
 CONFIG_SPL_TEXT_BASE=0x00908000
@@ -70,7 +68,7 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_USE_ETHPRIME=y
 CONFIG_ETHPRIME="FEC"
 CONFIG_BOUNCE_BUFFER=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SUPPORT_EMMC_RPMB=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 09/11] board: sniper: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
                   ` (6 preceding siblings ...)
  2024-08-03 16:15 ` [PATCH 08/11] board: vining_2000: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-04 10:05   ` Paul Kocialkowski
  2024-08-03 16:15 ` [PATCH 10/11] board: cm_fx6: " Anatolij Gustschin
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Paul Kocialkowski, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning. Also enable
OF_UPSTREAM since we do not have a default device
tree.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Paul Kocialkowski <contact@paulk.fr>
Cc: Tom Rini <trini@konsulko.com>
---
 arch/arm/mach-omap2/omap3/Kconfig | 1 +
 configs/sniper_defconfig          | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig
index f15f44fe7d..b56e379ca1 100644
--- a/arch/arm/mach-omap2/omap3/Kconfig
+++ b/arch/arm/mach-omap2/omap3/Kconfig
@@ -115,6 +115,7 @@ config TARGET_SNIPER
 	select OMAP3_GPIO_5
 	select OMAP3_GPIO_6
 	imply CMD_DM
+	imply OF_UPSTREAM
 
 endchoice
 
diff --git a/configs/sniper_defconfig b/configs/sniper_defconfig
index 0243b15f31..29e783da8a 100644
--- a/configs/sniper_defconfig
+++ b/configs/sniper_defconfig
@@ -7,6 +7,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4020ff00
+CONFIG_DEFAULT_DEVICE_TREE="ti/omap/omap3-sniper"
 CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_TARGET_SNIPER=y
 CONFIG_SPL_STACK=0x4020fffc
@@ -32,12 +33,13 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_SETEXPR is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_SYS_I2C_LEGACY=y
+# CONFIG_TI_SYSC is not set
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_SPEED=400000
 CONFIG_TWL4030_INPUT=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_CONS_INDEX=3
-CONFIG_OF_LIBFDT=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 10/11] board: cm_fx6: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
                   ` (7 preceding siblings ...)
  2024-08-03 16:15 ` [PATCH 09/11] board: sniper: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-07 11:16   ` Heiko Schocher
  2024-08-07 13:09   ` [PATCH v2 " Anatolij Gustschin
  2024-08-03 16:15 ` [PATCH 11/11] board: vf610twr: " Anatolij Gustschin
  2024-08-05  4:54 ` [PATCH 01/11] board: shc: " Heiko Schocher
  10 siblings, 2 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Nikita Kiryanov, Fabio Estevam, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C to fix board
removal warning. Convert EEPROM access to use DM_I2C API.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
 board/compulab/cm_fx6/cm_fx6.c |  3 ++-
 board/compulab/common/Makefile |  2 +-
 board/compulab/common/eeprom.c | 14 +++++---------
 board/compulab/common/eeprom.h |  2 +-
 configs/cm_fx6_defconfig       |  2 +-
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index c6d33c32cc..40047cf678 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -14,6 +14,7 @@
 #include <env.h>
 #include <fsl_esdhc_imx.h>
 #include <init.h>
+#include <i2c.h>
 #include <miiphy.h>
 #include <mtd_node.h>
 #include <net.h>
@@ -256,7 +257,7 @@ static int cm_fx6_setup_one_i2c(int busnum, struct i2c_pads_info *pads)
 {
 	int ret;
 
-	ret = setup_i2c(busnum, CONFIG_SYS_I2C_SPEED, 0x7f, pads);
+	ret = setup_i2c(busnum, I2C_SPEED_STANDARD_RATE, 0x7f, pads);
 	if (ret)
 		printf("Warning: I2C%d setup failed: %d\n", busnum, ret);
 
diff --git a/board/compulab/common/Makefile b/board/compulab/common/Makefile
index 7c8226e6e1..863b50a98e 100644
--- a/board/compulab/common/Makefile
+++ b/board/compulab/common/Makefile
@@ -5,5 +5,5 @@
 # Author: Igor Grinberg <grinberg@compulab.co.il>
 
 obj-y				+= common.o
-obj-$(CONFIG_$(SPL_)SYS_I2C_LEGACY)	+= eeprom.o
+obj-$(CONFIG_$(SPL_)DM_I2C)	+= eeprom.o
 obj-$(CONFIG_SMC911X)		+= omap3_smc911x.o
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index efdaf342d5..1b12d09604 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -34,19 +34,15 @@ static int cl_eeprom_layout; /* Implicitly LAYOUT_INVALID */
 
 static int cl_eeprom_read(uint offset, uchar *buf, int len)
 {
+	struct udevice *eeprom;
 	int res;
-	unsigned int current_i2c_bus = i2c_get_bus_num();
 
-	res = i2c_set_bus_num(cl_eeprom_bus);
-	if (res < 0)
+	res = i2c_get_chip_for_busnum(cl_eeprom_bus, CONFIG_SYS_I2C_EEPROM_ADDR,
+				      CONFIG_SYS_I2C_EEPROM_ADDR_LEN, &eeprom);
+	if (res)
 		return res;
 
-	res = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, offset,
-			CONFIG_SYS_I2C_EEPROM_ADDR_LEN, buf, len);
-
-	i2c_set_bus_num(current_i2c_bus);
-
-	return res;
+	return dm_i2c_read(eeprom, offset, (uint8_t *)buf, len);
 }
 
 static int cl_eeprom_setup(uint eeprom_bus)
diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h
index 9bd7604a99..ca8738db76 100644
--- a/board/compulab/common/eeprom.h
+++ b/board/compulab/common/eeprom.h
@@ -10,7 +10,7 @@
 #define _EEPROM_
 #include <errno.h>
 
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
+#if CONFIG_IS_ENABLED(DM_I2C)
 int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
 u32 cl_eeprom_get_board_rev(uint eeprom_bus);
 int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus);
diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
index 386616cc42..81a39f7073 100644
--- a/configs/cm_fx6_defconfig
+++ b/configs/cm_fx6_defconfig
@@ -80,7 +80,7 @@ CONFIG_BOUNCE_BUFFER=y
 CONFIG_DWC_AHSATA=y
 # CONFIG_DWC_AHSATA_AHCI is not set
 CONFIG_LBA48=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SYS_MXC_I2C3_SPEED=400000
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 11/11] board: vf610twr: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
                   ` (8 preceding siblings ...)
  2024-08-03 16:15 ` [PATCH 10/11] board: cm_fx6: " Anatolij Gustschin
@ 2024-08-03 16:15 ` Anatolij Gustschin
  2024-08-05  4:54 ` [PATCH 01/11] board: shc: " Heiko Schocher
  10 siblings, 0 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-03 16:15 UTC (permalink / raw)
  To: u-boot; +Cc: Alison Wang, Fabio Estevam, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Alison Wang <alison.wang@nxp.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
 configs/vf610twr_defconfig      | 2 +-
 configs/vf610twr_nand_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configs/vf610twr_defconfig b/configs/vf610twr_defconfig
index af889ec903..7713454136 100644
--- a/configs/vf610twr_defconfig
+++ b/configs/vf610twr_defconfig
@@ -47,7 +47,7 @@ CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_VYBRID_GPIO=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_FSL_ESDHC_IMX=y
 CONFIG_MTD=y
diff --git a/configs/vf610twr_nand_defconfig b/configs/vf610twr_nand_defconfig
index c50afc4bec..2cef898863 100644
--- a/configs/vf610twr_nand_defconfig
+++ b/configs/vf610twr_nand_defconfig
@@ -48,7 +48,7 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_ENV_RANGE=0x80000
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_VYBRID_GPIO=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_FSL_ESDHC_IMX=y
 CONFIG_MTD=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 07/11] board: novena: convert to DM_I2C
  2024-08-03 16:15 ` [PATCH 07/11] board: novena: " Anatolij Gustschin
@ 2024-08-04  0:21   ` Marek Vasut
  0 siblings, 0 replies; 20+ messages in thread
From: Marek Vasut @ 2024-08-04  0:21 UTC (permalink / raw)
  To: Anatolij Gustschin, u-boot; +Cc: Fabio Estevam, Tom Rini

On 8/3/24 6:15 PM, Anatolij Gustschin wrote:
> Conversion to DM_I2C is mandatory, enable DM_I2C
> to disable board removal warning. Convert EEPROM
> and IT6251 access to use DM_I2C API.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> Cc: Marek Vasut <marex@denx.de>
> Cc: Fabio Estevam <festevam@denx.de>
> Cc: Tom Rini <trini@konsulko.com>

Reviewed-by: Marek Vasut <marex@denx.de>

Thanks !

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 09/11] board: sniper: convert to DM_I2C
  2024-08-03 16:15 ` [PATCH 09/11] board: sniper: " Anatolij Gustschin
@ 2024-08-04 10:05   ` Paul Kocialkowski
  0 siblings, 0 replies; 20+ messages in thread
From: Paul Kocialkowski @ 2024-08-04 10:05 UTC (permalink / raw)
  To: Anatolij Gustschin; +Cc: u-boot, Paul Kocialkowski, Tom Rini

[-- Attachment #1: Type: text/plain, Size: 2310 bytes --]

Hi,

Le Sat 03 Aug 24, 18:15, Anatolij Gustschin a écrit :
> Conversion to DM_I2C is mandatory, enable DM_I2C
> to disable board removal warning. Also enable
> OF_UPSTREAM since we do not have a default device
> tree.

Thanks for looking into this, but I already submitted a similar patch just
a few days ago, with additional cleanups!

See https://patchwork.ozlabs.org/project/uboot/patch/20240729204439.429900-3-paulk@sys-base.io/

Cheers,

Paul

> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> Cc: Paul Kocialkowski <contact@paulk.fr>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>  arch/arm/mach-omap2/omap3/Kconfig | 1 +
>  configs/sniper_defconfig          | 6 ++++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig
> index f15f44fe7d..b56e379ca1 100644
> --- a/arch/arm/mach-omap2/omap3/Kconfig
> +++ b/arch/arm/mach-omap2/omap3/Kconfig
> @@ -115,6 +115,7 @@ config TARGET_SNIPER
>  	select OMAP3_GPIO_5
>  	select OMAP3_GPIO_6
>  	imply CMD_DM
> +	imply OF_UPSTREAM
>  
>  endchoice
>  
> diff --git a/configs/sniper_defconfig b/configs/sniper_defconfig
> index 0243b15f31..29e783da8a 100644
> --- a/configs/sniper_defconfig
> +++ b/configs/sniper_defconfig
> @@ -7,6 +7,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
>  CONFIG_NR_DRAM_BANKS=2
>  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
>  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x4020ff00
> +CONFIG_DEFAULT_DEVICE_TREE="ti/omap/omap3-sniper"
>  CONFIG_SPL_TEXT_BASE=0x40200000
>  CONFIG_TARGET_SNIPER=y
>  CONFIG_SPL_STACK=0x4020fffc
> @@ -32,12 +33,13 @@ CONFIG_CMD_GPIO=y
>  CONFIG_CMD_I2C=y
>  CONFIG_CMD_MMC=y
>  # CONFIG_CMD_SETEXPR is not set
> +CONFIG_OF_CONTROL=y
>  CONFIG_ENV_OVERWRITE=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> -CONFIG_SYS_I2C_LEGACY=y
> +# CONFIG_TI_SYSC is not set
> +CONFIG_DM_I2C=y
>  CONFIG_SPL_SYS_I2C_LEGACY=y
>  CONFIG_SYS_I2C_SPEED=400000
>  CONFIG_TWL4030_INPUT=y
>  CONFIG_MMC_OMAP_HS=y
>  CONFIG_CONS_INDEX=3
> -CONFIG_OF_LIBFDT=y
> -- 
> 2.25.1
> 

-- 
Paul Kocialkowski,

Independent contractor - sys-base - https://www.sys-base.io/
Free software developer - https://www.paulk.fr/

Expertise in multimedia, graphics and embedded hardware support with Linux.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 01/11] board: shc: convert to DM_I2C
  2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
                   ` (9 preceding siblings ...)
  2024-08-03 16:15 ` [PATCH 11/11] board: vf610twr: " Anatolij Gustschin
@ 2024-08-05  4:54 ` Heiko Schocher
  10 siblings, 0 replies; 20+ messages in thread
From: Heiko Schocher @ 2024-08-05  4:54 UTC (permalink / raw)
  To: Anatolij Gustschin, u-boot; +Cc: Tom Rini

Hello Anatolij,

On 03.08.24 18:15, Anatolij Gustschin wrote:
> Conversion to DM_I2C is mandatory, rework to remove
> use of legacy I2C API.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>   board/bosch/shc/board.c              | 22 +++++++++++-----------
>   configs/am335x_shc_defconfig         |  4 +++-
>   configs/am335x_shc_ict_defconfig     |  4 +++-
>   configs/am335x_shc_netboot_defconfig |  4 +++-
>   configs/am335x_shc_sdboot_defconfig  |  4 +++-
>   5 files changed, 23 insertions(+), 15 deletions(-)

Reviewed-by: Heiko Schocher <hs@denx.de>

Thanks!

bye,
Heiko

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs@denx.de

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 10/11] board: cm_fx6: convert to DM_I2C
  2024-08-03 16:15 ` [PATCH 10/11] board: cm_fx6: " Anatolij Gustschin
@ 2024-08-07 11:16   ` Heiko Schocher
  2024-08-07 13:11     ` Anatolij Gustschin
  2024-08-07 13:09   ` [PATCH v2 " Anatolij Gustschin
  1 sibling, 1 reply; 20+ messages in thread
From: Heiko Schocher @ 2024-08-07 11:16 UTC (permalink / raw)
  To: Anatolij Gustschin, u-boot; +Cc: Nikita Kiryanov, Fabio Estevam, Tom Rini

Hello Anatolij,

On 03.08.24 18:15, Anatolij Gustschin wrote:
> Conversion to DM_I2C is mandatory, enable DM_I2C to fix board
> removal warning. Convert EEPROM access to use DM_I2C API.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> Cc: Nikita Kiryanov <nikita@compulab.co.il>
> Cc: Fabio Estevam <festevam@denx.de>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>   board/compulab/cm_fx6/cm_fx6.c |  3 ++-
>   board/compulab/common/Makefile |  2 +-
>   board/compulab/common/eeprom.c | 14 +++++---------
>   board/compulab/common/eeprom.h |  2 +-
>   configs/cm_fx6_defconfig       |  2 +-
>   5 files changed, 10 insertions(+), 13 deletions(-)

This patch breaks world build ... could you take a look?

https://dev.azure.com/hs0298/hs/_build/results?buildId=114&view=logs&j=08d7dacc-cd40-5df3-6db5-bb431d28637a&t=8da0c77f-a38d-54ad-3682-1c9d5ed6f8aa&l=1228

Thanks!

bye,
Heiko

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs@denx.de

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 10/11] board: cm_fx6: convert to DM_I2C
  2024-08-03 16:15 ` [PATCH 10/11] board: cm_fx6: " Anatolij Gustschin
  2024-08-07 11:16   ` Heiko Schocher
@ 2024-08-07 13:09   ` Anatolij Gustschin
  2024-08-07 13:44     ` Fabio Estevam
  1 sibling, 1 reply; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-07 13:09 UTC (permalink / raw)
  To: u-boot; +Cc: Nikita Kiryanov, Fabio Estevam, Heiko Schocher, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C to fix board
removal warning. Convert EEPROM access to use DM_I2C API.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
Changes in v2: fix trimslice build errors

 board/compulab/cm_fx6/cm_fx6.c |  3 ++-
 board/compulab/common/Makefile |  8 +++++++-
 board/compulab/common/eeprom.c | 14 +++++---------
 board/compulab/common/eeprom.h |  2 +-
 configs/cm_fx6_defconfig       |  2 +-
 5 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index c6d33c32cc..40047cf678 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -14,6 +14,7 @@
 #include <env.h>
 #include <fsl_esdhc_imx.h>
 #include <init.h>
+#include <i2c.h>
 #include <miiphy.h>
 #include <mtd_node.h>
 #include <net.h>
@@ -256,7 +257,7 @@ static int cm_fx6_setup_one_i2c(int busnum, struct i2c_pads_info *pads)
 {
 	int ret;
 
-	ret = setup_i2c(busnum, CONFIG_SYS_I2C_SPEED, 0x7f, pads);
+	ret = setup_i2c(busnum, I2C_SPEED_STANDARD_RATE, 0x7f, pads);
 	if (ret)
 		printf("Warning: I2C%d setup failed: %d\n", busnum, ret);
 
diff --git a/board/compulab/common/Makefile b/board/compulab/common/Makefile
index 7c8226e6e1..c7b2237e5c 100644
--- a/board/compulab/common/Makefile
+++ b/board/compulab/common/Makefile
@@ -4,6 +4,12 @@
 #
 # Author: Igor Grinberg <grinberg@compulab.co.il>
 
+CL_EEPROM=y
+
+ifdef CONFIG_TARGET_TRIMSLICE
+CL_EEPROM=
+endif
+
 obj-y				+= common.o
-obj-$(CONFIG_$(SPL_)SYS_I2C_LEGACY)	+= eeprom.o
+obj-$(CL_EEPROM)		+= eeprom.o
 obj-$(CONFIG_SMC911X)		+= omap3_smc911x.o
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index efdaf342d5..1b12d09604 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -34,19 +34,15 @@ static int cl_eeprom_layout; /* Implicitly LAYOUT_INVALID */
 
 static int cl_eeprom_read(uint offset, uchar *buf, int len)
 {
+	struct udevice *eeprom;
 	int res;
-	unsigned int current_i2c_bus = i2c_get_bus_num();
 
-	res = i2c_set_bus_num(cl_eeprom_bus);
-	if (res < 0)
+	res = i2c_get_chip_for_busnum(cl_eeprom_bus, CONFIG_SYS_I2C_EEPROM_ADDR,
+				      CONFIG_SYS_I2C_EEPROM_ADDR_LEN, &eeprom);
+	if (res)
 		return res;
 
-	res = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, offset,
-			CONFIG_SYS_I2C_EEPROM_ADDR_LEN, buf, len);
-
-	i2c_set_bus_num(current_i2c_bus);
-
-	return res;
+	return dm_i2c_read(eeprom, offset, (uint8_t *)buf, len);
 }
 
 static int cl_eeprom_setup(uint eeprom_bus)
diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h
index 9bd7604a99..0a44926ebd 100644
--- a/board/compulab/common/eeprom.h
+++ b/board/compulab/common/eeprom.h
@@ -10,7 +10,7 @@
 #define _EEPROM_
 #include <errno.h>
 
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
+#if !CONFIG_IS_ENABLED(TARGET_TRIMSLICE)
 int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
 u32 cl_eeprom_get_board_rev(uint eeprom_bus);
 int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus);
diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
index 386616cc42..81a39f7073 100644
--- a/configs/cm_fx6_defconfig
+++ b/configs/cm_fx6_defconfig
@@ -80,7 +80,7 @@ CONFIG_BOUNCE_BUFFER=y
 CONFIG_DWC_AHSATA=y
 # CONFIG_DWC_AHSATA_AHCI is not set
 CONFIG_LBA48=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SYS_MXC_I2C3_SPEED=400000
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 10/11] board: cm_fx6: convert to DM_I2C
  2024-08-07 11:16   ` Heiko Schocher
@ 2024-08-07 13:11     ` Anatolij Gustschin
  2024-08-07 13:47       ` Heiko Schocher
  0 siblings, 1 reply; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-07 13:11 UTC (permalink / raw)
  To: Heiko Schocher; +Cc: u-boot, Nikita Kiryanov, Fabio Estevam, Tom Rini

Hello Heiko,

On Wed, 7 Aug 2024 13:16:21 +0200
Heiko Schocher hs@denx.de wrote:

> Hello Anatolij,
> 
> On 03.08.24 18:15, Anatolij Gustschin wrote:
> > Conversion to DM_I2C is mandatory, enable DM_I2C to fix board
> > removal warning. Convert EEPROM access to use DM_I2C API.
> > 
> > Signed-off-by: Anatolij Gustschin <agust@denx.de>
> > ---
> > Cc: Nikita Kiryanov <nikita@compulab.co.il>
> > Cc: Fabio Estevam <festevam@denx.de>
> > Cc: Tom Rini <trini@konsulko.com>
> > ---
> >   board/compulab/cm_fx6/cm_fx6.c |  3 ++-
> >   board/compulab/common/Makefile |  2 +-
> >   board/compulab/common/eeprom.c | 14 +++++---------
> >   board/compulab/common/eeprom.h |  2 +-
> >   configs/cm_fx6_defconfig       |  2 +-
> >   5 files changed, 10 insertions(+), 13 deletions(-)  
> 
> This patch breaks world build ... could you take a look?
> 
> https://dev.azure.com/hs0298/hs/_build/results?buildId=114&view=logs&j=08d7dacc-cd40-5df3-6db5-bb431d28637a&t=8da0c77f-a38d-54ad-3682-1c9d5ed6f8aa&l=1228

I've sent a v2 patch to fix this. Thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 10/11] board: cm_fx6: convert to DM_I2C
  2024-08-07 13:09   ` [PATCH v2 " Anatolij Gustschin
@ 2024-08-07 13:44     ` Fabio Estevam
  0 siblings, 0 replies; 20+ messages in thread
From: Fabio Estevam @ 2024-08-07 13:44 UTC (permalink / raw)
  To: Anatolij Gustschin
  Cc: u-boot, Nikita Kiryanov, Fabio Estevam, Heiko Schocher, Tom Rini

Hi Anatolij,

On Wed, Aug 7, 2024 at 10:09 AM Anatolij Gustschin <agust@denx.de> wrote:
>
> Conversion to DM_I2C is mandatory, enable DM_I2C to fix board
> removal warning. Convert EEPROM access to use DM_I2C API.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> Cc: Nikita Kiryanov <nikita@compulab.co.il>
> Cc: Fabio Estevam <festevam@denx.de>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> Changes in v2: fix trimslice build errors

Reviewed-by: Fabio Estevam <festevam@gmail.com>

Thanks

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 10/11] board: cm_fx6: convert to DM_I2C
  2024-08-07 13:11     ` Anatolij Gustschin
@ 2024-08-07 13:47       ` Heiko Schocher
  0 siblings, 0 replies; 20+ messages in thread
From: Heiko Schocher @ 2024-08-07 13:47 UTC (permalink / raw)
  To: Anatolij Gustschin; +Cc: u-boot, Nikita Kiryanov, Fabio Estevam, Tom Rini

Hello Anatolij,

On 07.08.24 15:11, Anatolij Gustschin wrote:
> Hello Heiko,
> 
> On Wed, 7 Aug 2024 13:16:21 +0200
> Heiko Schocher hs@denx.de wrote:
> 
>> Hello Anatolij,
>>
>> On 03.08.24 18:15, Anatolij Gustschin wrote:
>>> Conversion to DM_I2C is mandatory, enable DM_I2C to fix board
>>> removal warning. Convert EEPROM access to use DM_I2C API.
>>>
>>> Signed-off-by: Anatolij Gustschin <agust@denx.de>
>>> ---
>>> Cc: Nikita Kiryanov <nikita@compulab.co.il>
>>> Cc: Fabio Estevam <festevam@denx.de>
>>> Cc: Tom Rini <trini@konsulko.com>
>>> ---
>>>    board/compulab/cm_fx6/cm_fx6.c |  3 ++-
>>>    board/compulab/common/Makefile |  2 +-
>>>    board/compulab/common/eeprom.c | 14 +++++---------
>>>    board/compulab/common/eeprom.h |  2 +-
>>>    configs/cm_fx6_defconfig       |  2 +-
>>>    5 files changed, 10 insertions(+), 13 deletions(-)
>>
>> This patch breaks world build ... could you take a look?
>>
>> https://dev.azure.com/hs0298/hs/_build/results?buildId=114&view=logs&j=08d7dacc-cd40-5df3-6db5-bb431d28637a&t=8da0c77f-a38d-54ad-3682-1c9d5ed6f8aa&l=1228
> 
> I've sent a v2 patch to fix this. Thanks!

Thanks!

Applied to my local tree.. wait for response/fix from Fedor
for another i2c patch ... than I start another round...

bye,
Heiko
> 
> --
> Anatolij
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs@denx.de

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 08/11] board: vining_2000: convert to DM_I2C
  2024-08-03 16:15 ` [PATCH 08/11] board: vining_2000: " Anatolij Gustschin
@ 2024-08-07 22:34   ` Anatolij Gustschin
  0 siblings, 0 replies; 20+ messages in thread
From: Anatolij Gustschin @ 2024-08-07 22:34 UTC (permalink / raw)
  To: u-boot; +Cc: Silvio Fricke, Fabio Estevam, Heiko Schocher, Tom Rini

Conversion to DM_I2C is mandatory, enable DM_I2C
to disable board removal warning.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Cc: Silvio Fricke <open-source@softing.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
Changes in v2:
  do not remove CONFIG_SYS_I2C_MXC_I2C* to fix build warnings/errors

 board/softing/vining_2000/vining_2000.c | 25 -------------------------
 configs/vining_2000_defconfig           |  2 +-
 2 files changed, 1 insertion(+), 26 deletions(-)

diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c
index a0dbf97524..bd430cfaa7 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -18,7 +18,6 @@
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/io.h>
-#include <asm/mach-imx/mxc_i2c.h>
 #include <asm/sections.h>
 #include <env.h>
 #include <linux/bitops.h>
@@ -27,7 +26,6 @@
 #include <config.h>
 #include <fsl_esdhc_imx.h>
 #include <mmc.h>
-#include <i2c.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <power/pmic.h>
@@ -53,10 +51,6 @@ DECLARE_GLOBAL_DATA_PTR;
 	PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_HIGH |		\
 	PAD_CTL_SRE_FAST)
 
-#define I2C_PAD_CTRL  (PAD_CTL_HYS | PAD_CTL_PUS_100K_UP |	\
-	PAD_CTL_PKE | PAD_CTL_ODE | PAD_CTL_SPEED_MED |		\
-	PAD_CTL_DSE_40ohm)
-
 #define USDHC_CLK_PAD_CTRL  (PAD_CTL_HYS | PAD_CTL_SPEED_MED |	\
 	PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST)
 
@@ -120,21 +114,6 @@ eth_fail:
 	return ret;
 }
 
-#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
-/* I2C1 for PMIC */
-static struct i2c_pads_info i2c_pad_info1 = {
-	.scl = {
-		.i2c_mode = MX6_PAD_GPIO1_IO00__I2C1_SCL | PC,
-		.gpio_mode = MX6_PAD_GPIO1_IO00__GPIO1_IO_0 | PC,
-		.gp = IMX_GPIO_NR(1, 0),
-	},
-	.sda = {
-		.i2c_mode = MX6_PAD_GPIO1_IO01__I2C1_SDA | PC,
-		.gpio_mode = MX6_PAD_GPIO1_IO01__GPIO1_IO_1 | PC,
-		.gp = IMX_GPIO_NR(1, 1),
-	},
-};
-
 static struct pmic *pfuze_init(unsigned char i2cbus)
 {
 	struct pmic *p;
@@ -400,10 +379,6 @@ int board_init(void)
 	/* Address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-#ifdef CONFIG_SYS_I2C_MXC
-	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
-#endif
-
 	return board_net_init();
 }
 
diff --git a/configs/vining_2000_defconfig b/configs/vining_2000_defconfig
index c39597cdf5..e5c9c2861e 100644
--- a/configs/vining_2000_defconfig
+++ b/configs/vining_2000_defconfig
@@ -70,7 +70,7 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_USE_ETHPRIME=y
 CONFIG_ETHPRIME="FEC"
 CONFIG_BOUNCE_BUFFER=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SUPPORT_EMMC_RPMB=y
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2024-08-07 22:34 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-03 16:15 [PATCH 01/11] board: shc: convert to DM_I2C Anatolij Gustschin
2024-08-03 16:15 ` [PATCH 02/11] board: chiliboard: " Anatolij Gustschin
2024-08-03 16:15 ` [PATCH 03/11] board: cm-t43: " Anatolij Gustschin
2024-08-03 16:15 ` [PATCH 04/11] board: igep003x: " Anatolij Gustschin
2024-08-03 16:15 ` [PATCH 05/11] board: sl50: " Anatolij Gustschin
2024-08-03 16:15 ` [PATCH 06/11] board: rut: " Anatolij Gustschin
2024-08-03 16:15 ` [PATCH 07/11] board: novena: " Anatolij Gustschin
2024-08-04  0:21   ` Marek Vasut
2024-08-03 16:15 ` [PATCH 08/11] board: vining_2000: " Anatolij Gustschin
2024-08-07 22:34   ` [PATCH v2 " Anatolij Gustschin
2024-08-03 16:15 ` [PATCH 09/11] board: sniper: " Anatolij Gustschin
2024-08-04 10:05   ` Paul Kocialkowski
2024-08-03 16:15 ` [PATCH 10/11] board: cm_fx6: " Anatolij Gustschin
2024-08-07 11:16   ` Heiko Schocher
2024-08-07 13:11     ` Anatolij Gustschin
2024-08-07 13:47       ` Heiko Schocher
2024-08-07 13:09   ` [PATCH v2 " Anatolij Gustschin
2024-08-07 13:44     ` Fabio Estevam
2024-08-03 16:15 ` [PATCH 11/11] board: vf610twr: " Anatolij Gustschin
2024-08-05  4:54 ` [PATCH 01/11] board: shc: " Heiko Schocher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.