#include <common.h>
#include <command.h>
-
-extern u16 read_srom_word(int);
-extern void write_srom_word(int offset, u16 val);
+#include <dm9000.h>
static int do_read_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
- int i;
+ unsigned int i;
+ u8 data[2];
for (i=0; i < 0x40; i++) {
if (!(i % 0x10))
- printf("\n%08lx:", i);
- printf(" %04x", read_srom_word(i));
+ printf("\n%08x:", i);
+ dm9000_read_srom_word(i, data);
+ printf(" %02x%02x", data[1], data[0]);
}
printf ("\n");
return (0);
cmd_usage(cmdtp);
return 1;
}
- write_srom_word(offset, value);
+ dm9000_write_srom_word(offset, value);
return (0);
}
notes (i.e. double reset)
- some minor code cleanups
These changes are tested with DM9000{A,EP,E} together
- with a 200MHz Atmel AT91SAM92161 core
+ with a 200MHz Atmel AT91SAM9261 core
TODO: external MII is not functional, only internal at the moment.
*/
#include <command.h>
#include <net.h>
#include <asm/io.h>
+#include <dm9000.h>
#include "dm9000x.h"
static int dm9000_probe(void);
static u16 phy_read(int);
static void phy_write(int, u16);
-static void read_srom_word(int, u8 *);
static u8 DM9000_ior(int);
static void DM9000_iow(int reg, u8 value);
/* Set Node address */
if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
-#if !defined(CONFIG_AT91SAM9261EK)
+#if !defined(CONFIG_DM9000_NO_SROM)
for (i = 0; i < 3; i++)
- read_srom_word(i, enetaddr + 2 * i);
+ dm9000_read_srom_word(i, enetaddr + 2 * i);
eth_setenv_enetaddr("ethaddr", enetaddr);
#endif
}
/*
Read a word data from SROM
*/
-static void read_srom_word(int offset, u8 *to)
+#if !defined(CONFIG_DM9000_NO_SROM)
+void dm9000_read_srom_word(int offset, u8 *to)
{
DM9000_iow(DM9000_EPAR, offset);
DM9000_iow(DM9000_EPCR, 0x4);
to[1] = DM9000_ior(DM9000_EPDRH);
}
-void
-write_srom_word(int offset, u16 val)
+void dm9000_write_srom_word(int offset, u16 val)
{
DM9000_iow(DM9000_EPAR, offset);
DM9000_iow(DM9000_EPDRH, ((val >> 8) & 0xff));
udelay(8000);
DM9000_iow(DM9000_EPCR, 0);
}
-
+#endif
/*
Read a byte from I/O port
--- /dev/null
+/*
+ * NOTE: DAVICOM DM9000 ethernet driver interface
+ *
+ * Authors: Remy Bohmer <linux@bohmer.net>
+ *
+ * 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.
+ */
+#ifndef __DM9000_H__
+#define __DM9000_H__
+
+/****************** function prototypes **********************/
+#if !defined(CONFIG_DM9000_NO_SROM)
+void dm9000_write_srom_word(int offset, u16 val);
+void dm9000_read_srom_word(int offset, u8 *to);
+#endif
+
+#endif /* __DM9000_H__ */