summaryrefslogtreecommitdiff
path: root/board/keymile/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-07-23 10:43:58 -0600
committerTom Rini <trini@konsulko.com>2024-07-23 10:43:58 -0600
commitf659ba43837e5ae5a35fdff3736c8e13f9062abd (patch)
treeb14ed130f0e1a7efd85a755f389ac8788fd603c0 /board/keymile/common
parent123f6f75dfcb5f88d821e4eb91ddedfb7718d601 (diff)
parent3a63612c5f7b20e24a0bfebc5686dc78dfee6510 (diff)
Merge branch '2024-07-23-remove-or-update-some-platforms'
- Update a few platforms to use DM_I2C finally, and remove a number of other older platforms.
Diffstat (limited to 'board/keymile/common')
-rw-r--r--board/keymile/common/common.c12
-rw-r--r--board/keymile/common/common.h3
-rw-r--r--board/keymile/common/ivm.c18
3 files changed, 7 insertions, 26 deletions
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 9358c25dcb0..25897af2d8a 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -129,7 +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);
@@ -187,17 +186,6 @@ int i2c_make_abort(void)
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)
{
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index d16c82487b8..7d2fdffe983 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -138,13 +138,12 @@ void early_bootcount_store(ulong ebootcount);
void check_for_uboot_update(void);
#define DELAY_ABORT_SEQ 62 /* @200kHz 9 clocks = 44us, 62us is ok */
-#define DELAY_HALF_PERIOD (500 / (CONFIG_SYS_I2C_SPEED / 1000))
+#define DELAY_HALF_PERIOD (500 / (I2C_SPEED_STANDARD_RATE / 1000))
void set_sda(int state);
void set_scl(int state);
int get_sda(void);
int get_scl(void);
-int i2c_soft_read_pin(void);
int i2c_make_abort(void);
#endif /* __KEYMILE_COMMON_H */
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index f01fe44303c..9360c86566f 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -342,9 +342,8 @@ static int ivm_populate_env(unsigned char *buf, int len, int mac_address_offset)
int ivm_read_eeprom(unsigned char *buf, int len, int mac_address_offset)
{
- int ret;
-#if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *eedev = NULL;
+ int ret;
ret = i2c_get_chip_for_busnum(CONFIG_KM_IVM_BUS,
CONFIG_SYS_IVM_EEPROM_ADR, 1, &eedev);
@@ -354,22 +353,17 @@ int ivm_read_eeprom(unsigned char *buf, int len, int mac_address_offset)
return 1;
}
+#if CONFIG_IS_ENABLED(ARCH_LS1021A)
+ /* add deblocking here */
+ i2c_make_abort();
+#endif
+
ret = dm_i2c_read(eedev, 0, buf, len);
if (ret != 0) {
printf("Error: Unable to read from I2C EEPROM at address %02X:%02X\n",
CONFIG_SYS_IVM_EEPROM_ADR, 0);
return 1;
}
-#else
- i2c_set_bus_num(CONFIG_KM_IVM_BUS);
- /* add deblocking here */
- i2c_make_abort();
- ret = i2c_read(CONFIG_SYS_IVM_EEPROM_ADR, 0, 1, buf, len);
- if (ret != 0) {
- printf("Error reading EEprom\n");
- return -2;
- }
-#endif
return ivm_populate_env(buf, len, mac_address_offset);
}