Lines 106-112
enum {
Link Here
|
106 |
* SoCs. These are ORed into the FECTYPE enum values. |
106 |
* SoCs. These are ORed into the FECTYPE enum values. |
107 |
*/ |
107 |
*/ |
108 |
#define FECTYPE_MASK 0x0000ffff |
108 |
#define FECTYPE_MASK 0x0000ffff |
109 |
#define FECFLAG_GBE (0x0001 << 16) |
109 |
#define FECFLAG_GBE (1 << 16) |
|
|
110 |
#define FECFLAG_AVB (1 << 17) |
110 |
|
111 |
|
111 |
/* |
112 |
/* |
112 |
* Table of supported FDT compat strings and their associated FECTYPE values. |
113 |
* Table of supported FDT compat strings and their associated FECTYPE values. |
Lines 116-121
static struct ofw_compat_data compat_data[] = {
Link Here
|
116 |
{"fsl,imx53-fec", FECTYPE_IMX53}, |
117 |
{"fsl,imx53-fec", FECTYPE_IMX53}, |
117 |
{"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE}, |
118 |
{"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE}, |
118 |
{"fsl,imx6ul-fec", FECTYPE_IMX6}, |
119 |
{"fsl,imx6ul-fec", FECTYPE_IMX6}, |
|
|
120 |
+ {"fsl,imx7d-fec", FECTYPE_IMX6 | FECFLAG_GBE | FECFLAG_AVB}, |
119 |
{"fsl,mvf600-fec", FECTYPE_MVF}, |
121 |
{"fsl,mvf600-fec", FECTYPE_MVF}, |
120 |
{"fsl,mvf-fec", FECTYPE_MVF}, |
122 |
{"fsl,mvf-fec", FECTYPE_MVF}, |
121 |
{NULL, FECTYPE_NONE}, |
123 |
{NULL, FECTYPE_NONE}, |
Lines 148-158
struct ffec_softc {
Link Here
|
148 |
void * intr_cookie; |
150 |
void * intr_cookie; |
149 |
struct callout ffec_callout; |
151 |
struct callout ffec_callout; |
150 |
mii_contype_t phy_conn_type; |
152 |
mii_contype_t phy_conn_type; |
151 |
uint8_t fectype; |
153 |
uintptr_t fectype; |
152 |
boolean_t link_is_up; |
154 |
boolean_t link_is_up; |
153 |
boolean_t is_attached; |
155 |
boolean_t is_attached; |
154 |
boolean_t is_detaching; |
156 |
boolean_t is_detaching; |
155 |
int tx_watchdog_count; |
157 |
int tx_watchdog_count; |
|
|
158 |
int rxbuf_align; |
159 |
int txbuf_align; |
156 |
|
160 |
|
157 |
bus_dma_tag_t rxdesc_tag; |
161 |
bus_dma_tag_t rxdesc_tag; |
158 |
bus_dmamap_t rxdesc_map; |
162 |
bus_dmamap_t rxdesc_map; |
Lines 754-760
ffec_setup_rxbuf(struct ffec_softc *sc, int idx, struct mbuf * m)
Link Here
|
754 |
* have to ensure that the beginning of the buffer is aligned to the |
758 |
* have to ensure that the beginning of the buffer is aligned to the |
755 |
* hardware's requirements. |
759 |
* hardware's requirements. |
756 |
*/ |
760 |
*/ |
757 |
m_adj(m, roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN)); |
761 |
m_adj(m, roundup(ETHER_ALIGN, sc->rxbuf_align)); |
758 |
|
762 |
|
759 |
error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map, |
763 |
error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map, |
760 |
m, &seg, &nsegs, 0); |
764 |
m, &seg, &nsegs, 0); |
Lines 1098-1104
ffec_init_locked(struct ffec_softc *sc)
Link Here
|
1098 |
* when we support jumbo frames and receiving fragments of them into |
1102 |
* when we support jumbo frames and receiving fragments of them into |
1099 |
* separate buffers. |
1103 |
* separate buffers. |
1100 |
*/ |
1104 |
*/ |
1101 |
maxbuf = MCLBYTES - roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN); |
1105 |
maxbuf = MCLBYTES - roundup(ETHER_ALIGN, sc->rxbuf_align); |
1102 |
maxfl = min(maxbuf, 0x7ff); |
1106 |
maxfl = min(maxbuf, 0x7ff); |
1103 |
|
1107 |
|
1104 |
if (ifp->if_drv_flags & IFF_DRV_RUNNING) |
1108 |
if (ifp->if_drv_flags & IFF_DRV_RUNNING) |
Lines 1450-1455
ffec_attach(device_t dev)
Link Here
|
1450 |
*/ |
1454 |
*/ |
1451 |
sc->fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; |
1455 |
sc->fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; |
1452 |
|
1456 |
|
|
|
1457 |
if (sc->fectype & FECFLAG_AVB) { |
1458 |
sc->rxbuf_align = 64; |
1459 |
sc->txbuf_align = 1; |
1460 |
} else { |
1461 |
sc->rxbuf_align = 16; |
1462 |
sc->txbuf_align = 16; |
1463 |
} |
1464 |
|
1453 |
/* |
1465 |
/* |
1454 |
* We have to be told what kind of electrical connection exists between |
1466 |
* We have to be told what kind of electrical connection exists between |
1455 |
* the MAC and PHY or we can't operate correctly. |
1467 |
* the MAC and PHY or we can't operate correctly. |
Lines 1525-1531
ffec_attach(device_t dev)
Link Here
|
1525 |
|
1537 |
|
1526 |
error = bus_dma_tag_create( |
1538 |
error = bus_dma_tag_create( |
1527 |
bus_get_dma_tag(dev), /* Parent tag. */ |
1539 |
bus_get_dma_tag(dev), /* Parent tag. */ |
1528 |
FEC_TXBUF_ALIGN, 0, /* alignment, boundary */ |
1540 |
sc->txbuf_align, 0, /* alignment, boundary */ |
1529 |
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ |
1541 |
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ |
1530 |
BUS_SPACE_MAXADDR, /* highaddr */ |
1542 |
BUS_SPACE_MAXADDR, /* highaddr */ |
1531 |
NULL, NULL, /* filter, filterarg */ |
1543 |
NULL, NULL, /* filter, filterarg */ |