summaryrefslogtreecommitdiffstats
path: root/sys/dev/ed/if_ed_3c503.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-01-27 08:25:47 +0000
committerimp <imp@FreeBSD.org>2006-01-27 08:25:47 +0000
commit6efae9acb29b8c64923ae1ee77e7cc82e5e8a0e2 (patch)
tree54cb06ac114294dd37f2a97967880e27b26cc508 /sys/dev/ed/if_ed_3c503.c
parentc4eb978faff364387f77445334bee6d7ba640725 (diff)
downloadFreeBSD-src-6efae9acb29b8c64923ae1ee77e7cc82e5e8a0e2.zip
FreeBSD-src-6efae9acb29b8c64923ae1ee77e7cc82e5e8a0e2.tar.gz
Create mediachg functions for the 3c503 and hpp cards. This is used
to properly configure the right interface to use. Also call the mediachg function when we set flags UP and are already running. If this were a pure ifmedia driver, we'd not need to do this since we'd be ignoring the linkX flags. This reduces the number of ifdefs to support sub-devices a little as a nice side effect. It also reduces the number of hpp interfaces exposed by 33%.
Diffstat (limited to 'sys/dev/ed/if_ed_3c503.c')
-rw-r--r--sys/dev/ed/if_ed_3c503.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/ed/if_ed_3c503.c b/sys/dev/ed/if_ed_3c503.c
index c0fcd67..55b7046 100644
--- a/sys/dev/ed/if_ed_3c503.c
+++ b/sys/dev/ed/if_ed_3c503.c
@@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$");
#include <dev/ed/if_edreg.h>
#include <dev/ed/if_edvar.h>
+static void ed_3c503_mediachg(struct ed_softc *sc);
+
/*
* Probe and vendor-specific initialization routine for 3Com 3c503 boards
*/
@@ -335,7 +337,25 @@ ed_probe_3Com(device_t dev, int port_rid, int flags)
ed_asic_outb(sc, ED_3COM_VPTR1, 0xff);
ed_asic_outb(sc, ED_3COM_VPTR0, 0x00);
- return (ed_clear_memory(dev));
+ error = ed_clear_memory(dev);
+ if (error == 0)
+ sc->sc_mediachg = ed_3c503_mediachg;
+ return (error);
+}
+
+static void
+ed_3c503_mediachg(struct ed_softc *sc)
+{
+ struct ifnet *ifp = sc->ifp;
+
+ /*
+ * If this is a 3Com board, the tranceiver must be software enabled
+ * (there is no settable hardware default).
+ */
+ if (ifp->if_flags & IFF_LINK2)
+ ed_asic_outb(sc, ED_3COM_CR, 0);
+ else
+ ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL);
}
#endif /* ED_3C503 */
OpenPOWER on IntegriCloud