/* * Define the buffer descriptor structure. * * Evidently, ARM SoCs have the FEC block generated in a * little endian mode so adjust endianness accordingly.
*/ #ifdefined(CONFIG_ARM) || defined(CONFIG_ARM64) #define fec32_to_cpu le32_to_cpu #define fec16_to_cpu le16_to_cpu #define cpu_to_fec32 cpu_to_le32 #define cpu_to_fec16 cpu_to_le16 #define __fec32 __le32 #define __fec16 __le16
struct bufdesc {
__fec16 cbd_datlen; /* Data length */
__fec16 cbd_sc; /* Control and status info */
__fec32 cbd_bufaddr; /* Buffer address */
}; #else #define fec32_to_cpu be32_to_cpu #define fec16_to_cpu be16_to_cpu #define cpu_to_fec32 cpu_to_be32 #define cpu_to_fec16 cpu_to_be16 #define __fec32 __be32 #define __fec16 __be16
struct bufdesc {
__fec16 cbd_sc; /* Control and status info */
__fec16 cbd_datlen; /* Data length */
__fec32 cbd_bufaddr; /* Buffer address */
}; #endif
/* This device has up to three irqs on some platforms */ #define FEC_IRQ_NUM 3
/* Maximum number of queues supported * ENET with AVB IP can support up to 3 independent tx queues and rx queues. * User can point the queue number that is less than or equal to 3.
*/ #define FEC_ENET_MAX_TX_QS 3 #define FEC_ENET_MAX_RX_QS 3
/* The number of Tx and Rx buffers. These are allocated from the page * pool. The code may assume these are power of two, so it is best * to keep them that size. * We don't need to allocate pages for the transmitter. We just use * the skbuffer directly.
*/
#define FEC_ENET_XDP_HEADROOM (XDP_PACKET_HEADROOM) #define FEC_ENET_RX_PAGES 256 #define FEC_ENET_RX_FRSIZE (PAGE_SIZE - FEC_ENET_XDP_HEADROOM \
- SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) #define FEC_ENET_RX_FRPPG (PAGE_SIZE / FEC_ENET_RX_FRSIZE) #define RX_RING_SIZE (FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES) #define FEC_ENET_TX_FRSIZE 2048 #define FEC_ENET_TX_FRPPG (PAGE_SIZE / FEC_ENET_TX_FRSIZE) #define TX_RING_SIZE 1024 /* Must be power of two */ #define TX_RING_MOD_MASK 511 /* for this to work */
/* Controller is ENET-MAC */ #define FEC_QUIRK_ENET_MAC (1 << 0) /* Controller needs driver to swap frame */ #define FEC_QUIRK_SWAP_FRAME (1 << 1) /* Controller uses gasket */ #define FEC_QUIRK_USE_GASKET (1 << 2) /* Controller has GBIT support */ #define FEC_QUIRK_HAS_GBIT (1 << 3) /* Controller has extend desc buffer */ #define FEC_QUIRK_HAS_BUFDESC_EX (1 << 4) /* Controller has hardware checksum support */ #define FEC_QUIRK_HAS_CSUM (1 << 5) /* Controller has hardware vlan support */ #define FEC_QUIRK_HAS_VLAN (1 << 6) /* ENET IP errata ERR006358 * * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously * detected as not set during a prior frame transmission, then the * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in * frames not being transmitted until there is a 0-to-1 transition on * ENET_TDAR[TDAR].
*/ #define FEC_QUIRK_ERR006358 (1 << 7) /* ENET IP hw AVB * * i.MX6SX ENET IP add Audio Video Bridging (AVB) feature support. * - Two class indicators on receive with configurable priority * - Two class indicators and line speed timer on transmit allowing * implementation class credit based shapers externally * - Additional DMA registers provisioned to allow managing up to 3 * independent rings
*/ #define FEC_QUIRK_HAS_AVB (1 << 8) /* There is a TDAR race condition for mutliQ when the software sets TDAR * and the UDMA clears TDAR simultaneously or in a small window (2-4 cycles). * This will cause the udma_tx and udma_tx_arbiter state machines to hang. * The issue exist at i.MX6SX enet IP.
*/ #define FEC_QUIRK_ERR007885 (1 << 9) /* ENET Block Guide/ Chapter for the iMX6SX (PELE) address one issue: * After set ENET_ATCR[Capture], there need some time cycles before the counter * value is capture in the register clock domain. * The wait-time-cycles is at least 6 clock cycles of the slower clock between * the register clock and the 1588 clock. The 1588 ts_clk is fixed to 25Mhz, * register clock is 66Mhz, so the wait-time-cycles must be greater than 240ns * (40ns * 6).
*/ #define FEC_QUIRK_BUG_CAPTURE (1 << 10) /* Controller has only one MDIO bus */ #define FEC_QUIRK_SINGLE_MDIO (1 << 11) /* Controller supports RACC register */ #define FEC_QUIRK_HAS_RACC (1 << 12) /* Controller supports interrupt coalesce */ #define FEC_QUIRK_HAS_COALESCE (1 << 13) /* Interrupt doesn't wake CPU from deep idle */ #define FEC_QUIRK_ERR006687 (1 << 14) /* The MIB counters should be cleared and enabled during * initialisation.
*/ #define FEC_QUIRK_MIB_CLEAR (1 << 15) /* Only i.MX25/i.MX27/i.MX28 controller supports FRBR,FRSR registers, * those FIFO receive registers are resolved in other platforms.
*/ #define FEC_QUIRK_HAS_FRREG (1 << 16)
/* Some FEC hardware blocks need the MMFR cleared at setup time to avoid * the generation of an MII event. This must be avoided in the older * FEC blocks where it will stop MII events being generated.
*/ #define FEC_QUIRK_CLEAR_SETUP_MII (1 << 17)
/* Some link partners do not tolerate the momentary reset of the REF_CLK * frequency when the RNCTL register is cleared by hardware reset.
*/ #define FEC_QUIRK_NO_HARD_RESET (1 << 18)
/* i.MX6SX ENET IP supports multiple queues (3 queues), use this quirk to * represents this ENET IP.
*/ #define FEC_QUIRK_HAS_MULTI_QUEUES (1 << 19)
/* i.MX8MQ ENET IP version add new feature to support IEEE 802.3az EEE * standard. For the transmission, MAC supply two user registers to set * Sleep (TS) and Wake (TW) time.
*/ #define FEC_QUIRK_HAS_EEE (1 << 20)
/* i.MX8QM ENET IP version add new feature to generate delayed TXC/RXC * as an alternative option to make sure it works well with various PHYs. * For the implementation of delayed clock, ENET takes synchronized 250MHz * clocks to generate 2ns delay.
*/ #define FEC_QUIRK_DELAYED_CLKS_SUPPORT (1 << 21)
/* i.MX8MQ SoC integration mix wakeup interrupt signal into "int2" interrupt line. */ #define FEC_QUIRK_WAKEUP_FROM_INT2 (1 << 22)
/* i.MX6Q adds pm_qos support */ #define FEC_QUIRK_HAS_PMQOS BIT(23)
/* Not all FEC hardware block MDIOs support accesses in C45 mode. * Older blocks in the ColdFire parts do not support it.
*/ #define FEC_QUIRK_HAS_MDIO_C45 BIT(24)
/* The FEC buffer descriptors track the ring buffers. The rx_bd_base and * tx_bd_base always point to the base of the buffer descriptors. The * cur_rx and cur_tx point to the currently available buffer. * The dirty_tx tracks the current buffer that is being sent by the * controller. The cur_tx and dirty_tx are equal under both completely * empty and completely full conditions. The empty/ready indicator in * the buffer descriptor determines the actual condition.
*/ struct fec_enet_private { /* Hardware registers of the FEC device */ void __iomem *hwp;
/* Phylib and MDIO interface */ struct mii_bus *mii_bus;
uint phy_speed;
phy_interface_t phy_interface; struct device_node *phy_node; bool rgmii_txc_dly; bool rgmii_rxc_dly; bool rpm_active; int link; int full_duplex; int speed; int irq[FEC_IRQ_NUM]; bool bufdesc_ex; int pause_flag; int wol_flag; int wake_irq;
u32 quirks;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.