diff options
-rw-r--r-- | drivers/net/dm9000.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 2e0add074889..fa7eb39dbf3c 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -132,7 +132,6 @@ typedef struct board_info { | |||
132 | struct resource *data_req; | 132 | struct resource *data_req; |
133 | struct resource *irq_res; | 133 | struct resource *irq_res; |
134 | 134 | ||
135 | unsigned char srom[128]; | ||
136 | spinlock_t lock; | 135 | spinlock_t lock; |
137 | 136 | ||
138 | struct mii_if_info mii; | 137 | struct mii_if_info mii; |
@@ -166,7 +165,8 @@ static irqreturn_t dm9000_interrupt(int, void *); | |||
166 | static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg); | 165 | static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg); |
167 | static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, | 166 | static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, |
168 | int value); | 167 | int value); |
169 | static u16 read_srom_word(board_info_t *, int); | 168 | |
169 | static void dm9000_read_eeprom(board_info_t *, int addr, unsigned char *to); | ||
170 | static void dm9000_rx(struct net_device *); | 170 | static void dm9000_rx(struct net_device *); |
171 | static void dm9000_hash_table(struct net_device *); | 171 | static void dm9000_hash_table(struct net_device *); |
172 | 172 | ||
@@ -630,13 +630,9 @@ dm9000_probe(struct platform_device *pdev) | |||
630 | db->mii.mdio_read = dm9000_phy_read; | 630 | db->mii.mdio_read = dm9000_phy_read; |
631 | db->mii.mdio_write = dm9000_phy_write; | 631 | db->mii.mdio_write = dm9000_phy_write; |
632 | 632 | ||
633 | /* Read SROM content */ | 633 | /* try reading the node address from the attached EEPROM */ |
634 | for (i = 0; i < 64; i++) | 634 | for (i = 0; i < 6; i += 2) |
635 | ((u16 *) db->srom)[i] = read_srom_word(db, i); | 635 | dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i); |
636 | |||
637 | /* Set Node Address */ | ||
638 | for (i = 0; i < 6; i++) | ||
639 | ndev->dev_addr[i] = db->srom[i]; | ||
640 | 636 | ||
641 | if (!is_valid_ether_addr(ndev->dev_addr)) { | 637 | if (!is_valid_ether_addr(ndev->dev_addr)) { |
642 | /* try reading from mac */ | 638 | /* try reading from mac */ |
@@ -998,17 +994,19 @@ dm9000_rx(struct net_device *dev) | |||
998 | } | 994 | } |
999 | 995 | ||
1000 | /* | 996 | /* |
1001 | * Read a word data from SROM | 997 | * Read a word data from EEPROM |
1002 | */ | 998 | */ |
1003 | static u16 | 999 | static void |
1004 | read_srom_word(board_info_t * db, int offset) | 1000 | dm9000_read_eeprom(board_info_t * db, int offset, unsigned char *to) |
1005 | { | 1001 | { |
1006 | iow(db, DM9000_EPAR, offset); | 1002 | iow(db, DM9000_EPAR, offset); |
1007 | iow(db, DM9000_EPCR, EPCR_ERPRR); | 1003 | iow(db, DM9000_EPCR, EPCR_ERPRR); |
1008 | mdelay(8); /* according to the datasheet 200us should be enough, | 1004 | mdelay(8); /* according to the datasheet 200us should be enough, |
1009 | but it doesn't work */ | 1005 | but it doesn't work */ |
1010 | iow(db, DM9000_EPCR, 0x0); | 1006 | iow(db, DM9000_EPCR, 0x0); |
1011 | return (ior(db, DM9000_EPDRL) + (ior(db, DM9000_EPDRH) << 8)); | 1007 | |
1008 | to[0] = ior(db, DM9000_EPDRL); | ||
1009 | to[1] = ior(db, DM9000_EPDRH); | ||
1012 | } | 1010 | } |
1013 | 1011 | ||
1014 | #ifdef DM9000_PROGRAM_EEPROM | 1012 | #ifdef DM9000_PROGRAM_EEPROM |