Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/dev/pci Pull up revision 1.78 (requested by thorpej...



details:   https://anonhg.NetBSD.org/src/rev/92dde4481f43
branches:  netbsd-1-6
changeset: 530256:92dde4481f43
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Jun 15 12:42:45 2003 +0000

description:
Pull up revision 1.78 (requested by thorpej in ticket #1228):
Add a work-around for the "short cable problem" that some DP83815
revisions have, as discussed on the soekris-tech mailing list a
while ago, whereby one can experience excessive recieve erros when
using < 30m cables.  The patch detects overflow in a DSP filter
parameter, and corrects it by writing a known good value.

diffstat:

 sys/dev/pci/if_sip.c |  50 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 40 insertions(+), 10 deletions(-)

diffs (86 lines):

diff -r 264f8329db7a -r 92dde4481f43 sys/dev/pci/if_sip.c
--- a/sys/dev/pci/if_sip.c      Mon Jun 02 15:23:52 2003 +0000
+++ b/sys/dev/pci/if_sip.c      Sun Jun 15 12:42:45 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sip.c,v 1.52.4.7 2002/11/21 18:28:15 he Exp $       */
+/*     $NetBSD: if_sip.c,v 1.52.4.8 2003/06/15 12:42:45 tron Exp $     */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.52.4.7 2002/11/21 18:28:15 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.52.4.8 2003/06/15 12:42:45 tron Exp $");
 
 #include "bpfilter.h"
 
@@ -2148,7 +2148,9 @@
        struct sip_txsoft *txs;
        struct sip_rxsoft *rxs;
        struct sip_desc *sipd;
+#if defined(DP83820)
        u_int32_t reg;
+#endif
        int i, error = 0;
 
        /*
@@ -2181,14 +2183,14 @@
                 * Note that only the low-order 12 bits of 0xe4 are documented
                 * and that this sets reserved bits in that register.
                 */
-               reg = bus_space_read_4(st, sh, SIP_NS_SRR);
-               if (reg == 0x302) {
-                       bus_space_write_4(st, sh, 0x00cc, 0x0001);
-                       bus_space_write_4(st, sh, 0x00e4, 0x189C);
-                       bus_space_write_4(st, sh, 0x00fc, 0x0000);
-                       bus_space_write_4(st, sh, 0x00f4, 0x5040);
-                       bus_space_write_4(st, sh, 0x00f8, 0x008c);
-               }
+               bus_space_write_4(st, sh, 0x00cc, 0x0001);
+
+               bus_space_write_4(st, sh, 0x00e4, 0x189C);
+               bus_space_write_4(st, sh, 0x00fc, 0x0000);
+               bus_space_write_4(st, sh, 0x00f4, 0x5040);
+               bus_space_write_4(st, sh, 0x00f8, 0x008c);
+
+               bus_space_write_4(st, sh, 0x00cc, 0x0000);
        }
 #endif /* ! DP83820 */
 
@@ -3137,6 +3139,34 @@
 
        bus_space_write_4(sc->sc_st, sc->sc_sh, SIP_TXCFG, sc->sc_txcfg);
        bus_space_write_4(sc->sc_st, sc->sc_sh, SIP_RXCFG, sc->sc_rxcfg);
+
+       /*
+        * Some DP83815s experience problems when used with short
+        * (< 30m/100ft) Ethernet cables in 100BaseTX mode.  This
+        * sequence adjusts the DSP's signal attenuation to fix the
+        * problem.
+        */
+       if (IFM_SUBTYPE(sc->sc_mii.mii_media_active) == IFM_100_TX) {
+               uint32_t reg;
+
+               bus_space_write_4(sc->sc_st, sc->sc_sh, 0x00cc, 0x0001);
+
+               reg = bus_space_read_4(sc->sc_st, sc->sc_sh, 0x00f4);
+               reg &= 0x0fff;
+               bus_space_write_4(sc->sc_st, sc->sc_sh, 0x00f4, reg | 0x1000);
+               delay(100);
+               reg = bus_space_read_4(sc->sc_st, sc->sc_sh, 0x00fc);
+               reg &= 0x00ff;
+               if ((reg & 0x0080) == 0 || (reg >= 0x00d8)) {
+                       bus_space_write_4(sc->sc_st, sc->sc_sh, 0x00fc,
+                           0x00e8);
+                       reg = bus_space_read_4(sc->sc_st, sc->sc_sh, 0x00f4);
+                       bus_space_write_4(sc->sc_st, sc->sc_sh, 0x00f4,
+                           reg | 0x20);
+               }
+
+               bus_space_write_4(sc->sc_st, sc->sc_sh, 0x00cc, 0);
+       }
 }
 #endif /* DP83820 */
 



Home | Main Index | Thread Index | Old Index