[PATCH 5/6] i2c: Remove non-DM_I2C support from davinci_i2c.c

Tom Rini trini at konsulko.com
Mon Jun 27 19:35:50 CEST 2022


As the migration deadline has passed, and all platforms have been
migrated, remove the non-DM code here.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 arch/arm/mach-keystone/ddr3_spd.c    | 13 ----
 drivers/i2c/Kconfig                  |  4 +-
 drivers/i2c/davinci_i2c.c            | 97 ----------------------------
 include/configs/legoev3.h            |  6 --
 include/configs/omapl138_lcdk.h      |  2 -
 include/configs/ti_armv7_keystone2.h |  8 ---
 6 files changed, 2 insertions(+), 128 deletions(-)

diff --git a/arch/arm/mach-keystone/ddr3_spd.c b/arch/arm/mach-keystone/ddr3_spd.c
index c4a1908af8d0..6f7f8ab7b40c 100644
--- a/arch/arm/mach-keystone/ddr3_spd.c
+++ b/arch/arm/mach-keystone/ddr3_spd.c
@@ -404,24 +404,11 @@ static void init_ddr3param(struct ddr3_spd_cb *spd_cb,
 static int ddr3_read_spd(ddr3_spd_eeprom_t *spd_params)
 {
 	int ret;
-#if !CONFIG_IS_ENABLED(DM_I2C)
-	int old_bus;
-
-	i2c_init(CONFIG_SYS_DAVINCI_I2C_SPEED, CONFIG_SYS_DAVINCI_I2C_SLAVE);
-
-	old_bus = i2c_get_bus_num();
-	i2c_set_bus_num(1);
-
-	ret = i2c_read(0x53, 0, 1, (unsigned char *)spd_params, 256);
-
-	i2c_set_bus_num(old_bus);
-#else
 	struct udevice *dev;
 
 	ret = i2c_get_chip_for_busnum(1, 0x53, 1, &dev);
 	if (!ret)
 		ret = dm_i2c_read(dev, 0, (unsigned char *)spd_params, 256);
-#endif
 	if (ret) {
 		printf("Cannot read DIMM params\n");
 		return 1;
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index d25c5736ef08..72d06e4972b5 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -687,9 +687,9 @@ config SYS_I2C_SPEED
 
 config SYS_I2C_BUS_MAX
 	int "Max I2C busses"
-	depends on ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_SOCFPGA
+	depends on ARCH_OMAP2PLUS || ARCH_SOCFPGA
 	default 2 if TI816X
-	default 3 if OMAP34XX || AM33XX || AM43XX || ARCH_KEYSTONE
+	default 3 if OMAP34XX || AM33XX || AM43XX
 	default 4 if ARCH_SOCFPGA || OMAP44XX || TI814X
 	default 5 if OMAP54XX
 	help
diff --git a/drivers/i2c/davinci_i2c.c b/drivers/i2c/davinci_i2c.c
index a4abd25c3987..ae177227dea3 100644
--- a/drivers/i2c/davinci_i2c.c
+++ b/drivers/i2c/davinci_i2c.c
@@ -21,14 +21,12 @@
 #include <linux/delay.h>
 #include "davinci_i2c.h"
 
-#if CONFIG_IS_ENABLED(DM_I2C)
 /* Information about i2c controller */
 struct i2c_bus {
 	int			id;
 	uint			speed;
 	struct i2c_regs		*regs;
 };
-#endif
 
 #define CHECK_NACK() \
 	do {\
@@ -340,99 +338,6 @@ static int _davinci_i2c_probe_chip(struct i2c_regs *i2c_base, uint8_t chip)
 	return rc;
 }
 
-#if !CONFIG_IS_ENABLED(DM_I2C)
-static struct i2c_regs *davinci_get_base(struct i2c_adapter *adap)
-{
-	switch (adap->hwadapnr) {
-#if CONFIG_SYS_I2C_BUS_MAX >= 3
-	case 2:
-		return (struct i2c_regs *)I2C2_BASE;
-#endif
-#if CONFIG_SYS_I2C_BUS_MAX >= 2
-	case 1:
-		return (struct i2c_regs *)I2C1_BASE;
-#endif
-	case 0:
-		return (struct i2c_regs *)I2C_BASE;
-
-	default:
-		printf("wrong hwadapnr: %d\n", adap->hwadapnr);
-	}
-
-	return NULL;
-}
-
-static uint davinci_i2c_setspeed(struct i2c_adapter *adap, uint speed)
-{
-	struct i2c_regs *i2c_base = davinci_get_base(adap);
-	uint ret;
-
-	adap->speed = speed;
-	ret =  _davinci_i2c_setspeed(i2c_base, speed);
-
-	return ret;
-}
-
-static void davinci_i2c_init(struct i2c_adapter *adap, int speed,
-			     int slaveadd)
-{
-	struct i2c_regs *i2c_base = davinci_get_base(adap);
-
-	adap->speed = speed;
-	_davinci_i2c_init(i2c_base, speed, slaveadd);
-
-	return;
-}
-
-static int davinci_i2c_read(struct i2c_adapter *adap, uint8_t chip,
-			    uint32_t addr, int alen, uint8_t *buf, int len)
-{
-	struct i2c_regs *i2c_base = davinci_get_base(adap);
-	return _davinci_i2c_read(i2c_base, chip, addr, alen, buf, len);
-}
-
-static int davinci_i2c_write(struct i2c_adapter *adap, uint8_t chip,
-			     uint32_t addr, int alen, uint8_t *buf, int len)
-{
-	struct i2c_regs *i2c_base = davinci_get_base(adap);
-
-	return _davinci_i2c_write(i2c_base, chip, addr, alen, buf, len);
-}
-
-static int davinci_i2c_probe_chip(struct i2c_adapter *adap, uint8_t chip)
-{
-	struct i2c_regs *i2c_base = davinci_get_base(adap);
-
-	return _davinci_i2c_probe_chip(i2c_base, chip);
-}
-
-U_BOOT_I2C_ADAP_COMPLETE(davinci_0, davinci_i2c_init, davinci_i2c_probe_chip,
-			 davinci_i2c_read, davinci_i2c_write,
-			 davinci_i2c_setspeed,
-			 CONFIG_SYS_DAVINCI_I2C_SPEED,
-			 CONFIG_SYS_DAVINCI_I2C_SLAVE,
-			 0)
-
-#if CONFIG_SYS_I2C_BUS_MAX >= 2
-U_BOOT_I2C_ADAP_COMPLETE(davinci_1, davinci_i2c_init, davinci_i2c_probe_chip,
-			 davinci_i2c_read, davinci_i2c_write,
-			 davinci_i2c_setspeed,
-			 CONFIG_SYS_DAVINCI_I2C_SPEED1,
-			 CONFIG_SYS_DAVINCI_I2C_SLAVE1,
-			 1)
-#endif
-
-#if CONFIG_SYS_I2C_BUS_MAX >= 3
-U_BOOT_I2C_ADAP_COMPLETE(davinci_2, davinci_i2c_init, davinci_i2c_probe_chip,
-			 davinci_i2c_read, davinci_i2c_write,
-			 davinci_i2c_setspeed,
-			 CONFIG_SYS_DAVINCI_I2C_SPEED2,
-			 CONFIG_SYS_DAVINCI_I2C_SLAVE2,
-			 2)
-#endif
-
-#else /* CONFIG_DM_I2C */
-
 static int davinci_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
 			  int nmsgs)
 {
@@ -507,5 +412,3 @@ U_BOOT_DRIVER(i2c_davinci) = {
 	.priv_auto	= sizeof(struct i2c_bus),
 	.ops	= &davinci_i2c_ops,
 };
-
-#endif /* CONFIG_DM_I2C */
diff --git a/include/configs/legoev3.h b/include/configs/legoev3.h
index 418b08e73356..f0ae9248af34 100644
--- a/include/configs/legoev3.h
+++ b/include/configs/legoev3.h
@@ -41,12 +41,6 @@
 
 #define CONFIG_SYS_SPI_CLK		clk_get(DAVINCI_SPI0_CLKID)
 
-/*
- * I2C Configuration
- */
-#define CONFIG_SYS_DAVINCI_I2C_SPEED		400000
-#define CONFIG_SYS_DAVINCI_I2C_SLAVE   10 /* Bogus, master-only in U-Boot */
-
 /*
  * U-Boot general configuration
  */
diff --git a/include/configs/omapl138_lcdk.h b/include/configs/omapl138_lcdk.h
index c9f5004117f2..c644768ae7d7 100644
--- a/include/configs/omapl138_lcdk.h
+++ b/include/configs/omapl138_lcdk.h
@@ -99,8 +99,6 @@
 /*
  * I2C Configuration
  */
-#define CONFIG_SYS_DAVINCI_I2C_SPEED	25000
-#define CONFIG_SYS_DAVINCI_I2C_SLAVE	10 /* Bogus, master-only in U-Boot */
 #define CONFIG_SYS_I2C_EXPANDER_ADDR	0x20
 
 /*
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h
index bf76afaededc..29a6038f8985 100644
--- a/include/configs/ti_armv7_keystone2.h
+++ b/include/configs/ti_armv7_keystone2.h
@@ -59,14 +59,6 @@
 #define CONFIG_KSNET_SERDES_SGMII2_BASE		KS2_SGMII_SERDES2_BASE
 #define CONFIG_KSNET_SERDES_LANES_PER_SGMII	KS2_LANES_PER_SGMII_SERDES
 
-/* I2C Configuration */
-#define CONFIG_SYS_DAVINCI_I2C_SPEED	100000
-#define CONFIG_SYS_DAVINCI_I2C_SLAVE	0x10 /* SMBus host address */
-#define CONFIG_SYS_DAVINCI_I2C_SPEED1	100000
-#define CONFIG_SYS_DAVINCI_I2C_SLAVE1	0x10 /* SMBus host address */
-#define CONFIG_SYS_DAVINCI_I2C_SPEED2	100000
-#define CONFIG_SYS_DAVINCI_I2C_SLAVE2	0x10 /* SMBus host address */
-
 /* EEPROM definitions */
 
 /* NAND Configuration */
-- 
2.25.1



More information about the U-Boot mailing list