All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>, Heiko Schocher <hs@denx.de>,
	Simon Glass <sjg@chromium.org>,
	Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Martyn Welch <martyn.welch@collabora.com>,
	Philip Richard Oberfichtner <pro@denx.de>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	Sean Anderson <seanga2@gmail.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>
Subject: [PATCH 19/20] i2c: Remove CFG_SYS_I2C_MAX_HOPS
Date: Thu, 18 Jul 2024 18:36:10 +0100	[thread overview]
Message-ID: <20240718173611.4014274-20-sjg@chromium.org> (raw)
In-Reply-To: <20240718173611.4014274-1-sjg@chromium.org>

Now that this is always 0, remove it and the associated dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 README                 | 10 +---------
 cmd/i2c.c              | 23 -----------------------
 drivers/i2c/i2c_core.c | 37 -------------------------------------
 include/i2c.h          |  7 -------
 4 files changed, 1 insertion(+), 76 deletions(-)

diff --git a/README b/README
index 4b4d946e3fa..44dafa3be98 100644
--- a/README
+++ b/README
@@ -773,19 +773,11 @@ The following options need to be configured:
 
 		CFG_SYS_I2C_DIRECT_BUS
 		define this, if you don't use i2c muxes on your hardware.
-		if CFG_SYS_I2C_MAX_HOPS is not defined or == 0 you can
-		omit this define.
-
-		CFG_SYS_I2C_MAX_HOPS
-		define how many muxes are maximal consecutively connected
-		on one i2c bus. If you not use i2c muxes, omit this
-		define.
 
 		CFG_SYS_I2C_BUSES
 		hold a list of buses you want to use, only used if
 		CFG_SYS_I2C_DIRECT_BUS is not defined, for example
-		a board with CFG_SYS_I2C_MAX_HOPS = 1 and
-		CFG_SYS_NUM_I2C_BUSES = 9:
+		a board with CFG_SYS_NUM_I2C_BUSES = 9:
 
 		 CFG_SYS_I2C_BUSES	{{0, {I2C_NULL_HOP}}, \
 					{0, {{I2C_MUX_PCA9547, 0x70, 1}}}, \
diff --git a/cmd/i2c.c b/cmd/i2c.c
index 7dac0a9fb6c..7246c4fa3e7 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -1698,18 +1698,6 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
 
 		for (i = 0; i < CFG_SYS_NUM_I2C_BUSES; i++) {
 			printf("Bus %d:\t%s", i, I2C_ADAP_NR(i)->name);
-#ifndef CFG_SYS_I2C_DIRECT_BUS
-			int j;
-
-			for (j = 0; j < CFG_SYS_I2C_MAX_HOPS; j++) {
-				if (i2c_bus[i].next_hop[j].chip == 0)
-					break;
-				printf("->%s@0x%2x:%d",
-				       i2c_bus[i].next_hop[j].mux.name,
-				       i2c_bus[i].next_hop[j].chip,
-				       i2c_bus[i].next_hop[j].channel);
-			}
-#endif
 			printf("\n");
 		}
 #endif
@@ -1734,17 +1722,6 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
 			return -1;
 		}
 		printf("Bus %d:\t%s", i, I2C_ADAP_NR(i)->name);
-#ifndef CFG_SYS_I2C_DIRECT_BUS
-			int j;
-			for (j = 0; j < CFG_SYS_I2C_MAX_HOPS; j++) {
-				if (i2c_bus[i].next_hop[j].chip == 0)
-					break;
-				printf("->%s@0x%2x:%d",
-				       i2c_bus[i].next_hop[j].mux.name,
-				       i2c_bus[i].next_hop[j].chip,
-				       i2c_bus[i].next_hop[j].channel);
-			}
-#endif
 		printf("\n");
 #endif
 	}
diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index 7c43a5546d3..f371d952af5 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -111,23 +111,6 @@ static int i2c_mux_set_all(void)
 	struct i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS];
 	int i;
 
-	/* Connect requested bus if behind muxes */
-	if (i2c_bus_tmp->next_hop[0].chip != 0) {
-		/* Set all muxes along the path to that bus */
-		for (i = 0; i < CFG_SYS_I2C_MAX_HOPS; i++) {
-			int	ret;
-
-			if (i2c_bus_tmp->next_hop[i].chip == 0)
-				break;
-
-			ret = i2c_mux_set(I2C_ADAP,
-					i2c_bus_tmp->next_hop[i].mux.id,
-					i2c_bus_tmp->next_hop[i].chip,
-					i2c_bus_tmp->next_hop[i].channel);
-			if (ret != 0)
-				return ret;
-		}
-	}
 	return 0;
 }
 
@@ -140,26 +123,6 @@ static int i2c_mux_disconnect_all(void)
 	if (I2C_ADAP->init_done == 0)
 		return 0;
 
-	/* Disconnect current bus (turn off muxes if any) */
-	if ((i2c_bus_tmp->next_hop[0].chip != 0) &&
-	    (I2C_ADAP->init_done != 0)) {
-		i = CFG_SYS_I2C_MAX_HOPS;
-		do {
-			uint8_t	chip;
-			int ret;
-
-			chip = i2c_bus_tmp->next_hop[--i].chip;
-			if (chip == 0)
-				continue;
-
-			ret = I2C_ADAP->write(I2C_ADAP, chip, 0, 0, &buf, 1);
-			if (ret != 0) {
-				printf("i2c: mux disconnect error\n");
-				return ret;
-			}
-		} while (i > 0);
-	}
-
 	return 0;
 }
 #endif
diff --git a/include/i2c.h b/include/i2c.h
index f468b52cd7b..180b71f1451 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -645,15 +645,9 @@ void i2c_early_init_f(void);
  */
 #define I2C_RXTX_LEN	128	/* maximum tx/rx buffer length */
 
-#if !defined(CFG_SYS_I2C_MAX_HOPS)
 /* no muxes used bus = i2c adapters */
 #define CFG_SYS_I2C_DIRECT_BUS	1
-#define CFG_SYS_I2C_MAX_HOPS		0
 #define CFG_SYS_NUM_I2C_BUSES	ll_entry_count(struct i2c_adapter, i2c)
-#else
-/* we use i2c muxes */
-#undef CFG_SYS_I2C_DIRECT_BUS
-#endif
 
 struct i2c_adapter {
 	void		(*init)(struct i2c_adapter *adap, int speed,
@@ -712,7 +706,6 @@ struct i2c_next_hop {
 
 struct i2c_bus_hose {
 	int	adapter;
-	struct i2c_next_hop	next_hop[CFG_SYS_I2C_MAX_HOPS];
 };
 #define I2C_NULL_HOP	{{-1, ""}, 0, 0}
 extern struct i2c_bus_hose	i2c_bus[];
-- 
2.34.1


  parent reply	other threads:[~2024-07-18 17:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 17:35 [PATCH 00/20] i2c: Chip away at some old code Simon Glass
2024-07-18 17:35 ` [PATCH 01/20] arm: Remove pg_wcom boards Simon Glass
2024-07-19  8:50   ` Anatolij Gustschin
2024-07-19 19:20     ` Anatolij Gustschin
2024-07-18 17:35 ` [PATCH 02/20] i2c: Remove board_i2c_init() Simon Glass
2024-07-18 17:35 ` [PATCH 03/20] i2c: Remove IC2_xxx enum Simon Glass
2024-07-18 17:35 ` [PATCH 04/20] i2c: Remove CFG_I2C_MULTI_BUS Simon Glass
2024-07-18 17:35 ` [PATCH 05/20] mips: malta: Drop CMD_DATE Simon Glass
2024-07-18 17:35 ` [PATCH 06/20] armv8: ls2085a: " Simon Glass
2024-07-18 17:35 ` [PATCH 07/20] mx28 / mx51: " Simon Glass
2024-07-18 17:35 ` [PATCH 08/20] MPC837XERDB: ethernut5: work_92105: " Simon Glass
2024-07-18 17:36 ` [PATCH 09/20] rtc: Drop CFG_SYS_RTC_BUS_NUM Simon Glass
2024-07-18 17:36 ` [PATCH 10/20] date: Drop the legacy I2C code Simon Glass
2024-07-18 17:36 ` [PATCH 11/20] keymile: Remove use of legacy I2C Simon Glass
2024-07-19 23:36   ` Anatolij Gustschin
2024-07-22  4:10     ` Heiko Schocher
2024-07-18 17:36 ` [PATCH 12/20] i2c: mxc: pg_wcom: Drop legacy I2c Simon Glass
2024-07-18 17:36 ` [PATCH 13/20] i2c: Drop reference to SYS_I2C_INIT_BOARD Simon Glass
2024-07-18 17:36 ` [PATCH 14/20] octeon: Drop OCTEON_I2C_FDT dead code Simon Glass
2024-07-18 17:36 ` [PATCH 15/20] i2c: Remove I2C_SET_BUS() Simon Glass
2024-07-18 17:36 ` [PATCH 16/20] i2c: Remove I2C_GET_BUS() Simon Glass
2024-07-18 17:36 ` [PATCH 17/20] i2c: Drop CFG_SYS_MAX_I2C_BUS Simon Glass
2024-07-18 17:36 ` [PATCH 18/20] i2c: Drop i2c_get_bus_num_fdt() and i2c_reset_port_fdt() Simon Glass
2024-07-18 17:36 ` Simon Glass [this message]
2024-07-18 17:36 ` [PATCH 20/20] i2c: Remove CFG_SYS_I2C_DIRECT_BUS Simon Glass
2024-08-09 18:37 ` [PATCH 00/20] i2c: Chip away at some old code Simon Glass
2024-08-09 18:56   ` Tom Rini
2024-08-09 19:58     ` Anatolij Gustschin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240718173611.4014274-20-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=clamor95@gmail.com \
    --cc=hs@denx.de \
    --cc=marcel.ziswiler@toradex.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=martyn.welch@collabora.com \
    --cc=pro@denx.de \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=seanga2@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.