Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic PR/13653: Onno van der Linden: Set tranceiver med...
details: https://anonhg.NetBSD.org/src/rev/40c8ece51118
branches: trunk
changeset: 546954:40c8ece51118
user: christos <christos%NetBSD.org@localhost>
date: Fri May 09 20:54:18 2003 +0000
description:
PR/13653: Onno van der Linden: Set tranceiver media properly.
diffstat:
sys/dev/ic/elinkxl.c | 54 ++++++++++++++++++++++++++++++---------------------
1 files changed, 32 insertions(+), 22 deletions(-)
diffs (97 lines):
diff -r 6cd9a1348c7a -r 40c8ece51118 sys/dev/ic/elinkxl.c
--- a/sys/dev/ic/elinkxl.c Fri May 09 20:50:35 2003 +0000
+++ b/sys/dev/ic/elinkxl.c Fri May 09 20:54:18 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: elinkxl.c,v 1.68 2003/01/31 00:26:29 thorpej Exp $ */
+/* $NetBSD: elinkxl.c,v 1.69 2003/05/09 20:54:18 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.68 2003/01/31 00:26:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.69 2003/05/09 20:54:18 christos Exp $");
#include "bpfilter.h"
#include "rnd.h"
@@ -94,6 +94,7 @@
void ex_probe_media __P((struct ex_softc *));
void ex_set_filter __P((struct ex_softc *));
void ex_set_media __P((struct ex_softc *));
+void ex_set_xcvr __P((struct ex_softc *, u_int16_t));
struct mbuf *ex_get __P((struct ex_softc *, int));
u_int16_t ex_read_eeprom __P((struct ex_softc *, int));
int ex_init __P((struct ifnet *));
@@ -398,19 +399,7 @@
* Find PHY, extract media information from it.
* First, select the right transceiver.
*/
- u_int32_t icfg;
-
- GO_WINDOW(3);
- icfg = bus_space_read_4(iot, ioh, ELINK_W3_INTERNAL_CONFIG);
- icfg &= ~(CONFIG_XCVR_SEL << 16);
- if (val & (ELINK_MEDIACAP_MII | ELINK_MEDIACAP_100BASET4))
- icfg |= ELINKMEDIA_MII << (CONFIG_XCVR_SEL_SHIFT + 16);
- if (val & ELINK_MEDIACAP_100BASETX)
- icfg |= ELINKMEDIA_AUTO << (CONFIG_XCVR_SEL_SHIFT + 16);
- if (val & ELINK_MEDIACAP_100BASEFX)
- icfg |= ELINKMEDIA_100BASE_FX
- << (CONFIG_XCVR_SEL_SHIFT + 16);
- bus_space_write_4(iot, ioh, ELINK_W3_INTERNAL_CONFIG, icfg);
+ ex_set_xcvr(sc, val);
mii_attach(&sc->sc_dev, &sc->ex_mii, 0xffffffff,
MII_PHY_ANY, MII_OFFSET_ANY, 0);
@@ -834,6 +823,30 @@
}
void
+ex_set_xcvr(sc, media)
+ struct ex_softc *sc;
+ const u_int16_t media;
+{
+ bus_space_tag_t iot = sc->sc_iot;
+ bus_space_handle_t ioh = sc->sc_ioh;
+ u_int32_t icfg;
+
+ /*
+ * We're already in Window 3
+ */
+ icfg = bus_space_read_4(iot, ioh, ELINK_W3_INTERNAL_CONFIG);
+ icfg &= ~(CONFIG_XCVR_SEL << 16);
+ if (media & (ELINK_MEDIACAP_MII | ELINK_MEDIACAP_100BASET4))
+ icfg |= ELINKMEDIA_MII << (CONFIG_XCVR_SEL_SHIFT + 16);
+ if (media & ELINK_MEDIACAP_100BASETX)
+ icfg |= ELINKMEDIA_AUTO << (CONFIG_XCVR_SEL_SHIFT + 16);
+ if (media & ELINK_MEDIACAP_100BASEFX)
+ icfg |= ELINKMEDIA_100BASE_FX
+ << (CONFIG_XCVR_SEL_SHIFT + 16);
+ bus_space_write_4(iot, ioh, ELINK_W3_INTERNAL_CONFIG, icfg);
+}
+
+void
ex_set_media(sc)
struct ex_softc *sc;
{
@@ -856,14 +869,11 @@
* PHY which media to use.
*/
if (sc->ex_conf & EX_CONF_MII) {
- GO_WINDOW(3);
-
- configreg = bus_space_read_4(iot, ioh, ELINK_W3_INTERNAL_CONFIG);
+ u_int16_t val;
- configreg &= ~(CONFIG_MEDIAMASK << 16);
- configreg |= (ELINKMEDIA_MII << (CONFIG_MEDIAMASK_SHIFT + 16));
-
- bus_space_write_4(iot, ioh, ELINK_W3_INTERNAL_CONFIG, configreg);
+ GO_WINDOW(3);
+ val = bus_space_read_2(iot, ioh, ELINK_W3_RESET_OPTIONS);
+ ex_set_xcvr(sc, val);
mii_mediachg(&sc->ex_mii);
return;
}
Home |
Main Index |
Thread Index |
Old Index