Changeset ba0b059 in rtems-libbsd


Ignore:
Timestamp:
Sep 27, 2017, 7:54:56 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
c1e05b9ea378b2971e3d7704779112b4bc4296da, 4a77611a223ea883fb548679b516d326a020d447
Children:
e2e4bf4
Parents:
1378632
git-author:
Sebastian Huber <sebastian.huber@…> (09/27/17 07:54:56)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/27/17 09:02:06)
Message:

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.

Location:
freebsd/sys/dev/ffec
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/dev/ffec/if_ffec.c

    r1378632 rba0b059  
    107107 */
    108108#define FECTYPE_MASK            0x0000ffff
    109 #define FECFLAG_GBE             (0x0001 << 16)
     109#define FECFLAG_GBE             (1 << 16)
     110#define FECFLAG_AVB             (1 << 17)
    110111
    111112/*
     
    118119        {"fsl,mvf600-fec",      FECTYPE_MVF},
    119120        {"fsl,mvf-fec",         FECTYPE_MVF},
     121        {"fsl,imx7d-fec",       FECTYPE_IMX6 | FECFLAG_GBE | FECFLAG_AVB},
    120122        {NULL,                  FECTYPE_NONE},
    121123};
     
    156158        struct callout          ffec_callout;
    157159        uint8_t                 phy_conn_type;
    158         uint8_t                 fectype;
     160        uintptr_t               fectype;
    159161        boolean_t               link_is_up;
    160162        boolean_t               is_attached;
     
    162164        int                     tx_watchdog_count;
    163165        int                     stats_harvest_count;
     166        int                     rxbuf_align;
     167        int                     txbuf_align;
    164168
    165169        bus_dma_tag_t           rxdesc_tag;
     
    752756         * hardware's requirements.
    753757         */
    754         m_adj(m, roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN));
     758        m_adj(m, roundup(ETHER_ALIGN, sc->rxbuf_align));
    755759
    756760        error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map,
     
    11001104         * separate buffers.
    11011105         */
    1102         maxbuf = MCLBYTES - roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN);
     1106        maxbuf = MCLBYTES - roundup(ETHER_ALIGN, sc->rxbuf_align);
    11031107        maxfl = min(maxbuf, 0x7ff);
    11041108
     
    14511455        sc->fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
    14521456
     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
    14531465        /*
    14541466         * We have to be told what kind of electrical connection exists between
     
    15421554        error = bus_dma_tag_create(
    15431555            bus_get_dma_tag(dev),       /* Parent tag. */
    1544             FEC_TXBUF_ALIGN, 0,         /* alignment, boundary */
     1556            sc->txbuf_align, 0,         /* alignment, boundary */
    15451557            BUS_SPACE_MAXADDR_32BIT,    /* lowaddr */
    15461558            BUS_SPACE_MAXADDR,          /* highaddr */
  • freebsd/sys/dev/ffec/if_ffecreg.h

    r1378632 rba0b059  
    319319 */
    320320#define FEC_DESC_RING_ALIGN             64
    321 #define FEC_RXBUF_ALIGN                 16
    322 #define FEC_TXBUF_ALIGN                 16
    323321
    324322#endif  /* IF_FFECREG_H */
Note: See TracChangeset for help on using the changeset viewer.