mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-02 15:18:54 +08:00
ffec: Add FECFLAG_AVB variant flag
This flag is analogous to the Linux driver FEC_QUIRK_HAS_AVB. It indicates an FEC with support for Audio Video Bridging (AVB). This indicator is used for various other parts in the Linux driver (drivers/net/ethernet/freescale/fec_main.c). Use it to customize the receive/transmit buffer alignment. The receive buffer alignment increased to 64-bytes on the i.MX 6SoloX and i.MX 7Dual. There are no hard alignment restrictions for transmit buffers on these chips. Fix the ffec_softc::fectype type to provide enough storage for the feature flags.
This commit is contained in:
parent
1378632ad8
commit
ba0b05902b
@ -106,7 +106,8 @@ enum {
|
|||||||
* SoCs. These are ORed into the FECTYPE enum values.
|
* SoCs. These are ORed into the FECTYPE enum values.
|
||||||
*/
|
*/
|
||||||
#define FECTYPE_MASK 0x0000ffff
|
#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.
|
* 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,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE},
|
||||||
{"fsl,mvf600-fec", FECTYPE_MVF},
|
{"fsl,mvf600-fec", FECTYPE_MVF},
|
||||||
{"fsl,mvf-fec", FECTYPE_MVF},
|
{"fsl,mvf-fec", FECTYPE_MVF},
|
||||||
|
{"fsl,imx7d-fec", FECTYPE_IMX6 | FECFLAG_GBE | FECFLAG_AVB},
|
||||||
{NULL, FECTYPE_NONE},
|
{NULL, FECTYPE_NONE},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,12 +157,14 @@ struct ffec_softc {
|
|||||||
void * intr_cookie;
|
void * intr_cookie;
|
||||||
struct callout ffec_callout;
|
struct callout ffec_callout;
|
||||||
uint8_t phy_conn_type;
|
uint8_t phy_conn_type;
|
||||||
uint8_t fectype;
|
uintptr_t fectype;
|
||||||
boolean_t link_is_up;
|
boolean_t link_is_up;
|
||||||
boolean_t is_attached;
|
boolean_t is_attached;
|
||||||
boolean_t is_detaching;
|
boolean_t is_detaching;
|
||||||
int tx_watchdog_count;
|
int tx_watchdog_count;
|
||||||
int stats_harvest_count;
|
int stats_harvest_count;
|
||||||
|
int rxbuf_align;
|
||||||
|
int txbuf_align;
|
||||||
|
|
||||||
bus_dma_tag_t rxdesc_tag;
|
bus_dma_tag_t rxdesc_tag;
|
||||||
bus_dmamap_t rxdesc_map;
|
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
|
* have to ensure that the beginning of the buffer is aligned to the
|
||||||
* hardware's requirements.
|
* 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,
|
error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map,
|
||||||
m, &seg, &nsegs, 0);
|
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
|
* when we support jumbo frames and receiving fragments of them into
|
||||||
* separate buffers.
|
* separate buffers.
|
||||||
*/
|
*/
|
||||||
maxbuf = MCLBYTES - roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN);
|
maxbuf = MCLBYTES - roundup(ETHER_ALIGN, sc->rxbuf_align);
|
||||||
maxfl = min(maxbuf, 0x7ff);
|
maxfl = min(maxbuf, 0x7ff);
|
||||||
|
|
||||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
|
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;
|
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
|
* We have to be told what kind of electrical connection exists between
|
||||||
* the MAC and PHY or we can't operate correctly.
|
* the MAC and PHY or we can't operate correctly.
|
||||||
@ -1541,7 +1553,7 @@ ffec_attach(device_t dev)
|
|||||||
|
|
||||||
error = bus_dma_tag_create(
|
error = bus_dma_tag_create(
|
||||||
bus_get_dma_tag(dev), /* Parent tag. */
|
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_32BIT, /* lowaddr */
|
||||||
BUS_SPACE_MAXADDR, /* highaddr */
|
BUS_SPACE_MAXADDR, /* highaddr */
|
||||||
NULL, NULL, /* filter, filterarg */
|
NULL, NULL, /* filter, filterarg */
|
||||||
|
@ -318,7 +318,5 @@ struct ffec_hwdesc
|
|||||||
* DMA transfers. These values are expressed in bytes (not bits).
|
* DMA transfers. These values are expressed in bytes (not bits).
|
||||||
*/
|
*/
|
||||||
#define FEC_DESC_RING_ALIGN 64
|
#define FEC_DESC_RING_ALIGN 64
|
||||||
#define FEC_RXBUF_ALIGN 16
|
|
||||||
#define FEC_TXBUF_ALIGN 16
|
|
||||||
|
|
||||||
#endif /* IF_FFECREG_H */
|
#endif /* IF_FFECREG_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user