#define _LINUX_STRING_H_ /* avoid unnecessary str/mem functions */
#include <common.h>
-#include <syscall.h>
+#include <exports.h>
static int reset_eeprom(unsigned long ioaddr, unsigned char *hwaddr);
-int eepro100_eeprom(void)
+int eepro100_eeprom(int argc, char *argv[])
{
int ret = 0;
unsigned char hwaddr1[6] = { 0x00, 0x00, 0x02, 0x03, 0x04, 0x05 };
unsigned char hwaddr2[6] = { 0x00, 0x00, 0x02, 0x03, 0x04, 0x06 };
+ app_startup(argv);
+
#if defined(CONFIG_OXC)
ret |= reset_eeprom(0x80000000, hwaddr1);
ret |= reset_eeprom(0x81000000, hwaddr2);
static inline void *memcpy(void *dst, const void *src, unsigned int len)
{
- void * ret = dst;
- while (len-- > 0) *((char *)dst)++ = *((char *)src)++;
- return ret;
+ char *ret = dst;
+ while (len-- > 0) {
+ *ret++ = *((char *)src);
+ src++;
+ }
+ return (void *)ret;
}
/* The EEPROM commands include the alway-set leading bit. */
long ee_addr = ioaddr + EE_OFFSET;
if (debug > 1)
- mon_printf(" EEPROM op 0x%x: ", cmd);
+ printf(" EEPROM op 0x%x: ", cmd);
outw(EE_ENB | EE_SHIFT_CLK, ee_addr);
outw(dataval, ee_addr);
eeprom_delay(ee_addr);
if (debug > 2)
- mon_printf("%X", inw(ee_addr) & 15);
+ printf("%X", inw(ee_addr) & 15);
outw(dataval | EE_SHIFT_CLK, ee_addr);
eeprom_delay(ee_addr);
retval = (retval << 1) | ((inw(ee_addr) & EE_DATA_READ) ? 1 : 0);
/* Terminate the EEPROM access. */
outw(EE_ENB & ~EE_CS, ee_addr);
if (debug > 1)
- mon_printf(" EEPROM result is 0x%5.5x.\n", retval);
+ printf(" EEPROM result is 0x%5.5x.\n", retval);
return retval;
}
/* Poll for write finished. */
i = eeprom_busy_poll(ee_ioaddr); /* Typical 2000 ticks */
if (debug)
- mon_printf(" Write finished after %d ticks.\n", i);
+ printf(" Write finished after %d ticks.\n", i);
/* Disable programming. This command is not instantaneous, so we check
for busy before the next op. */
do_eeprom_cmd(ioaddr, (0x40 << (addr_len-4)), 3 + addr_len);
int size_test;
int i;
- mon_printf("Resetting i82559 EEPROM @ 0x%08x ... ", ioaddr);
+ printf("Resetting i82559 EEPROM @ 0x%08lX ... ", ioaddr);
size_test = do_eeprom_cmd(ioaddr, (EE_READ_CMD << 8) << 16, 27);
eeprom_addr_size = (size_test & 0xffe0000) == 0xffe0000 ? 8 : 6;
for (i = 0; i < eeprom_size; i++)
if (read_eeprom(ioaddr, i, eeprom_addr_size) != eeprom[i]) {
- mon_printf("failed\n");
+ printf("failed\n");
return 1;
}
- mon_printf("done\n");
+ printf("done\n");
return 0;
}