Tulip auto negotiation fix on linux-2.3.99-pre6

From: s-sumi@trc.rwcp.or.jp
Date: Tue May 09 2000 - 12:11:37 EST


Hi.

Here is a patch which is work on Alpha with DE500(21143 based).
I have tested DS20E and XP1000 with 100Mbps switch and ftp achieves 11MB/s.

Please test on the other platform and 2114x NICs and refine this patch.

Thank you.
===========================================================================
ftp> get vmlinux-2.3.99-pre6
200 PORT command successful.
150 Opening BINARY mode data connection for vmlinux-2.3.99-pre6 (4412070 bytes).
226 Transfer complete.
4412070 bytes received in 0.394 secs (1.1e+04 Kbytes/sec)

===========================================================================
diff -c -r /home/s-sumi/work1/KERNEL/linux-2.3.99-pre6/drivers/net/tulip/21142.c linux/drivers/net/tulip/21142.c
*** /home/s-sumi/work1/KERNEL/linux-2.3.99-pre6/drivers/net/tulip/21142.c Sat Apr 15 02:09:00 2000
--- linux/drivers/net/tulip/21142.c Wed May 10 01:17:28 2000
***************
*** 102,107 ****
--- 102,113 ----
          int csr14 = ((tp->to_advertise & 0x0780) << 9) |
                  ((tp->to_advertise&0x0020)<<1) | 0xffbf;
  
+ if(tp->chip_id == DC21143) {
+ outl(0x3ffff, ioaddr + CSR14);
+ if (tulip_debug > 1)
+ printk(KERN_DEBUG " enabling auto negotiation, CSR14 is 0x%x.\n",
+ inl(ioaddr + CSR14));
+ }
          dev->if_port = 0;
          tp->nway = tp->mediasense = 1;
          tp->nwayset = tp->lpar = 0;
***************
*** 187,214 ****
  #endif
                  tulip_outl_CSR6(tp, tp->csr6 | 0x2002);
                  if (tulip_debug > 2)
! printk(KERN_DEBUG "%s: Setting CSR6 %8.8x/%x CSR12 %8.8x.\n",
                                     dev->name, tp->csr6, inl(ioaddr + CSR6),
! inl(ioaddr + CSR12));
          } else if ((tp->nwayset && (csr5 & 0x08000000)
                                  && (dev->if_port == 3 || dev->if_port == 5)
                                  && (csr12 & 2) == 2) ||
                             (tp->nway && (csr5 & (TPLnkFail)))) {
                  /* Link blew? Maybe restart NWay. */
! del_timer(&tp->timer);
                  t21142_start_nway(dev);
                  tp->timer.expires = RUN_AT(3*HZ);
! add_timer(&tp->timer);
          } else if (dev->if_port == 3 || dev->if_port == 5) {
                  if (tulip_debug > 1)
                          printk(KERN_INFO"%s: 21143 %s link beat %s.\n",
                                     dev->name, medianame[dev->if_port],
                                     (csr12 & 2) ? "failed" : "good");
                  if ((csr12 & 2) && ! tp->medialock) {
! del_timer(&tp->timer);
                          t21142_start_nway(dev);
                          tp->timer.expires = RUN_AT(3*HZ);
! add_timer(&tp->timer);
                  }
          } else if (dev->if_port == 0 || dev->if_port == 4) {
                  if ((csr12 & 4) == 0)
--- 193,220 ----
  #endif
                  tulip_outl_CSR6(tp, tp->csr6 | 0x2002);
                  if (tulip_debug > 2)
! printk(KERN_DEBUG "%s: Setting CSR6 %8.8x/%x CSR12 %8.8x CSR7(%8.8x).\n",
                                     dev->name, tp->csr6, inl(ioaddr + CSR6),
! inl(ioaddr + CSR12), inl(ioaddr + CSR7));
          } else if ((tp->nwayset && (csr5 & 0x08000000)
                                  && (dev->if_port == 3 || dev->if_port == 5)
                                  && (csr12 & 2) == 2) ||
                             (tp->nway && (csr5 & (TPLnkFail)))) {
                  /* Link blew? Maybe restart NWay. */
! //del_timer(&tp->timer);
                  t21142_start_nway(dev);
                  tp->timer.expires = RUN_AT(3*HZ);
! //add_timer(&tp->timer);
          } else if (dev->if_port == 3 || dev->if_port == 5) {
                  if (tulip_debug > 1)
                          printk(KERN_INFO"%s: 21143 %s link beat %s.\n",
                                     dev->name, medianame[dev->if_port],
                                     (csr12 & 2) ? "failed" : "good");
                  if ((csr12 & 2) && ! tp->medialock) {
! //del_timer(&tp->timer);
                          t21142_start_nway(dev);
                          tp->timer.expires = RUN_AT(3*HZ);
! //add_timer(&tp->timer);
                  }
          } else if (dev->if_port == 0 || dev->if_port == 4) {
                  if ((csr12 & 4) == 0)
***************
*** 233,238 ****
--- 239,250 ----
                  outl(0x0301, ioaddr + CSR12);
                  tulip_outl_CSR6(tp, tp->csr6 | 0x0002);
                  tulip_outl_CSR6(tp, tp->csr6 | 0x2002);
+ }
+ if((tp->chip_id == DC21143) && (dev->if_port > 3)) {
+ outl(0,ioaddr + CSR14);
+ if (tulip_debug > 1)
+ printk(KERN_DEBUG " disabling auto negotiation, CSR14 is %2.2x.\n",
+ inl(ioaddr + CSR14) & 0xff);
          }
  }
===========================================================================
-----
Shinji Sumimoto E-Mail: s-sumi@trc.rwcp.or.jp
Real World Computing Partnership, Japan.
URL: http://www.rwcp.or.jp/lab/pdslab

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:13 EST