]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_i2c.c
net: fec_mxc: Poll FEC_TBD_READY after polling TDAR
[karo-tx-uboot.git] / common / cmd_i2c.c
index 0a583c2ee5305c41c1e1a594ea51d7ce48f8e974..3a75f94ea1ff50c14846998b38282b37c42da09a 100644 (file)
@@ -7,23 +7,7 @@
  * (C) Copyright 2001
  * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -82,6 +66,8 @@
  */
 
 #include <common.h>
+#include <bootretry.h>
+#include <cli.h>
 #include <command.h>
 #include <edid.h>
 #include <environment.h>
@@ -578,9 +564,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
        if (argc != 3)
                return CMD_RET_USAGE;
 
-#ifdef CONFIG_BOOT_RETRY_TIME
-       reset_cmd_timeout();    /* got a good command to get here */
-#endif
+       bootretry_reset_cmd_timeout();  /* got a good command to get here */
        /*
         * We use the last specified parameters, unless new ones are
         * entered.
@@ -628,7 +612,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
                                printf(" %08lx", data);
                }
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0) {
                        /*
                         * <CR> pressed as only input, don't modify current
@@ -637,9 +621,8 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
                        if (incrflag)
                                addr += size;
                        nbytes = size;
-#ifdef CONFIG_BOOT_RETRY_TIME
-                       reset_cmd_timeout(); /* good enough to not time out */
-#endif
+                       /* good enough to not time out */
+                       bootretry_reset_cmd_timeout();
                }
 #ifdef CONFIG_BOOT_RETRY_TIME
                else if (nbytes == -2)
@@ -656,12 +639,10 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
                        data = be32_to_cpu(data);
                        nbytes = endp - console_buffer;
                        if (nbytes) {
-#ifdef CONFIG_BOOT_RETRY_TIME
                                /*
                                 * good enough to not time out
                                 */
-                               reset_cmd_timeout();
-#endif
+                               bootretry_reset_cmd_timeout();
                                if (i2c_write(chip, addr, alen, (uchar *)&data, size) != 0)
                                        puts ("Error writing the chip.\n");
 #ifdef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
@@ -1385,7 +1366,8 @@ int do_edid(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
  * Returns zero always.
  */
 #if defined(CONFIG_SYS_I2C)
-int do_i2c_show_bus(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_show_bus(cmd_tbl_t *cmdtp, int flag, int argc,
+                               char * const argv[])
 {
        int     i;
 #ifndef CONFIG_SYS_I2C_DIRECT_BUS
@@ -1444,7 +1426,8 @@ int do_i2c_show_bus(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  * on error.
  */
 #if defined(CONFIG_SYS_I2C) || defined(CONFIG_I2C_MULTI_BUS)
-int do_i2c_bus_num(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_bus_num(cmd_tbl_t *cmdtp, int flag, int argc,
+                               char * const argv[])
 {
        int             ret = 0;
        unsigned int    bus_no;
@@ -1454,10 +1437,12 @@ int do_i2c_bus_num(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                printf("Current bus is %d\n", i2c_get_bus_num());
        else {
                bus_no = simple_strtoul(argv[1], NULL, 10);
+#if defined(CONFIG_SYS_I2C)
                if (bus_no >= CONFIG_SYS_NUM_I2C_BUSES) {
                        printf("Invalid bus %d\n", bus_no);
                        return -1;
                }
+#endif
                printf("Setting bus to %d\n", bus_no);
                ret = i2c_set_bus_num(bus_no);
                if (ret)