aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-02-04 19:02:09 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-11 11:06:28 -0500
commit86c62fab5aafe33d033d2f616ba8be0527e1c286 (patch)
treee7fa174e6e825d62722618b9d1f197d177b40e6c
parent321f69a4c3bb807abdf1fd6329403ec0449a3d78 (diff)
DM9000: Remove barely used SROM array read.
The srom array in the board data is only being used in the device probe routines. The probe also only uses the first 6 bytes of an array we spend 512ms reading 128 bytes from. Change to reading the MAC area directly to the MAC address structure. As a side product, we rename the read_srom_word to dm9000_read_eeprom to bring it into line with the rest of the driver. No change is made to the delay in this function, which will be dealt with in a later patch. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/dm9000.c24
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 *);
166static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg); 165static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg);
167static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, 166static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg,
168 int value); 167 int value);
169static u16 read_srom_word(board_info_t *, int); 168
169static void dm9000_read_eeprom(board_info_t *, int addr, unsigned char *to);
170static void dm9000_rx(struct net_device *); 170static void dm9000_rx(struct net_device *);
171static void dm9000_hash_table(struct net_device *); 171static 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 */
1003static u16 999static void
1004read_srom_word(board_info_t * db, int offset) 1000dm9000_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