0324-docs-networking-Add-PPE-driver-documentation-for-Qua.patch 10 KB

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