diff options
-rw-r--r-- | drivers/net/Kconfig | 7 | ||||
-rw-r--r-- | drivers/net/ax88796.c | 49 | ||||
-rw-r--r-- | include/linux/eeprom_93cx6.h | 3 | ||||
-rw-r--r-- | include/net/ax88796.h | 1 |
4 files changed, 59 insertions, 1 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 9ff1cf46eaee..45f6cf531566 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -240,6 +240,13 @@ config AX88796 | |||
240 | AX88796 driver, using platform bus to provide | 240 | AX88796 driver, using platform bus to provide |
241 | chip detection and resources | 241 | chip detection and resources |
242 | 242 | ||
243 | config AX88796_93CX6 | ||
244 | bool "ASIX AX88796 external 93CX6 eeprom support" | ||
245 | depends on AX88796 | ||
246 | select EEPROM_93CX6 | ||
247 | help | ||
248 | Select this if your platform comes with an external 93CX6 eeprom. | ||
249 | |||
243 | config MACE | 250 | config MACE |
244 | tristate "MACE (Power Mac ethernet) support" | 251 | tristate "MACE (Power Mac ethernet) support" |
245 | depends on PPC_PMAC && PPC32 | 252 | depends on PPC_PMAC && PPC32 |
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); |
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h index d774b7778c91..a55c873e8b66 100644 --- a/include/linux/eeprom_93cx6.h +++ b/include/linux/eeprom_93cx6.h | |||
@@ -21,13 +21,14 @@ | |||
21 | /* | 21 | /* |
22 | Module: eeprom_93cx6 | 22 | Module: eeprom_93cx6 |
23 | Abstract: EEPROM reader datastructures for 93cx6 chipsets. | 23 | Abstract: EEPROM reader datastructures for 93cx6 chipsets. |
24 | Supported chipsets: 93c46 & 93c66. | 24 | Supported chipsets: 93c46, 93c56 and 93c66. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * EEPROM operation defines. | 28 | * EEPROM operation defines. |
29 | */ | 29 | */ |
30 | #define PCI_EEPROM_WIDTH_93C46 6 | 30 | #define PCI_EEPROM_WIDTH_93C46 6 |
31 | #define PCI_EEPROM_WIDTH_93C56 8 | ||
31 | #define PCI_EEPROM_WIDTH_93C66 8 | 32 | #define PCI_EEPROM_WIDTH_93C66 8 |
32 | #define PCI_EEPROM_WIDTH_OPCODE 3 | 33 | #define PCI_EEPROM_WIDTH_OPCODE 3 |
33 | #define PCI_EEPROM_WRITE_OPCODE 0x05 | 34 | #define PCI_EEPROM_WRITE_OPCODE 0x05 |
diff --git a/include/net/ax88796.h b/include/net/ax88796.h index ee786a043b3d..51329dae44e6 100644 --- a/include/net/ax88796.h +++ b/include/net/ax88796.h | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #define AXFLG_HAS_EEPROM (1<<0) | 15 | #define AXFLG_HAS_EEPROM (1<<0) |
16 | #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ | 16 | #define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ |
17 | #define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */ | ||
17 | 18 | ||
18 | struct ax_plat_data { | 19 | struct ax_plat_data { |
19 | unsigned int flags; | 20 | unsigned int flags; |