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.
This commit is contained in:
thorpej 2003-03-23 00:56:15 +00:00
parent 77076c2d51
commit 8f70c6754b
1 changed files with 40 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_sip.c,v 1.77 2003/03/13 13:57:01 briggs Exp $ */
/* $NetBSD: if_sip.c,v 1.78 2003/03/23 00:56:15 thorpej Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.77 2003/03/13 13:57:01 briggs Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.78 2003/03/23 00:56:15 thorpej Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -2168,7 +2168,9 @@ SIP_DECL(init)(struct ifnet *ifp)
struct sip_txsoft *txs;
struct sip_rxsoft *rxs;
struct sip_desc *sipd;
#if defined(DP83820)
u_int32_t reg;
#endif
int i, error = 0;
/*
@ -2201,14 +2203,14 @@ SIP_DECL(init)(struct ifnet *ifp)
* 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 */
@ -3228,6 +3230,34 @@ SIP_DECL(dp83815_mii_statchg)(struct device *self)
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 */