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>,
	Angelo Dureghello <angelo@kernel-space.org>,
	Holger Brunck <holger.brunck@hitachienergy.com>,
	Michal Simek <michal.simek@amd.com>, Niel Fourie <lusus@denx.de>,
	Svyatoslav Ryhel <clamor95@gmail.com>
Subject: [PATCH 11/20] keymile: Remove use of legacy I2C
Date: Thu, 18 Jul 2024 18:36:02 +0100	[thread overview]
Message-ID: <20240718173611.4014274-12-sjg@chromium.org> (raw)
In-Reply-To: <20240718173611.4014274-1-sjg@chromium.org>

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

Signed-off-by: Simon Glass <sjg@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


  parent reply	other threads:[~2024-07-18 17:38 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 ` Simon Glass [this message]
2024-07-19 23:36   ` [PATCH 11/20] keymile: Remove use of legacy I2C 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 ` [PATCH 19/20] i2c: Remove CFG_SYS_I2C_MAX_HOPS Simon Glass
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-12-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=angelo@kernel-space.org \
    --cc=clamor95@gmail.com \
    --cc=holger.brunck@hitachienergy.com \
    --cc=hs@denx.de \
    --cc=lusus@denx.de \
    --cc=michal.simek@amd.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.