aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMichal Meloun <mmel@FreeBSD.org>2020-06-19 18:34:27 +0000
committerMichal Meloun <mmel@FreeBSD.org>2020-06-19 18:34:27 +0000
commit188aee740fb5146f1616253deeb9cd0e9bb7f713 (patch)
treec44b66a8f135bde1164d1a8b217fc5b29d5cd2c3 /sys/dev
parent8d43a8685cc278adb7f3c1183ad974aaa7f00946 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/altera/dwc/if_dwc_socfpga.c2
-rw-r--r--sys/dev/dwc/if_dwc.c14
-rw-r--r--sys/dev/dwc/if_dwc.h5
-rw-r--r--sys/dev/dwc/if_dwc_if.m2
4 files changed, 12 insertions, 11 deletions
diff --git a/sys/dev/altera/dwc/if_dwc_socfpga.c b/sys/dev/altera/dwc/if_dwc_socfpga.c
index dce00a0901ad..c02015243de1 100644
--- a/sys/dev/altera/dwc/if_dwc_socfpga.c
+++ b/sys/dev/altera/dwc/if_dwc_socfpga.c
@@ -74,7 +74,7 @@ static int
if_dwc_socfpga_mac_type(device_t dev)
{
- return (DWC_GMAC);
+ return (DWC_GMAC_EXT_DESC);
}
static int
diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c
index 51a2019b0f1e..8c5e2a256f05 100644
--- a/sys/dev/dwc/if_dwc.c
+++ b/sys/dev/dwc/if_dwc.c
@@ -249,7 +249,7 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr,
flags = 0;
--sc->txcount;
} else {
- if (sc->mactype == DWC_GMAC_ALT_DESC)
+ if (sc->mactype != DWC_GMAC_EXT_DESC)
flags = NTDESC1_TCH | NTDESC1_FS
| NTDESC1_LS | NTDESC1_IC;
else
@@ -259,7 +259,7 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr,
}
sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr);
- if (sc->mactype == DWC_GMAC_ALT_DESC) {
+ if (sc->mactype != DWC_GMAC_EXT_DESC) {
sc->txdesc_ring[idx].desc0 = 0;
sc->txdesc_ring[idx].desc1 = flags | len;
} else {
@@ -537,7 +537,7 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr)
nidx = next_rxidx(sc, idx);
sc->rxdesc_ring[idx].addr2 = sc->rxdesc_ring_paddr +
(nidx * sizeof(struct dwc_hwdesc));
- if (sc->mactype == DWC_GMAC_ALT_DESC)
+ if (sc->mactype != DWC_GMAC_EXT_DESC)
sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | RX_MAX_PACKET;
else
sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | MCLBYTES;
@@ -661,7 +661,7 @@ dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN);
/* Take lower 8 bits and reverse it */
val = bitreverse(~crc & 0xff);
- if (ctx->sc->mactype == DWC_GMAC_ALT_DESC)
+ if (ctx->sc->mactype != DWC_GMAC_EXT_DESC)
val >>= 2; /* Only need lower 6 bits */
hashreg = (val >> 5);
hashbit = (val & 31);
@@ -682,7 +682,7 @@ dwc_setup_rxfilter(struct dwc_softc *sc)
DWC_ASSERT_LOCKED(sc);
ifp = sc->ifp;
- nhash = sc->mactype == DWC_GMAC_ALT_DESC ? 2 : 8;
+ nhash = sc->mactype != DWC_GMAC_EXT_DESC ? 2 : 8;
/*
* Set the multicast (group) filter hash.
@@ -715,7 +715,7 @@ dwc_setup_rxfilter(struct dwc_softc *sc)
WRITE4(sc, MAC_ADDRESS_LOW(0), lo);
WRITE4(sc, MAC_ADDRESS_HIGH(0), hi);
WRITE4(sc, MAC_FRAME_FILTER, ffval);
- if (sc->mactype == DWC_GMAC_ALT_DESC) {
+ if (sc->mactype != DWC_GMAC_EXT_DESC) {
WRITE4(sc, GMAC_MAC_HTLOW, ctx.hash[0]);
WRITE4(sc, GMAC_MAC_HTHIGH, ctx.hash[1]);
} else {
@@ -1260,7 +1260,7 @@ dwc_attach(device_t dev)
return (ENXIO);
}
- if (sc->mactype == DWC_GMAC_ALT_DESC) {
+ if (sc->mactype != DWC_GMAC_EXT_DESC) {
reg = BUS_MODE_FIXEDBURST;
reg |= (BUS_MODE_PRIORXTX_41 << BUS_MODE_PRIORXTX_SHIFT);
} else
diff --git a/sys/dev/dwc/if_dwc.h b/sys/dev/dwc/if_dwc.h
index d88ca0db55da..d20f35d74ce5 100644
--- a/sys/dev/dwc/if_dwc.h
+++ b/sys/dev/dwc/if_dwc.h
@@ -272,8 +272,9 @@
#define CURRENT_HOST_RECEIVE_BUF_ADDR 0x1054
#define HW_FEATURE 0x1058
-#define DWC_GMAC 0x1
-#define DWC_GMAC_ALT_DESC 0x2
+#define DWC_GMAC_NORMAL_DESC 0x1
+#define DWC_GMAC_EXT_DESC 0x2
+
#define GMAC_MII_CLK_60_100M_DIV42 0x0
#define GMAC_MII_CLK_100_150M_DIV62 0x1
#define GMAC_MII_CLK_25_35M_DIV16 0x2
diff --git a/sys/dev/dwc/if_dwc_if.m b/sys/dev/dwc/if_dwc_if.m
index feecb4e1f599..733f83545cf4 100644
--- a/sys/dev/dwc/if_dwc_if.m
+++ b/sys/dev/dwc/if_dwc_if.m
@@ -41,7 +41,7 @@ CODE {
static int
if_dwc_default_mac_type(device_t dev)
{
- return (DWC_GMAC);
+ return (DWC_GMAC_EXT_DESC);
}
static int