[PATCH 11/20] keymile: Remove use of legacy I2C

Simon Glass sjg at chromium.org
Thu Jul 18 19:36:02 CEST 2024


Drop this old code to permit removal of legacy I2C code.

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

 board/keymile/Kconfig         |  3 --
 board/keymile/common/common.c | 69 -----------------------------------
 2 files changed, 72 deletions(-)

diff --git a/board/keymile/Kconfig b/board/keymile/Kconfig
index 18ef689b334..3585941470e 100644
--- a/board/keymile/Kconfig
+++ b/board/keymile/Kconfig
@@ -11,9 +11,6 @@ if VENDOR_KM
 
 menu "KM Board Setup"
 
-config SYS_I2C_INIT_BOARD
-	def_bool y if ARM
-
 config HUSH_INIT_VAR
 	def_bool y
 
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 9358c25dcb0..5aa7c4e5383 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -129,75 +129,6 @@ void check_for_uboot_update(void)
 }
 #endif
 
-#if defined(CONFIG_SYS_I2C_INIT_BOARD)
-static void i2c_write_start_seq(void)
-{
-	set_sda(1);
-	udelay(DELAY_HALF_PERIOD);
-	set_scl(1);
-	udelay(DELAY_HALF_PERIOD);
-	set_sda(0);
-	udelay(DELAY_HALF_PERIOD);
-	set_scl(0);
-	udelay(DELAY_HALF_PERIOD);
-}
-
-/*
- * I2C is a synchronous protocol and resets of the processor in the middle
- * of an access can block the I2C Bus until a powerdown of the full unit is
- * done. This function toggles the SCL until the SCL and SCA line are
- * released, but max. 16 times, after this a I2C start-sequence is sent.
- * This I2C Deblocking mechanism was developed by Keymile in association
- * with Anatech and Atmel in 1998.
- */
-int i2c_make_abort(void)
-{
-	int	scl_state = 0;
-	int	sda_state = 0;
-	int	i = 0;
-	int	ret = 0;
-
-	if (!get_sda()) {
-		ret = -1;
-		while (i < 16) {
-			i++;
-			set_scl(0);
-			udelay(DELAY_ABORT_SEQ);
-			set_scl(1);
-			udelay(DELAY_ABORT_SEQ);
-			scl_state = get_scl();
-			sda_state = get_sda();
-			if (scl_state && sda_state) {
-				ret = 0;
-				break;
-			}
-		}
-	}
-	if (ret == 0)
-		for (i = 0; i < 5; i++)
-			i2c_write_start_seq();
-
-	/* respect stop setup time */
-	udelay(DELAY_ABORT_SEQ);
-	set_scl(1);
-	udelay(DELAY_ABORT_SEQ);
-	set_sda(1);
-	get_sda();
-
-	return ret;
-}
-
-/**
- * i2c_init_board - reset i2c bus. When the board is powercycled during a
- * bus transfer it might hang; for details see doc/I2C_Edge_Conditions.
- */
-void i2c_init_board(void)
-{
-	/* Now run the AbortSequence() */
-	i2c_make_abort();
-}
-#endif
-
 #if defined(CONFIG_KM_COMMON_ETH_INIT)
 int board_eth_init(struct bd_info *bis)
 {
-- 
2.34.1



More information about the U-Boot mailing list