diff options
Diffstat (limited to 'drivers/net/ax88796.c')
-rw-r--r-- | drivers/net/ax88796.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 90e0734e6037..9fe0517cf893 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/etherdevice.h> | 24 | #include <linux/etherdevice.h> |
25 | #include <linux/ethtool.h> | 25 | #include <linux/ethtool.h> |
26 | #include <linux/mii.h> | 26 | #include <linux/mii.h> |
27 | #include <linux/eeprom_93cx6.h> | ||
27 | 28 | ||
28 | #include <net/ax88796.h> | 29 | #include <net/ax88796.h> |
29 | 30 | ||
@@ -582,6 +583,37 @@ static const struct ethtool_ops ax_ethtool_ops = { | |||
582 | .get_link = ax_get_link, | 583 | .get_link = ax_get_link, |
583 | }; | 584 | }; |
584 | 585 | ||
586 | #ifdef CONFIG_AX88796_93CX6 | ||
587 | static void ax_eeprom_register_read(struct eeprom_93cx6 *eeprom) | ||
588 | { | ||
589 | struct ei_device *ei_local = eeprom->data; | ||
590 | u8 reg = ei_inb(ei_local->mem + AX_MEMR); | ||
591 | |||
592 | eeprom->reg_data_in = reg & AX_MEMR_EEI; | ||
593 | eeprom->reg_data_out = reg & AX_MEMR_EEO; /* Input pin */ | ||
594 | eeprom->reg_data_clock = reg & AX_MEMR_EECLK; | ||
595 | eeprom->reg_chip_select = reg & AX_MEMR_EECS; | ||
596 | } | ||
597 | |||
598 | static void ax_eeprom_register_write(struct eeprom_93cx6 *eeprom) | ||
599 | { | ||
600 | struct ei_device *ei_local = eeprom->data; | ||
601 | u8 reg = ei_inb(ei_local->mem + AX_MEMR); | ||
602 | |||
603 | reg &= ~(AX_MEMR_EEI | AX_MEMR_EECLK | AX_MEMR_EECS); | ||
604 | |||
605 | if (eeprom->reg_data_in) | ||
606 | reg |= AX_MEMR_EEI; | ||
607 | if (eeprom->reg_data_clock) | ||
608 | reg |= AX_MEMR_EECLK; | ||
609 | if (eeprom->reg_chip_select) | ||
610 | reg |= AX_MEMR_EECS; | ||
611 | |||
612 | ei_outb(reg, ei_local->mem + AX_MEMR); | ||
613 | udelay(10); | ||
614 | } | ||
615 | #endif | ||
616 | |||
585 | /* setup code */ | 617 | /* setup code */ |
586 | 618 | ||
587 | static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) | 619 | static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) |
@@ -640,6 +672,23 @@ static int ax_init_dev(struct net_device *dev, int first_init) | |||
640 | memcpy(dev->dev_addr, SA_prom, 6); | 672 | memcpy(dev->dev_addr, SA_prom, 6); |
641 | } | 673 | } |
642 | 674 | ||
675 | #ifdef CONFIG_AX88796_93CX6 | ||
676 | if (first_init && ax->plat->flags & AXFLG_HAS_93CX6) { | ||
677 | unsigned char mac_addr[6]; | ||
678 | struct eeprom_93cx6 eeprom; | ||
679 | |||
680 | eeprom.data = ei_local; | ||
681 | eeprom.register_read = ax_eeprom_register_read; | ||
682 | eeprom.register_write = ax_eeprom_register_write; | ||
683 | eeprom.width = PCI_EEPROM_WIDTH_93C56; | ||
684 | |||
685 | eeprom_93cx6_multiread(&eeprom, 0, | ||
686 | (__le16 __force *)mac_addr, | ||
687 | sizeof(mac_addr) >> 1); | ||
688 | |||
689 | memcpy(dev->dev_addr, mac_addr, 6); | ||
690 | } | ||
691 | #endif | ||
643 | if (ax->plat->wordlength == 2) { | 692 | if (ax->plat->wordlength == 2) { |
644 | /* We must set the 8390 for word mode. */ | 693 | /* We must set the 8390 for word mode. */ |
645 | ei_outb(ax->plat->dcr_val, ei_local->mem + EN0_DCFG); | 694 | ei_outb(ax->plat->dcr_val, ei_local->mem + EN0_DCFG); |