• John Crispin's avatar
    staging: mt7621-eth: add the drivers core files · e3cbf478
    John Crispin authored
    Original comment:
    This patch adds the main chunk of the driver. The ethernet core is used in
    all of the Mediatek/Ralink Wireless SoCs. Over the years we have seen
    various changes to
    * the register layout
    * the type of ports (single/dual gbit, internal FE/Gbit switch)
    * dma engine (PDMA/QDMA)
    and new offloading features were added, such as
    * checksum
    * VLAN TX/RX
    * TSO
    * LRO
    The core functionality has however remained the same allowing us to use
    the same code for all SoCs.
    The abstraction for the various SoCs uses the typical ops struct pattern
    which allows us to extend or override the core functionality depending on
    which SoC we are on. The code to bring up the switches and external ports
    has also been split into separate files.
    There are 2 types of DMA engine, PDMA and the newer QDMA. PDMA uses a
    typical ring buffer while QDMA uses a linked list. Unfortunatley we have
    the MT7621 which has a few silicon issues. Due to these issues we need to
    PDMA for RX and QDMA for TX. All SoCs newer than the MT7621 can can run on
    QDMA exclusively.
    Most of the SoCs have a switch frontend. Older silicon has a so called ESW
    (Ethernet Switch) while newer cores have a GSW (Gigabit switch).
    Additionally there is a MDIO bus that can be used to talk to PHYs. In these
    cases one switch port get changed into a normal MAC port.
    Some SoCs have a dual MAC, we currently only support this on MT7623.
     - removed everything not closely related to mt7621, as that is all I
       can test
     - converted ethtool.c to new ethtool_link_ksettings interfaces.
       Doesn't work yet.
     - updated some phydev interface use: e.g. dev_name() -> phydev_name()
     - updated mdio to use mdiobus_get_phy()
     - added some missing export_symbols
     - updated get_stats64 interface
     - TX_DMA_FPORT and TX_DMA_TSO to tx dma descriptor
     - range checked RX_DMA_FPORT in rx dma descriptor
     - tell hardware what mac address was chosen
     - fixed MT7620_GDMA1_FWD_CFG which was using wrong value
    Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
    Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
    Signed-off-by: default avatarMichael Lee <igvtee@gmail.com>
    Signed-off-by: default avatarNeilBrown <neil@brown.name>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>