dwmac ethernet driver(stmmac)

时间:2024-04-02 16:52:20

 

1. 官方介绍

stmmac which is the official driver for Synopsys Ethernet QoS 10/100/1000 and QoS

IP  in Linux. The cstmmac driver was originally developed by STMicroelectronics, one of Synopsys

Ethernet IP customers, supporting MAC 10/100/1000. The source code for cstmmac driver can

be found in Linux Kernel under the folder cdrivers/net/ethernet/stmicro/stmmac 

As an open source project, the driver started receiving new features and bug fixes and started

being adopted by other Synopsys Ethernet IP clients. Finally, in 2016 the QoS IP support was

added to the driver.

 

dwmac ethernet driver(stmmac)

 

The stmmac driver has an architecture that increases hardware/IP abstraction as we go up through the layers.

Starting from the bottom layer, each IP has its isolated ecosystem consisting of a core (MAC

related operations), DMA (DMA related operations), DESCS (descriptor related operations) and

common libs blocks. In the case of MAC 10/100 and MAC 1000, they share the same lib file,

because they have a set of common registers and operations.

 

The stmmac driver supports two types of socket buffers: ring and chain. Each implementation

is done in ring_mode and chain_mode files. For the common MAC Management Counters

(MMC) operations, the driver has the mmc_core file that includes all the necessary operations

for this purpose.

 

The middle layer is the common layer for all the IPs. Based on configuration, this layer will

choose the IP block to use. The main file is stmmac_main where the programmer can find the

typical Ethernet driver functions like *_open(), *_xmit() and other relevant ones.

stmmac_main is the maestro of stmmac , picking each block operations (MDIO, PTP,

Ethtool and IP functions) and putting them in a common operational flow.

 

The upper layer is composed by stmmac_platform and stmmac_pci files. The platform

related file contains a wide set of device tree parsing functions serving as a common device tree

interpreter for all specific-platform drivers (top layer). The PCI related file is an end-use glue

driver, to be used when this type of bus is needed.

 

In the top layer we can find a generic driver and a set of custom platform glue drivers that

implement operations related to a certain SoC. All these drivers typically use Release dwc_enet_qos_software_5.10a

 

stmmac_platform device tree parsing features and then call stmmac_main methods to

follow the normal flow.

In order to add support for Ethernet QoS 5.xx IP Cores a new file was introduced ( dwmac5 )

which implements all the relevant configuration and handling of 5.xx features. For TSN

functions stmmac_tsn was introduced, serving as interface with the TSN subsystem.

 

 

2. driver path

linux-linaro-stable-lsk/drivers/net/ethernet/stmicro/stmmac

 

 

3. dwmac5

kernel4.14只支持dwmac-4.1,kernel 4.17开始支持dwmac-5.10,即eqos5.1,具体如下:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/net/ethernet/stmicro?id=8bf993a5877e8a0a2f6338085f2dee7c23f524a3

 

dwmac ethernet driver(stmmac)

 

dwmac ethernet driver(stmmac)