[PATCH 20/41] i2c: Remove CONFIG_I2C_MULTI_BUS

Tom Rini
2022-12-02T21:46:41Z

This functionality is part of the legacy I2C subsystem and is currently
unused anywhere. Remove the remaining references.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
README | 10 +--------
cmd/i2c.c | 15 +++++--------
drivers/i2c/mv_i2c.c | 33 ----------------------------
include/configs/display5.h | 3 ---
include/configs/km/pg-wcom-ls102xa.h | 1 -
include/configs/novena.h | 3 ---
6 files changed, 7 insertions(+), 58 deletions(-)

diff --git a/README b/README
index c0f55b2586cf..120963317608 100644
--- a/README
+++ b/README
@@ -984,21 +984,13 @@ The following options need to be configured:
CFG_SYS_I2C_NOPROBES

This option specifies a list of I2C devices that will be skipped
- when the 'i2c probe' command is issued. If CONFIG_I2C_MULTI_BUS
- is set, specify a list of bus-device pairs. Otherwise, specify
- a 1D array of device addresses
+ when the 'i2c probe' command is issued.

e.g.
- #undef CONFIG_I2C_MULTI_BUS
#define CFG_SYS_I2C_NOPROBES {0x50,0x68}

will skip addresses 0x50 and 0x68 on a board with one I2C bus

- #define CONFIG_I2C_MULTI_BUS
- #define CFG_SYS_I2C_NOPROBES {{0,0x50},{0,0x68},{1,0x54}}
-
- will skip addresses 0x50 and 0x68 on bus 0 and address 0x54 on bus 1
-
CFG_SYS_RTC_BUS_NUM

If defined, then this indicates the I2C bus number for the RTC.
diff --git a/cmd/i2c.c b/cmd/i2c.c
index da8b4c255555..f204061cf09f 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -98,7 +98,7 @@ static uint i2c_mm_last_alen;
* pairs. The following macros take care of this */

#if defined(CFG_SYS_I2C_NOPROBES)
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || defined(CONFIG_I2C_MULTI_BUS)
+#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
static struct
{
uchar bus;
@@ -1764,8 +1764,7 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || defined(CONFIG_I2C_MULTI_BUS) || \
- CONFIG_IS_ENABLED(DM_I2C)
+#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
@@ -1915,10 +1914,9 @@ static struct cmd_tbl cmd_i2c_sub[] = {
U_BOOT_CMD_MKENT(bus, 1, 1, do_i2c_show_bus, "", ""),
#endif
U_BOOT_CMD_MKENT(crc32, 3, 1, do_i2c_crc, "", ""),
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || \
- defined(CONFIG_I2C_MULTI_BUS) || CONFIG_IS_ENABLED(DM_I2C)
+#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
U_BOOT_CMD_MKENT(dev, 1, 1, do_i2c_bus_num, "", ""),
-#endif /* CONFIG_I2C_MULTI_BUS */
+#endif
#if defined(CONFIG_I2C_EDID)
U_BOOT_CMD_MKENT(edid, 1, 1, do_edid, "", ""),
#endif /* CONFIG_I2C_EDID */
@@ -1992,10 +1990,9 @@ static char i2c_help_text[] =
"i2c " /* That's the prefix for the crc32 command below. */
#endif
"crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n"
-#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || \
- defined(CONFIG_I2C_MULTI_BUS) || CONFIG_IS_ENABLED(DM_I2C)
+#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) || CONFIG_IS_ENABLED(DM_I2C)
"i2c dev [dev] - show or set current I2C bus\n"
-#endif /* CONFIG_I2C_MULTI_BUS */
+#endif
#if defined(CONFIG_I2C_EDID)
"i2c edid chip - print EDID configuration information\n"
#endif /* CONFIG_I2C_EDID */
diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c
index 8ee17f0a4501..5bc9cd7b295a 100644
--- a/drivers/i2c/mv_i2c.c
+++ b/drivers/i2c/mv_i2c.c
@@ -374,45 +374,12 @@ static int __i2c_write(struct mv_i2c *base, uchar chip, u8 *addr, int alen,

static struct mv_i2c *base_glob;

-#ifdef CONFIG_I2C_MULTI_BUS
-static unsigned long i2c_regs[CONFIG_MV_I2C_NUM] = CONFIG_MV_I2C_REG;
-static unsigned int bus_initialized[CONFIG_MV_I2C_NUM];
-static unsigned int current_bus;
-
-int i2c_set_bus_num(unsigned int bus)
-{
- if ((bus < 0) || (bus >= CONFIG_MV_I2C_NUM)) {
- printf("Bad bus: %d\n", bus);
- return -1;
- }
-
- base_glob = (struct mv_i2c *)i2c_regs[bus];
- current_bus = bus;
-
- if (!bus_initialized[current_bus]) {
- bus_initialized[current_bus] = 1;
- }
-
- return 0;
-}
-
-unsigned int i2c_get_bus_num(void)
-{
- return current_bus;
-}
-#endif
-
/* API Functions */
void i2c_init(int speed, int slaveaddr)
{
u32 val;

-#ifdef CONFIG_I2C_MULTI_BUS
- current_bus = 0;
- base_glob = (struct mv_i2c *)i2c_regs[current_bus];
-#else
base_glob = (struct mv_i2c *)CONFIG_MV_I2C_REG;
-#endif

if (speed > I2C_SPEED_STANDARD_RATE)
val = ICR_FM;
diff --git a/include/configs/display5.h b/include/configs/display5.h
index 7636d2869a9f..5cbeb9224c36 100644
--- a/include/configs/display5.h
+++ b/include/configs/display5.h
@@ -36,9 +36,6 @@

#define CONFIG_MXC_UART_BASE UART5_BASE

-/* I2C Configs */
-#define CONFIG_I2C_MULTI_BUS
-
/* MMC Configs */
#define CFG_SYS_FSL_ESDHC_ADDR 0
#define CFG_SYS_FSL_USDHC_NUM 2
diff --git a/include/configs/km/pg-wcom-ls102xa.h b/include/configs/km/pg-wcom-ls102xa.h
index a8dc41df0088..45997c75128c 100644
--- a/include/configs/km/pg-wcom-ls102xa.h
+++ b/include/configs/km/pg-wcom-ls102xa.h
@@ -152,7 +152,6 @@
* I2C
*/

-#define CONFIG_I2C_MULTI_BUS
#define CFG_SYS_I2C_MAX_HOPS 1
#define CFG_SYS_NUM_I2C_BUSES 3
#define I2C_MUX_PCA_ADDR 0x70
diff --git a/include/configs/novena.h b/include/configs/novena.h
index 6e4bdce1c08d..79e49c74f856 100644
--- a/include/configs/novena.h
+++ b/include/configs/novena.h
@@ -33,9 +33,6 @@
#define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
#define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE

-/* I2C */
-#define CONFIG_I2C_MULTI_BUS
-
/* I2C EEPROM */

/* MMC Configs */
--
2.25.1