i2c: Drop use of CONFIG_I2C_HARD
This option is pretty old. It predates CONFIG_SYS_I2C which is itself
deprecated in favour of driver model. Disable it for all boards.
Also drop I2C options which depend on this.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/board/cm5200/cm5200.c b/board/cm5200/cm5200.c
index 7b86235..2f55191 100644
--- a/board/cm5200/cm5200.c
+++ b/board/cm5200/cm5200.c
@@ -161,14 +161,7 @@
*/
static void read_hw_id(hw_id_t hw_id)
{
- int i;
- for (i = 0; i < HW_ID_ELEM_COUNT; ++i)
- if (i2c_read(CONFIG_SYS_I2C_EEPROM,
- hw_id_format[i].offset,
- 2,
- (uchar *)&hw_id[i][0],
- hw_id_format[i].length) != 0)
- printf("ERROR: can't read HW ID from EEPROM\n");
+ printf("ERROR: can't read HW ID from EEPROM\n");
}
@@ -221,7 +214,7 @@
strcat(buf, tmp);
}
-
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT)
/*
* Compose string with hostname.
* buf is assumed to have enough space, and be null-terminated.
@@ -237,7 +230,7 @@
*p = tolower(*p);
}
-
+#endif
#ifdef CONFIG_OF_BOARD_SETUP
/*
@@ -270,15 +263,6 @@
hw_id_t hw_id_tmp;
char module_name_tmp[MODULE_NAME_MAXLEN] = "";
- /*
- * We need I2C to access HW ID data from EEPROM, so we call i2c_init()
- * here despite the fact that it will be called again later on. We
- * also use a little trick to silence I2C-related output.
- */
- gd->flags |= GD_FLG_SILENT;
- i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
- gd->flags &= ~GD_FLG_SILENT;
-
read_hw_id(hw_id_tmp);
identify_module(hw_id_tmp); /* this sets gd->board_type */
compose_module_name(hw_id_tmp, module_name_tmp);
@@ -334,16 +318,16 @@
" device at address %02X:%04X\n", CONFIG_SYS_I2C_EEPROM,
CONFIG_MAC_OFFSET);
}
+ hostname[0] = 0x00;
+ /* set the hostname appropriate to the module we're running on */
+ compose_hostname(hw_id, hostname);
+ setenv("hostname", hostname);
+
#endif /* defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) */
if (!getenv("ethaddr"))
printf(LOG_PREFIX "MAC address not set, networking is not "
"operational\n");
- /* set the hostname appropriate to the module we're running on */
- hostname[0] = 0x00;
- compose_hostname(hw_id, hostname);
- setenv("hostname", hostname);
-
return 0;
}
#endif /* CONFIG_MISC_INIT_R */
diff --git a/board/cm5200/cmd_cm5200.c b/board/cm5200/cmd_cm5200.c
index 9c40ad7..60097dc 100644
--- a/board/cm5200/cmd_cm5200.c
+++ b/board/cm5200/cmd_cm5200.c
@@ -13,34 +13,6 @@
#ifdef CONFIG_CMD_BSP
-static int do_i2c_test(char * const argv[])
-{
- unsigned char temp, temp1;
-
- printf("Starting I2C Test\n"
- "Please set Jumper:\nI2C SDA 2-3\nI2C SCL 2-3\n\n"
- "Please press any key to start\n\n");
- getc();
-
- temp = 0xf0; /* set io 0-4 as output */
- i2c_write(CONFIG_SYS_I2C_IO, 3, 1, (uchar *)&temp, 1);
-
- printf("Press I2C4-7. LED I2C0-3 should have the same state\n\n"
- "Press any key to stop\n\n");
-
- while (!tstc()) {
- i2c_read(CONFIG_SYS_I2C_IO, 0, 1, (uchar *)&temp, 1);
- temp1 = (temp >> 4) & 0x03;
- temp1 |= (temp >> 3) & 0x08; /* S302 -> LED303 */
- temp1 |= (temp >> 5) & 0x04; /* S303 -> LED302 */
- temp = temp1;
- i2c_write(CONFIG_SYS_I2C_IO, 1, 1, (uchar *)&temp, 1);
- }
- getc();
-
- return 0;
-}
-
static int do_usb_test(char * const argv[])
{
int i;
@@ -387,9 +359,7 @@
switch (argc) {
case 2:
- if (strncmp(argv[1], "i2c", 3) == 0)
- rcode = do_i2c_test(argv);
- else if (strncmp(argv[1], "led", 3) == 0)
+ if (strncmp(argv[1], "led", 3) == 0)
rcode = do_led_test(argv);
else if (strncmp(argv[1], "usb", 3) == 0)
rcode = do_usb_test(argv);