-/* $OpenBSD: if_axe.c,v 1.129 2015/02/12 22:39:27 mpi Exp $ */
+/* $OpenBSD: if_axe.c,v 1.130 2015/05/17 02:44:38 canacar Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Jonathan Gray <jsg@openbsd.org>
axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL);
}
+/* Read Ethernet Address from EEPROM if it is zero */
+void
+axe_ax88772b_nodeid(struct axe_softc *sc, u_char *eaddr)
+{
+ int i;
+ uint16_t val;
+
+ for (i = 0; i < ETHER_ADDR_LEN; i++) {
+ if (eaddr[i] != 0)
+ break;
+ }
+
+ /* We already have an ethernet address */
+ if (i != ETHER_ADDR_LEN)
+ return;
+
+ /* read from EEPROM */
+ for (i = 0; i < ETHER_ADDR_LEN/2; i++) {
+ axe_cmd(sc, AXE_CMD_SROM_READ, 0, AXE_EEPROM_772B_NODEID + i, &val);
+ val = ntohs(val);
+ *eaddr++ = (u_char)((val >> 8) & 0xff);
+ *eaddr++ = (u_char)(val & 0xff);
+ }
+}
+
void
axe_ax88772_init(struct axe_softc *sc)
{
else
axe_cmd(sc, AXE_172_CMD_READ_NODEID, 0, 0, &eaddr);
+ if (sc->axe_flags & AX772B)
+ axe_ax88772b_nodeid(sc, eaddr);
+
/*
* Load IPG values
*/
-/* $OpenBSD: if_axereg.h,v 1.24 2013/05/31 15:20:49 yuo Exp $ */
+/* $OpenBSD: if_axereg.h,v 1.25 2015/05/17 02:44:38 canacar Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003
#define AXE_CONFIG_NO 1
#define AXE_IFACE_IDX 0
+/* EEPROM Map */
+#define AXE_EEPROM_772B_NODEID 0x04
+
/*
* The interrupt endpoint is currently unused
* by the ASIX part.