On 8/12/2025 10:39 PM, Kiran Venkatappa wrote:
Current ath drivers have separate implementations for different
classes of devices. For example, ath11k supports WiFi-6 devices,
while ath12k supports Wi-Fi 7 devices. However, there is significant
common functionality across these generations due to shared firmware
and hardware architecture. In the existing driver code, this leverage
is achieved through code duplication. As a result, when a new driver
is introduced, many features are missed, and new additions require
porting across different generation drivers.
To improve reuse and maintainability, ath12k should be split into common
and device-specific modules. Common code can be shared across multiple
architectures, enabling better leverage for future hardware generations.
generation drivers.
Firmware interfaces and core initialization sequences are typically common
across different device families. In contrast, hardware register offsets, copy
engine mappings, and HAL configurations are usually hardware-specific.
Common components include:
- mac80211 interface: Control path operations are mostly common across
different ATH hardware and will be shared as much as possible.
- Firmware interface (WMI, HTT, HTC, QMI): Firmware messaging and
sequences are common and maintained with backward/forward compatibility
using TLVs.
- Datapath: Data path files are also separated similarly. More information
will be provided in later patches.
- Core initialization, reset, and recovery sequences: These will be part
of the shared code.
Device-specific code includes:
- Hardware capabilities, configurations, HAL, and other
architecture-specific logic.
The original ath12k.ko is split into these two modules as depicted below.
+-----------------+
| |
| ath12k.ko |
| (common) |
+---------------+ | |
| | +-----------------+
| ath12k.ko | ===========>
| | +------------------+
+---------------+ | |
| ath12k_wifi7.ko |
| (wifi7 family) |
| |
+------------------+
The ath12k.ko module will serve as the common component, while ath12k_wifi7.ko
will be the architecture-specific module for WiFi-7 devices.
After this modular separation, adding support for a new device will
primarily involve implementing device-specific code, while reusing the
majority of the shared common components.
---
Kiran Venkatappa (13):
wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
wifi: ath12k: Move hw_init invocation to target-specific probe
wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components
wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
wifi: ath12k: Remove HAL defines from shared PCI code
wifi: ath12k: Remove HAL define dependencies from shared AHB code
drivers/net/wireless/ath/ath12k/Makefile | 4 +-
drivers/net/wireless/ath/ath12k/ahb.c | 139 ++--
drivers/net/wireless/ath/ath12k/ahb.h | 27 +-
drivers/net/wireless/ath/ath12k/ce.c | 301 -------
drivers/net/wireless/ath/ath12k/ce.h | 5 +-
drivers/net/wireless/ath/ath12k/core.c | 38 +-
drivers/net/wireless/ath/ath12k/core.h | 7 +
drivers/net/wireless/ath/ath12k/debug.c | 4 +
drivers/net/wireless/ath/ath12k/dp_rx.c | 3 +
drivers/net/wireless/ath/ath12k/hal.c | 4 +
drivers/net/wireless/ath/ath12k/htc.c | 2 +
drivers/net/wireless/ath/ath12k/hw.h | 2 -
drivers/net/wireless/ath/ath12k/mhi.c | 130 ---
drivers/net/wireless/ath/ath12k/mhi.h | 4 +-
drivers/net/wireless/ath/ath12k/pci.c | 215 ++---
drivers/net/wireless/ath/ath12k/pci.h | 28 +-
drivers/net/wireless/ath/ath12k/peer.c | 2 +
drivers/net/wireless/ath/ath12k/wifi7/Makefile | 10 +
drivers/net/wireless/ath/ath12k/wifi7/ahb.c | 71 ++
drivers/net/wireless/ath/ath12k/wifi7/ahb.h | 20 +
drivers/net/wireless/ath/ath12k/wifi7/ce.c | 973 +++++++++++++++++++++++
drivers/net/wireless/ath/ath12k/wifi7/ce.h | 22 +
drivers/net/wireless/ath/ath12k/wifi7/core.c | 44 +
drivers/net/wireless/ath/ath12k/{ => wifi7}/hw.c | 798 +++----------------
drivers/net/wireless/ath/ath12k/wifi7/hw.h | 13 +
drivers/net/wireless/ath/ath12k/wifi7/mhi.c | 138 ++++
drivers/net/wireless/ath/ath12k/wifi7/mhi.h | 11 +
drivers/net/wireless/ath/ath12k/wifi7/pci.c | 188 +++++
drivers/net/wireless/ath/ath12k/wifi7/pci.h | 12 +
drivers/net/wireless/ath/ath12k/wifi7/wmi.c | 105 +++
drivers/net/wireless/ath/ath12k/wifi7/wmi.h | 15 +
drivers/net/wireless/ath/ath12k/wmi.c | 97 ---
drivers/net/wireless/ath/ath12k/wmi.h | 4 -
33 files changed, 1956 insertions(+), 1480 deletions(-)
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@xxxxxxxxxxxxxxxx>