static int rtl8139_init_common(struct rtl8139_priv *priv)
{
- unsigned short *ap = (unsigned short *)priv->enetaddr;
- int addr_len, i;
u8 reg;
/* Bring the chip out of low-power mode. */
outb(0x00, priv->ioaddr + RTL_REG_CONFIG1);
- addr_len = rtl8139_read_eeprom(priv, 0, 8) == 0x8129 ? 8 : 6;
- for (i = 0; i < 3; i++)
- *ap++ = le16_to_cpu(rtl8139_read_eeprom(priv, i + 7, addr_len));
-
rtl8139_reset(priv);
reg = inb(priv->ioaddr + RTL_REG_MEDIASTATUS);
return -1;
}
- /* Non-DM compatibility */
- memcpy(priv->dev.enetaddr, priv->enetaddr, 6);
-
return 0;
}
rtl8139_hw_reset(priv);
}
+static void rtl8139_get_hwaddr(struct rtl8139_priv *priv)
+{
+ unsigned short *ap = (unsigned short *)priv->enetaddr;
+ int i, addr_len;
+
+ /* Bring the chip out of low-power mode. */
+ outb(0x00, priv->ioaddr + RTL_REG_CONFIG1);
+
+ addr_len = rtl8139_read_eeprom(priv, 0, 8) == 0x8129 ? 8 : 6;
+ for (i = 0; i < 3; i++)
+ *ap++ = le16_to_cpu(rtl8139_read_eeprom(priv, i + 7, addr_len));
+}
+
static void rtl8139_name(char *str, int card_number)
{
sprintf(str, "RTL8139#%u", card_number);
dev->recv = rtl8139_recv;
dev->mcast = rtl8139_bcast_addr;
+ rtl8139_get_hwaddr(priv);
+
+ /* Non-DM compatibility */
+ memcpy(priv->dev.enetaddr, priv->enetaddr, 6);
+
eth_register(dev);
card_number++;