colibri_imx6: fix video stdout in default environment
[oweals/u-boot.git] / examples / standalone / smc91111_eeprom.c
index 89afc871fa70283cf5963448f5e4fa57188863f0..bf7e93064309f2ef6b8fbf8bedc133da0a9b01b1 100644 (file)
@@ -1,40 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2004
  * Robin Getz rgetz@blacfin.uclinux.org
  *
- * 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
- *
  * Heavily borrowed from the following peoples GPL'ed software:
  *  - Wolfgang Denk, DENX Software Engineering, wd@denx.de
- *       Das U-boot
+ *       Das U-Boot
  *  - Ladislav Michl ladis@linux-mips.org
  *       A rejected patch on the U-Boot mailing list
  */
 
 #include <common.h>
 #include <exports.h>
-/* the smc91111.h gets base addr through eth_device' iobase */
-struct eth_device { unsigned long iobase; };
+#include <linux/delay.h>
 #include "../drivers/net/smc91111.h"
 
-#ifdef CONFIG_SMC91111
-
 #ifndef SMC91111_EEPROM_INIT
 # define SMC91111_EEPROM_INIT()
 #endif
@@ -52,14 +32,13 @@ void print_MAC (struct eth_device *dev);
 int read_eeprom_reg (struct eth_device *dev, int reg);
 void print_macaddr (struct eth_device *dev);
 
-int smc91111_eeprom (int argc, char *argv[])
+int smc91111_eeprom(int argc, char *const argv[])
 {
        int c, i, j, done, line, reg, value, start, what;
        char input[50];
 
-       struct eth_device dev = {
-               .iobase = CONFIG_SMC91111_BASE
-       };
+       struct eth_device dev;
+       dev.iobase = CONFIG_SMC91111_BASE;
 
        /* Print the ABI version */
        app_startup (argv);
@@ -259,7 +238,7 @@ void copy_from_eeprom (struct eth_device *dev)
                CTL_RELOAD, CTL_REG);
        i = 100;
        while ((SMC_inw (dev, CTL_REG) & CTL_RELOAD) && --i)
-               udelay (100);
+               udelay(100);
        if (i == 0) {
                printf ("Timeout Refreshing EEPROM registers\n");
        } else {
@@ -340,7 +319,7 @@ int read_eeprom_reg (struct eth_device *dev, int reg)
                CTL_RELOAD, CTL_REG);
        timeout = 100;
        while ((SMC_inw (dev, CTL_REG) & CTL_RELOAD) && --timeout)
-               udelay (100);
+               udelay(100);
        if (timeout == 0) {
                printf ("Timeout Reading EEPROM register %02x\n", reg);
                return 0;
@@ -363,7 +342,7 @@ int write_eeprom_reg (struct eth_device *dev, int value, int reg)
                CTL_STORE, CTL_REG);
        timeout = 100;
        while ((SMC_inw (dev, CTL_REG) & CTL_STORE) && --timeout)
-               udelay (100);
+               udelay(100);
        if (timeout == 0) {
                printf ("Timeout Writing EEPROM register %02x\n", reg);
                return 0;
@@ -391,13 +370,3 @@ void dump_reg (struct eth_device *dev)
                printf ("\n");
        }
 }
-
-#else
-
-int smc91111_eeprom (int argc, char *argv[])
-{
-       printf("Not supported for this board\n");
-       return 1;
-}
-
-#endif