|
@@ -48,13 +48,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
48
|
48
|
#define USE_64BIT_ADDR
|
49
|
49
|
#endif
|
50
|
50
|
|
51
|
|
-//#define DDEBUG
|
52
|
|
-#ifdef DDEBUG
|
53
|
|
-#define dprintf(x) printf x
|
54
|
|
-#else
|
55
|
|
-#define dprintf(x)
|
56
|
|
-#endif
|
57
|
|
-
|
58
|
51
|
#define HZ 100
|
59
|
52
|
|
60
|
53
|
/* Condensed operations for readability. */
|
|
@@ -322,7 +315,7 @@ static int lnksts = 0; /* CFG_LNKSTS bit polarity */
|
322
|
315
|
#define __kick_rx() writel(CR_RXE, ns->base + CR)
|
323
|
316
|
|
324
|
317
|
#define kick_rx() do { \
|
325
|
|
- dprintf(("kick_rx: maybe kicking\n")); \
|
|
318
|
+ DBG("kick_rx: maybe kicking\n"); \
|
326
|
319
|
writel(virt_to_le32desc(&rx_ring[ns->cur_rx]), ns->base + RXDP); \
|
327
|
320
|
if (ns->next_rx == ns->next_empty) \
|
328
|
321
|
printf("uh-oh: next_rx == next_empty???\n"); \
|
|
@@ -415,8 +408,8 @@ static void phy_intr(struct nic *nic __unused)
|
415
|
408
|
tbisr = readl(ns->base + TBISR);
|
416
|
409
|
tanar = readl(ns->base + TANAR);
|
417
|
410
|
tanlpar = readl(ns->base + TANLPAR);
|
418
|
|
- dprintf(("phy_intr: tbisr=%hX, tanar=%hX, tanlpar=%hX\n",
|
419
|
|
- tbisr, tanar, tanlpar));
|
|
411
|
+ DBG("phy_intr: tbisr=%hX, tanar=%hX, tanlpar=%hX\n",
|
|
412
|
+ tbisr, tanar, tanlpar);
|
420
|
413
|
|
421
|
414
|
if ((fullduplex = (tanlpar & TANAR_FULL_DUP)
|
422
|
415
|
&& (tanar & TANAR_FULL_DUP))) {
|
|
@@ -511,7 +504,7 @@ static void ns83820_setup_rx(struct nic *nic)
|
511
|
504
|
writel(0, ns->base + RXDP_HI);
|
512
|
505
|
writel(virt_to_le32desc(&rx_ring[0]), ns->base + RXDP);
|
513
|
506
|
|
514
|
|
- dprintf(("starting receiver\n"));
|
|
507
|
+ DBG("starting receiver\n");
|
515
|
508
|
|
516
|
509
|
writel(0x0001, ns->base + CCSR);
|
517
|
510
|
writel(0, ns->base + RFCR);
|
|
@@ -544,18 +537,18 @@ static void ns83820_setup_rx(struct nic *nic)
|
544
|
537
|
|
545
|
538
|
static void ns83820_do_reset(struct nic *nic __unused, u32 which)
|
546
|
539
|
{
|
547
|
|
- dprintf(("resetting chip...\n"));
|
|
540
|
+ DBG("resetting chip...\n");
|
548
|
541
|
writel(which, ns->base + CR);
|
549
|
542
|
do {
|
550
|
543
|
|
551
|
544
|
} while (readl(ns->base + CR) & which);
|
552
|
|
- dprintf(("okay!\n"));
|
|
545
|
+ DBG("okay!\n");
|
553
|
546
|
}
|
554
|
547
|
|
555
|
548
|
static void ns83820_reset(struct nic *nic)
|
556
|
549
|
{
|
557
|
550
|
unsigned i;
|
558
|
|
- dprintf(("ns83820_reset\n"));
|
|
551
|
+ DBG("ns83820_reset\n");
|
559
|
552
|
|
560
|
553
|
writel(0, ns->base + PQCR);
|
561
|
554
|
|
|
@@ -612,7 +605,7 @@ static void ns83820_run_bist(struct nic *nic __unused, const char *name,
|
612
|
605
|
u32 status;
|
613
|
606
|
int loops = 0;
|
614
|
607
|
|
615
|
|
- dprintf(("start %s\n", name))
|
|
608
|
+ DBG("start %s\n", name);
|
616
|
609
|
|
617
|
610
|
start = currticks();
|
618
|
611
|
|
|
@@ -637,7 +630,7 @@ static void ns83820_run_bist(struct nic *nic __unused, const char *name,
|
637
|
630
|
(unsigned int) fail);
|
638
|
631
|
else if (timed_out)
|
639
|
632
|
printf("run_bist %s timed out! (%hX)\n", name, (unsigned int) status);
|
640
|
|
- dprintf(("done %s in %d loops\n", name, loops));
|
|
633
|
+ DBG("done %s in %d loops\n", name, loops);
|
641
|
634
|
}
|
642
|
635
|
|
643
|
636
|
/*************************************
|
|
@@ -697,7 +690,7 @@ static int ns83820_poll(struct nic *nic, int retrieve)
|
697
|
690
|
|
698
|
691
|
static inline void kick_tx(struct nic *nic __unused)
|
699
|
692
|
{
|
700
|
|
- dprintf(("kick_tx\n"));
|
|
693
|
+ DBG("kick_tx\n");
|
701
|
694
|
writel(CR_TXE, ns->base + CR);
|
702
|
695
|
}
|
703
|
696
|
|
|
@@ -897,7 +890,7 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
|
897
|
890
|
|
898
|
891
|
/* setup optical transceiver if we have one */
|
899
|
892
|
if (ns->CFG_cache & CFG_TBI_EN) {
|
900
|
|
- dprintf(("%s: enabling optical transceiver\n", pci->driver_name));
|
|
893
|
+ DBG("%s: enabling optical transceiver\n", pci->id->name);
|
901
|
894
|
writel(readl(ns->base + GPIOR) | 0x3e8, ns->base + GPIOR);
|
902
|
895
|
|
903
|
896
|
/* setup auto negotiation feature advertisement */
|
|
@@ -914,11 +907,11 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
|
914
|
907
|
ns->CFG_cache |= CFG_MODE_1000;
|
915
|
908
|
}
|
916
|
909
|
writel(ns->CFG_cache, ns->base + CFG);
|
917
|
|
- dprintf(("CFG: %hX\n", ns->CFG_cache));
|
|
910
|
+ DBG("CFG: %hX\n", ns->CFG_cache);
|
918
|
911
|
|
919
|
912
|
/* FIXME: reset_phy is defaulted to 0, should we reset anyway? */
|
920
|
913
|
if (reset_phy) {
|
921
|
|
- dprintf(("%s: resetting phy\n", pci->driver_name));
|
|
914
|
+ DBG("%s: resetting phy\n", pci->id->name);
|
922
|
915
|
writel(ns->CFG_cache | CFG_PHY_RST, ns->base + CFG);
|
923
|
916
|
writel(ns->CFG_cache, ns->base + CFG);
|
924
|
917
|
}
|
|
@@ -983,14 +976,14 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
|
983
|
976
|
ns83820_getmac(nic, nic->node_addr);
|
984
|
977
|
|
985
|
978
|
if (using_dac) {
|
986
|
|
- dprintf(("%s: using 64 bit addressing.\n", pci->driver_name));
|
|
979
|
+ DBG("%s: using 64 bit addressing.\n", pci->id->name);
|
987
|
980
|
}
|
988
|
981
|
|
989
|
|
- dprintf(("%s: DP83820 %d.%d: %! io=0x%hX\n",
|
990
|
|
- pci->driver_name,
|
991
|
|
- (unsigned) readl(ns->base + SRR) >> 8,
|
992
|
|
- (unsigned) readl(ns->base + SRR) & 0xff,
|
993
|
|
- nic->node_addr, pci->ioaddr));
|
|
982
|
+ DBG("%s: DP83820 %d.%d: io=%#04lx\n",
|
|
983
|
+ pci->id->name,
|
|
984
|
+ (unsigned) readl(ns->base + SRR) >> 8,
|
|
985
|
+ (unsigned) readl(ns->base + SRR) & 0xff,
|
|
986
|
+ pci->ioaddr);
|
994
|
987
|
|
995
|
988
|
#ifdef PHY_CODE_IS_FINISHED
|
996
|
989
|
ns83820_probe_phy(dev);
|