| 1 |
.. SPDX-License-Identifier: GPL-2.0 |
| 2 |
|
| 3 |
=============================================== |
| 4 |
PPE Ethernet Driver for Qualcomm IPQ SoC Family |
| 5 |
=============================================== |
| 6 |
|
| 7 |
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. |
| 8 |
|
| 9 |
Author: Lei Wei <[email protected]> |
| 10 |
|
| 11 |
|
| 12 |
Contents |
| 13 |
======== |
| 14 |
|
| 15 |
- `PPE Overview`_ |
| 16 |
- `PPE Driver Overview`_ |
| 17 |
- `PPE Driver Supported SoCs`_ |
| 18 |
- `Enabling the Driver`_ |
| 19 |
- `Debugging`_ |
| 20 |
|
| 21 |
|
| 22 |
PPE Overview |
| 23 |
============ |
| 24 |
|
| 25 |
IPQ (Qualcomm Internet Processor) SoC (System-on-Chip) series is Qualcomm's series of |
| 26 |
networking SoC for Wi-Fi access points. The PPE (Packet Process Engine) is the Ethernet |
| 27 |
packet process engine in the IPQ SoC. |
| 28 |
|
| 29 |
Below is a simplified hardware diagram of IPQ9574 SoC which includes the PPE engine and |
| 30 |
other blocks which are in the SoC but outside the PPE engine. These blocks work together |
| 31 |
to enable the Ethernet for the IPQ SoC:: |
| 32 |
|
| 33 |
+------+ +------+ +------+ +------+ +------+ +------+ start +-------+ |
| 34 |
|netdev| |netdev| |netdev| |netdev| |netdev| |netdev|<------|PHYLINK| |
| 35 |
+------+ +------+ +------+ +------+ +------+ +------+ stop +-+-+-+-+ |
| 36 |
| | | ^ |
| 37 |
+-------+ +-------------------------+--------+----------------------+ | | | |
| 38 |
| GCC | | | EDMA | | | | | |
| 39 |
+---+---+ | PPE +---+----+ | | | | |
| 40 |
| clk | | | | | | |
| 41 |
+-------->| +-----------------------+------+-----+---------------+ | | | | |
| 42 |
| | Switch Core |Port0 | |Port7(EIP FIFO)| | | | | |
| 43 |
| | +---+--+ +------+--------+ | | | | |
| 44 |
| | | | | | | | | |
| 45 |
+-------+ | | +------+---------------+----+ | | | | | |
| 46 |
|CMN PLL| | | +---+ +---+ +----+ | +--------+ | | | | | | |
| 47 |
+---+---+ | | |BM | |QM | |SCH | | | L2/L3 | ....... | | | | | | |
| 48 |
| | | | +---+ +---+ +----+ | +--------+ | | | | | | |
| 49 |
| | | | +------+--------------------+ | | | | | |
| 50 |
| | | | | | | | | | |
| 51 |
| v | | +-----+-+-----+-+-----+-+-+---+--+-----+-+-----+ | | | | | |
| 52 |
| +------+ | | |Port1| |Port2| |Port3| |Port4| |Port5| |Port6| | | | | | |
| 53 |
| |NSSCC | | | +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ | | mac| | | |
| 54 |
| +-+-+--+ | | |MAC0 | |MAC1 | |MAC2 | |MAC3 | |MAC4 | |MAC5 | | |<---+ | | |
| 55 |
| ^ | |clk | | +-----+-+-----+-+-----+-+-----+--+-----+-+-----+ | | ops | | |
| 56 |
| | | +------>| +----|------|-------|-------|---------|--------|-----+ | | | |
| 57 |
| | | +---------------------------------------------------------+ | | |
| 58 |
| | | | | | | | | | | |
| 59 |
| | | MII clk | QSGMII USXGMII USXGMII | | |
| 60 |
| | +--------------->| | | | | | | | |
| 61 |
| | +-------------------------+ +---------+ +---------+ | | |
| 62 |
| |125/312.5MHz clk| (PCS0) | | (PCS1) | | (PCS2) | pcs ops | | |
| 63 |
| +----------------+ UNIPHY0 | | UNIPHY1 | | UNIPHY2 |<--------+ | |
| 64 |
+----------------->| | | | | | | |
| 65 |
| 31.25MHz ref clk +-------------------------+ +---------+ +---------+ | |
| 66 |
| | | | | | | | |
| 67 |
| +-----------------------------------------------------+ | |
| 68 |
|25/50MHz ref clk| +-------------------------+ +------+ +------+ | link | |
| 69 |
+--------------->| | QUAD PHY | | PHY4 | | PHY5 | |---------+ |
| 70 |
| +-------------------------+ +------+ +------+ | change |
| 71 |
| | |
| 72 |
| MDIO bus | |
| 73 |
+-----------------------------------------------------+ |
| 74 |
|
| 75 |
The CMN (Common) PLL, NSSCC (Networking Sub System Clock Controller) and GCC (Global |
| 76 |
Clock Controller) blocks are in the SoC and act as clock providers. |
| 77 |
|
| 78 |
The UNIPHY block is in the SoC and provides the PCS (Physical Coding Sublayer) and |
| 79 |
XPCS (10-Gigabit Physical Coding Sublayer) functions to support different interface |
| 80 |
modes between the PPE MAC and the external PHY. |
| 81 |
|
| 82 |
This documentation focuses on the descriptions of PPE engine and the PPE driver. |
| 83 |
|
| 84 |
The Ethernet functionality in the PPE (Packet Process Engine) is comprised of three |
| 85 |
components: the switch core, port wrapper and Ethernet DMA. |
| 86 |
|
| 87 |
The Switch core in the IPQ9574 PPE has maximum of 6 front panel ports and two FIFO |
| 88 |
interfaces. One of the two FIFO interfaces is used for Ethernet port to host CPU |
| 89 |
communication using Ethernet DMA. The other one is used to communicate to the EIP |
| 90 |
engine which is used for IPsec offload. On the IPQ9574, the PPE includes 6 GMAC/XGMACs |
| 91 |
that can be connected with external Ethernet PHY. Switch core also includes BM (Buffer |
| 92 |
Management), QM (Queue Management) and SCH (Scheduler) modules for supporting the |
| 93 |
packet processing. |
| 94 |
|
| 95 |
The port wrapper provides connections from the 6 GMAC/XGMACS to UNIPHY (PCS) supporting |
| 96 |
various modes such as SGMII/QSGMII/PSGMII/USXGMII/10G-BASER. There are 3 UNIPHY (PCS) |
| 97 |
instances supported on the IPQ9574. |
| 98 |
|
| 99 |
Ethernet DMA is used to transmit and receive packets between the Ethernet subsystem |
| 100 |
and ARM host CPU. |
| 101 |
|
| 102 |
The following lists the main blocks in the PPE engine which will be driven by this |
| 103 |
PPE driver: |
| 104 |
|
| 105 |
- BM |
| 106 |
BM is the hardware buffer manager for the PPE switch ports. |
| 107 |
- QM |
| 108 |
Queue Manager for managing the egress hardware queues of the PPE switch ports. |
| 109 |
- SCH |
| 110 |
The scheduler which manages the hardware traffic scheduling for the PPE switch ports. |
| 111 |
- L2 |
| 112 |
The L2 block performs the packet bridging in the switch core. The bridge domain is |
| 113 |
represented by the VSI (Virtual Switch Instance) domain in PPE. FDB learning can be |
| 114 |
enabled based on the VSI domain and bridge forwarding occurs within the VSI domain. |
| 115 |
- MAC |
| 116 |
The PPE in the IPQ9574 supports up to six MACs (MAC0 to MAC5) which are corresponding |
| 117 |
to six switch ports (port1 to port6). The MAC block is connected with external PHY |
| 118 |
through the UNIPHY PCS block. Each MAC block includes the GMAC and XGMAC blocks and |
| 119 |
the switch port can select to use GMAC or XMAC through a MUX selection according to |
| 120 |
the external PHY's capability. |
| 121 |
- EDMA (Ethernet DMA) |
| 122 |
The Ethernet DMA is used to transmit and receive Ethernet packets between the PPE |
| 123 |
ports and the ARM cores. |
| 124 |
|
| 125 |
The received packet on a PPE MAC port can be forwarded to another PPE MAC port. It can |
| 126 |
be also forwarded to internal switch port0 so that the packet can be delivered to the |
| 127 |
ARM cores using the Ethernet DMA (EDMA) engine. The Ethernet DMA driver will deliver the |
| 128 |
packet to the corresponding 'netdevice' interface. |
| 129 |
|
| 130 |
The software instantiations of the PPE MAC (netdevice), PCS and external PHYs interact |
| 131 |
with the Linux PHYLINK framework to manage the connectivity between the PPE ports and |
| 132 |
the connected PHYs, and the port link states. This is also illustrated in above diagram. |
| 133 |
|
| 134 |
|
| 135 |
PPE Driver Overview |
| 136 |
=================== |
| 137 |
PPE driver is Ethernet driver for the Qualcomm IPQ SoC. It is a single platform driver |
| 138 |
which includes the PPE part and Ethernet DMA part. The PPE part initializes and drives the |
| 139 |
various blocks in PPE switch core such as BM/QM/L2 blocks and the PPE MACs. The EDMA part |
| 140 |
drives the Ethernet DMA for packet transfer between PPE ports and ARM cores, and enables |
| 141 |
the netdevice driver for the PPE ports. |
| 142 |
|
| 143 |
The PPE driver files in drivers/net/ethernet/qualcomm/ppe/ are listed as below: |
| 144 |
|
| 145 |
- Makefile |
| 146 |
- ppe.c |
| 147 |
- ppe.h |
| 148 |
- ppe_config.c |
| 149 |
- ppe_config.h |
| 150 |
- ppe_debugfs.c |
| 151 |
- ppe_debugfs.h |
| 152 |
- ppe_regs.h |
| 153 |
|
| 154 |
The ppe.c file contains the main PPE platform driver and undertakes the initialization of |
| 155 |
PPE switch core blocks such as QM, BM and L2. The configuration APIs for these hardware |
| 156 |
blocks are provided in the ppe_config.c file. |
| 157 |
|
| 158 |
The ppe.h defines the PPE device data structure which will be used by PPE driver functions. |
| 159 |
|
| 160 |
The ppe_debugfs.c enables the PPE statistics counters such as PPE port Rx and Tx counters, |
| 161 |
CPU code counters and queue counters. |
| 162 |
|
| 163 |
|
| 164 |
PPE Driver Supported SoCs |
| 165 |
========================= |
| 166 |
|
| 167 |
The PPE driver supports the following IPQ SoC: |
| 168 |
|
| 169 |
- IPQ9574 |
| 170 |
|
| 171 |
|
| 172 |
Enabling the Driver |
| 173 |
=================== |
| 174 |
|
| 175 |
The driver is located in the menu structure at:: |
| 176 |
|
| 177 |
-> Device Drivers |
| 178 |
-> Network device support (NETDEVICES [=y]) |
| 179 |
-> Ethernet driver support |
| 180 |
-> Qualcomm devices |
| 181 |
-> Qualcomm Technologies, Inc. PPE Ethernet support |
| 182 |
|
| 183 |
If the driver is built as a module, the module will be called qcom-ppe. |
| 184 |
|
| 185 |
The PPE driver functionally depends on the CMN PLL and NSSCC clock controller drivers. |
| 186 |
Please make sure the dependent modules are installed before installing the PPE driver |
| 187 |
module. |
| 188 |
|
| 189 |
|
| 190 |
Debugging |
| 191 |
========= |
| 192 |
|
| 193 |
The PPE hardware counters can be accessed using debugfs interface from the |
| 194 |
``/sys/kernel/debug/ppe/`` directory. |