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