aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2005-07-30 07:12:06 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-07-30 18:21:00 -0400
commit40292fb0f041362bca2f6ad975acedce4f6e3f3e (patch)
treeeb2ce359b1bf105cad86f3e01f228ac8115c92e6
parent188f23ba94a618b12cc205306f02b4f5036c4fa7 (diff)
[PATCH] sis190: remove hardcoded constants.
Replace hardcoded constants by enumerated values in sis190_read_eeprom The names of the enumerated values have been extracted from SiS'official driver (v1.00.00 published on 2005/07/11). Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/net/sis190.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index e67a5753882e..d915507e90eb 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -5,7 +5,8 @@
5 Copyright (c) 2003, 2004 Jeff Garzik <jgarzik@pobox.com> 5 Copyright (c) 2003, 2004 Jeff Garzik <jgarzik@pobox.com>
6 Copyright (c) 2003, 2004, 2005 Francois Romieu <romieu@fr.zoreil.com> 6 Copyright (c) 2003, 2004, 2005 Francois Romieu <romieu@fr.zoreil.com>
7 7
8 Based on r8169.c, tg3.c, 8139cp.c, skge.c and probably even epic100.c. 8 Based on r8169.c, tg3.c, 8139cp.c, skge.c, epic100.c and SiS 190/191
9 genuine driver.
9 10
10 This software may be used and distributed according to the terms of 11 This software may be used and distributed according to the terms of
11 the GNU General Public License (GPL), incorporated herein by reference. 12 the GNU General Public License (GPL), incorporated herein by reference.
@@ -221,6 +222,16 @@ enum _DescStatusBit {
221 RxSizeMask = 0x0000ffff 222 RxSizeMask = 0x0000ffff
222}; 223};
223 224
225enum sis190_eeprom_access_register_bits {
226 EECS = 0x00000001, // unused
227 EECLK = 0x00000002, // unused
228 EEDO = 0x00000008, // unused
229 EEDI = 0x00000004, // unused
230 EEREQ = 0x00000080,
231 EEROP = 0x00000200,
232 EEWOP = 0x00000100 // unused
233};
234
224struct sis190_private { 235struct sis190_private {
225 void __iomem *mmio_addr; 236 void __iomem *mmio_addr;
226 struct pci_dev *pci_dev; 237 struct pci_dev *pci_dev;
@@ -333,27 +344,24 @@ static int __mdio_read(struct net_device *dev, int phy_id, int reg)
333 return mdio_read(tp->mmio_addr, reg); 344 return mdio_read(tp->mmio_addr, reg);
334} 345}
335 346
336static int sis190_read_eeprom(void __iomem *ioaddr, u32 reg) 347static u16 __devinit sis190_read_eeprom(void __iomem *ioaddr, u32 reg)
337{ 348{
349 u16 data = 0xffff;
338 unsigned int i; 350 unsigned int i;
339 u16 data;
340 u32 val;
341 351
342 if (!(SIS_R32(ROMControl) & 0x0002)) 352 if (!(SIS_R32(ROMControl) & 0x0002))
343 return 0; 353 return 0;
344 354
345 val = (0x0080 | (0x2 << 8) | (reg << 10)); 355 SIS_W32(ROMInterface, EEREQ | EEROP | (reg << 10));
346
347 SIS_W32(ROMInterface, val);
348 356
349 for (i = 0; i < 200; i++) { 357 for (i = 0; i < 200; i++) {
350 if (!(SIS_R32(ROMInterface) & 0x0080)) 358 if (!(SIS_R32(ROMInterface) & EEREQ)) {
359 data = (SIS_R32(ROMInterface) & 0xffff0000) >> 16;
351 break; 360 break;
361 }
352 msleep(1); 362 msleep(1);
353 } 363 }
354 364
355 data = (u16) ((SIS_R32(ROMInterface) & 0xffff0000) >> 16);
356
357 return data; 365 return data;
358} 366}
359 367