diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-06-26 22:48:38 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-06-26 22:48:38 -0400 |
commit | a2b524b2ec6caa0499aea56a58fdb67a6d10db90 (patch) | |
tree | 4297b0a3e27688ef30a627dc062303a378897452 /drivers | |
parent | 5a40f09baa3d74e9e6f1bd86a9998a10fbba012a (diff) |
[netdrvr] natsemi: minor cleanups
* make eeprom size a variable, prepping for future patch
* eliminate unused PCI_xxx stuff left over from Becker driver template
* convert a few #defines to enum
* mark PCI table const, __devinitdata
* don't bother with named constant for PCI device id
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/natsemi.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 5dc41462fa01..5657049c2160 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -226,7 +226,6 @@ static int full_duplex[MAX_UNITS]; | |||
226 | NATSEMI_PG1_NREGS) | 226 | NATSEMI_PG1_NREGS) |
227 | #define NATSEMI_REGS_VER 1 /* v1 added RFDR registers */ | 227 | #define NATSEMI_REGS_VER 1 /* v1 added RFDR registers */ |
228 | #define NATSEMI_REGS_SIZE (NATSEMI_NREGS * sizeof(u32)) | 228 | #define NATSEMI_REGS_SIZE (NATSEMI_NREGS * sizeof(u32)) |
229 | #define NATSEMI_DEF_EEPROM_SIZE 24 /* 12 16-bit values */ | ||
230 | 229 | ||
231 | /* Buffer sizes: | 230 | /* Buffer sizes: |
232 | * The nic writes 32-bit values, even if the upper bytes of | 231 | * The nic writes 32-bit values, even if the upper bytes of |
@@ -344,18 +343,6 @@ None characterised. | |||
344 | 343 | ||
345 | 344 | ||
346 | 345 | ||
347 | enum pcistuff { | ||
348 | PCI_USES_IO = 0x01, | ||
349 | PCI_USES_MEM = 0x02, | ||
350 | PCI_USES_MASTER = 0x04, | ||
351 | PCI_ADDR0 = 0x08, | ||
352 | PCI_ADDR1 = 0x10, | ||
353 | }; | ||
354 | |||
355 | /* MMIO operations required */ | ||
356 | #define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1) | ||
357 | |||
358 | |||
359 | /* | 346 | /* |
360 | * Support for fibre connections on Am79C874: | 347 | * Support for fibre connections on Am79C874: |
361 | * This phy needs a special setup when connected to a fibre cable. | 348 | * This phy needs a special setup when connected to a fibre cable. |
@@ -363,22 +350,25 @@ enum pcistuff { | |||
363 | */ | 350 | */ |
364 | #define PHYID_AM79C874 0x0022561b | 351 | #define PHYID_AM79C874 0x0022561b |
365 | 352 | ||
366 | #define MII_MCTRL 0x15 /* mode control register */ | 353 | enum { |
367 | #define MII_FX_SEL 0x0001 /* 100BASE-FX (fiber) */ | 354 | MII_MCTRL = 0x15, /* mode control register */ |
368 | #define MII_EN_SCRM 0x0004 /* enable scrambler (tp) */ | 355 | MII_FX_SEL = 0x0001, /* 100BASE-FX (fiber) */ |
356 | MII_EN_SCRM = 0x0004, /* enable scrambler (tp) */ | ||
357 | }; | ||
369 | 358 | ||
370 | 359 | ||
371 | /* array of board data directly indexed by pci_tbl[x].driver_data */ | 360 | /* array of board data directly indexed by pci_tbl[x].driver_data */ |
372 | static const struct { | 361 | static const struct { |
373 | const char *name; | 362 | const char *name; |
374 | unsigned long flags; | 363 | unsigned long flags; |
364 | unsigned int eeprom_size; | ||
375 | } natsemi_pci_info[] __devinitdata = { | 365 | } natsemi_pci_info[] __devinitdata = { |
376 | { "NatSemi DP8381[56]", PCI_IOTYPE }, | 366 | { "NatSemi DP8381[56]", 0, 24 }, |
377 | }; | 367 | }; |
378 | 368 | ||
379 | static struct pci_device_id natsemi_pci_tbl[] = { | 369 | static const struct pci_device_id natsemi_pci_tbl[] __devinitdata = { |
380 | { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_83815, PCI_ANY_ID, PCI_ANY_ID, }, | 370 | { PCI_VENDOR_ID_NS, 0x0020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
381 | { 0, }, | 371 | { } /* terminate list */ |
382 | }; | 372 | }; |
383 | MODULE_DEVICE_TABLE(pci, natsemi_pci_tbl); | 373 | MODULE_DEVICE_TABLE(pci, natsemi_pci_tbl); |
384 | 374 | ||
@@ -888,8 +878,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, | |||
888 | iosize = pci_resource_len(pdev, pcibar); | 878 | iosize = pci_resource_len(pdev, pcibar); |
889 | irq = pdev->irq; | 879 | irq = pdev->irq; |
890 | 880 | ||
891 | if (natsemi_pci_info[chip_idx].flags & PCI_USES_MASTER) | 881 | pci_set_master(pdev); |
892 | pci_set_master(pdev); | ||
893 | 882 | ||
894 | dev = alloc_etherdev(sizeof (struct netdev_private)); | 883 | dev = alloc_etherdev(sizeof (struct netdev_private)); |
895 | if (!dev) | 884 | if (!dev) |
@@ -928,7 +917,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, | |||
928 | np->msg_enable = (debug >= 0) ? (1<<debug)-1 : NATSEMI_DEF_MSG; | 917 | np->msg_enable = (debug >= 0) ? (1<<debug)-1 : NATSEMI_DEF_MSG; |
929 | np->hands_off = 0; | 918 | np->hands_off = 0; |
930 | np->intr_status = 0; | 919 | np->intr_status = 0; |
931 | np->eeprom_size = NATSEMI_DEF_EEPROM_SIZE; | 920 | np->eeprom_size = natsemi_pci_info[chip_idx].eeprom_size; |
932 | 921 | ||
933 | /* Initial port: | 922 | /* Initial port: |
934 | * - If the nic was configured to use an external phy and if find_mii | 923 | * - If the nic was configured to use an external phy and if find_mii |