summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/dev/ffec/if_ffec.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/dev/ffec/if_ffec.c')
-rw-r--r--freebsd/sys/dev/ffec/if_ffec.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/freebsd/sys/dev/ffec/if_ffec.c b/freebsd/sys/dev/ffec/if_ffec.c
index f4914adf..85a720fc 100644
--- a/freebsd/sys/dev/ffec/if_ffec.c
+++ b/freebsd/sys/dev/ffec/if_ffec.c
@@ -106,7 +106,8 @@ enum {
* SoCs. These are ORed into the FECTYPE enum values.
*/
#define FECTYPE_MASK 0x0000ffff
-#define FECFLAG_GBE (0x0001 << 16)
+#define FECFLAG_GBE (1 << 16)
+#define FECFLAG_AVB (1 << 17)
/*
* Table of supported FDT compat strings and their associated FECTYPE values.
@@ -117,6 +118,7 @@ static struct ofw_compat_data compat_data[] = {
{"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE},
{"fsl,mvf600-fec", FECTYPE_MVF},
{"fsl,mvf-fec", FECTYPE_MVF},
+ {"fsl,imx7d-fec", FECTYPE_IMX6 | FECFLAG_GBE | FECFLAG_AVB},
{NULL, FECTYPE_NONE},
};
@@ -155,12 +157,14 @@ struct ffec_softc {
void * intr_cookie;
struct callout ffec_callout;
uint8_t phy_conn_type;
- uint8_t fectype;
+ uintptr_t fectype;
boolean_t link_is_up;
boolean_t is_attached;
boolean_t is_detaching;
int tx_watchdog_count;
int stats_harvest_count;
+ int rxbuf_align;
+ int txbuf_align;
bus_dma_tag_t rxdesc_tag;
bus_dmamap_t rxdesc_map;
@@ -751,7 +755,7 @@ ffec_setup_rxbuf(struct ffec_softc *sc, int idx, struct mbuf * m)
* have to ensure that the beginning of the buffer is aligned to the
* hardware's requirements.
*/
- m_adj(m, roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN));
+ m_adj(m, roundup(ETHER_ALIGN, sc->rxbuf_align));
error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map,
m, &seg, &nsegs, 0);
@@ -1099,7 +1103,7 @@ ffec_init_locked(struct ffec_softc *sc)
* when we support jumbo frames and receiving fragments of them into
* separate buffers.
*/
- maxbuf = MCLBYTES - roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN);
+ maxbuf = MCLBYTES - roundup(ETHER_ALIGN, sc->rxbuf_align);
maxfl = min(maxbuf, 0x7ff);
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
@@ -1450,6 +1454,14 @@ ffec_attach(device_t dev)
*/
sc->fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
+ if (sc->fectype & FECFLAG_AVB) {
+ sc->rxbuf_align = 64;
+ sc->txbuf_align = 1;
+ } else {
+ sc->rxbuf_align = 16;
+ sc->txbuf_align = 16;
+ }
+
/*
* We have to be told what kind of electrical connection exists between
* the MAC and PHY or we can't operate correctly.
@@ -1541,7 +1553,7 @@ ffec_attach(device_t dev)
error = bus_dma_tag_create(
bus_get_dma_tag(dev), /* Parent tag. */
- FEC_TXBUF_ALIGN, 0, /* alignment, boundary */
+ sc->txbuf_align, 0, /* alignment, boundary */
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */