Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic When link status changes, update MAC configuratio...
details: https://anonhg.NetBSD.org/src/rev/8531525f8fff
branches: trunk
changeset: 803125:8531525f8fff
user: martin <martin%NetBSD.org@localhost>
date: Mon Oct 13 08:24:52 2014 +0000
description:
When link status changes, update MAC configuration accordingly.
diffstat:
sys/dev/ic/dwc_gmac.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diffs (53 lines):
diff -r fa8945f43e0c -r 8531525f8fff sys/dev/ic/dwc_gmac.c
--- a/sys/dev/ic/dwc_gmac.c Mon Oct 13 08:18:52 2014 +0000
+++ b/sys/dev/ic/dwc_gmac.c Mon Oct 13 08:24:52 2014 +0000
@@ -39,7 +39,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.8 2014/10/08 18:24:21 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.9 2014/10/13 08:24:52 martin Exp $");
/* #define DWC_GMAC_DEBUG 1 */
@@ -644,20 +644,37 @@
{
struct dwc_gmac_softc * const sc = ifp->if_softc;
struct mii_data * const mii = &sc->sc_mii;
+ uint32_t conf;
/*
* Set MII or GMII interface based on the speed
* negotiated by the PHY.
- */
+ */
+ conf = bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_MAC_CONF);
+ conf &= ~(AWIN_GMAC_MAC_CONF_FES100|AWIN_GMAC_MAC_CONF_MIISEL
+ |AWIN_GMAC_MAC_CONF_FULLDPLX);
+ conf |= AWIN_GMAC_MAC_CONF_FRAMEBURST | AWIN_GMAC_MAC_CONF_TXENABLE
+ | AWIN_GMAC_MAC_CONF_RXENABLE;
switch (IFM_SUBTYPE(mii->mii_media_active)) {
case IFM_10_T:
+ break;
case IFM_100_TX:
- /* XXX */
+ conf |= AWIN_GMAC_MAC_CONF_FES100;
break;
case IFM_1000_T:
- /* XXX */
+ conf |= AWIN_GMAC_MAC_CONF_MIISEL;
break;
}
+ if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX)
+ conf |= AWIN_GMAC_MAC_CONF_FULLDPLX;
+
+#ifdef DWC_GMAC_DEBUG
+ aprint_normal_dev(sc->sc_dev,
+ "setting MAC conf register: %08x\n", conf);
+#endif
+
+ bus_space_write_4(sc->sc_bst, sc->sc_bsh,
+ AWIN_GMAC_MAC_CONF, conf);
}
static int
Home |
Main Index |
Thread Index |
Old Index