Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66854
b: refs/heads/master
c: 89e536a
h: refs/heads/master
v: v3
  • Loading branch information
Magnus Damm authored and David S. Miller committed Oct 10, 2007
1 parent 32de3b0 commit 36fd785
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6daf65310374d24d888201b7a6eba90b44008b7b
refs/heads/master: 89e536a190f90d038bae7905a0c582cb7089b739
7 changes: 7 additions & 0 deletions trunk/drivers/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ config AX88796
AX88796 driver, using platform bus to provide
chip detection and resources

config AX88796_93CX6
bool "ASIX AX88796 external 93CX6 eeprom support"
depends on AX88796
select EEPROM_93CX6
help
Select this if your platform comes with an external 93CX6 eeprom.

config MACE
tristate "MACE (Power Mac ethernet) support"
depends on PPC_PMAC && PPC32
Expand Down
49 changes: 49 additions & 0 deletions trunk/drivers/net/ax88796.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/eeprom_93cx6.h>

#include <net/ax88796.h>

Expand Down Expand Up @@ -582,6 +583,37 @@ static const struct ethtool_ops ax_ethtool_ops = {
.get_link = ax_get_link,
};

#ifdef CONFIG_AX88796_93CX6
static void ax_eeprom_register_read(struct eeprom_93cx6 *eeprom)
{
struct ei_device *ei_local = eeprom->data;
u8 reg = ei_inb(ei_local->mem + AX_MEMR);

eeprom->reg_data_in = reg & AX_MEMR_EEI;
eeprom->reg_data_out = reg & AX_MEMR_EEO; /* Input pin */
eeprom->reg_data_clock = reg & AX_MEMR_EECLK;
eeprom->reg_chip_select = reg & AX_MEMR_EECS;
}

static void ax_eeprom_register_write(struct eeprom_93cx6 *eeprom)
{
struct ei_device *ei_local = eeprom->data;
u8 reg = ei_inb(ei_local->mem + AX_MEMR);

reg &= ~(AX_MEMR_EEI | AX_MEMR_EECLK | AX_MEMR_EECS);

if (eeprom->reg_data_in)
reg |= AX_MEMR_EEI;
if (eeprom->reg_data_clock)
reg |= AX_MEMR_EECLK;
if (eeprom->reg_chip_select)
reg |= AX_MEMR_EECS;

ei_outb(reg, ei_local->mem + AX_MEMR);
udelay(10);
}
#endif

/* setup code */

static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local)
Expand Down Expand Up @@ -640,6 +672,23 @@ static int ax_init_dev(struct net_device *dev, int first_init)
memcpy(dev->dev_addr, SA_prom, 6);
}

#ifdef CONFIG_AX88796_93CX6
if (first_init && ax->plat->flags & AXFLG_HAS_93CX6) {
unsigned char mac_addr[6];
struct eeprom_93cx6 eeprom;

eeprom.data = ei_local;
eeprom.register_read = ax_eeprom_register_read;
eeprom.register_write = ax_eeprom_register_write;
eeprom.width = PCI_EEPROM_WIDTH_93C56;

eeprom_93cx6_multiread(&eeprom, 0,
(__le16 __force *)mac_addr,
sizeof(mac_addr) >> 1);

memcpy(dev->dev_addr, mac_addr, 6);
}
#endif
if (ax->plat->wordlength == 2) {
/* We must set the 8390 for word mode. */
ei_outb(ax->plat->dcr_val, ei_local->mem + EN0_DCFG);
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/eeprom_93cx6.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
/*
Module: eeprom_93cx6
Abstract: EEPROM reader datastructures for 93cx6 chipsets.
Supported chipsets: 93c46 & 93c66.
Supported chipsets: 93c46, 93c56 and 93c66.
*/

/*
* EEPROM operation defines.
*/
#define PCI_EEPROM_WIDTH_93C46 6
#define PCI_EEPROM_WIDTH_93C56 8
#define PCI_EEPROM_WIDTH_93C66 8
#define PCI_EEPROM_WIDTH_OPCODE 3
#define PCI_EEPROM_WRITE_OPCODE 0x05
Expand Down
1 change: 1 addition & 0 deletions trunk/include/net/ax88796.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#define AXFLG_HAS_EEPROM (1<<0)
#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */
#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */

struct ax_plat_data {
unsigned int flags;
Expand Down

0 comments on commit 36fd785

Please sign in to comment.