From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02D091CFBC; Mon, 17 Mar 2025 15:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226180; cv=none; b=bZiVoyh82eDtNXPZgUsz9jFATaGzO7b1NcTlI0x8nugVJX8PwxYBoIIsLXZAshL993+CVuywQW/h2XV1fPuEsdIX70cYDwd9KrAiUbJNesvpx3ASknLP9byA5MYNfThXL2XDbD3w/doQpsM5NGQtPR5BlWhPuKNZ+2bsqt/ZAFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226180; c=relaxed/simple; bh=yyGVr/9KpBelB0MRHLgeaBtrwColEWNFVjUtSxToO18=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uxWBzflUluZk0YAttfZvgF45pJm0KFB0dwFchpSTwbb1c+5lUL8+WpYibykbGf64GEaw4YZAq5IWpxss67IW6rsX5VllMtKRq0vpT3SYYP/D843UyjK2ssWxsm9H6If3rmSzirhscgSXCoyKV3pXpABMHg54AsKd8B5KdbWn7Mw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=XNGMlxo2; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="XNGMlxo2" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HAle6v031634; Mon, 17 Mar 2025 15:42:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= z+I/aFySycPbYQc8+dTKGRK5efiwKmMB45PSsX7kIds=; b=XNGMlxo2ay5MLQvY BonXma9aS7v8MSDXaZBbw3cT5ITLidELLIir5FVgqIKlRTXvHC0tyVyrHmoiV0re eWaRjBfK7vybOIOZrXfxvsImUV6F/8dvh92GQu+tPGvBaK2ZOQUjzRBKWCGfhKVA O2YNh3H/GfYXTSp65oe+JpgFDldXmGh30XWC+nhBxz7DP0qYYz5JCPAn/vbZSGHh Q+b95PiaXoriHIDGauNELvRE7H4DQxUq5nxAW8UNdiHWk2M9E7HIusCeGzu2F+Ub 184v4aYaCOYjVfD3VpM4WzdQ6SrVqqrmMFL+rZ4EL0jkq5FeBiCNfxTFyqdv6qTK 6Ny1CA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1r157sc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:42:48 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFgllq015224 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:42:47 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:42:43 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , "Raj Kumar Bhagat" , Krzysztof Kozlowski Subject: [PATCH ath-next v10 01/13] dt-bindings: net: wireless: describe the ath12k AHB module for IPQ5332 Date: Mon, 17 Mar 2025 21:11:38 +0530 Message-ID: <20250317154150.1361364-2-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=LuaSymdc c=1 sm=1 tr=0 ts=67d842f8 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=gEfo2CItAAAA:8 a=COk6AnOGAAAA:8 a=KKAkSRfTAAAA:8 a=VwQbUJbxAAAA:8 a=dkxe8MPypZQ4jCj5x1IA:9 a=RVmHIydaz68A:10 a=sptkURWiP4Gy88Gu7hUp:22 a=TjNXssC_j7lpFel5tvFf:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: SeIE3F9b653T7u7lIjJkNcDinYVQANkK X-Proofpoint-ORIG-GUID: SeIE3F9b653T7u7lIjJkNcDinYVQANkK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 phishscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" Add device-tree bindings for the ATH12K module found in the IPQ5332 device. Signed-off-by: Raj Kumar Bhagat Reviewed-by: Krzysztof Kozlowski --- .../net/wireless/qcom,ipq5332-wifi.yaml | 315 ++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/qcom,ipq= 5332-wifi.yaml diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ipq5332-wi= fi.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ipq5332-wifi.= yaml new file mode 100644 index 000000000000..363a0ecb6ad9 --- /dev/null +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ipq5332-wifi.yaml @@ -0,0 +1,315 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights rese= rved. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/wireless/qcom,ipq5332-wifi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies ath12k wireless devices (AHB) + +maintainers: + - Jeff Johnson + +description: + Qualcomm Technologies IEEE 802.11be AHB devices. + +properties: + compatible: + enum: + - qcom,ipq5332-wifi + + reg: + maxItems: 1 + + clocks: + items: + - description: XO clock used for copy engine + + clock-names: + items: + - const: xo + + interrupts: + items: + - description: Fatal interrupt + - description: Ready interrupt + - description: Spawn acknowledge interrupt + - description: Stop acknowledge interrupt + - description: misc-pulse1 interrupt events + - description: misc-latch interrupt events + - description: sw exception interrupt events + - description: interrupt event for ring CE0 + - description: interrupt event for ring CE1 + - description: interrupt event for ring CE2 + - description: interrupt event for ring CE3 + - description: interrupt event for ring CE4 + - description: interrupt event for ring CE5 + - description: interrupt event for ring CE6 + - description: interrupt event for ring CE7 + - description: interrupt event for ring CE8 + - description: interrupt event for ring CE9 + - description: interrupt event for ring CE10 + - description: interrupt event for ring CE11 + - description: interrupt event for ring host2wbm-desc-feed + - description: interrupt event for ring host2reo-re-injection + - description: interrupt event for ring host2reo-command + - description: interrupt event for ring host2rxdma-monitor-ring1 + - description: interrupt event for ring reo2ost-exception + - description: interrupt event for ring wbm2host-rx-release + - description: interrupt event for ring reo2host-status + - description: interrupt event for ring reo2host-destination-ring4 + - description: interrupt event for ring reo2host-destination-ring3 + - description: interrupt event for ring reo2host-destination-ring2 + - description: interrupt event for ring reo2host-destination-ring1 + - description: interrupt event for ring rxdma2host-monitor-destinati= on-mac3 + - description: interrupt event for ring rxdma2host-monitor-destinati= on-mac2 + - description: interrupt event for ring rxdma2host-monitor-destinati= on-mac1 + - description: interrupt event for ring host2rxdma-host-buf-ring-mac3 + - description: interrupt event for ring host2rxdma-host-buf-ring-mac2 + - description: interrupt event for ring host2rxdma-host-buf-ring-mac1 + - description: interrupt event for ring host2tcl-input-ring4 + - description: interrupt event for ring host2tcl-input-ring3 + - description: interrupt event for ring host2tcl-input-ring2 + - description: interrupt event for ring host2tcl-input-ring1 + - description: interrupt event for ring wbm2host-tx-completions-ring4 + - description: interrupt event for ring wbm2host-tx-completions-ring3 + - description: interrupt event for ring wbm2host-tx-completions-ring2 + - description: interrupt event for ring wbm2host-tx-completions-ring1 + - description: interrupt event for ring host2tx-monitor-ring1 + - description: interrupt event for ring txmon2host-monitor-destinati= on-mac3 + - description: interrupt event for ring txmon2host-monitor-destinati= on-mac2 + - description: interrupt event for ring txmon2host-monitor-destinati= on-mac1 + - description: interrupt event for umac-reset + + interrupt-names: + items: + - const: fatal + - const: ready + - const: spawn + - const: stop-ack + - const: misc-pulse1 + - const: misc-latch + - const: sw-exception + - const: ce0 + - const: ce1 + - const: ce2 + - const: ce3 + - const: ce4 + - const: ce5 + - const: ce6 + - const: ce7 + - const: ce8 + - const: ce9 + - const: ce10 + - const: ce11 + - const: host2wbm-desc-feed + - const: host2reo-re-injection + - const: host2reo-command + - const: host2rxdma-monitor-ring1 + - const: reo2ost-exception + - const: wbm2host-rx-release + - const: reo2host-status + - const: reo2host-destination-ring4 + - const: reo2host-destination-ring3 + - const: reo2host-destination-ring2 + - const: reo2host-destination-ring1 + - const: rxdma2host-monitor-destination-mac3 + - const: rxdma2host-monitor-destination-mac2 + - const: rxdma2host-monitor-destination-mac1 + - const: host2rxdma-host-buf-ring-mac3 + - const: host2rxdma-host-buf-ring-mac2 + - const: host2rxdma-host-buf-ring-mac1 + - const: host2tcl-input-ring4 + - const: host2tcl-input-ring3 + - const: host2tcl-input-ring2 + - const: host2tcl-input-ring1 + - const: wbm2host-tx-completions-ring4 + - const: wbm2host-tx-completions-ring3 + - const: wbm2host-tx-completions-ring2 + - const: wbm2host-tx-completions-ring1 + - const: host2tx-monitor-ring1 + - const: txmon2host-monitor-destination-mac3 + - const: txmon2host-monitor-destination-mac2 + - const: txmon2host-monitor-destination-mac1 + - const: umac-reset + + memory-region: + description: + Memory regions used by the ath12k firmware. + items: + - description: Q6 memory region + - description: m3 dump memory region + - description: Q6 caldata memory region + - description: Multi Link Operation (MLO) Global memory region + + memory-region-names: + items: + - const: q6-region + - const: m3-dump + - const: q6-caldb + - const: mlo-global-mem + + qcom,calibration-variant: + $ref: /schemas/types.yaml#/definitions/string + description: + String to uniquely identify variant of the calibration data for desi= gns + with colliding bus and device ids + + qcom,rproc: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to the Qualcomm Hexagon DSP(q6 remote processor), which is u= tilized + for offloading WiFi processing tasks, this q6 remote processor opera= tes in + conjunction with WiFi. + + qcom,smem-states: + $ref: /schemas/types.yaml#/definitions/phandle-array + description: States used by the AP to signal the remote processor + items: + - description: Shutdown WCSS pd + - description: Stop WCSS pd + - description: Spawn WCSS pd + + qcom,smem-state-names: + description: + Names of the states used by the AP to signal the remote processor + items: + - const: shutdown + - const: stop + - const: spawn + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - interrupt-names + - memory-region + - memory-region-names + - qcom,rproc + - qcom,smem-states + - qcom,smem-state-names + +additionalProperties: false + +examples: + - | + #include + #include + + wifi0: wifi@c000000 { + compatible =3D "qcom,ipq5332-wifi"; + reg =3D <0x0c000000 0x1000000>; + clocks =3D <&gcc GCC_XO_CLK>; + clock-names =3D "xo"; + interrupts-extended =3D <&wcss_smp2p_in 8 IRQ_TYPE_NONE>, + <&wcss_smp2p_in 9 IRQ_TYPE_NONE>, + <&wcss_smp2p_in 12 IRQ_TYPE_NONE>, + <&wcss_smp2p_in 11 IRQ_TYPE_NONE>, + <&intc GIC_SPI 559 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 560 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 561 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 422 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 423 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 424 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 425 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 426 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 427 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 428 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 429 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 430 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 431 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 432 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 433 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 491 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 495 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 493 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 544 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 457 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 466 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 497 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 454 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 453 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 452 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 451 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 488 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 488 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 484 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 554 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 554 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 549 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 507 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 500 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 499 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 498 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 450 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 449 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 448 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 447 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 543 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 486 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 486 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 482 IRQ_TYPE_EDGE_RISING>, + <&intc GIC_SPI 419 IRQ_TYPE_EDGE_RISING>; + interrupt-names =3D "fatal", + "ready", + "spawn", + "stop-ack", + "misc-pulse1", + "misc-latch", + "sw-exception", + "ce0", + "ce1", + "ce2", + "ce3", + "ce4", + "ce5", + "ce6", + "ce7", + "ce8", + "ce9", + "ce10", + "ce11", + "host2wbm-desc-feed", + "host2reo-re-injection", + "host2reo-command", + "host2rxdma-monitor-ring1", + "reo2ost-exception", + "wbm2host-rx-release", + "reo2host-status", + "reo2host-destination-ring4", + "reo2host-destination-ring3", + "reo2host-destination-ring2", + "reo2host-destination-ring1", + "rxdma2host-monitor-destination-mac3", + "rxdma2host-monitor-destination-mac2", + "rxdma2host-monitor-destination-mac1", + "host2rxdma-host-buf-ring-mac3", + "host2rxdma-host-buf-ring-mac2", + "host2rxdma-host-buf-ring-mac1", + "host2tcl-input-ring4", + "host2tcl-input-ring3", + "host2tcl-input-ring2", + "host2tcl-input-ring1", + "wbm2host-tx-completions-ring4", + "wbm2host-tx-completions-ring3", + "wbm2host-tx-completions-ring2", + "wbm2host-tx-completions-ring1", + "host2tx-monitor-ring1", + "txmon2host-monitor-destination-mac3", + "txmon2host-monitor-destination-mac2", + "txmon2host-monitor-destination-mac1", + "umac-reset"; + + memory-region =3D <&q6_region>, <&m3_dump>, <&q6_caldb>, <&mlo_mem= >; + memory-region-names =3D "q6-region", "m3-dump", "q6-caldb", "mlo-g= lobal-mem"; + qcom,calibration-variant =3D "RDP441_1"; + qcom,rproc =3D <&q6v5_wcss>; + qcom,smem-states =3D <&wcss_smp2p_out 8>, + <&wcss_smp2p_out 9>, + <&wcss_smp2p_out 10>; + qcom,smem-state-names =3D "shutdown", + "stop", + "spawn"; + }; --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D59E8248880; Mon, 17 Mar 2025 15:43:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226183; cv=none; b=s5wtq0CgRvCW3b3qHDZ5MLABmk7NW2MMz+YfIfYBz7IVfydIRVftoAgGogzSWsSIAds/JTQS+fkvRJ4SK/3wZmWMuqj96j4Aue/lCrxC4vq0S1sJVi1i4R/KKOEkIZSsglMn1Ll/qpCjge6510FY+cw1RTfnJ7qtS+ut4IvBQv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226183; c=relaxed/simple; bh=IiwwcpL4dt212LFljgt+XeSBO/zwujkEI5Li2SK+o9Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DeyvKxzVRsWzwZx275G3z8fjM3pQKOnky0J2mfwJJpWdx9dYGCDPvF+3vyS8W3uI6ndEb9hP+81CEwZ+aZJpbr9gqCSVcOQ/r6uNktXJuBzz6Vo4EAfDWfq5d1QC9QVINxw+I0s1NRlm2iHaCki+CuEGizFkKOTkCS1DSBQZPF8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=S0MiToFY; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="S0MiToFY" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HAmNgk009775; Mon, 17 Mar 2025 15:42:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= gmLy9eGoJ+M40Xya2AA0/uvKBqtaVKpwGWFSKzLWplw=; b=S0MiToFYQADcv3rh v17/yyGukNSf6qRADi4U4b4+j/XlF1gm04pRdTb0z4Kv93yQjwQHGTM+s4bSxjfI xrNCJVysQY6A56d8Sw/bUOjieWQkQFxLg9GkqgM1vU0i2wMm1C2nmfkmm5Cu3Hrp MLyls2JYarYh1bsySzEbsW09B4epCeI8dBBOYRchrjk0u6p2VysIeRjWGbPCnHc0 XGepUhSCcUvi7okpaQv/99K/vXA4Bcc0UZgrBCbT8KBRgSUhDwPguqbPOpWsr6Jp w9+MadBkE1EqJJdORGaDw5QwX1I2vpWPlLquiA2nb740WGmh7Q7Ex7MROd2BsF/5 BtHQoQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1sxw5gs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:42:51 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFgo1L010839 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:42:50 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:42:47 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , Balamurugan S , Raj Kumar Bhagat , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 02/13] wifi: ath12k: fix incorrect CE addresses Date: Mon, 17 Mar 2025 21:11:39 +0530 Message-ID: <20250317154150.1361364-3-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: QMNgDKXBguGU0BsyP38xbxGyaQj0zzF9 X-Proofpoint-ORIG-GUID: QMNgDKXBguGU0BsyP38xbxGyaQj0zzF9 X-Authority-Analysis: v=2.4 cv=XKcwSRhE c=1 sm=1 tr=0 ts=67d842fb cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=ZxUqoUJ0tR4sbPRcKb4A:9 a=RVmHIydaz68A:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=916 priorityscore=1501 clxscore=1015 phishscore=0 impostorscore=0 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Balamurugan S In the current ath12k implementation, the CE addresses CE_HOST_IE_ADDRESS and CE_HOST_IE_2_ADDRESS are incorrect. These values were inherited from ath11k, but ath12k does not currently use them. However, the Ath12k AHB support relies on these addresses. Therefore, correct the CE addresses for ath12k. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1 Signed-off-by: Balamurugan S Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/ce.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/ce.h b/drivers/net/wireless/at= h/ath12k/ce.h index 1a14b9fb86b8..f85188af5de2 100644 --- a/drivers/net/wireless/ath/ath12k/ce.h +++ b/drivers/net/wireless/ath/ath12k/ce.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All righ= ts reserved. + * Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. All= rights reserved. */ =20 #ifndef ATH12K_CE_H @@ -39,8 +39,8 @@ #define PIPEDIR_INOUT_H2H 4 /* bidirectional, host to host */ =20 /* CE address/mask */ -#define CE_HOST_IE_ADDRESS 0x00A1803C -#define CE_HOST_IE_2_ADDRESS 0x00A18040 +#define CE_HOST_IE_ADDRESS 0x75804C +#define CE_HOST_IE_2_ADDRESS 0x758050 #define CE_HOST_IE_3_ADDRESS CE_HOST_IE_ADDRESS =20 #define CE_HOST_IE_3_SHIFT 0xC --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7406624886D; Mon, 17 Mar 2025 15:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226187; cv=none; b=EJ+sGYJNZz+s/G9xRSpsz8pqs1mkuTO9u+Be/waxIDyU5bEzElYrMY+I/kBvC0fQVOZcXOpgUTjP3l/i2G2VgccHaXFpecj2FxT1jKuo/XuItuI80H44I2aZRmEeJKCGuPWo017gMNmmaZFzOUmXwK0JhCkjZ2GZmJzaG2v9QFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226187; c=relaxed/simple; bh=5QJ7TDabCy6zwUUQIveKvg9swUitpH7LPC0qskHZtog=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kQ2D4OBUFoSNTsLxO/fXuTpa1fBY3JnU6HZRR/jyfU8CfdUqpwrauX6cj8Z7vIXsHfQtUO5L0VgpTEIPqz0oKaGkF5XE9r4AgWtHX0gP2JLkUDa8nkQ2/nG7CO9+c0naIu39j276/4KCthwE6vhAoVrYl3W+VG5Nje4vq7dInO0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=O2XSQz0v; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="O2XSQz0v" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HAkSFt016308; Mon, 17 Mar 2025 15:42:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= qGsEDYvGf4vo8Ebr18/Y5ig7z3L9b3i9HM2SFs4Kgd4=; b=O2XSQz0vjQgQttY4 wYE+vbT9pd+yQnoPnIg8WUWPt3yMRb6lKA/yefm+krilyY/k3Q3nBQu4/6cc8Vg+ 6J8v5w3LUCRkGM9JgLqinKPrPXNBtYki3BFR4woJjgbl3WCY23F6HZU/4TWNgpD1 KuMGF510+aAvED5v1bCUDDgUoh3ZARZuCEz4G41lixeqgYYv4TpmjrD0xwzYqC+Q gxk6ruDZNT2fOMQVOowYqenFMWNR/Ju8oNthJ6RnJxIPyGXh2UeJ/TjZx7XSWUN0 cbML8m8yRprC+qjDDYHaQY3p/BT5eNTffLEzqbFjwC2aAV9Caz1S5/NroypYFg50 oJ60IA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1t4n6mc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:42:56 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFgtMK015289 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:42:55 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:42:50 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , P Praneesh , Balamurugan S , "Raj Kumar Bhagat" , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 03/13] wifi: ath12k: refactor ath12k_hw_regs structure Date: Mon, 17 Mar 2025 21:11:40 +0530 Message-ID: <20250317154150.1361364-4-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=VLPdn8PX c=1 sm=1 tr=0 ts=67d84300 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=0b9HUTbONrYHnOzTNYgA:9 a=RVmHIydaz68A:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: FpGZLH_PTCY90jx07gmkT1uySDHuU-I4 X-Proofpoint-GUID: FpGZLH_PTCY90jx07gmkT1uySDHuU-I4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: P Praneesh IPQ5332 device have different register address values for the below registers: HAL_TCL1_RING_BASE_LSB HAL_TCL1_RING_BASE_MSB HAL_TCL2_RING_BASE_LSB HAL_SEQ_WCSS_UMAC_CE0_SRC_REG HAL_SEQ_WCSS_UMAC_CE0_DST_REG HAL_SEQ_WCSS_UMAC_CE1_SRC_REG HAL_SEQ_WCSS_UMAC_CE1_DST_REG Hence, refactor ath12k_hw_regs structure to accommodate these changes in IPQ5332. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1 Signed-off-by: P Praneesh Co-developed-by: Balamurugan S Signed-off-by: Balamurugan S Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/hal.c | 84 +++++++++++++-------------- drivers/net/wireless/ath/ath12k/hal.h | 63 +++++++++++--------- drivers/net/wireless/ath/ath12k/hw.c | 29 ++++++++- drivers/net/wireless/ath/ath12k/hw.h | 10 +++- 4 files changed, 114 insertions(+), 72 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/hal.c b/drivers/net/wireless/a= th/ath12k/hal.c index cd59ff8e6c7b..031f76d88bef 100644 --- a/drivers/net/wireless/ath/ath12k/hal.c +++ b/drivers/net/wireless/ath/ath12k/hal.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights res= erved. */ #include #include "hal_tx.h" @@ -552,9 +552,9 @@ static int ath12k_hal_srng_create_config_qcn9274(struct= ath12k_base *ab) s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_REO_REG + HAL_REO_STATUS_HP; =20 s =3D &hal->srng_config[HAL_TCL_DATA]; - s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_BASE_LSB; + s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_BASE_LSB(ab= ); s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_HP; - s->reg_size[0] =3D HAL_TCL2_RING_BASE_LSB - HAL_TCL1_RING_BASE_LSB; + s->reg_size[0] =3D HAL_TCL2_RING_BASE_LSB(ab) - HAL_TCL1_RING_BASE_LSB(ab= ); s->reg_size[1] =3D HAL_TCL2_RING_HP - HAL_TCL1_RING_HP; =20 s =3D &hal->srng_config[HAL_TCL_CMD]; @@ -566,29 +566,29 @@ static int ath12k_hal_srng_create_config_qcn9274(stru= ct ath12k_base *ab) s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL_STATUS_RING_HP; =20 s =3D &hal->srng_config[HAL_CE_SRC]; - s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_SRC_REG + HAL_CE_DST_RING_BASE_= LSB; - s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_SRC_REG + HAL_CE_DST_RING_HP; - s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_SRC_REG - - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG; - s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_SRC_REG - - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG; + s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_B= ASE_LSB; + s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_H= P; + s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); + s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); =20 s =3D &hal->srng_config[HAL_CE_DST]; - s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_RING_BASE_= LSB; - s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_RING_HP; - s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; - s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; + s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_B= ASE_LSB; + s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_H= P; + s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); + s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); =20 s =3D &hal->srng_config[HAL_CE_DST_STATUS]; - s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG + + s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_BASE_LSB; - s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_STATUS_RIN= G_HP; - s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; - s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; + s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS= _RING_HP; + s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); + s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); =20 s =3D &hal->srng_config[HAL_WBM_IDLE_LINK]; s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_WBM_REG + HAL_WBM_IDLE_LINK_RING_BA= SE_LSB(ab); @@ -1371,9 +1371,9 @@ static int ath12k_hal_srng_create_config_wcn7850(stru= ct ath12k_base *ab) =20 s =3D &hal->srng_config[HAL_TCL_DATA]; s->max_rings =3D 5; - s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_BASE_LSB; + s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_BASE_LSB(ab= ); s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL1_RING_HP; - s->reg_size[0] =3D HAL_TCL2_RING_BASE_LSB - HAL_TCL1_RING_BASE_LSB; + s->reg_size[0] =3D HAL_TCL2_RING_BASE_LSB(ab) - HAL_TCL1_RING_BASE_LSB(ab= ); s->reg_size[1] =3D HAL_TCL2_RING_HP - HAL_TCL1_RING_HP; =20 s =3D &hal->srng_config[HAL_TCL_CMD]; @@ -1386,31 +1386,31 @@ static int ath12k_hal_srng_create_config_wcn7850(st= ruct ath12k_base *ab) =20 s =3D &hal->srng_config[HAL_CE_SRC]; s->max_rings =3D 12; - s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_SRC_REG + HAL_CE_DST_RING_BASE_= LSB; - s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_SRC_REG + HAL_CE_DST_RING_HP; - s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_SRC_REG - - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG; - s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_SRC_REG - - HAL_SEQ_WCSS_UMAC_CE0_SRC_REG; + s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_B= ASE_LSB; + s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_H= P; + s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); + s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab); =20 s =3D &hal->srng_config[HAL_CE_DST]; s->max_rings =3D 12; - s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_RING_BASE_= LSB; - s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_RING_HP; - s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; - s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; + s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_B= ASE_LSB; + s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_H= P; + s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); + s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); =20 s =3D &hal->srng_config[HAL_CE_DST_STATUS]; s->max_rings =3D 12; - s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG + + s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_BASE_LSB; - s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG + HAL_CE_DST_STATUS_RIN= G_HP; - s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; - s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG - - HAL_SEQ_WCSS_UMAC_CE0_DST_REG; + s->reg_start[1] =3D HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS= _RING_HP; + s->reg_size[0] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); + s->reg_size[1] =3D HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) - + HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab); =20 s =3D &hal->srng_config[HAL_WBM_IDLE_LINK]; s->reg_start[0] =3D HAL_SEQ_WCSS_UMAC_WBM_REG + HAL_WBM_IDLE_LINK_RING_BA= SE_LSB(ab); @@ -1756,7 +1756,7 @@ static void ath12k_hal_srng_src_hw_init(struct ath12k= _base *ab, HAL_TCL1_RING_BASE_MSB_RING_BASE_ADDR_MSB) | u32_encode_bits((srng->entry_size * srng->num_entries), HAL_TCL1_RING_BASE_MSB_RING_SIZE); - ath12k_hif_write32(ab, reg_base + HAL_TCL1_RING_BASE_MSB_OFFSET, val); + ath12k_hif_write32(ab, reg_base + HAL_TCL1_RING_BASE_MSB_OFFSET(ab), val); =20 val =3D u32_encode_bits(srng->entry_size, HAL_REO1_RING_ID_ENTRY_SIZE); ath12k_hif_write32(ab, reg_base + HAL_TCL1_RING_ID_OFFSET(ab), val); diff --git a/drivers/net/wireless/ath/ath12k/hal.h b/drivers/net/wireless/a= th/ath12k/hal.h index 94e2e8735958..1ce97f9a92ac 100644 --- a/drivers/net/wireless/ath/ath12k/hal.h +++ b/drivers/net/wireless/ath/ath12k/hal.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights res= erved. */ =20 #ifndef ATH12K_HAL_H @@ -44,10 +44,14 @@ struct ath12k_base; #define HAL_SEQ_WCSS_UMAC_OFFSET 0x00a00000 #define HAL_SEQ_WCSS_UMAC_REO_REG 0x00a38000 #define HAL_SEQ_WCSS_UMAC_TCL_REG 0x00a44000 -#define HAL_SEQ_WCSS_UMAC_CE0_SRC_REG 0x01b80000 -#define HAL_SEQ_WCSS_UMAC_CE0_DST_REG 0x01b81000 -#define HAL_SEQ_WCSS_UMAC_CE1_SRC_REG 0x01b82000 -#define HAL_SEQ_WCSS_UMAC_CE1_DST_REG 0x01b83000 +#define HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) \ + ((ab)->hw_params->regs->hal_umac_ce0_src_reg_base) +#define HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) \ + ((ab)->hw_params->regs->hal_umac_ce0_dest_reg_base) +#define HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) \ + ((ab)->hw_params->regs->hal_umac_ce1_src_reg_base) +#define HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) \ + ((ab)->hw_params->regs->hal_umac_ce1_dest_reg_base) #define HAL_SEQ_WCSS_UMAC_WBM_REG 0x00a34000 =20 #define HAL_CE_WFSS_CE_REG_BASE 0x01b80000 @@ -57,8 +61,10 @@ struct ath12k_base; /* SW2TCL(x) R0 ring configuration address */ #define HAL_TCL1_RING_CMN_CTRL_REG 0x00000020 #define HAL_TCL1_RING_DSCP_TID_MAP 0x00000240 -#define HAL_TCL1_RING_BASE_LSB 0x00000900 -#define HAL_TCL1_RING_BASE_MSB 0x00000904 +#define HAL_TCL1_RING_BASE_LSB(ab) \ + ((ab)->hw_params->regs->hal_tcl1_ring_base_lsb) +#define HAL_TCL1_RING_BASE_MSB(ab) \ + ((ab)->hw_params->regs->hal_tcl1_ring_base_msb) #define HAL_TCL1_RING_ID(ab) ((ab)->hw_params->regs->hal_tcl1_ring_id) #define HAL_TCL1_RING_MISC(ab) \ ((ab)->hw_params->regs->hal_tcl1_ring_misc) @@ -76,30 +82,31 @@ struct ath12k_base; ((ab)->hw_params->regs->hal_tcl1_ring_msi1_base_msb) #define HAL_TCL1_RING_MSI1_DATA(ab) \ ((ab)->hw_params->regs->hal_tcl1_ring_msi1_data) -#define HAL_TCL2_RING_BASE_LSB 0x00000978 +#define HAL_TCL2_RING_BASE_LSB(ab) \ + ((ab)->hw_params->regs->hal_tcl2_ring_base_lsb) #define HAL_TCL_RING_BASE_LSB(ab) \ ((ab)->hw_params->regs->hal_tcl_ring_base_lsb) =20 -#define HAL_TCL1_RING_MSI1_BASE_LSB_OFFSET(ab) \ - (HAL_TCL1_RING_MSI1_BASE_LSB(ab) - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_MSI1_BASE_MSB_OFFSET(ab) \ - (HAL_TCL1_RING_MSI1_BASE_MSB(ab) - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_MSI1_DATA_OFFSET(ab) \ - (HAL_TCL1_RING_MSI1_DATA(ab) - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_BASE_MSB_OFFSET \ - (HAL_TCL1_RING_BASE_MSB - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_ID_OFFSET(ab) \ - (HAL_TCL1_RING_ID(ab) - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_CONSR_INT_SETUP_IX0_OFFSET(ab) \ - (HAL_TCL1_RING_CONSUMER_INT_SETUP_IX0(ab) - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_CONSR_INT_SETUP_IX1_OFFSET(ab) \ - (HAL_TCL1_RING_CONSUMER_INT_SETUP_IX1(ab) - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_TP_ADDR_LSB_OFFSET(ab) \ - (HAL_TCL1_RING_TP_ADDR_LSB(ab) - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_TP_ADDR_MSB_OFFSET(ab) \ - (HAL_TCL1_RING_TP_ADDR_MSB(ab) - HAL_TCL1_RING_BASE_LSB) -#define HAL_TCL1_RING_MISC_OFFSET(ab) \ - (HAL_TCL1_RING_MISC(ab) - HAL_TCL1_RING_BASE_LSB) +#define HAL_TCL1_RING_MSI1_BASE_LSB_OFFSET(ab) ({ typeof(ab) _ab =3D (ab);= \ + (HAL_TCL1_RING_MSI1_BASE_LSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) +#define HAL_TCL1_RING_MSI1_BASE_MSB_OFFSET(ab) ({ typeof(ab) _ab =3D (ab);= \ + (HAL_TCL1_RING_MSI1_BASE_MSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) +#define HAL_TCL1_RING_MSI1_DATA_OFFSET(ab) ({ typeof(ab) _ab =3D (ab); \ + (HAL_TCL1_RING_MSI1_DATA(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) +#define HAL_TCL1_RING_BASE_MSB_OFFSET(ab) ({ typeof(ab) _ab =3D (ab); \ + (HAL_TCL1_RING_BASE_MSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) +#define HAL_TCL1_RING_ID_OFFSET(ab) ({ typeof(ab) _ab =3D (ab); \ + (HAL_TCL1_RING_ID(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) +#define HAL_TCL1_RING_CONSR_INT_SETUP_IX0_OFFSET(ab) ({ typeof(ab) _ab =3D= (ab); \ + (HAL_TCL1_RING_CONSUMER_INT_SETUP_IX0(_ab) - HAL_TCL1_RING_BASE_LSB(_ab))= ; }) +#define HAL_TCL1_RING_CONSR_INT_SETUP_IX1_OFFSET(ab) ({ typeof(ab) _ab =3D= (ab); \ + (HAL_TCL1_RING_CONSUMER_INT_SETUP_IX1(_ab) - HAL_TCL1_RING_BASE_LSB(_ab))= ; }) +#define HAL_TCL1_RING_TP_ADDR_LSB_OFFSET(ab) ({ typeof(ab) _ab =3D (ab); \ + (HAL_TCL1_RING_TP_ADDR_LSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) +#define HAL_TCL1_RING_TP_ADDR_MSB_OFFSET(ab) ({ typeof(ab) _ab =3D (ab); \ + (HAL_TCL1_RING_TP_ADDR_MSB(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) +#define HAL_TCL1_RING_MISC_OFFSET(ab) ({ typeof(ab) _ab =3D (ab); \ + (HAL_TCL1_RING_MISC(_ab) - HAL_TCL1_RING_BASE_LSB(_ab)); }) =20 /* SW2TCL(x) R2 ring pointers (head/tail) address */ #define HAL_TCL1_RING_HP 0x00002000 diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/at= h/ath12k/hw.c index a106ebed7870..4c9d6c42fbb9 100644 --- a/drivers/net/wireless/ath/ath12k/hw.c +++ b/drivers/net/wireless/ath/ath12k/hw.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights res= erved. */ =20 #include @@ -619,6 +619,9 @@ static const struct ath12k_hw_regs qcn9274_v1_regs =3D { .hal_tcl1_ring_msi1_base_msb =3D 0x0000094c, .hal_tcl1_ring_msi1_data =3D 0x00000950, .hal_tcl_ring_base_lsb =3D 0x00000b58, + .hal_tcl1_ring_base_lsb =3D 0x00000900, + .hal_tcl1_ring_base_msb =3D 0x00000904, + .hal_tcl2_ring_base_lsb =3D 0x00000978, =20 /* TCL STATUS ring address */ .hal_tcl_status_ring_base_lsb =3D 0x00000d38, @@ -681,6 +684,12 @@ static const struct ath12k_hw_regs qcn9274_v1_regs =3D= { =20 /* REO status ring address */ .hal_reo_status_ring_base =3D 0x00000a84, + + /* CE base address */ + .hal_umac_ce0_src_reg_base =3D 0x01b80000, + .hal_umac_ce0_dest_reg_base =3D 0x01b81000, + .hal_umac_ce1_src_reg_base =3D 0x01b82000, + .hal_umac_ce1_dest_reg_base =3D 0x01b83000, }; =20 static const struct ath12k_hw_regs qcn9274_v2_regs =3D { @@ -695,6 +704,9 @@ static const struct ath12k_hw_regs qcn9274_v2_regs =3D { .hal_tcl1_ring_msi1_base_msb =3D 0x0000094c, .hal_tcl1_ring_msi1_data =3D 0x00000950, .hal_tcl_ring_base_lsb =3D 0x00000b58, + .hal_tcl1_ring_base_lsb =3D 0x00000900, + .hal_tcl1_ring_base_msb =3D 0x00000904, + .hal_tcl2_ring_base_lsb =3D 0x00000978, =20 /* TCL STATUS ring address */ .hal_tcl_status_ring_base_lsb =3D 0x00000d38, @@ -761,6 +773,12 @@ static const struct ath12k_hw_regs qcn9274_v2_regs =3D= { =20 /* REO status ring address */ .hal_reo_status_ring_base =3D 0x00000aa0, + + /* CE base address */ + .hal_umac_ce0_src_reg_base =3D 0x01b80000, + .hal_umac_ce0_dest_reg_base =3D 0x01b81000, + .hal_umac_ce1_src_reg_base =3D 0x01b82000, + .hal_umac_ce1_dest_reg_base =3D 0x01b83000, }; =20 static const struct ath12k_hw_regs wcn7850_regs =3D { @@ -775,6 +793,9 @@ static const struct ath12k_hw_regs wcn7850_regs =3D { .hal_tcl1_ring_msi1_base_msb =3D 0x0000094c, .hal_tcl1_ring_msi1_data =3D 0x00000950, .hal_tcl_ring_base_lsb =3D 0x00000b58, + .hal_tcl1_ring_base_lsb =3D 0x00000900, + .hal_tcl1_ring_base_msb =3D 0x00000904, + .hal_tcl2_ring_base_lsb =3D 0x00000978, =20 /* TCL STATUS ring address */ .hal_tcl_status_ring_base_lsb =3D 0x00000d38, @@ -837,6 +858,12 @@ static const struct ath12k_hw_regs wcn7850_regs =3D { =20 /* REO status ring address */ .hal_reo_status_ring_base =3D 0x00000a84, + + /* CE base address */ + .hal_umac_ce0_src_reg_base =3D 0x01b80000, + .hal_umac_ce0_dest_reg_base =3D 0x01b81000, + .hal_umac_ce1_src_reg_base =3D 0x01b82000, + .hal_umac_ce1_dest_reg_base =3D 0x01b83000, }; =20 static const struct ath12k_hw_hal_params ath12k_hw_hal_params_qcn9274 =3D { diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/at= h/ath12k/hw.h index 8d52182e28ae..acb81b5798ac 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights res= erved. */ =20 #ifndef ATH12K_HW_H @@ -293,6 +293,9 @@ struct ath12k_hw_regs { u32 hal_tcl1_ring_msi1_base_msb; u32 hal_tcl1_ring_msi1_data; u32 hal_tcl_ring_base_lsb; + u32 hal_tcl1_ring_base_lsb; + u32 hal_tcl1_ring_base_msb; + u32 hal_tcl2_ring_base_lsb; =20 u32 hal_tcl_status_ring_base_lsb; =20 @@ -316,6 +319,11 @@ struct ath12k_hw_regs { u32 pcie_qserdes_sysclk_en_sel; u32 pcie_pcs_osc_dtct_config_base; =20 + u32 hal_umac_ce0_src_reg_base; + u32 hal_umac_ce0_dest_reg_base; + u32 hal_umac_ce1_src_reg_base; + u32 hal_umac_ce1_dest_reg_base; + u32 hal_ppe_rel_ring_base; =20 u32 hal_reo2_ring_base; --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A998E248895; Mon, 17 Mar 2025 15:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226193; cv=none; b=NDLBYP2C7s4ssx5MNKVJlIg+PT357omcMlrM2WwxHMTOX84mBE+7nb7dshQf0KWMPYXAaxKYA8qa898zV070/Z7Zsc9/9zWst6eZlH8tpQ7NHRAxIcR64SswYvlhKR3uNNodpuUh0826xGhZXhJFrECsI99VoKgwdgFAmLn+fXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226193; c=relaxed/simple; bh=13MNDb2OXB947v0QcLfVBFraBFNpWgacgUpOCbWNMoE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QZaws+zhx3yOIlCJkI+drGuq9GETC3nHiwnzyVbcgRO7V0+sviS+/zDuvwL3zGNH/FmjNb5rORLKPyk5qqS58G+vPOztyDBMcAa4AY7NrSoybW8BsDqmcsWgQpdEv/eyXnJLdMPDmNnpFtXdermotkhuHggVlOJNa83pXzfh8kw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=XNKHsHRr; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="XNKHsHRr" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HAmNgl009775; Mon, 17 Mar 2025 15:43:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= eZ95uKovz/v5EvRHGw7uYaiBn7QdoLZR1eXx61faqIM=; b=XNKHsHRr6bfc3YgR CBnyKRR1kxF7uKLJFer0KJRcNLSM6NVik6iPE5bG5SaIjv5+9+f0BjD9q9iTtheG Df/MajaSq7e49nMWVn22LYujSvtBnGDS1kpJyGcTq1o/qnF788SiCxADoxIbI6m7 bDI7Tkq/7GkhPXEHPSsHyRRmLhMoNevxhRyvR43227ndwFXJcpSyd13eUXFet33g Sc76ejleTsrjTTWXmMxT60mRNZU4KEj5NPaFDCdCI7UpA8yH/QoRs/tKKZAS+yFY IS0KnrfbLSN3fTzktbLU3i+kB1L8fvuh0F3UUuPZZ0TPJX6SA7zfQmSbvop/O1R8 DpfZag== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1sxw5h5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:00 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFgxYt010911 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:42:59 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:42:55 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , Balamurugan S , P Praneesh , "Raj Kumar Bhagat" , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 04/13] wifi: ath12k: add ath12k_hw_params for IPQ5332 Date: Mon, 17 Mar 2025 21:11:41 +0530 Message-ID: <20250317154150.1361364-5-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: A_6eWQAde0w4C56pTsVwsOtVB8iVCK0G X-Proofpoint-ORIG-GUID: A_6eWQAde0w4C56pTsVwsOtVB8iVCK0G X-Authority-Analysis: v=2.4 cv=XKcwSRhE c=1 sm=1 tr=0 ts=67d84304 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=C4orLhmnYW0ZFoe8lpwA:9 a=RVmHIydaz68A:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 impostorscore=0 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Balamurugan S Add ath12k_hw_params for new ath12k AHB based WiFi device IPQ5332. Some hardware parameters like hw_ops, wmi_init & hal_ops are same between IPQ5332 and QCN9274, hence use these same parameters for IPQ5332. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1 Signed-off-by: Balamurugan S Co-developed-by: P Praneesh Signed-off-by: P Praneesh Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/ce.c | 92 +++++- drivers/net/wireless/ath/ath12k/ce.h | 1 + drivers/net/wireless/ath/ath12k/core.h | 3 +- drivers/net/wireless/ath/ath12k/hw.c | 415 +++++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/qmi.h | 3 +- 5 files changed, 511 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/ce.c b/drivers/net/wireless/at= h/ath12k/ce.c index be0d669d31fc..7a5656aceebe 100644 --- a/drivers/net/wireless/ath/ath12k/ce.c +++ b/drivers/net/wireless/ath/ath12k/ce.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights res= erved. + * Copyright (c) 2021-2022, 2024-2025 Qualcomm Innovation Center, Inc. All= rights reserved. */ =20 #include "dp_rx.h" @@ -219,6 +219,96 @@ const struct ce_attr ath12k_host_ce_config_wcn7850[] = =3D { =20 }; =20 +const struct ce_attr ath12k_host_ce_config_ipq5332[] =3D { + /* CE0: host->target HTC control and raw streams */ + { + .flags =3D CE_ATTR_FLAGS, + .src_nentries =3D 16, + .src_sz_max =3D 2048, + .dest_nentries =3D 0, + }, + /* CE1: target->host HTT + HTC control */ + { + .flags =3D CE_ATTR_FLAGS, + .src_nentries =3D 0, + .src_sz_max =3D 2048, + .dest_nentries =3D 512, + .recv_cb =3D ath12k_htc_rx_completion_handler, + }, + /* CE2: target->host WMI */ + { + .flags =3D CE_ATTR_FLAGS, + .src_nentries =3D 0, + .src_sz_max =3D 2048, + .dest_nentries =3D 128, + .recv_cb =3D ath12k_htc_rx_completion_handler, + }, + /* CE3: host->target WMI */ + { + .flags =3D CE_ATTR_FLAGS, + .src_nentries =3D 32, + .src_sz_max =3D 2048, + .dest_nentries =3D 0, + }, + /* CE4: host->target HTT */ + { + .flags =3D CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, + .src_nentries =3D 2048, + .src_sz_max =3D 256, + .dest_nentries =3D 0, + }, + /* CE5: target -> host PKTLOG */ + { + .flags =3D CE_ATTR_FLAGS, + .src_nentries =3D 0, + .src_sz_max =3D 2048, + .dest_nentries =3D 512, + .recv_cb =3D ath12k_dp_htt_htc_t2h_msg_handler, + }, + /* CE6: Target autonomous HIF_memcpy */ + { + .flags =3D CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, + .src_nentries =3D 0, + .src_sz_max =3D 0, + .dest_nentries =3D 0, + }, + /* CE7: CV Prefetch */ + { + .flags =3D CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, + .src_nentries =3D 0, + .src_sz_max =3D 0, + .dest_nentries =3D 0, + }, + /* CE8: Target HIF memcpy (Generic HIF memcypy) */ + { + .flags =3D CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, + .src_nentries =3D 0, + .src_sz_max =3D 0, + .dest_nentries =3D 0, + }, + /* CE9: WMI logging/CFR/Spectral/Radar */ + { + .flags =3D CE_ATTR_FLAGS, + .src_nentries =3D 0, + .src_sz_max =3D 2048, + .dest_nentries =3D 128, + }, + /* CE10: Unused */ + { + .flags =3D CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, + .src_nentries =3D 0, + .src_sz_max =3D 0, + .dest_nentries =3D 0, + }, + /* CE11: Unused */ + { + .flags =3D CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, + .src_nentries =3D 0, + .src_sz_max =3D 0, + .dest_nentries =3D 0, + }, +}; + static int ath12k_ce_rx_buf_enqueue_pipe(struct ath12k_ce_pipe *pipe, struct sk_buff *skb, dma_addr_t paddr) { diff --git a/drivers/net/wireless/ath/ath12k/ce.h b/drivers/net/wireless/at= h/ath12k/ce.h index f85188af5de2..8007a94cec5d 100644 --- a/drivers/net/wireless/ath/ath12k/ce.h +++ b/drivers/net/wireless/ath/ath12k/ce.h @@ -164,6 +164,7 @@ struct ath12k_ce { =20 extern const struct ce_attr ath12k_host_ce_config_qcn9274[]; extern const struct ce_attr ath12k_host_ce_config_wcn7850[]; +extern const struct ce_attr ath12k_host_ce_config_ipq5332[]; =20 void ath12k_ce_cleanup_pipes(struct ath12k_base *ab); void ath12k_ce_rx_replenish_retry(struct timer_list *t); diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/= ath/ath12k/core.h index 3fac4f00d383..553965f12fcd 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -147,7 +147,8 @@ struct ath12k_skb_rxcb { enum ath12k_hw_rev { ATH12K_HW_QCN9274_HW10, ATH12K_HW_QCN9274_HW20, - ATH12K_HW_WCN7850_HW20 + ATH12K_HW_WCN7850_HW20, + ATH12K_HW_IPQ5332_HW10, }; =20 enum ath12k_firmware_mode { diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/at= h/ath12k/hw.c index 4c9d6c42fbb9..86c4ce143169 100644 --- a/drivers/net/wireless/ath/ath12k/hw.c +++ b/drivers/net/wireless/ath/ath12k/hw.c @@ -535,6 +535,217 @@ static const struct service_to_pipe ath12k_target_ser= vice_to_ce_map_wlan_wcn7850 }, }; =20 +static const struct ce_pipe_config ath12k_target_ce_config_wlan_ipq5332[] = =3D { + /* host->target HTC control and raw streams */ + { + .pipenum =3D __cpu_to_le32(0), + .pipedir =3D __cpu_to_le32(PIPEDIR_OUT), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(2048), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* target->host HTT */ + { + .pipenum =3D __cpu_to_le32(1), + .pipedir =3D __cpu_to_le32(PIPEDIR_IN), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(2048), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* target->host WMI + HTC control */ + { + .pipenum =3D __cpu_to_le32(2), + .pipedir =3D __cpu_to_le32(PIPEDIR_IN), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(2048), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* host->target WMI */ + { + .pipenum =3D __cpu_to_le32(3), + .pipedir =3D __cpu_to_le32(PIPEDIR_OUT), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(2048), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* host->target HTT */ + { + .pipenum =3D __cpu_to_le32(4), + .pipedir =3D __cpu_to_le32(PIPEDIR_OUT), + .nentries =3D __cpu_to_le32(256), + .nbytes_max =3D __cpu_to_le32(256), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR), + .reserved =3D __cpu_to_le32(0), + }, + /* Target -> host PKTLOG */ + { + .pipenum =3D __cpu_to_le32(5), + .pipedir =3D __cpu_to_le32(PIPEDIR_IN), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(2048), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* Reserved for target autonomous HIF_memcpy */ + { + .pipenum =3D __cpu_to_le32(6), + .pipedir =3D __cpu_to_le32(PIPEDIR_INOUT), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(16384), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* CE7 Reserved for CV Prefetch */ + { + .pipenum =3D __cpu_to_le32(7), + .pipedir =3D __cpu_to_le32(PIPEDIR_OUT), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(2048), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* CE8 Reserved for target generic HIF memcpy */ + { + .pipenum =3D __cpu_to_le32(8), + .pipedir =3D __cpu_to_le32(PIPEDIR_INOUT), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(16384), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* CE9 WMI logging/CFR/Spectral/Radar/ */ + { + .pipenum =3D __cpu_to_le32(9), + .pipedir =3D __cpu_to_le32(PIPEDIR_IN), + .nentries =3D __cpu_to_le32(32), + .nbytes_max =3D __cpu_to_le32(2048), + .flags =3D __cpu_to_le32(CE_ATTR_FLAGS), + .reserved =3D __cpu_to_le32(0), + }, + /* Unused TBD */ + { + .pipenum =3D __cpu_to_le32(10), + .pipedir =3D __cpu_to_le32(PIPEDIR_NONE), + .nentries =3D __cpu_to_le32(0), + .nbytes_max =3D __cpu_to_le32(0), + .flags =3D __cpu_to_le32(0), + .reserved =3D __cpu_to_le32(0), + }, + /* Unused TBD */ + { + .pipenum =3D __cpu_to_le32(11), + .pipedir =3D __cpu_to_le32(PIPEDIR_NONE), + .nentries =3D __cpu_to_le32(0), + .nbytes_max =3D __cpu_to_le32(0), + .flags =3D __cpu_to_le32(0), + .reserved =3D __cpu_to_le32(0), + }, +}; + +static const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_i= pq5332[] =3D { + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO), + __cpu_to_le32(PIPEDIR_OUT), + __cpu_to_le32(3), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(2), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK), + __cpu_to_le32(PIPEDIR_OUT), + __cpu_to_le32(3), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(2), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE), + __cpu_to_le32(PIPEDIR_OUT), + __cpu_to_le32(3), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(2), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI), + __cpu_to_le32(PIPEDIR_OUT), + __cpu_to_le32(3), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(2), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL), + __cpu_to_le32(PIPEDIR_OUT), + __cpu_to_le32(3), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(2), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL), + __cpu_to_le32(PIPEDIR_OUT), + __cpu_to_le32(0), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(1), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS), + __cpu_to_le32(PIPEDIR_OUT), + __cpu_to_le32(0), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(1), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG), + __cpu_to_le32(PIPEDIR_OUT), + __cpu_to_le32(4), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(1), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(5), + }, + { + __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG), + __cpu_to_le32(PIPEDIR_IN), + __cpu_to_le32(9), + }, + /* (Additions here) */ + + { /* must be last */ + __cpu_to_le32(0), + __cpu_to_le32(0), + __cpu_to_le32(0), + }, +}; + static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_qcn9274 =3D { .tx =3D { ATH12K_TX_RING_MASK_0, @@ -577,6 +788,46 @@ static const struct ath12k_hw_ring_mask ath12k_hw_ring= _mask_qcn9274 =3D { }, }; =20 +static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_ipq5332 =3D { + .tx =3D { + ATH12K_TX_RING_MASK_0, + ATH12K_TX_RING_MASK_1, + ATH12K_TX_RING_MASK_2, + ATH12K_TX_RING_MASK_3, + }, + .rx_mon_dest =3D { + 0, 0, 0, 0, 0, 0, 0, 0, + ATH12K_RX_MON_RING_MASK_0, + }, + .rx =3D { + 0, 0, 0, 0, + ATH12K_RX_RING_MASK_0, + ATH12K_RX_RING_MASK_1, + ATH12K_RX_RING_MASK_2, + ATH12K_RX_RING_MASK_3, + }, + .rx_err =3D { + 0, 0, 0, + ATH12K_RX_ERR_RING_MASK_0, + }, + .rx_wbm_rel =3D { + 0, 0, 0, + ATH12K_RX_WBM_REL_RING_MASK_0, + }, + .reo_status =3D { + 0, 0, 0, + ATH12K_REO_STATUS_RING_MASK_0, + }, + .host2rxdma =3D { + 0, 0, 0, + ATH12K_HOST2RXDMA_RING_MASK_0, + }, + .tx_mon_dest =3D { + ATH12K_TX_MON_RING_MASK_0, + ATH12K_TX_MON_RING_MASK_1, + }, +}; + static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_wcn7850 =3D { .tx =3D { ATH12K_TX_RING_MASK_0, @@ -781,6 +1032,90 @@ static const struct ath12k_hw_regs qcn9274_v2_regs = =3D { .hal_umac_ce1_dest_reg_base =3D 0x01b83000, }; =20 +static const struct ath12k_hw_regs ipq5332_regs =3D { + /* SW2TCL(x) R0 ring configuration address */ + .hal_tcl1_ring_id =3D 0x00000918, + .hal_tcl1_ring_misc =3D 0x00000920, + .hal_tcl1_ring_tp_addr_lsb =3D 0x0000092c, + .hal_tcl1_ring_tp_addr_msb =3D 0x00000930, + .hal_tcl1_ring_consumer_int_setup_ix0 =3D 0x00000940, + .hal_tcl1_ring_consumer_int_setup_ix1 =3D 0x00000944, + .hal_tcl1_ring_msi1_base_lsb =3D 0x00000958, + .hal_tcl1_ring_msi1_base_msb =3D 0x0000095c, + .hal_tcl1_ring_base_lsb =3D 0x00000910, + .hal_tcl1_ring_base_msb =3D 0x00000914, + .hal_tcl1_ring_msi1_data =3D 0x00000960, + .hal_tcl2_ring_base_lsb =3D 0x00000988, + .hal_tcl_ring_base_lsb =3D 0x00000b68, + + /* TCL STATUS ring address */ + .hal_tcl_status_ring_base_lsb =3D 0x00000d48, + + /* REO DEST ring address */ + .hal_reo2_ring_base =3D 0x00000578, + .hal_reo1_misc_ctrl_addr =3D 0x00000b9c, + .hal_reo1_sw_cookie_cfg0 =3D 0x0000006c, + .hal_reo1_sw_cookie_cfg1 =3D 0x00000070, + .hal_reo1_qdesc_lut_base0 =3D 0x00000074, + .hal_reo1_qdesc_lut_base1 =3D 0x00000078, + .hal_reo1_ring_base_lsb =3D 0x00000500, + .hal_reo1_ring_base_msb =3D 0x00000504, + .hal_reo1_ring_id =3D 0x00000508, + .hal_reo1_ring_misc =3D 0x00000510, + .hal_reo1_ring_hp_addr_lsb =3D 0x00000514, + .hal_reo1_ring_hp_addr_msb =3D 0x00000518, + .hal_reo1_ring_producer_int_setup =3D 0x00000524, + .hal_reo1_ring_msi1_base_lsb =3D 0x00000548, + .hal_reo1_ring_msi1_base_msb =3D 0x0000054C, + .hal_reo1_ring_msi1_data =3D 0x00000550, + .hal_reo1_aging_thres_ix0 =3D 0x00000B28, + .hal_reo1_aging_thres_ix1 =3D 0x00000B2C, + .hal_reo1_aging_thres_ix2 =3D 0x00000B30, + .hal_reo1_aging_thres_ix3 =3D 0x00000B34, + + /* REO Exception ring address */ + .hal_reo2_sw0_ring_base =3D 0x000008c0, + + /* REO Reinject ring address */ + .hal_sw2reo_ring_base =3D 0x00000320, + .hal_sw2reo1_ring_base =3D 0x00000398, + + /* REO cmd ring address */ + .hal_reo_cmd_ring_base =3D 0x000002A8, + + /* REO status ring address */ + .hal_reo_status_ring_base =3D 0x00000aa0, + + /* WBM idle link ring address */ + .hal_wbm_idle_ring_base_lsb =3D 0x00000d3c, + .hal_wbm_idle_ring_misc_addr =3D 0x00000d4c, + .hal_wbm_r0_idle_list_cntl_addr =3D 0x00000240, + .hal_wbm_r0_idle_list_size_addr =3D 0x00000244, + .hal_wbm_scattered_ring_base_lsb =3D 0x00000250, + .hal_wbm_scattered_ring_base_msb =3D 0x00000254, + .hal_wbm_scattered_desc_head_info_ix0 =3D 0x00000260, + .hal_wbm_scattered_desc_head_info_ix1 =3D 0x00000264, + .hal_wbm_scattered_desc_tail_info_ix0 =3D 0x00000270, + .hal_wbm_scattered_desc_tail_info_ix1 =3D 0x00000274, + .hal_wbm_scattered_desc_ptr_hp_addr =3D 0x0000027c, + + /* SW2WBM release ring address */ + .hal_wbm_sw_release_ring_base_lsb =3D 0x0000037c, + + /* WBM2SW release ring address */ + .hal_wbm0_release_ring_base_lsb =3D 0x00000e08, + .hal_wbm1_release_ring_base_lsb =3D 0x00000e80, + + /* PPE release ring address */ + .hal_ppe_rel_ring_base =3D 0x0000046c, + + /* CE address */ + .hal_umac_ce0_src_reg_base =3D 0x00740000, + .hal_umac_ce0_dest_reg_base =3D 0x00741000, + .hal_umac_ce1_src_reg_base =3D 0x00742000, + .hal_umac_ce1_dest_reg_base =3D 0x00743000, +}; + static const struct ath12k_hw_regs wcn7850_regs =3D { /* SW2TCL(x) R0 ring configuration address */ .hal_tcl1_ring_id =3D 0x00000908, @@ -883,6 +1218,15 @@ static const struct ath12k_hw_hal_params ath12k_hw_ha= l_params_wcn7850 =3D { HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN, }; =20 +static const struct ath12k_hw_hal_params ath12k_hw_hal_params_ipq5332 =3D { + .rx_buf_rbm =3D HAL_RX_BUF_RBM_SW3_BM, + .wbm2sw_cc_enable =3D HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW0_EN | + HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW1_EN | + HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW2_EN | + HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW3_EN | + HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN, +}; + static const struct ath12k_hw_params ath12k_hw_params[] =3D { { .name =3D "qcn9274 hw1.0", @@ -1116,6 +1460,77 @@ static const struct ath12k_hw_params ath12k_hw_param= s[] =3D { =20 .supports_aspm =3D false, }, + { + .name =3D "ipq5332 hw1.0", + .hw_rev =3D ATH12K_HW_IPQ5332_HW10, + .fw =3D { + .dir =3D "IPQ5332/hw1.0", + .board_size =3D 256 * 1024, + .cal_offset =3D 128 * 1024, + }, + .max_radios =3D 1, + .single_pdev_only =3D false, + .qmi_service_ins_id =3D ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ5332, + .internal_sleep_clock =3D false, + + .hw_ops =3D &qcn9274_ops, + .regs =3D &ipq5332_regs, + .ring_mask =3D &ath12k_hw_ring_mask_ipq5332, + + .host_ce_config =3D ath12k_host_ce_config_ipq5332, + .ce_count =3D 12, + .target_ce_config =3D ath12k_target_ce_config_wlan_ipq5332, + .target_ce_count =3D 12, + .svc_to_ce_map =3D ath12k_target_service_to_ce_map_wlan_ipq5332, + .svc_to_ce_map_len =3D 18, + + .hal_params =3D &ath12k_hw_hal_params_ipq5332, + + .rxdma1_enable =3D false, + .num_rxdma_per_pdev =3D 1, + .num_rxdma_dst_ring =3D 0, + .rx_mac_buf_ring =3D false, + .vdev_start_delay =3D false, + + .interface_modes =3D BIT(NL80211_IFTYPE_STATION) | + BIT(NL80211_IFTYPE_AP) | + BIT(NL80211_IFTYPE_MESH_POINT), + .supports_monitor =3D false, + + .idle_ps =3D false, + .download_calib =3D true, + .supports_suspend =3D false, + .tcl_ring_retry =3D true, + .reoq_lut_support =3D false, + .supports_shadow_regs =3D false, + + .num_tcl_banks =3D 48, + .max_tx_ring =3D 4, + + .wmi_init =3D &ath12k_wmi_init_qcn9274, + + .hal_ops =3D &hal_qcn9274_ops, + + .qmi_cnss_feature_bitmap =3D BIT(CNSS_QDSS_CFG_MISS_V01), + + .rfkill_pin =3D 0, + .rfkill_cfg =3D 0, + .rfkill_on_level =3D 0, + + .rddm_size =3D 0, + + .def_num_link =3D 0, + .max_mlo_peer =3D 256, + + .otp_board_id_register =3D 0, + + .supports_sta_ps =3D false, + + .acpi_guid =3D NULL, + .supports_dynamic_smps_6ghz =3D false, + .iova_mask =3D 0, + .supports_aspm =3D false, + }, }; =20 int ath12k_hw_init(struct ath12k_base *ab) diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/a= th/ath12k/qmi.h index 45d7c3fcafdd..7c44ced22c6f 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.h +++ b/drivers/net/wireless/ath/ath12k/qmi.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights res= erved. */ =20 #ifndef ATH12K_QMI_H @@ -21,6 +21,7 @@ #define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_WCN7850 0x1 =20 #define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_QCN9274 0x07 +#define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ5332 0x2 #define ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 32 #define ATH12K_QMI_RESP_LEN_MAX 8192 #define ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01 52 --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD89A24A049; Mon, 17 Mar 2025 15:43:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226196; cv=none; b=QKiAOO18rLBUgsu6W4vcmE7/G3N8dli5MysaQPZCx5xUl1xSlhJfAAE3kYkuDCV08vI7fwIyviaX5aO+8ccFqu3LvuoF99HYKv5s/q+I2Bp9U+aPq3atcpiKrVDqzZhPu+EWgrY6/2jp/lCXXctgz0byO3+7iMif7bPg9Murscw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226196; c=relaxed/simple; bh=J3pBPmBtWpjSxzusKOJ+lS0lOw24+MGbNDsgWk0QCdU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MxJsXki5LR+Ma0PQDnUGnheAgbvSqiq+s3ZnN2UFIFBqG24pLW/Mc7qoAUYRsphBpd9uH5zzwSaDyz3hyi5oK0iUTYPxXbET6QfQRrzJ+cZfofQyYZ+/Z4E0BRU4MPd39K16uIE9JBUu290Qc5WPB5oEdK9QTibBDCZwNOPcYoM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=eN5crRQJ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="eN5crRQJ" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HAjPPX026060; Mon, 17 Mar 2025 15:43:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= UbKV4giO6P4T11RFq91NGeB15IVWEY2tVPwbT1YXh/w=; b=eN5crRQJi1GmcFgE d7IKKEOEjWTrwthB/gWaz81e2dCSGnC8uesegy1W94IYjZSSKbYjmu4OC+c+ZRf8 rCHTQ2zACJirJpnGqmREOBR5EM/oA6O9/074Hj2OgU8M9EBwmyUl7ncFAKVmicOU enR7kjs8Dq+Tj9oatV0beibpy3KjCqSSWlOi0lPWwJMUMWBzZw/WEoRqls9HEUqt tjjGwG2wNFfF4R1jSzpLMqERVZTibtAoCgqscvaOxYLrxdX8C4HJE0SNdZqbo62D nz6QSBgSFSB5qgnoHaGftlJL2pfdZ5/u81ilJpSQdUz/r52QScGVIEt4b6QuDxKw 5Q/vbA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1sxw5hc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:04 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFh3mQ015942 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:03 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:42:59 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , Balamurugan S , P Praneesh , "Raj Kumar Bhagat" , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 05/13] wifi: ath12k: avoid m3 firmware download in AHB device IPQ5332 Date: Mon, 17 Mar 2025 21:11:42 +0530 Message-ID: <20250317154150.1361364-6-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ArTr0kLSKJHjZ4csWZF96Zgm5fy-1KIm X-Proofpoint-ORIG-GUID: ArTr0kLSKJHjZ4csWZF96Zgm5fy-1KIm X-Authority-Analysis: v=2.4 cv=XKcwSRhE c=1 sm=1 tr=0 ts=67d84308 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=xxvc9IR4fv61F9HQkbgA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 impostorscore=0 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Balamurugan S Current ath12k devices, QCN9274 and WCN7850, supports m3.bin firmware download through ath12k driver. The new ath12k AHB based device IPQ5332 supports m3 firmware download through remoteproc driver. Hence, add new parameter (fw.m3_loader) in ath12k_hw_params to avoid m3 firmware download in IPQ5332. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1 Signed-off-by: Balamurugan S Co-developed-by: P Praneesh Signed-off-by: P Praneesh Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/hw.c | 4 ++++ drivers/net/wireless/ath/ath12k/hw.h | 6 ++++++ drivers/net/wireless/ath/ath12k/qmi.c | 28 ++++++++++++++++----------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/at= h/ath12k/hw.c index 86c4ce143169..84f542c02c94 100644 --- a/drivers/net/wireless/ath/ath12k/hw.c +++ b/drivers/net/wireless/ath/ath12k/hw.c @@ -1235,6 +1235,7 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { .dir =3D "QCN9274/hw1.0", .board_size =3D 256 * 1024, .cal_offset =3D 128 * 1024, + .m3_loader =3D ath12k_m3_fw_loader_driver, }, .max_radios =3D 1, .single_pdev_only =3D false, @@ -1312,6 +1313,7 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { .dir =3D "WCN7850/hw2.0", .board_size =3D 256 * 1024, .cal_offset =3D 256 * 1024, + .m3_loader =3D ath12k_m3_fw_loader_driver, }, =20 .max_radios =3D 1, @@ -1391,6 +1393,7 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { .dir =3D "QCN9274/hw2.0", .board_size =3D 256 * 1024, .cal_offset =3D 128 * 1024, + .m3_loader =3D ath12k_m3_fw_loader_driver, }, .max_radios =3D 2, .single_pdev_only =3D false, @@ -1467,6 +1470,7 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { .dir =3D "IPQ5332/hw1.0", .board_size =3D 256 * 1024, .cal_offset =3D 128 * 1024, + .m3_loader =3D ath12k_m3_fw_loader_remoteproc, }, .max_radios =3D 1, .single_pdev_only =3D false, diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/at= h/ath12k/hw.h index acb81b5798ac..fbe1aec475ce 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -146,6 +146,11 @@ struct ath12k_hw_hal_params { u32 wbm2sw_cc_enable; }; =20 +enum ath12k_m3_fw_loaders { + ath12k_m3_fw_loader_driver, + ath12k_m3_fw_loader_remoteproc, +}; + struct ath12k_hw_params { const char *name; u16 hw_rev; @@ -154,6 +159,7 @@ struct ath12k_hw_params { const char *dir; size_t board_size; size_t cal_offset; + enum ath12k_m3_fw_loaders m3_loader; } fw; =20 u8 max_radios; diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/a= th/ath12k/qmi.c index 348dbc81bad8..6978200fb79a 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -2168,10 +2168,12 @@ int ath12k_qmi_host_cap_send(struct ath12k_base *ab) req.bdf_support_valid =3D 1; req.bdf_support =3D 1; =20 - req.m3_support_valid =3D 1; - req.m3_support =3D 1; - req.m3_cache_support_valid =3D 1; - req.m3_cache_support =3D 1; + if (ab->hw_params->fw.m3_loader =3D=3D ath12k_m3_fw_loader_driver) { + req.m3_support_valid =3D 1; + req.m3_support =3D 1; + req.m3_cache_support_valid =3D 1; + req.m3_cache_support =3D 1; + } =20 req.cal_done_valid =3D 1; req.cal_done =3D ab->qmi.cal_done; @@ -2939,6 +2941,9 @@ static void ath12k_qmi_m3_free(struct ath12k_base *ab) { struct m3_mem_region *m3_mem =3D &ab->qmi.m3_mem; =20 + if (ab->hw_params->fw.m3_loader =3D=3D ath12k_m3_fw_loader_remoteproc) + return; + if (!m3_mem->vaddr) return; =20 @@ -3019,15 +3024,16 @@ int ath12k_qmi_wlanfw_m3_info_send(struct ath12k_ba= se *ab) struct qmi_txn txn; int ret =3D 0; =20 - ret =3D ath12k_qmi_m3_load(ab); - if (ret) { - ath12k_err(ab, "failed to load m3 firmware: %d", ret); - return ret; + if (ab->hw_params->fw.m3_loader =3D=3D ath12k_m3_fw_loader_driver) { + ret =3D ath12k_qmi_m3_load(ab); + if (ret) { + ath12k_err(ab, "failed to load m3 firmware: %d", ret); + return ret; + } + req.addr =3D m3_mem->paddr; + req.size =3D m3_mem->size; } =20 - req.addr =3D m3_mem->paddr; - req.size =3D m3_mem->size; - ret =3D qmi_txn_init(&ab->qmi.handle, &txn, qmi_wlanfw_m3_info_resp_msg_v01_ei, &resp); if (ret < 0) --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B57F624DFF7; Mon, 17 Mar 2025 15:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226200; cv=none; b=boaCJeFD+THqYMe5QQRPwvYPNMCWAokiT9uyWUhutO1n3Sb++tKqOUbbsoZ5afGSmKmFa9NMwrK1eCkXCQjDN8rUdpIp5nb5K6DwIN+0Bh49Il8S6vQcXJSwVkoXt5bPRiy8Sl4glXbyRWqruy8NCKRyMu9F49QRAKP5qvdhq0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226200; c=relaxed/simple; bh=w+wm1M9dx3XKvm+n2laF9jGsXnjwYGSlI2WSGrrVRoc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PJIC/xEPkfHT4xc6kyKBeeKCZcIZ9nMeJcKTFHpUCApDnK8LiNxgC9uFPLHtsx4SSUD5ZhD7KtU3lvmZaSsjLdvShZNhwRaGHNwHxY3H7LpvlF7Hh1780oXLFYeGwe99EJvU9SeLoviw6X+84emTPrZbW3umuBdxpVA1VQTrNeE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=HRqqROwy; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="HRqqROwy" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HAUAXG011631; Mon, 17 Mar 2025 15:43:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= kMzwBR0HwdMxDOU5MHCY25bbnLrxSfvAhgP8h3Yolt4=; b=HRqqROwyRFZwju46 dLt+04rEMBeo5GbF6PlQq0h1QCz8aQthOuxJ7K1tkVc4QdJN0Xs3w9sTv26a/ZBU MTV0YIzTm1eBB/GzNeyMCdOc4r5AE5UqNWKiWNXOnC8eqecoaadkJStrqDQbnPOg CWCf6wPedO4P4tpamGB0ywVYKL0Ho6m/503GDWA5okQvLwZROoTLTzHN/fUeNuuI Sm7A578IYkZjY4NyqrDr91r/iTyHVpKIT50cWQJV5l67kwK2dqMol0tu0Nl2+4qU 9XYxY+wTRN9vkYd3oaeo+6tYkGqjMnZw+6azYqlctegPYjRRTevqFPUoRrnWQaeF zD+d9A== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1s3w7n5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:08 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFh7H9027875 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:07 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:43:03 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , Balamurugan S , P Praneesh , "Raj Kumar Bhagat" , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 06/13] wifi: ath12k: Add hw_params to remap CE register space for IPQ5332 Date: Mon, 17 Mar 2025 21:11:43 +0530 Message-ID: <20250317154150.1361364-7-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=WbQMa1hX c=1 sm=1 tr=0 ts=67d8430c cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=7j9kn6NuwsAEDTjzSyQA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: F1Hm6yDiznadvF0hVoBdQoo3rzBlyTSA X-Proofpoint-ORIG-GUID: F1Hm6yDiznadvF0hVoBdQoo3rzBlyTSA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 impostorscore=0 suspectscore=0 mlxscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Balamurugan S For IPQ5332 CE register space is moved out of WCSS region and the space is not contiguous. Hence, add hardware params (ce_ie_addr & ce_remap) for IPQ5332. These parameters would be used by Ath12k AHB driver (in subsequent patches) to remap the CE registers to a new space for accessing them. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1 Signed-off-by: Balamurugan S Co-developed-by: P Praneesh Signed-off-by: P Praneesh Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/ce.h | 11 ++++++++ drivers/net/wireless/ath/ath12k/core.h | 4 +++ drivers/net/wireless/ath/ath12k/hal.h | 4 +++ drivers/net/wireless/ath/ath12k/hw.c | 35 +++++++++++++++++++++++--- drivers/net/wireless/ath/ath12k/hw.h | 3 +++ 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/ce.h b/drivers/net/wireless/at= h/ath12k/ce.h index 8007a94cec5d..57f75899ee03 100644 --- a/drivers/net/wireless/ath/ath12k/ce.h +++ b/drivers/net/wireless/ath/ath12k/ce.h @@ -76,6 +76,17 @@ struct ce_pipe_config { __le32 reserved; }; =20 +struct ce_ie_addr { + u32 ie1_reg_addr; + u32 ie2_reg_addr; + u32 ie3_reg_addr; +}; + +struct ce_remap { + u32 base; + u32 size; +}; + struct ce_attr { /* CE_ATTR_* values */ unsigned int flags; diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/= ath/ath12k/core.h index 553965f12fcd..85f0cdce774e 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -924,6 +924,10 @@ struct ath12k_base { void __iomem *mem; unsigned long mem_len; =20 + void __iomem *mem_ce; + u32 ce_remap_base_addr; + bool ce_remap; + struct { enum ath12k_bus bus; const struct ath12k_hif_ops *ops; diff --git a/drivers/net/wireless/ath/ath12k/hal.h b/drivers/net/wireless/a= th/ath12k/hal.h index 1ce97f9a92ac..47ff0b1bfdf4 100644 --- a/drivers/net/wireless/ath/ath12k/hal.h +++ b/drivers/net/wireless/ath/ath12k/hal.h @@ -11,6 +11,7 @@ #include "rx_desc.h" =20 struct ath12k_base; +#define HAL_CE_REMAP_REG_BASE (ab->ce_remap_base_addr) =20 #define HAL_LINK_DESC_SIZE (32 << 2) #define HAL_LINK_DESC_ALIGN 128 @@ -372,6 +373,9 @@ struct ath12k_base; * ath12k_hal_rx_desc_get_err(). */ =20 +#define HAL_IPQ5332_CE_WFSS_REG_BASE 0x740000 +#define HAL_IPQ5332_CE_SIZE 0x100000 + enum hal_srng_ring_id { HAL_SRNG_RING_ID_REO2SW0 =3D 0, HAL_SRNG_RING_ID_REO2SW1, diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/at= h/ath12k/hw.c index 84f542c02c94..91aecca566a4 100644 --- a/drivers/net/wireless/ath/ath12k/hw.c +++ b/drivers/net/wireless/ath/ath12k/hw.c @@ -1110,10 +1110,14 @@ static const struct ath12k_hw_regs ipq5332_regs =3D= { .hal_ppe_rel_ring_base =3D 0x0000046c, =20 /* CE address */ - .hal_umac_ce0_src_reg_base =3D 0x00740000, - .hal_umac_ce0_dest_reg_base =3D 0x00741000, - .hal_umac_ce1_src_reg_base =3D 0x00742000, - .hal_umac_ce1_dest_reg_base =3D 0x00743000, + .hal_umac_ce0_src_reg_base =3D 0x00740000 - + HAL_IPQ5332_CE_WFSS_REG_BASE, + .hal_umac_ce0_dest_reg_base =3D 0x00741000 - + HAL_IPQ5332_CE_WFSS_REG_BASE, + .hal_umac_ce1_src_reg_base =3D 0x00742000 - + HAL_IPQ5332_CE_WFSS_REG_BASE, + .hal_umac_ce1_dest_reg_base =3D 0x00743000 - + HAL_IPQ5332_CE_WFSS_REG_BASE, }; =20 static const struct ath12k_hw_regs wcn7850_regs =3D { @@ -1227,6 +1231,17 @@ static const struct ath12k_hw_hal_params ath12k_hw_h= al_params_ipq5332 =3D { HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN, }; =20 +static const struct ce_ie_addr ath12k_ce_ie_addr_ipq5332 =3D { + .ie1_reg_addr =3D CE_HOST_IE_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE, + .ie2_reg_addr =3D CE_HOST_IE_2_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE, + .ie3_reg_addr =3D CE_HOST_IE_3_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE, +}; + +static const struct ce_remap ath12k_ce_remap_ipq5332 =3D { + .base =3D HAL_IPQ5332_CE_WFSS_REG_BASE, + .size =3D HAL_IPQ5332_CE_SIZE, +}; + static const struct ath12k_hw_params ath12k_hw_params[] =3D { { .name =3D "qcn9274 hw1.0", @@ -1304,6 +1319,9 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { .iova_mask =3D 0, =20 .supports_aspm =3D false, + + .ce_ie_addr =3D NULL, + .ce_remap =3D NULL, }, { .name =3D "wcn7850 hw2.0", @@ -1385,6 +1403,9 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { .iova_mask =3D ATH12K_PCIE_MAX_PAYLOAD_SIZE - 1, =20 .supports_aspm =3D true, + + .ce_ie_addr =3D NULL, + .ce_remap =3D NULL, }, { .name =3D "qcn9274 hw2.0", @@ -1462,6 +1483,9 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { .iova_mask =3D 0, =20 .supports_aspm =3D false, + + .ce_ie_addr =3D NULL, + .ce_remap =3D NULL, }, { .name =3D "ipq5332 hw1.0", @@ -1534,6 +1558,9 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { .supports_dynamic_smps_6ghz =3D false, .iova_mask =3D 0, .supports_aspm =3D false, + + .ce_ie_addr =3D &ath12k_ce_ie_addr_ipq5332, + .ce_remap =3D &ath12k_ce_remap_ipq5332, }, }; =20 diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/at= h/ath12k/hw.h index fbe1aec475ce..6a75af093f31 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -226,6 +226,9 @@ struct ath12k_hw_params { bool supports_dynamic_smps_6ghz; =20 u32 iova_mask; + + const struct ce_ie_addr *ce_ie_addr; + const struct ce_remap *ce_remap; }; =20 struct ath12k_hw_ops { --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C5EC24A049; Mon, 17 Mar 2025 15:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226202; cv=none; b=IQUe6Thwf5TRpomBRfX/tTDbvP0kZvLwbItGKdAqy6crWZFmaF51CHNoymmR2RdGGJ8/+qNRkDNW6Vzfyy+ldm1vcLcB9YJKXr6dJt+pRbSRY6kAOgelxCMadtCRUDSAIogkRR8TJ9T+C9b2gK09lyS2z1KRoDLORNu8uKVoKnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226202; c=relaxed/simple; bh=tvXGG0DIrVKk8YMmY4EbTVTJbQJ+fcBTTsRtEHq8IMo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=priMXr/63zm5NlfCG4AnFYG3g+a6U29LCZuTWzYJ6kpDFJBOz6vv3kOWkfCY7MZyrKO8uvxfKlv7cFOfThCBZU8yQoeQCCluzNQen7eMVN5MW/GgDjazbf8IrqP7qHyQ7GorpDBGgUu8AmfbMJ2kyfYA9aBz3GcMcNjIgoWaO8U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=AQQW5S3u; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="AQQW5S3u" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HA0n64016073; Mon, 17 Mar 2025 15:43:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= paeUxdtEap98ulA2M9qXU7Rwz535AKstZwhO2nhD3dw=; b=AQQW5S3uWwzsqxD+ 7P6Kkcd4hNx2OfK2qqYHCDawrNyky5OCd1OPy26NVk5cFQ6NFnkKm0FTC1wHe3r9 n1IdG81/InYfZRsq1jNKrWausIHHyAxKAiiSFI0QWc1C2s4xi/ADhwJd5fXYQ/AC gPPusQo4p2FtLqqvmJAQyr9rEI5bqOz0P/QolUefiPXZcv82ndBcVI13AhyHDfVE gGJiudP5SK0QA38nFgcxIt8pMt8IsT7xlnFkY33aJg3e8PEJdNAIyGaOPKNhbeb6 gouSTeGvmu1IlcVvXD5f8kUWSWIp7z+EJltUwNnbb9kMq1x3J5MCznsfhoFATcPX n5JUKQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1rdn80q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:11 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFhBFi011629 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:11 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:43:07 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , "Raj Kumar Bhagat" , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 07/13] wifi: ath12k: add support for fixed QMI firmware memory Date: Mon, 17 Mar 2025 21:11:44 +0530 Message-ID: <20250317154150.1361364-8-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=Fe83xI+6 c=1 sm=1 tr=0 ts=67d8430f cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=szl3tP_wlCkQoreKIoEA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: muTXDSGCwrTTqA--0WD9SWylFgPhAOMJ X-Proofpoint-GUID: muTXDSGCwrTTqA--0WD9SWylFgPhAOMJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 priorityscore=1501 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" IPQ5332 firmware supports only fixed QMI firmware memory. Hence, add support to read reserved fixed memory region from device-tree and provide the reserved memory segments for firmware to use during QMI firmware memory request. Note that the ability to set the fixed memory will be introduced in a subsequent patch. Currently, the flag remains unset by default, ensuring that existing chipsets are unaffected. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1 Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/core.c | 25 ++++ drivers/net/wireless/ath/ath12k/core.h | 4 + drivers/net/wireless/ath/ath12k/hw.c | 4 + drivers/net/wireless/ath/ath12k/hw.h | 1 + drivers/net/wireless/ath/ath12k/qmi.c | 182 ++++++++++++++++++++++--- 5 files changed, 200 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/= ath/ath12k/core.c index 0b2dec081c6e..5bd852f9572b 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -612,6 +612,31 @@ u32 ath12k_core_get_max_num_tids(struct ath12k_base *a= b) return TARGET_NUM_TIDS(SINGLE); } =20 +struct reserved_mem *ath12k_core_get_reserved_mem(struct ath12k_base *ab, + int index) +{ + struct device *dev =3D ab->dev; + struct reserved_mem *rmem; + struct device_node *node; + + node =3D of_parse_phandle(dev->of_node, "memory-region", index); + if (!node) { + ath12k_dbg(ab, ATH12K_DBG_BOOT, + "failed to parse memory-region for index %d\n", index); + return NULL; + } + + rmem =3D of_reserved_mem_lookup(node); + of_node_put(node); + if (!rmem) { + ath12k_dbg(ab, ATH12K_DBG_BOOT, + "unable to get memory-region for index %d\n", index); + return NULL; + } + + return rmem; +} + static void ath12k_core_stop(struct ath12k_base *ab) { ath12k_core_stopped(ab); diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/= ath/ath12k/core.h index 85f0cdce774e..398f76a9d2e4 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include "qmi.h" @@ -239,6 +240,7 @@ enum ath12k_dev_flags { ATH12K_FLAG_EXT_IRQ_ENABLED, ATH12K_FLAG_QMI_FW_READY_COMPLETE, ATH12K_FLAG_FTM_SEGMENTED, + ATH12K_FLAG_FIXED_MEM_REGION, }; =20 struct ath12k_tx_conf { @@ -1220,6 +1222,8 @@ u32 ath12k_core_get_max_peers_per_radio(struct ath12k= _base *ab); u32 ath12k_core_get_max_num_tids(struct ath12k_base *ab); =20 void ath12k_core_hw_group_set_mlo_capable(struct ath12k_hw_group *ag); +struct reserved_mem *ath12k_core_get_reserved_mem(struct ath12k_base *ab, + int index); =20 static inline const char *ath12k_scan_state_str(enum ath12k_scan_state sta= te) { diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/at= h/ath12k/hw.c index 91aecca566a4..b4d5651973b7 100644 --- a/drivers/net/wireless/ath/ath12k/hw.c +++ b/drivers/net/wireless/ath/ath12k/hw.c @@ -1322,6 +1322,7 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { =20 .ce_ie_addr =3D NULL, .ce_remap =3D NULL, + .bdf_addr_offset =3D 0, }, { .name =3D "wcn7850 hw2.0", @@ -1406,6 +1407,7 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { =20 .ce_ie_addr =3D NULL, .ce_remap =3D NULL, + .bdf_addr_offset =3D 0, }, { .name =3D "qcn9274 hw2.0", @@ -1486,6 +1488,7 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { =20 .ce_ie_addr =3D NULL, .ce_remap =3D NULL, + .bdf_addr_offset =3D 0, }, { .name =3D "ipq5332 hw1.0", @@ -1561,6 +1564,7 @@ static const struct ath12k_hw_params ath12k_hw_params= [] =3D { =20 .ce_ie_addr =3D &ath12k_ce_ie_addr_ipq5332, .ce_remap =3D &ath12k_ce_remap_ipq5332, + .bdf_addr_offset =3D 0xC00000, }, }; =20 diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/at= h/ath12k/hw.h index 6a75af093f31..5123d2f51865 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -229,6 +229,7 @@ struct ath12k_hw_params { =20 const struct ce_ie_addr *ce_ie_addr; const struct ce_remap *ce_remap; + u32 bdf_addr_offset; }; =20 struct ath12k_hw_ops { diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/a= th/ath12k/qmi.c index 6978200fb79a..7df6c6eebed6 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -11,6 +11,8 @@ #include "debug.h" #include #include +#include +#include =20 #define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02 #define HOST_CSTATE_BIT 0x04 @@ -2378,7 +2380,8 @@ int ath12k_qmi_respond_fw_mem_request(struct ath12k_b= ase *ab) * failure to firmware and firmware then request multiple blocks of * small chunk size memory. */ - if (ab->qmi.target_mem_delayed) { + if (!test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags) && + ab->qmi.target_mem_delayed) { delayed =3D true; ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi delays mem_request %d\n", ab->qmi.mem_seg_count); @@ -2442,6 +2445,7 @@ static void ath12k_qmi_free_mlo_mem_chunk(struct ath1= 2k_base *ab, { struct ath12k_hw_group *ag =3D ab->ag; struct target_mem_chunk *mlo_chunk; + bool fixed_mem; =20 lockdep_assert_held(&ag->mutex); =20 @@ -2453,8 +2457,13 @@ static void ath12k_qmi_free_mlo_mem_chunk(struct ath= 12k_base *ab, return; } =20 + fixed_mem =3D test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags); mlo_chunk =3D &ag->mlo_mem.chunk[idx]; - if (mlo_chunk->v.addr) { + + if (fixed_mem && mlo_chunk->v.ioaddr) { + iounmap(mlo_chunk->v.ioaddr); + mlo_chunk->v.ioaddr =3D NULL; + } else if (mlo_chunk->v.addr) { dma_free_coherent(ab->dev, mlo_chunk->size, mlo_chunk->v.addr, @@ -2464,7 +2473,10 @@ static void ath12k_qmi_free_mlo_mem_chunk(struct ath= 12k_base *ab, =20 mlo_chunk->paddr =3D 0; mlo_chunk->size =3D 0; - chunk->v.addr =3D NULL; + if (fixed_mem) + chunk->v.ioaddr =3D NULL; + else + chunk->v.addr =3D NULL; chunk->paddr =3D 0; chunk->size =3D 0; } @@ -2475,19 +2487,24 @@ static void ath12k_qmi_free_target_mem_chunk(struct= ath12k_base *ab) int i, mlo_idx; =20 for (i =3D 0, mlo_idx =3D 0; i < ab->qmi.mem_seg_count; i++) { - if (!ab->qmi.target_mem[i].v.addr) - continue; - if (ab->qmi.target_mem[i].type =3D=3D MLO_GLOBAL_MEM_REGION_TYPE) { ath12k_qmi_free_mlo_mem_chunk(ab, &ab->qmi.target_mem[i], mlo_idx++); } else { - dma_free_coherent(ab->dev, - ab->qmi.target_mem[i].prev_size, - ab->qmi.target_mem[i].v.addr, - ab->qmi.target_mem[i].paddr); - ab->qmi.target_mem[i].v.addr =3D NULL; + if (test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags) && + ab->qmi.target_mem[i].v.ioaddr) { + iounmap(ab->qmi.target_mem[i].v.ioaddr); + ab->qmi.target_mem[i].v.ioaddr =3D NULL; + } else { + if (!ab->qmi.target_mem[i].v.addr) + continue; + dma_free_coherent(ab->dev, + ab->qmi.target_mem[i].prev_size, + ab->qmi.target_mem[i].v.addr, + ab->qmi.target_mem[i].paddr); + ab->qmi.target_mem[i].v.addr =3D NULL; + } } } =20 @@ -2640,6 +2657,130 @@ static int ath12k_qmi_alloc_target_mem_chunk(struct= ath12k_base *ab) return ret; } =20 +static int ath12k_qmi_assign_target_mem_chunk(struct ath12k_base *ab) +{ + struct reserved_mem *rmem; + size_t avail_rmem_size; + int i, idx, ret; + + for (i =3D 0, idx =3D 0; i < ab->qmi.mem_seg_count; i++) { + switch (ab->qmi.target_mem[i].type) { + case HOST_DDR_REGION_TYPE: + rmem =3D ath12k_core_get_reserved_mem(ab, 0); + if (!rmem) { + ret =3D -ENODEV; + goto out; + } + + avail_rmem_size =3D rmem->size; + if (avail_rmem_size < ab->qmi.target_mem[i].size) { + ath12k_dbg(ab, ATH12K_DBG_QMI, + "failed to assign mem type %u req size %u avail size %zu\n", + ab->qmi.target_mem[i].type, + ab->qmi.target_mem[i].size, + avail_rmem_size); + ret =3D -EINVAL; + goto out; + } + + ab->qmi.target_mem[idx].paddr =3D rmem->base; + ab->qmi.target_mem[idx].v.ioaddr =3D + ioremap(ab->qmi.target_mem[idx].paddr, + ab->qmi.target_mem[i].size); + if (!ab->qmi.target_mem[idx].v.ioaddr) { + ret =3D -EIO; + goto out; + } + ab->qmi.target_mem[idx].size =3D ab->qmi.target_mem[i].size; + ab->qmi.target_mem[idx].type =3D ab->qmi.target_mem[i].type; + idx++; + break; + case BDF_MEM_REGION_TYPE: + rmem =3D ath12k_core_get_reserved_mem(ab, 0); + if (!rmem) { + ret =3D -ENODEV; + goto out; + } + + avail_rmem_size =3D rmem->size - ab->hw_params->bdf_addr_offset; + if (avail_rmem_size < ab->qmi.target_mem[i].size) { + ath12k_dbg(ab, ATH12K_DBG_QMI, + "failed to assign mem type %u req size %u avail size %zu\n", + ab->qmi.target_mem[i].type, + ab->qmi.target_mem[i].size, + avail_rmem_size); + ret =3D -EINVAL; + goto out; + } + ab->qmi.target_mem[idx].paddr =3D + rmem->base + ab->hw_params->bdf_addr_offset; + ab->qmi.target_mem[idx].v.ioaddr =3D + ioremap(ab->qmi.target_mem[idx].paddr, + ab->qmi.target_mem[i].size); + if (!ab->qmi.target_mem[idx].v.ioaddr) { + ret =3D -EIO; + goto out; + } + ab->qmi.target_mem[idx].size =3D ab->qmi.target_mem[i].size; + ab->qmi.target_mem[idx].type =3D ab->qmi.target_mem[i].type; + idx++; + break; + case CALDB_MEM_REGION_TYPE: + /* Cold boot calibration is not enabled in Ath12k. Hence, + * assign paddr =3D 0. + * Once cold boot calibration is enabled add support to + * assign reserved memory from DT. + */ + ab->qmi.target_mem[idx].paddr =3D 0; + ab->qmi.target_mem[idx].v.ioaddr =3D NULL; + ab->qmi.target_mem[idx].size =3D ab->qmi.target_mem[i].size; + ab->qmi.target_mem[idx].type =3D ab->qmi.target_mem[i].type; + idx++; + break; + case M3_DUMP_REGION_TYPE: + rmem =3D ath12k_core_get_reserved_mem(ab, 1); + if (!rmem) { + ret =3D -EINVAL; + goto out; + } + + avail_rmem_size =3D rmem->size; + if (avail_rmem_size < ab->qmi.target_mem[i].size) { + ath12k_dbg(ab, ATH12K_DBG_QMI, + "failed to assign mem type %u req size %u avail size %zu\n", + ab->qmi.target_mem[i].type, + ab->qmi.target_mem[i].size, + avail_rmem_size); + ret =3D -EINVAL; + goto out; + } + + ab->qmi.target_mem[idx].paddr =3D rmem->base; + ab->qmi.target_mem[idx].v.ioaddr =3D + ioremap(ab->qmi.target_mem[idx].paddr, + ab->qmi.target_mem[i].size); + if (!ab->qmi.target_mem[idx].v.ioaddr) { + ret =3D -EIO; + goto out; + } + ab->qmi.target_mem[idx].size =3D ab->qmi.target_mem[i].size; + ab->qmi.target_mem[idx].type =3D ab->qmi.target_mem[i].type; + idx++; + break; + default: + ath12k_warn(ab, "qmi ignore invalid mem req type %u\n", + ab->qmi.target_mem[i].type); + break; + } + } + ab->qmi.mem_seg_count =3D idx; + + return 0; +out: + ath12k_qmi_free_target_mem_chunk(ab); + return ret; +} + /* clang stack usage explodes if this is inlined */ static noinline_for_stack int ath12k_qmi_request_target_cap(struct ath12k_base *ab) @@ -3483,11 +3624,20 @@ static void ath12k_qmi_msg_mem_request_cb(struct qm= i_handle *qmi_hdl, msg->mem_seg[i].type, msg->mem_seg[i].size); } =20 - ret =3D ath12k_qmi_alloc_target_mem_chunk(ab); - if (ret) { - ath12k_warn(ab, "qmi failed to alloc target memory: %d\n", - ret); - return; + if (test_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags)) { + ret =3D ath12k_qmi_assign_target_mem_chunk(ab); + if (ret) { + ath12k_warn(ab, "failed to assign qmi target memory: %d\n", + ret); + return; + } + } else { + ret =3D ath12k_qmi_alloc_target_mem_chunk(ab); + if (ret) { + ath12k_warn(ab, "qmi failed to alloc target memory: %d\n", + ret); + return; + } } =20 ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_REQUEST_MEM, NULL); --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F18E24EA86; Mon, 17 Mar 2025 15:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226207; cv=none; b=Uy2i7ul2ceT9nWOdUGLJq5JUH8JZUd3ppFnuceN4VTaFAPi1zop7Zlf+CrU7+Sr8Lv+Gwc5N3XA8Bo5ul1Y0R6QbfBTFBcZ0fLc7rfJPwBNUE14hpCDKQ66z0WjEdCIWwLEJtJeruEzgkH1enIyllZSjngLiRZseT6CbS+OPt2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226207; c=relaxed/simple; bh=Zxi+IWLBrDhzXiulezq+FsAHDgcOtjchg8tPjWr1+Q4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qRYAGDt5XxWboyZMbK08V8Ocfry30OVQZAz561p6s+QHLcKeJEuKtuYk2rlsceVOo5N3Ztty3+nz+C1DTiI5P1c4QElFjGZtZIdwkPy+jStGODWQoAQL5CrbbcrBV23FhuiB150uPEoGWYPUZDWfhsFDcV9iiqcrLebYU1aUqHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=PtqCnP+A; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="PtqCnP+A" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52H9VicL020998; Mon, 17 Mar 2025 15:43:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= vvDvB/CvrS7WwHxKOS+mjnxwb+Z86LYS0KZ7Td4hr2w=; b=PtqCnP+AP3Fbk9LZ ZmOE7Iaxd1rCu4Ap5m7UQwF/RqKOXEO/UVkOS9xzpOOGh95FfCJncL4BI082Wu2a Ka1/I0EYMGGm9VB3i+RxOIWj0ecIlAVGGSzmwC1mSzK3wmnBAhWWg7Dt3S2M6NDH va1udNjhog8gd5oWKHSeq3LsyGRJJNzLLc/5/I1BtXwLsvkbtwd7UZBHvCvRaKb1 SqYrCpHs4u6CUnr9OhQBNIEqQAdkauVszNfMRRY/ZR6lXEYm2s6f6BvCp1RW4USP FLYTDVfB4QU05z2aUh/6X9f5TOgf1DcMTdwfoTD8HjlofTFXKrgHAYpu0wdJKbBw qB8Eww== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d2u9w6yp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:15 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFhFmL016096 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:15 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:43:11 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , Balamurugan S , P Praneesh , "Raj Kumar Bhagat" , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 08/13] wifi: ath12k: add AHB driver support for IPQ5332 Date: Mon, 17 Mar 2025 21:11:45 +0530 Message-ID: <20250317154150.1361364-9-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=JsfxrN4C c=1 sm=1 tr=0 ts=67d84313 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=piuMfSQ_hNHvUAxF-GQA:9 a=RVmHIydaz68A:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: VncQhpwMOI9BwzgM-FUP72Cl0GNWa9An X-Proofpoint-ORIG-GUID: VncQhpwMOI9BwzgM-FUP72Cl0GNWa9An X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 phishscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Balamurugan S Add Initial Ath12k AHB driver support for IPQ5332. IPQ5332 is AHB based IEEE802.11be 2 GHz 2x2 WiFi device. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1 Signed-off-by: Balamurugan S Co-developed-by: P Praneesh Signed-off-by: P Praneesh Co-developed-by: Raj Kumar Bhagat Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/ahb.c | 781 +++++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/ahb.h | 37 ++ drivers/net/wireless/ath/ath12k/core.h | 3 + drivers/net/wireless/ath/ath12k/hal.h | 1 + drivers/net/wireless/ath/ath12k/hw.h | 1 + 5 files changed, 823 insertions(+) create mode 100644 drivers/net/wireless/ath/ath12k/ahb.c create mode 100644 drivers/net/wireless/ath/ath12k/ahb.h diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/a= th/ath12k/ahb.c new file mode 100644 index 000000000000..597bc522ed01 --- /dev/null +++ b/drivers/net/wireless/ath/ath12k/ahb.c @@ -0,0 +1,781 @@ +// SPDX-License-Identifier: BSD-3-Clause-Clear +/* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights res= erved. + */ + +#include +#include +#include +#include +#include "ahb.h" +#include "debug.h" +#include "hif.h" + +static const struct of_device_id ath12k_ahb_of_match[] =3D { + { .compatible =3D "qcom,ipq5332-wifi", + .data =3D (void *)ATH12K_HW_IPQ5332_HW10, + }, + { } +}; + +MODULE_DEVICE_TABLE(of, ath12k_ahb_of_match); + +#define ATH12K_IRQ_CE0_OFFSET 4 + +static const char *irq_name[ATH12K_IRQ_NUM_MAX] =3D { + "misc-pulse1", + "misc-latch", + "sw-exception", + "watchdog", + "ce0", + "ce1", + "ce2", + "ce3", + "ce4", + "ce5", + "ce6", + "ce7", + "ce8", + "ce9", + "ce10", + "ce11", + "host2wbm-desc-feed", + "host2reo-re-injection", + "host2reo-command", + "host2rxdma-monitor-ring3", + "host2rxdma-monitor-ring2", + "host2rxdma-monitor-ring1", + "reo2ost-exception", + "wbm2host-rx-release", + "reo2host-status", + "reo2host-destination-ring4", + "reo2host-destination-ring3", + "reo2host-destination-ring2", + "reo2host-destination-ring1", + "rxdma2host-monitor-destination-mac3", + "rxdma2host-monitor-destination-mac2", + "rxdma2host-monitor-destination-mac1", + "ppdu-end-interrupts-mac3", + "ppdu-end-interrupts-mac2", + "ppdu-end-interrupts-mac1", + "rxdma2host-monitor-status-ring-mac3", + "rxdma2host-monitor-status-ring-mac2", + "rxdma2host-monitor-status-ring-mac1", + "host2rxdma-host-buf-ring-mac3", + "host2rxdma-host-buf-ring-mac2", + "host2rxdma-host-buf-ring-mac1", + "rxdma2host-destination-ring-mac3", + "rxdma2host-destination-ring-mac2", + "rxdma2host-destination-ring-mac1", + "host2tcl-input-ring4", + "host2tcl-input-ring3", + "host2tcl-input-ring2", + "host2tcl-input-ring1", + "wbm2host-tx-completions-ring4", + "wbm2host-tx-completions-ring3", + "wbm2host-tx-completions-ring2", + "wbm2host-tx-completions-ring1", + "tcl2host-status-ring", +}; + +enum ext_irq_num { + host2wbm_desc_feed =3D 16, + host2reo_re_injection, + host2reo_command, + host2rxdma_monitor_ring3, + host2rxdma_monitor_ring2, + host2rxdma_monitor_ring1, + reo2host_exception, + wbm2host_rx_release, + reo2host_status, + reo2host_destination_ring4, + reo2host_destination_ring3, + reo2host_destination_ring2, + reo2host_destination_ring1, + rxdma2host_monitor_destination_mac3, + rxdma2host_monitor_destination_mac2, + rxdma2host_monitor_destination_mac1, + ppdu_end_interrupts_mac3, + ppdu_end_interrupts_mac2, + ppdu_end_interrupts_mac1, + rxdma2host_monitor_status_ring_mac3, + rxdma2host_monitor_status_ring_mac2, + rxdma2host_monitor_status_ring_mac1, + host2rxdma_host_buf_ring_mac3, + host2rxdma_host_buf_ring_mac2, + host2rxdma_host_buf_ring_mac1, + rxdma2host_destination_ring_mac3, + rxdma2host_destination_ring_mac2, + rxdma2host_destination_ring_mac1, + host2tcl_input_ring4, + host2tcl_input_ring3, + host2tcl_input_ring2, + host2tcl_input_ring1, + wbm2host_tx_completions_ring4, + wbm2host_tx_completions_ring3, + wbm2host_tx_completions_ring2, + wbm2host_tx_completions_ring1, + tcl2host_status_ring, +}; + +static u32 ath12k_ahb_read32(struct ath12k_base *ab, u32 offset) +{ + if (ab->ce_remap && offset < HAL_SEQ_WCSS_CMEM_OFFSET) + return ioread32(ab->mem_ce + offset); + return ioread32(ab->mem + offset); +} + +static void ath12k_ahb_write32(struct ath12k_base *ab, u32 offset, + u32 value) +{ + if (ab->ce_remap && offset < HAL_SEQ_WCSS_CMEM_OFFSET) + iowrite32(value, ab->mem_ce + offset); + else + iowrite32(value, ab->mem + offset); +} + +static void ath12k_ahb_cancel_workqueue(struct ath12k_base *ab) +{ + int i; + + for (i =3D 0; i < ab->hw_params->ce_count; i++) { + struct ath12k_ce_pipe *ce_pipe =3D &ab->ce.ce_pipe[i]; + + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) + continue; + + cancel_work_sync(&ce_pipe->intr_wq); + } +} + +static void ath12k_ahb_ext_grp_disable(struct ath12k_ext_irq_grp *irq_grp) +{ + int i; + + for (i =3D 0; i < irq_grp->num_irq; i++) + disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); +} + +static void __ath12k_ahb_ext_irq_disable(struct ath12k_base *ab) +{ + int i; + + for (i =3D 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { + struct ath12k_ext_irq_grp *irq_grp =3D &ab->ext_irq_grp[i]; + + ath12k_ahb_ext_grp_disable(irq_grp); + if (irq_grp->napi_enabled) { + napi_synchronize(&irq_grp->napi); + napi_disable(&irq_grp->napi); + irq_grp->napi_enabled =3D false; + } + } +} + +static void ath12k_ahb_ext_grp_enable(struct ath12k_ext_irq_grp *irq_grp) +{ + int i; + + for (i =3D 0; i < irq_grp->num_irq; i++) + enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); +} + +static void ath12k_ahb_setbit32(struct ath12k_base *ab, u8 bit, u32 offset) +{ + u32 val; + + val =3D ath12k_ahb_read32(ab, offset); + ath12k_ahb_write32(ab, offset, val | BIT(bit)); +} + +static void ath12k_ahb_clearbit32(struct ath12k_base *ab, u8 bit, u32 offs= et) +{ + u32 val; + + val =3D ath12k_ahb_read32(ab, offset); + ath12k_ahb_write32(ab, offset, val & ~BIT(bit)); +} + +static void ath12k_ahb_ce_irq_enable(struct ath12k_base *ab, u16 ce_id) +{ + const struct ce_attr *ce_attr; + const struct ce_ie_addr *ce_ie_addr =3D ab->hw_params->ce_ie_addr; + u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr; + + ie1_reg_addr =3D ce_ie_addr->ie1_reg_addr; + ie2_reg_addr =3D ce_ie_addr->ie2_reg_addr; + ie3_reg_addr =3D ce_ie_addr->ie3_reg_addr; + + ce_attr =3D &ab->hw_params->host_ce_config[ce_id]; + if (ce_attr->src_nentries) + ath12k_ahb_setbit32(ab, ce_id, ie1_reg_addr); + + if (ce_attr->dest_nentries) { + ath12k_ahb_setbit32(ab, ce_id, ie2_reg_addr); + ath12k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, + ie3_reg_addr); + } +} + +static void ath12k_ahb_ce_irq_disable(struct ath12k_base *ab, u16 ce_id) +{ + const struct ce_attr *ce_attr; + const struct ce_ie_addr *ce_ie_addr =3D ab->hw_params->ce_ie_addr; + u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr; + + ie1_reg_addr =3D ce_ie_addr->ie1_reg_addr; + ie2_reg_addr =3D ce_ie_addr->ie2_reg_addr; + ie3_reg_addr =3D ce_ie_addr->ie3_reg_addr; + + ce_attr =3D &ab->hw_params->host_ce_config[ce_id]; + if (ce_attr->src_nentries) + ath12k_ahb_clearbit32(ab, ce_id, ie1_reg_addr); + + if (ce_attr->dest_nentries) { + ath12k_ahb_clearbit32(ab, ce_id, ie2_reg_addr); + ath12k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, + ie3_reg_addr); + } +} + +static void ath12k_ahb_sync_ce_irqs(struct ath12k_base *ab) +{ + int i; + int irq_idx; + + for (i =3D 0; i < ab->hw_params->ce_count; i++) { + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) + continue; + + irq_idx =3D ATH12K_IRQ_CE0_OFFSET + i; + synchronize_irq(ab->irq_num[irq_idx]); + } +} + +static void ath12k_ahb_sync_ext_irqs(struct ath12k_base *ab) +{ + int i, j; + int irq_idx; + + for (i =3D 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { + struct ath12k_ext_irq_grp *irq_grp =3D &ab->ext_irq_grp[i]; + + for (j =3D 0; j < irq_grp->num_irq; j++) { + irq_idx =3D irq_grp->irqs[j]; + synchronize_irq(ab->irq_num[irq_idx]); + } + } +} + +static void ath12k_ahb_ce_irqs_enable(struct ath12k_base *ab) +{ + int i; + + for (i =3D 0; i < ab->hw_params->ce_count; i++) { + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) + continue; + ath12k_ahb_ce_irq_enable(ab, i); + } +} + +static void ath12k_ahb_ce_irqs_disable(struct ath12k_base *ab) +{ + int i; + + for (i =3D 0; i < ab->hw_params->ce_count; i++) { + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) + continue; + ath12k_ahb_ce_irq_disable(ab, i); + } +} + +static int ath12k_ahb_start(struct ath12k_base *ab) +{ + ath12k_ahb_ce_irqs_enable(ab); + ath12k_ce_rx_post_buf(ab); + + return 0; +} + +static void ath12k_ahb_ext_irq_enable(struct ath12k_base *ab) +{ + struct ath12k_ext_irq_grp *irq_grp; + int i; + + for (i =3D 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { + irq_grp =3D &ab->ext_irq_grp[i]; + if (!irq_grp->napi_enabled) { + napi_enable(&irq_grp->napi); + irq_grp->napi_enabled =3D true; + } + ath12k_ahb_ext_grp_enable(irq_grp); + } +} + +static void ath12k_ahb_ext_irq_disable(struct ath12k_base *ab) +{ + __ath12k_ahb_ext_irq_disable(ab); + ath12k_ahb_sync_ext_irqs(ab); +} + +static void ath12k_ahb_stop(struct ath12k_base *ab) +{ + if (!test_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags)) + ath12k_ahb_ce_irqs_disable(ab); + ath12k_ahb_sync_ce_irqs(ab); + ath12k_ahb_cancel_workqueue(ab); + del_timer_sync(&ab->rx_replenish_retry); + ath12k_ce_cleanup_pipes(ab); +} + +static void ath12k_ahb_init_qmi_ce_config(struct ath12k_base *ab) +{ + struct ath12k_qmi_ce_cfg *cfg =3D &ab->qmi.ce_cfg; + + cfg->tgt_ce_len =3D ab->hw_params->target_ce_count; + cfg->tgt_ce =3D ab->hw_params->target_ce_config; + cfg->svc_to_ce_map_len =3D ab->hw_params->svc_to_ce_map_len; + cfg->svc_to_ce_map =3D ab->hw_params->svc_to_ce_map; + ab->qmi.service_ins_id =3D ab->hw_params->qmi_service_ins_id; +} + +static void ath12k_ahb_ce_workqueue(struct work_struct *work) +{ + struct ath12k_ce_pipe *ce_pipe =3D from_work(ce_pipe, work, intr_wq); + + ath12k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); + + ath12k_ahb_ce_irq_enable(ce_pipe->ab, ce_pipe->pipe_num); +} + +static irqreturn_t ath12k_ahb_ce_interrupt_handler(int irq, void *arg) +{ + struct ath12k_ce_pipe *ce_pipe =3D arg; + + /* last interrupt received for this CE */ + ce_pipe->timestamp =3D jiffies; + + ath12k_ahb_ce_irq_disable(ce_pipe->ab, ce_pipe->pipe_num); + + queue_work(system_bh_wq, &ce_pipe->intr_wq); + + return IRQ_HANDLED; +} + +static int ath12k_ahb_ext_grp_napi_poll(struct napi_struct *napi, int budg= et) +{ + struct ath12k_ext_irq_grp *irq_grp =3D container_of(napi, + struct ath12k_ext_irq_grp, + napi); + struct ath12k_base *ab =3D irq_grp->ab; + int work_done; + + work_done =3D ath12k_dp_service_srng(ab, irq_grp, budget); + if (work_done < budget) { + napi_complete_done(napi, work_done); + ath12k_ahb_ext_grp_enable(irq_grp); + } + + if (work_done > budget) + work_done =3D budget; + + return work_done; +} + +static irqreturn_t ath12k_ahb_ext_interrupt_handler(int irq, void *arg) +{ + struct ath12k_ext_irq_grp *irq_grp =3D arg; + + /* last interrupt received for this group */ + irq_grp->timestamp =3D jiffies; + + ath12k_ahb_ext_grp_disable(irq_grp); + + napi_schedule(&irq_grp->napi); + + return IRQ_HANDLED; +} + +static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab) +{ + const struct ath12k_hw_ring_mask *ring_mask; + struct ath12k_ext_irq_grp *irq_grp; + const struct hal_ops *hal_ops; + int i, j, irq, irq_idx, ret; + u32 num_irq; + + ring_mask =3D ab->hw_params->ring_mask; + hal_ops =3D ab->hw_params->hal_ops; + for (i =3D 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) { + irq_grp =3D &ab->ext_irq_grp[i]; + num_irq =3D 0; + + irq_grp->ab =3D ab; + irq_grp->grp_id =3D i; + + irq_grp->napi_ndev =3D alloc_netdev_dummy(0); + if (!irq_grp->napi_ndev) + return -ENOMEM; + + netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi, + ath12k_ahb_ext_grp_napi_poll); + + for (j =3D 0; j < ATH12K_EXT_IRQ_NUM_MAX; j++) { + /* For TX ring, ensure that the ring mask and the + * tcl_to_wbm_rbm_map point to the same ring number. + */ + if (ring_mask->tx[i] & + BIT(hal_ops->tcl_to_wbm_rbm_map[j].wbm_ring_num)) { + irq_grp->irqs[num_irq++] =3D + wbm2host_tx_completions_ring1 - j; + } + + if (ring_mask->rx[i] & BIT(j)) { + irq_grp->irqs[num_irq++] =3D + reo2host_destination_ring1 - j; + } + + if (ring_mask->rx_err[i] & BIT(j)) + irq_grp->irqs[num_irq++] =3D reo2host_exception; + + if (ring_mask->rx_wbm_rel[i] & BIT(j)) + irq_grp->irqs[num_irq++] =3D wbm2host_rx_release; + + if (ring_mask->reo_status[i] & BIT(j)) + irq_grp->irqs[num_irq++] =3D reo2host_status; + + if (ring_mask->rx_mon_dest[i] & BIT(j)) + irq_grp->irqs[num_irq++] =3D + rxdma2host_monitor_destination_mac1; + } + + irq_grp->num_irq =3D num_irq; + + for (j =3D 0; j < irq_grp->num_irq; j++) { + irq_idx =3D irq_grp->irqs[j]; + + irq =3D platform_get_irq_byname(ab->pdev, + irq_name[irq_idx]); + ab->irq_num[irq_idx] =3D irq; + irq_set_status_flags(irq, IRQ_NOAUTOEN | IRQ_DISABLE_UNLAZY); + ret =3D devm_request_irq(ab->dev, irq, + ath12k_ahb_ext_interrupt_handler, + IRQF_TRIGGER_RISING, + irq_name[irq_idx], irq_grp); + if (ret) + ath12k_warn(ab, "failed request_irq for %d\n", irq); + } + } + + return 0; +} + +static int ath12k_ahb_config_irq(struct ath12k_base *ab) +{ + int irq, irq_idx, i; + int ret; + + /* Configure CE irqs */ + for (i =3D 0; i < ab->hw_params->ce_count; i++) { + struct ath12k_ce_pipe *ce_pipe =3D &ab->ce.ce_pipe[i]; + + if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) + continue; + + irq_idx =3D ATH12K_IRQ_CE0_OFFSET + i; + + INIT_WORK(&ce_pipe->intr_wq, ath12k_ahb_ce_workqueue); + irq =3D platform_get_irq_byname(ab->pdev, irq_name[irq_idx]); + ret =3D devm_request_irq(ab->dev, irq, ath12k_ahb_ce_interrupt_handler, + IRQF_TRIGGER_RISING, irq_name[irq_idx], + ce_pipe); + if (ret) + return ret; + + ab->irq_num[irq_idx] =3D irq; + } + + /* Configure external interrupts */ + ret =3D ath12k_ahb_config_ext_irq(ab); + + return ret; +} + +static int ath12k_ahb_map_service_to_pipe(struct ath12k_base *ab, u16 serv= ice_id, + u8 *ul_pipe, u8 *dl_pipe) +{ + const struct service_to_pipe *entry; + bool ul_set =3D false, dl_set =3D false; + u32 pipedir; + int i; + + for (i =3D 0; i < ab->hw_params->svc_to_ce_map_len; i++) { + entry =3D &ab->hw_params->svc_to_ce_map[i]; + + if (__le32_to_cpu(entry->service_id) !=3D service_id) + continue; + + pipedir =3D __le32_to_cpu(entry->pipedir); + if (pipedir =3D=3D PIPEDIR_IN || pipedir =3D=3D PIPEDIR_INOUT) { + WARN_ON(dl_set); + *dl_pipe =3D __le32_to_cpu(entry->pipenum); + dl_set =3D true; + } + + if (pipedir =3D=3D PIPEDIR_OUT || pipedir =3D=3D PIPEDIR_INOUT) { + WARN_ON(ul_set); + *ul_pipe =3D __le32_to_cpu(entry->pipenum); + ul_set =3D true; + } + } + + if (WARN_ON(!ul_set || !dl_set)) + return -ENOENT; + + return 0; +} + +static const struct ath12k_hif_ops ath12k_ahb_hif_ops_ipq5332 =3D { + .start =3D ath12k_ahb_start, + .stop =3D ath12k_ahb_stop, + .read32 =3D ath12k_ahb_read32, + .write32 =3D ath12k_ahb_write32, + .irq_enable =3D ath12k_ahb_ext_irq_enable, + .irq_disable =3D ath12k_ahb_ext_irq_disable, + .map_service_to_pipe =3D ath12k_ahb_map_service_to_pipe, +}; + +static int ath12k_ahb_resource_init(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + struct platform_device *pdev =3D ab->pdev; + struct resource *mem_res; + int ret; + + ab->mem =3D devm_platform_get_and_ioremap_resource(pdev, 0, &mem_res); + if (IS_ERR(ab->mem)) { + ret =3D dev_err_probe(&pdev->dev, PTR_ERR(ab->mem), "ioremap error\n"); + goto out; + } + + ab->mem_len =3D resource_size(mem_res); + + if (ab->hw_params->ce_remap) { + const struct ce_remap *ce_remap =3D ab->hw_params->ce_remap; + /* CE register space is moved out of WCSS and the space is not + * contiguous, hence remapping the CE registers to a new space + * for accessing them. + */ + ab->mem_ce =3D ioremap(ce_remap->base, ce_remap->size); + if (IS_ERR(ab->mem_ce)) { + dev_err(&pdev->dev, "ce ioremap error\n"); + ret =3D -ENOMEM; + goto err_mem_unmap; + } + ab->ce_remap =3D true; + ab->ce_remap_base_addr =3D HAL_IPQ5332_CE_WFSS_REG_BASE; + } + + ab_ahb->xo_clk =3D devm_clk_get(ab->dev, "xo"); + if (IS_ERR(ab_ahb->xo_clk)) { + ret =3D dev_err_probe(&pdev->dev, PTR_ERR(ab_ahb->xo_clk), + "failed to get xo clock\n"); + goto err_mem_ce_unmap; + } + + ret =3D clk_prepare_enable(ab_ahb->xo_clk); + if (ret) { + dev_err(&pdev->dev, "failed to enable gcc_xo_clk: %d\n", ret); + goto err_clock_deinit; + } + + return 0; + +err_clock_deinit: + devm_clk_put(ab->dev, ab_ahb->xo_clk); + +err_mem_ce_unmap: + ab_ahb->xo_clk =3D NULL; + if (ab->hw_params->ce_remap) + iounmap(ab->mem_ce); + +err_mem_unmap: + ab->mem_ce =3D NULL; + devm_iounmap(ab->dev, ab->mem); + +out: + ab->mem =3D NULL; + return ret; +} + +static void ath12k_ahb_resource_deinit(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + + if (ab->mem) + devm_iounmap(ab->dev, ab->mem); + + if (ab->mem_ce) + iounmap(ab->mem_ce); + + ab->mem =3D NULL; + ab->mem_ce =3D NULL; + + clk_disable_unprepare(ab_ahb->xo_clk); + devm_clk_put(ab->dev, ab_ahb->xo_clk); + ab_ahb->xo_clk =3D NULL; +} + +static int ath12k_ahb_probe(struct platform_device *pdev) +{ + struct ath12k_base *ab; + const struct ath12k_hif_ops *hif_ops; + enum ath12k_hw_rev hw_rev; + u32 addr; + int ret; + + ret =3D dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "Failed to set 32-bit coherent dma\n"); + return ret; + } + + ab =3D ath12k_core_alloc(&pdev->dev, sizeof(struct ath12k_ahb), + ATH12K_BUS_AHB); + if (!ab) + return -ENOMEM; + + hw_rev =3D (enum ath12k_hw_rev)of_device_get_match_data(&pdev->dev); + switch (hw_rev) { + case ATH12K_HW_IPQ5332_HW10: + hif_ops =3D &ath12k_ahb_hif_ops_ipq5332; + break; + default: + ret =3D -EOPNOTSUPP; + goto err_core_free; + } + + ab->hif.ops =3D hif_ops; + ab->pdev =3D pdev; + ab->hw_rev =3D hw_rev; + platform_set_drvdata(pdev, ab); + + /* Set fixed_mem_region to true for platforms that support fixed memory + * reservation from DT. If memory is reserved from DT for FW, ath12k driv= er + * need not to allocate memory. + */ + if (!of_property_read_u32(ab->dev->of_node, "memory-region", &addr)) + set_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags); + + ret =3D ath12k_core_pre_init(ab); + if (ret) + goto err_core_free; + + ret =3D ath12k_ahb_resource_init(ab); + if (ret) + goto err_core_free; + + ret =3D ath12k_hal_srng_init(ab); + if (ret) + goto err_resource_deinit; + + ret =3D ath12k_ce_alloc_pipes(ab); + if (ret) { + ath12k_err(ab, "failed to allocate ce pipes: %d\n", ret); + goto err_hal_srng_deinit; + } + + ath12k_ahb_init_qmi_ce_config(ab); + + ret =3D ath12k_ahb_config_irq(ab); + if (ret) { + ath12k_err(ab, "failed to configure irq: %d\n", ret); + goto err_ce_free; + } + + ret =3D ath12k_core_init(ab); + if (ret) { + ath12k_err(ab, "failed to init core: %d\n", ret); + goto err_ce_free; + } + + return 0; + +err_ce_free: + ath12k_ce_free_pipes(ab); + +err_hal_srng_deinit: + ath12k_hal_srng_deinit(ab); + +err_resource_deinit: + ath12k_ahb_resource_deinit(ab); + +err_core_free: + ath12k_core_free(ab); + platform_set_drvdata(pdev, NULL); + + return ret; +} + +static void ath12k_ahb_remove_prepare(struct ath12k_base *ab) +{ + unsigned long left; + + if (test_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags)) { + left =3D wait_for_completion_timeout(&ab->driver_recovery, + ATH12K_AHB_RECOVERY_TIMEOUT); + if (!left) + ath12k_warn(ab, "failed to receive recovery response completion\n"); + } + + set_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags); + cancel_work_sync(&ab->restart_work); + cancel_work_sync(&ab->qmi.event_work); +} + +static void ath12k_ahb_free_resources(struct ath12k_base *ab) +{ + struct platform_device *pdev =3D ab->pdev; + + ath12k_hal_srng_deinit(ab); + ath12k_ce_free_pipes(ab); + ath12k_ahb_resource_deinit(ab); + ath12k_core_free(ab); + platform_set_drvdata(pdev, NULL); +} + +static void ath12k_ahb_remove(struct platform_device *pdev) +{ + struct ath12k_base *ab =3D platform_get_drvdata(pdev); + + if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath12k_qmi_deinit_service(ab); + goto qmi_fail; + } + + ath12k_ahb_remove_prepare(ab); + ath12k_core_deinit(ab); + +qmi_fail: + ath12k_ahb_free_resources(ab); +} + +static struct platform_driver ath12k_ahb_driver =3D { + .driver =3D { + .name =3D "ath12k_ahb", + .of_match_table =3D ath12k_ahb_of_match, + }, + .probe =3D ath12k_ahb_probe, + .remove =3D ath12k_ahb_remove, +}; + +int ath12k_ahb_init(void) +{ + return platform_driver_register(&ath12k_ahb_driver); +} + +void ath12k_ahb_exit(void) +{ + platform_driver_unregister(&ath12k_ahb_driver); +} diff --git a/drivers/net/wireless/ath/ath12k/ahb.h b/drivers/net/wireless/a= th/ath12k/ahb.h new file mode 100644 index 000000000000..64f0696588c0 --- /dev/null +++ b/drivers/net/wireless/ath/ath12k/ahb.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause-Clear */ +/* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2025, Qualcomm Innovation Center, Inc. All rights re= served. + */ +#ifndef ATH12K_AHB_H +#define ATH12K_AHB_H + +#include +#include "core.h" + +#define ATH12K_AHB_RECOVERY_TIMEOUT (3 * HZ) + +#define ATH12K_AHB_SMP2P_SMEM_MSG GENMASK(15, 0) +#define ATH12K_AHB_SMP2P_SMEM_SEQ_NO GENMASK(31, 16) +#define ATH12K_AHB_SMP2P_SMEM_VALUE_MASK 0xFFFFFFFF +#define ATH12K_PCI_CE_WAKE_IRQ 2 +#define ATH12K_PCI_IRQ_CE0_OFFSET 3 + +enum ath12k_ahb_smp2p_msg_id { + ATH12K_AHB_POWER_SAVE_ENTER =3D 1, + ATH12K_AHB_POWER_SAVE_EXIT, +}; + +struct ath12k_base; + +struct ath12k_ahb { + struct rproc *tgt_rproc; + struct clk *xo_clk; +}; + +static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct ath12k_base *ab) +{ + return (struct ath12k_ahb *)ab->drv_priv; +} + +#endif diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/= ath/ath12k/core.h index 398f76a9d2e4..28fa0a9f7ed4 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -162,6 +162,7 @@ enum ath12k_firmware_mode { =20 #define ATH12K_IRQ_NUM_MAX 57 #define ATH12K_EXT_IRQ_NUM_MAX 16 +#define ATH12K_MAX_TCL_RING_NUM 3 =20 struct ath12k_ext_irq_grp { struct ath12k_base *ab; @@ -1293,6 +1294,8 @@ static inline const char *ath12k_bus_str(enum ath12k_= bus bus) switch (bus) { case ATH12K_BUS_PCI: return "pci"; + case ATH12K_BUS_AHB: + return "ahb"; } =20 return "unknown"; diff --git a/drivers/net/wireless/ath/ath12k/hal.h b/drivers/net/wireless/a= th/ath12k/hal.h index 47ff0b1bfdf4..9f12ed84a653 100644 --- a/drivers/net/wireless/ath/ath12k/hal.h +++ b/drivers/net/wireless/ath/ath12k/hal.h @@ -42,6 +42,7 @@ struct ath12k_base; #define HAL_SHADOW_REG(x) (HAL_SHADOW_BASE_ADDR + (4 * (x))) =20 /* WCSS Relative address */ +#define HAL_SEQ_WCSS_CMEM_OFFSET 0x00100000 #define HAL_SEQ_WCSS_UMAC_OFFSET 0x00a00000 #define HAL_SEQ_WCSS_UMAC_REO_REG 0x00a38000 #define HAL_SEQ_WCSS_UMAC_TCL_REG 0x00a44000 diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/at= h/ath12k/hw.h index 5123d2f51865..a4332588b117 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -121,6 +121,7 @@ enum ath12k_hw_rate_ofdm { =20 enum ath12k_bus { ATH12K_BUS_PCI, + ATH12K_BUS_AHB, }; =20 #define ATH12K_EXT_IRQ_GRP_NUM_MAX 11 --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C74C24EA9F; Mon, 17 Mar 2025 15:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226213; cv=none; b=AYBpwN37bj4pxT9MFCzSLXXjn+PHnydr5FADoRV9kaCcuNCfI0h5wNm68FzuxKejrajM5p0Vjpt1rEYGuH8Mw0WR21VDA980C8nOlyPXdSK58+EZqppcOKYfeXAKDXeChEYIHFogF8M+OTfE4hp6KDA3JWgm9Eml/8vS7jq/Uqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226213; c=relaxed/simple; bh=hwp9/O2Fbuwjc82T6hQ804eE7giobo//smjQfjbiC9Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZeZyhzdMBBGwohzIq/kSJOkgtqvdrI8NlRsZTzlr+shslvpRdlph4EWXEDvO9z7AnezMDkhXCDvGt6Vg39pvkpkm92MAa9PHprYSK6WpyBB5vjIuM0k5YkVKlhDNwW44Ui244FlhMmY6NXELgTELGbEzDnTOwK/yMxS7exGbp2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=eO2xwkT9; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="eO2xwkT9" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52H9DEgh019140; Mon, 17 Mar 2025 15:43:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ksxotXP8NMy4CZ2fJb8N5TJK/PuT6qeKP4ZGGBd7JRQ=; b=eO2xwkT95YYav65O bf9Fo9ZtMfg2XLFssk/Whv3quWce/Myv/+hZ3lmXkItazNPk+cW11jqle+Q9LRDH xHxvGx72kcbno64AAgiHy4kGJS6962r0znWx9d6JveMUWBrDqzShmKkxjU0IFVTB VH5z33BwF0DlJbyVlg2KNPJBHQxLJFn/32FvgJlaopDLN2X437qs/2zP9xNC/h5E kOQ/NyfuGdWVyqZ3lIHctbcTg7SZAhetJlkn6InU74YWeiBYrK7VUvbbReOGcKcR HO6bQc2ySb73TB2tPOZ29rQKnGxF3avH7vJ8PvTxZAL9V7ALY3paORWrlDRCuEYC cWo3dA== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d2u9w6yw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:19 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFhIrs029875 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:18 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:43:15 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , "Sowmiya Sree Elavalagan" , Raj Kumar Bhagat , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 09/13] wifi: ath12k: Power up root PD Date: Mon, 17 Mar 2025 21:11:46 +0530 Message-ID: <20250317154150.1361364-10-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=JsfxrN4C c=1 sm=1 tr=0 ts=67d84317 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=ts5QanDNsPI7iOQJwMMA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: gyC3rkpLeOhY0cfT_m15I88ieY-hJVyK X-Proofpoint-ORIG-GUID: gyC3rkpLeOhY0cfT_m15I88ieY-hJVyK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 phishscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Sowmiya Sree Elavalagan Q6 processor acts as rootPD, other hardware like IPQ5332 which are attached to Q6 act as userPDs. WCSS driver handles loading and booting of rootPD, while the ath12k driver boots the userPD. Get the rproc handle from the DTS entry and boot the rootPD if it is not already powered on. Register to the rproc notifier to monitor the rproc state, this allows ath12k driver to know power up/down sequence of the rootPD. Power up the rootPD and wait for a power-up notification from the notifier callback before powering up the userPDs. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sowmiya Sree Elavalagan Co-developed-by: Raj Kumar Bhagat Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/ahb.c | 146 +++++++++++++++++++++++++- drivers/net/wireless/ath/ath12k/ahb.h | 7 ++ 2 files changed, 151 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/a= th/ath12k/ahb.c index 597bc522ed01..8f7a00e9602f 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.c +++ b/drivers/net/wireless/ath/ath12k/ahb.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "ahb.h" #include "debug.h" #include "hif.h" @@ -546,6 +547,136 @@ static const struct ath12k_hif_ops ath12k_ahb_hif_ops= _ipq5332 =3D { .map_service_to_pipe =3D ath12k_ahb_map_service_to_pipe, }; =20 +static int ath12k_ahb_root_pd_state_notifier(struct notifier_block *nb, + const unsigned long event, void *data) +{ + struct ath12k_ahb *ab_ahb =3D container_of(nb, struct ath12k_ahb, root_pd= _nb); + struct ath12k_base *ab =3D ab_ahb->ab; + + if (event =3D=3D ATH12K_RPROC_AFTER_POWERUP) { + ath12k_dbg(ab, ATH12K_DBG_AHB, "Root PD is UP\n"); + complete(&ab_ahb->rootpd_ready); + } + + return 0; +} + +static int ath12k_ahb_register_rproc_notifier(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + + ab_ahb->root_pd_nb.notifier_call =3D ath12k_ahb_root_pd_state_notifier; + init_completion(&ab_ahb->rootpd_ready); + + ab_ahb->root_pd_notifier =3D qcom_register_ssr_notifier(ab_ahb->tgt_rproc= ->name, + &ab_ahb->root_pd_nb); + if (IS_ERR(ab_ahb->root_pd_notifier)) + return PTR_ERR(ab_ahb->root_pd_notifier); + + return 0; +} + +static void ath12k_ahb_unregister_rproc_notifier(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + + if (!ab_ahb->root_pd_notifier) { + ath12k_err(ab, "Rproc notifier not registered\n"); + return; + } + + qcom_unregister_ssr_notifier(ab_ahb->root_pd_notifier, + &ab_ahb->root_pd_nb); + ab_ahb->root_pd_notifier =3D NULL; +} + +static int ath12k_ahb_get_rproc(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + struct device *dev =3D ab->dev; + struct device_node *np; + struct rproc *prproc; + + np =3D of_parse_phandle(dev->of_node, "qcom,rproc", 0); + if (!np) { + ath12k_err(ab, "failed to get q6_rproc handle\n"); + return -ENOENT; + } + + prproc =3D rproc_get_by_phandle(np->phandle); + of_node_put(np); + if (!prproc) + return dev_err_probe(&ab->pdev->dev, -EPROBE_DEFER, + "failed to get rproc\n"); + + ab_ahb->tgt_rproc =3D prproc; + + return 0; +} + +static int ath12k_ahb_boot_root_pd(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + unsigned long time_left; + int ret; + + ret =3D rproc_boot(ab_ahb->tgt_rproc); + if (ret < 0) { + ath12k_err(ab, "RootPD boot failed\n"); + return ret; + } + + time_left =3D wait_for_completion_timeout(&ab_ahb->rootpd_ready, + ATH12K_ROOTPD_READY_TIMEOUT); + if (!time_left) { + ath12k_err(ab, "RootPD ready wait timed out\n"); + return -ETIMEDOUT; + } + + return 0; +} + +static int ath12k_ahb_configure_rproc(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + int ret; + + ret =3D ath12k_ahb_get_rproc(ab); + if (ret < 0) + return ret; + + ret =3D ath12k_ahb_register_rproc_notifier(ab); + if (ret < 0) { + ret =3D dev_err_probe(&ab->pdev->dev, ret, + "failed to register rproc notifier\n"); + goto err_put_rproc; + } + + if (ab_ahb->tgt_rproc->state !=3D RPROC_RUNNING) { + ret =3D ath12k_ahb_boot_root_pd(ab); + if (ret < 0) { + ath12k_err(ab, "failed to boot the remote processor Q6\n"); + goto err_unreg_notifier; + } + } + return 0; + +err_unreg_notifier: + ath12k_ahb_unregister_rproc_notifier(ab); + +err_put_rproc: + rproc_put(ab_ahb->tgt_rproc); + return ret; +} + +static void ath12k_ahb_deconfigure_rproc(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + + ath12k_ahb_unregister_rproc_notifier(ab); + rproc_put(ab_ahb->tgt_rproc); +} + static int ath12k_ahb_resource_init(struct ath12k_base *ab) { struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); @@ -631,6 +762,7 @@ static int ath12k_ahb_probe(struct platform_device *pde= v) { struct ath12k_base *ab; const struct ath12k_hif_ops *hif_ops; + struct ath12k_ahb *ab_ahb; enum ath12k_hw_rev hw_rev; u32 addr; int ret; @@ -660,6 +792,8 @@ static int ath12k_ahb_probe(struct platform_device *pde= v) ab->pdev =3D pdev; ab->hw_rev =3D hw_rev; platform_set_drvdata(pdev, ab); + ab_ahb =3D ath12k_ab_to_ahb(ab); + ab_ahb->ab =3D ab; =20 /* Set fixed_mem_region to true for platforms that support fixed memory * reservation from DT. If memory is reserved from DT for FW, ath12k driv= er @@ -688,20 +822,27 @@ static int ath12k_ahb_probe(struct platform_device *p= dev) =20 ath12k_ahb_init_qmi_ce_config(ab); =20 + ret =3D ath12k_ahb_configure_rproc(ab); + if (ret) + goto err_ce_free; + ret =3D ath12k_ahb_config_irq(ab); if (ret) { ath12k_err(ab, "failed to configure irq: %d\n", ret); - goto err_ce_free; + goto err_rproc_deconfigure; } =20 ret =3D ath12k_core_init(ab); if (ret) { ath12k_err(ab, "failed to init core: %d\n", ret); - goto err_ce_free; + goto err_rproc_deconfigure; } =20 return 0; =20 +err_rproc_deconfigure: + ath12k_ahb_deconfigure_rproc(ab); + err_ce_free: ath12k_ce_free_pipes(ab); =20 @@ -741,6 +882,7 @@ static void ath12k_ahb_free_resources(struct ath12k_bas= e *ab) ath12k_hal_srng_deinit(ab); ath12k_ce_free_pipes(ab); ath12k_ahb_resource_deinit(ab); + ath12k_ahb_deconfigure_rproc(ab); ath12k_core_free(ab); platform_set_drvdata(pdev, NULL); } diff --git a/drivers/net/wireless/ath/ath12k/ahb.h b/drivers/net/wireless/a= th/ath12k/ahb.h index 64f0696588c0..1105473917ce 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.h +++ b/drivers/net/wireless/ath/ath12k/ahb.h @@ -7,6 +7,7 @@ #define ATH12K_AHB_H =20 #include +#include #include "core.h" =20 #define ATH12K_AHB_RECOVERY_TIMEOUT (3 * HZ) @@ -16,6 +17,8 @@ #define ATH12K_AHB_SMP2P_SMEM_VALUE_MASK 0xFFFFFFFF #define ATH12K_PCI_CE_WAKE_IRQ 2 #define ATH12K_PCI_IRQ_CE0_OFFSET 3 +#define ATH12K_ROOTPD_READY_TIMEOUT (5 * HZ) +#define ATH12K_RPROC_AFTER_POWERUP QCOM_SSR_AFTER_POWERUP =20 enum ath12k_ahb_smp2p_msg_id { ATH12K_AHB_POWER_SAVE_ENTER =3D 1, @@ -25,8 +28,12 @@ enum ath12k_ahb_smp2p_msg_id { struct ath12k_base; =20 struct ath12k_ahb { + struct ath12k_base *ab; struct rproc *tgt_rproc; struct clk *xo_clk; + struct completion rootpd_ready; + struct notifier_block root_pd_nb; + void *root_pd_notifier; }; =20 static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct ath12k_base *ab) --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D579B248870; Mon, 17 Mar 2025 15:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226228; cv=none; b=jFzMXSj7dl8riXUWXQ9Mgv+zGi039PzX3YT3QDGyEmakOvZU1KeSRLFNDuTvqVVY3uqw30gv1Yd/9Im68VFHKBl1iazXaj0WKS3+uIZzvYPx/dvcpg+kTd9lZ65UZzeTs7h6lDV57nJb5Yg1gst2AuO/7EhBlB06EKKuKxJPI3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226228; c=relaxed/simple; bh=MpM7B4VEuguCgZ+mH3k6R2uhTi93Rx3HOkk4jwIVZmc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OTaEv0u/o9c9EmZydL/B70PUwK7T95iwO3NK0e1dMOuZNTmBH3IFcyKQfFKjhxqn/h+SMlJUEp6cs81zuUWd66JiYMBh+e35eVYAbgImaDJLCgVFC4NNKSCWWZygxqR9ZLjRpxXs+XCjh8LWqxo01GVnVki+9/aT0VZIgJl2YEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=GXFVDYOY; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GXFVDYOY" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HAC9p8000755; Mon, 17 Mar 2025 15:43:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ztjSg7idj2pQKxvx6vrc+WeOuuy7j/s4ig6YtaF6Ly8=; b=GXFVDYOYnNppU35F q8FLHDj34TI5srGdMfv6Y0aPmBJGQk04iFWz5H1rMQSSxtGOKJll9dZV2TpgUPAe +R6sc1DDM61iz0Zu0Bjwxw2rQ8OaH7uiu22PVWWJxA+JCoZ3UMUY0MZuAq45o0co +/fRSufK61G2Z3FX2C6NX0vg7bwZc6S6XtYB8n48umT6MPMRNyzLCYJ5V3Y+lQU1 cHbiZfoEjow+kpLMlHCo40c9XpsZ90cdEBaD0NtS50ZH50vNSX+TsGORScoxlx65 1rsf35WJTp0cJxq7zi6PoLAFhAaWhsTCPGuCz2a1hwxK5/mEVLJO9mfhjZU6Vmcd zw3a2Q== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1r157us-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:23 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFhMdh029940 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:22 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:43:18 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , "Sowmiya Sree Elavalagan" , Raj Kumar Bhagat , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 10/13] wifi: ath12k: Register various userPD interrupts and save SMEM entries Date: Mon, 17 Mar 2025 21:11:47 +0530 Message-ID: <20250317154150.1361364-11-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=LuaSymdc c=1 sm=1 tr=0 ts=67d8431b cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=M8MUCSGaitjyiz5FeOUA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: fzxYMz622gypbBb5TtJeUI4-o2VwT-jJ X-Proofpoint-ORIG-GUID: fzxYMz622gypbBb5TtJeUI4-o2VwT-jJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 phishscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Sowmiya Sree Elavalagan Q6 and ath12k driver communicates using SMEM and IRQs. Spawn interrupt is triggered once the userPD thread is spawned. Ready interrupts denotes userPD is completely powered up and ready. Stop-ack is to acknowledge the ath12k driver that userPD is stopped. Ath12k driver needs to set spawn bit in SMEM to instruct Q6 to spawn a userPD. Similarly stop bit is set when userPD needs to be stopped. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sowmiya Sree Elavalagan Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/ahb.c | 79 ++++++++++++++++++++++++++- drivers/net/wireless/ath/ath12k/ahb.h | 16 ++++++ drivers/net/wireless/ath/ath12k/hw.h | 1 + 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/a= th/ath12k/ahb.c index 8f7a00e9602f..291ae8177cdd 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.c +++ b/drivers/net/wireless/ath/ath12k/ahb.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "ahb.h" #include "debug.h" #include "hif.h" @@ -23,6 +24,11 @@ static const struct of_device_id ath12k_ahb_of_match[] = =3D { MODULE_DEVICE_TABLE(of, ath12k_ahb_of_match); =20 #define ATH12K_IRQ_CE0_OFFSET 4 +#define ATH12K_MAX_UPDS 1 +#define ATH12K_UPD_IRQ_WRD_LEN 18 +static const char ath12k_userpd_irq[][9] =3D {"spawn", + "ready", + "stop-ack"}; =20 static const char *irq_name[ATH12K_IRQ_NUM_MAX] =3D { "misc-pulse1", @@ -547,6 +553,72 @@ static const struct ath12k_hif_ops ath12k_ahb_hif_ops_= ipq5332 =3D { .map_service_to_pipe =3D ath12k_ahb_map_service_to_pipe, }; =20 +static irqreturn_t ath12k_userpd_irq_handler(int irq, void *data) +{ + struct ath12k_base *ab =3D data; + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + + if (irq =3D=3D ab_ahb->userpd_irq_num[ATH12K_USERPD_SPAWN_IRQ]) { + complete(&ab_ahb->userpd_spawned); + } else if (irq =3D=3D ab_ahb->userpd_irq_num[ATH12K_USERPD_READY_IRQ]) { + complete(&ab_ahb->userpd_ready); + } else if (irq =3D=3D ab_ahb->userpd_irq_num[ATH12K_USERPD_STOP_ACK_IRQ])= { + complete(&ab_ahb->userpd_stopped); + } else { + ath12k_err(ab, "Invalid userpd interrupt\n"); + return IRQ_NONE; + } + + return IRQ_HANDLED; +} + +static int ath12k_ahb_config_rproc_irq(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + int i, ret; + char *upd_irq_name; + + for (i =3D 0; i < ATH12K_USERPD_MAX_IRQ; i++) { + ab_ahb->userpd_irq_num[i] =3D platform_get_irq_byname(ab->pdev, + ath12k_userpd_irq[i]); + if (ab_ahb->userpd_irq_num[i] < 0) + return ab_ahb->userpd_irq_num[i]; + + upd_irq_name =3D devm_kzalloc(&ab->pdev->dev, ATH12K_UPD_IRQ_WRD_LEN, + GFP_KERNEL); + if (!upd_irq_name) + return -ENOMEM; + + scnprintf(upd_irq_name, ATH12K_UPD_IRQ_WRD_LEN, "UserPD%u-%s", + ab_ahb->userpd_id, ath12k_userpd_irq[i]); + ret =3D devm_request_threaded_irq(&ab->pdev->dev, ab_ahb->userpd_irq_num= [i], + NULL, ath12k_userpd_irq_handler, + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + upd_irq_name, ab); + if (ret) + return dev_err_probe(&ab->pdev->dev, ret, + "Request %s irq failed: %d\n", + ath12k_userpd_irq[i], ret); + } + + ab_ahb->spawn_state =3D devm_qcom_smem_state_get(&ab->pdev->dev, "spawn", + &ab_ahb->spawn_bit); + if (IS_ERR(ab_ahb->spawn_state)) + return dev_err_probe(&ab->pdev->dev, PTR_ERR(ab_ahb->spawn_state), + "Failed to acquire spawn state\n"); + + ab_ahb->stop_state =3D devm_qcom_smem_state_get(&ab->pdev->dev, "stop", + &ab_ahb->stop_bit); + if (IS_ERR(ab_ahb->stop_state)) + return dev_err_probe(&ab->pdev->dev, PTR_ERR(ab_ahb->stop_state), + "Failed to acquire stop state\n"); + + init_completion(&ab_ahb->userpd_spawned); + init_completion(&ab_ahb->userpd_ready); + init_completion(&ab_ahb->userpd_stopped); + return 0; +} + static int ath12k_ahb_root_pd_state_notifier(struct notifier_block *nb, const unsigned long event, void *data) { @@ -659,7 +731,8 @@ static int ath12k_ahb_configure_rproc(struct ath12k_bas= e *ab) goto err_unreg_notifier; } } - return 0; + + return ath12k_ahb_config_rproc_irq(ab); =20 err_unreg_notifier: ath12k_ahb_unregister_rproc_notifier(ab); @@ -764,7 +837,7 @@ static int ath12k_ahb_probe(struct platform_device *pde= v) const struct ath12k_hif_ops *hif_ops; struct ath12k_ahb *ab_ahb; enum ath12k_hw_rev hw_rev; - u32 addr; + u32 addr, userpd_id; int ret; =20 ret =3D dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); @@ -782,6 +855,7 @@ static int ath12k_ahb_probe(struct platform_device *pde= v) switch (hw_rev) { case ATH12K_HW_IPQ5332_HW10: hif_ops =3D &ath12k_ahb_hif_ops_ipq5332; + userpd_id =3D ATH12K_IPQ5332_USERPD_ID; break; default: ret =3D -EOPNOTSUPP; @@ -794,6 +868,7 @@ static int ath12k_ahb_probe(struct platform_device *pde= v) platform_set_drvdata(pdev, ab); ab_ahb =3D ath12k_ab_to_ahb(ab); ab_ahb->ab =3D ab; + ab_ahb->userpd_id =3D userpd_id; =20 /* Set fixed_mem_region to true for platforms that support fixed memory * reservation from DT. If memory is reserved from DT for FW, ath12k driv= er diff --git a/drivers/net/wireless/ath/ath12k/ahb.h b/drivers/net/wireless/a= th/ath12k/ahb.h index 1105473917ce..b17e7693b31a 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.h +++ b/drivers/net/wireless/ath/ath12k/ahb.h @@ -25,6 +25,13 @@ enum ath12k_ahb_smp2p_msg_id { ATH12K_AHB_POWER_SAVE_EXIT, }; =20 +enum ath12k_ahb_userpd_irq { + ATH12K_USERPD_SPAWN_IRQ, + ATH12K_USERPD_READY_IRQ, + ATH12K_USERPD_STOP_ACK_IRQ, + ATH12K_USERPD_MAX_IRQ, +}; + struct ath12k_base; =20 struct ath12k_ahb { @@ -34,6 +41,15 @@ struct ath12k_ahb { struct completion rootpd_ready; struct notifier_block root_pd_nb; void *root_pd_notifier; + struct qcom_smem_state *spawn_state; + struct qcom_smem_state *stop_state; + struct completion userpd_spawned; + struct completion userpd_ready; + struct completion userpd_stopped; + u32 userpd_id; + u32 spawn_bit; + u32 stop_bit; + int userpd_irq_num[ATH12K_USERPD_MAX_IRQ]; }; =20 static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct ath12k_base *ab) diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/at= h/ath12k/hw.h index a4332588b117..d4a2e47169d9 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -97,6 +97,7 @@ #define ATH12K_REGDB_FILE_NAME "regdb.bin" =20 #define ATH12K_PCIE_MAX_PAYLOAD_SIZE 128 +#define ATH12K_IPQ5332_USERPD_ID 1 =20 enum ath12k_hw_rate_cck { ATH12K_HW_RATE_CCK_LP_11M =3D 0, --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D206024EF7F; Mon, 17 Mar 2025 15:43:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226231; cv=none; b=GhT76gU3gbZrU3xIygA9Tbgikr5wVuMnSqgqlDRruK8cm7JvuE5m3iiboOqi97onwMlCkpzv+ZeRwh55U1wpLqzXYWl+X36x1CF1cwqxc8Q4DJwRxq3UDVQXgRmMax69singXJdSZneL2lgC+fsmkZckLRAhtHb5O0e8M7Iwg4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226231; c=relaxed/simple; bh=7aJWQv15k9Ny2AV2XLhRvLqSnfH/XSqW4mQBoZVgDfI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DQdfuUPmgmTos4FTHZYeSdLqovHYdJOdAhBzxYF3g52tFQNb9b9q5kNsCmPRHLUAjcRM/6xwQLFITxJrMhxwFIjDG14weA7PmzeVPU5kcxdLR42/j0k2AkL4FHDBgApfOU2BrGdpPpK3tJDsB6Pj95qvcmF8Hm2IudCy+wpWegQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=OZk8MAd7; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="OZk8MAd7" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52HAKbbh017976; Mon, 17 Mar 2025 15:43:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= JzLJEJ5/4D5taHBhWMVYlLCGW98gosvYPwN3I05GWoI=; b=OZk8MAd7gYitpiQ6 V5ojx4iFdwhY6LVspXQKLUEvdZozVdW6ia1fnn7gFeFGGDJgINEISM9EFb4svf9L 86rvLtOJvwAo3Al8228E/mmXeKkeD0t1ecwjuvf7O174kqGV2GVWeKxn7SoR5mHl hyBSqzZTCx0O5LtN/3Gn+P8LniX/oEEvTPmRauA4oX97OKa81RnuXouoVeTg9fNO wzhL3xMf5z8HsNHMW76csfSOf93wmYhf2BPqVEnsUcAtI6Gsab6i8bBsyIPeM5rC No3LLSFGn2P49XuL0qqhFknJxq7n3YwIZA+sV0j/Mi8mdIK/n3Noy94CsOi7ussK fjSpag== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1sxw5ku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:27 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFhQ0Z030255 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:26 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:43:22 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , "Sowmiya Sree Elavalagan" , Raj Kumar Bhagat , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 11/13] wifi: ath12k: Power up userPD Date: Mon, 17 Mar 2025 21:11:48 +0530 Message-ID: <20250317154150.1361364-12-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: DT54S_oH4DH_Vs2m8o4uIv5SBEQEeSYx X-Proofpoint-ORIG-GUID: DT54S_oH4DH_Vs2m8o4uIv5SBEQEeSYx X-Authority-Analysis: v=2.4 cv=XKcwSRhE c=1 sm=1 tr=0 ts=67d8431f cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=9KLz4mBoNmX795gwMUkA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 impostorscore=0 adultscore=0 mlxscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Sowmiya Sree Elavalagan UserPD firmware image is loaded and booted by ath12k driver. Get the userPD memory region from DTS and load the firmware for userPD from pre-defined path into io-remapped address of this region. Authenticate this image using pasid which is a peripheral ID. Set the spawn bit to instruct Q6 to spawn userPD thread. Wait for userPD to spawn which is indicated by spawn interrupt. Ready interrupt is triggered once the userPD is powered up completely. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sowmiya Sree Elavalagan Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/ahb.c | 128 ++++++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/ahb.h | 9 ++ 2 files changed, 137 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/a= th/ath12k/ahb.c index 291ae8177cdd..1ce08bad0646 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.c +++ b/drivers/net/wireless/ath/ath12k/ahb.c @@ -5,10 +5,12 @@ */ =20 #include +#include #include #include #include #include +#include #include #include "ahb.h" #include "debug.h" @@ -336,6 +338,131 @@ static void ath12k_ahb_stop(struct ath12k_base *ab) ath12k_ce_cleanup_pipes(ab); } =20 +static int ath12k_ahb_power_up(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + char fw_name[ATH12K_USERPD_FW_NAME_LEN]; + char fw2_name[ATH12K_USERPD_FW_NAME_LEN]; + struct device *dev =3D ab->dev; + const struct firmware *fw, *fw2; + struct reserved_mem *rmem =3D NULL; + unsigned long time_left; + phys_addr_t mem_phys; + void *mem_region; + size_t mem_size; + u32 pasid; + int ret; + + rmem =3D ath12k_core_get_reserved_mem(ab, 0); + if (!rmem) + return -ENODEV; + + mem_phys =3D rmem->base; + mem_size =3D rmem->size; + mem_region =3D (void *)devm_ioremap_wc(dev, mem_phys, mem_size); + if (!mem_region) { + ath12k_err(ab, "unable to map memory region: %pa+%pa\n", + &rmem->base, &rmem->size); + return -ENOMEM; + } + + snprintf(fw_name, sizeof(fw_name), "%s/%s/%s%d%s", ATH12K_FW_DIR, + ab->hw_params->fw.dir, ATH12K_AHB_FW_PREFIX, ab_ahb->userpd_id, + ATH12K_AHB_FW_SUFFIX); + + ret =3D request_firmware(&fw, fw_name, dev); + if (ret < 0) { + ath12k_err(ab, "request_firmware failed\n"); + return ret; + } + + ath12k_dbg(ab, ATH12K_DBG_AHB, "Booting fw image %s, size %zd\n", fw_name, + fw->size); + + if (!fw->size) { + ath12k_err(ab, "Invalid firmware size\n"); + ret =3D -EINVAL; + goto err_fw; + } + + pasid =3D (u32_encode_bits(ab_ahb->userpd_id, ATH12K_USERPD_ID_MASK)) | + ATH12K_AHB_UPD_SWID; + + /* Load FW image to a reserved memory location */ + ret =3D qcom_mdt_load(dev, fw, fw_name, pasid, mem_region, mem_phys, mem_= size, + &mem_phys); + if (ret) { + ath12k_err(ab, "Failed to load MDT segments: %d\n", ret); + goto err_fw; + } + + snprintf(fw2_name, sizeof(fw2_name), "%s/%s/%s", ATH12K_FW_DIR, + ab->hw_params->fw.dir, ATH12K_AHB_FW2); + + ret =3D request_firmware(&fw2, fw2_name, dev); + if (ret < 0) { + ath12k_err(ab, "request_firmware failed\n"); + goto err_fw; + } + + ath12k_dbg(ab, ATH12K_DBG_AHB, "Booting fw image %s, size %zd\n", fw2_nam= e, + fw2->size); + + if (!fw2->size) { + ath12k_err(ab, "Invalid firmware size\n"); + ret =3D -EINVAL; + goto err_fw2; + } + + ret =3D qcom_mdt_load_no_init(dev, fw2, fw2_name, pasid, mem_region, mem_= phys, + mem_size, &mem_phys); + if (ret) { + ath12k_err(ab, "Failed to load MDT segments: %d\n", ret); + goto err_fw2; + } + + /* Authenticate FW image using peripheral ID */ + ret =3D qcom_scm_pas_auth_and_reset(pasid); + if (ret) { + ath12k_err(ab, "failed to boot the remote processor %d\n", ret); + goto err_fw2; + } + + /* Instruct Q6 to spawn userPD thread */ + ret =3D qcom_smem_state_update_bits(ab_ahb->spawn_state, BIT(ab_ahb->spaw= n_bit), + BIT(ab_ahb->spawn_bit)); + if (ret) { + ath12k_err(ab, "Failed to update spawn state %d\n", ret); + goto err_fw2; + } + + time_left =3D wait_for_completion_timeout(&ab_ahb->userpd_spawned, + ATH12K_USERPD_SPAWN_TIMEOUT); + if (!time_left) { + ath12k_err(ab, "UserPD spawn wait timed out\n"); + ret =3D -ETIMEDOUT; + goto err_fw2; + } + + time_left =3D wait_for_completion_timeout(&ab_ahb->userpd_ready, + ATH12K_USERPD_READY_TIMEOUT); + if (!time_left) { + ath12k_err(ab, "UserPD ready wait timed out\n"); + ret =3D -ETIMEDOUT; + goto err_fw2; + } + + qcom_smem_state_update_bits(ab_ahb->spawn_state, BIT(ab_ahb->spawn_bit), = 0); + + ath12k_dbg(ab, ATH12K_DBG_AHB, "UserPD%d is now UP\n", ab_ahb->userpd_id); + +err_fw2: + release_firmware(fw2); +err_fw: + release_firmware(fw); + return ret; +} + static void ath12k_ahb_init_qmi_ce_config(struct ath12k_base *ab) { struct ath12k_qmi_ce_cfg *cfg =3D &ab->qmi.ce_cfg; @@ -551,6 +678,7 @@ static const struct ath12k_hif_ops ath12k_ahb_hif_ops_i= pq5332 =3D { .irq_enable =3D ath12k_ahb_ext_irq_enable, .irq_disable =3D ath12k_ahb_ext_irq_disable, .map_service_to_pipe =3D ath12k_ahb_map_service_to_pipe, + .power_up =3D ath12k_ahb_power_up, }; =20 static irqreturn_t ath12k_userpd_irq_handler(int irq, void *data) diff --git a/drivers/net/wireless/ath/ath12k/ahb.h b/drivers/net/wireless/a= th/ath12k/ahb.h index b17e7693b31a..f8a5c43075c1 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.h +++ b/drivers/net/wireless/ath/ath12k/ahb.h @@ -19,6 +19,15 @@ #define ATH12K_PCI_IRQ_CE0_OFFSET 3 #define ATH12K_ROOTPD_READY_TIMEOUT (5 * HZ) #define ATH12K_RPROC_AFTER_POWERUP QCOM_SSR_AFTER_POWERUP +#define ATH12K_AHB_FW_PREFIX "q6_fw" +#define ATH12K_AHB_FW_SUFFIX ".mdt" +#define ATH12K_AHB_FW2 "iu_fw.mdt" +#define ATH12K_AHB_UPD_SWID 0x12 +#define ATH12K_USERPD_SPAWN_TIMEOUT (5 * HZ) +#define ATH12K_USERPD_READY_TIMEOUT (10 * HZ) +#define ATH12K_USERPD_STOP_TIMEOUT (5 * HZ) +#define ATH12K_USERPD_ID_MASK GENMASK(9, 8) +#define ATH12K_USERPD_FW_NAME_LEN 35 =20 enum ath12k_ahb_smp2p_msg_id { ATH12K_AHB_POWER_SAVE_ENTER =3D 1, --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B53F2475F2; Mon, 17 Mar 2025 15:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226228; cv=none; b=a8YeMMC/S+Pt2lW0AwBVXpVbe7+VwveOiIeBUQ99iVOjSyc04XJh5VIiZK0d1Znx/nnoao2LACVgzsmiVs9nxVwhpr5PWF+HnDD5aN8spRWw1yYUF+Uarmw9N/C2Bf0y6VdgDyjzQjO+qO8Z+gFVJQdLesxkCeyBHdd62rI+Z5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226228; c=relaxed/simple; bh=PJPYQE7lA7kdslY/CtPhco+LiaZu/TtbV0i52+HYi2c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rxSCo8fc83OyeyK3OLCW8mnC/hqVqGkT384o23lIDWk/GPc6AY1KiDVAWv78+NNUawoW75a5iavucZ/8X1TIjQIY/6GtV+qY1UCUL6SITZ66Kn3X3l7IY72ddNFs9TEzGndMlmS69BwMLvDFktTM7fn/5gdC36xQlgrAZisOSpc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=NuM7vJw8; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="NuM7vJw8" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52H9aPJ4002276; Mon, 17 Mar 2025 15:43:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= OHMpkp9wmRDtWguMQ5PqvBIoeCvyPD9Yh2G3s5nksJQ=; b=NuM7vJw8CDT6BxNH a8Gu2eQeQeIXEzM/0eCEdBl2WZkyE6Tz9pvBWzgWxX4TiMDO6k3AfhCjkntwu4E5 NTeRZfryMNGQ0/pZTlOLkofMFvV5oUzQ99DFgNvdPfNnb0+JrwORoudxdrJnrMGG JI2VM777Zf1WgRILFUuw0F7GfszTL/LAXxctzj6ujdjp7ESF8NkQzKQd0lYT0UQF Z4GEKJfBZv62PW4hup8cMico2VDREHWaUBUQopNtHRPGetRdTNBZiUoqXlTdbnHe DgGxDeRZcweRSOpLQdvEgd6XZFe+AaJ9Hl2wOVM8/ZLvlYGYb32whBkvsncuVYMx 6xIk5A== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1x7w5jw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:31 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFhUE4029030 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:30 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:43:26 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , "Sowmiya Sree Elavalagan" , Raj Kumar Bhagat , Vasanthakumar Thiagarajan Subject: [PATCH ath-next v10 12/13] wifi: ath12k: Power down userPD Date: Mon, 17 Mar 2025 21:11:49 +0530 Message-ID: <20250317154150.1361364-13-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: iUzpcnBEYgSQXu8HiwrBawHD-2qaPnKW X-Proofpoint-ORIG-GUID: iUzpcnBEYgSQXu8HiwrBawHD-2qaPnKW X-Authority-Analysis: v=2.4 cv=Jem8rVKV c=1 sm=1 tr=0 ts=67d84323 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=9C-aMoZdzPBDcThTcjAA:9 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 malwarescore=0 adultscore=0 phishscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Sowmiya Sree Elavalagan Set the stop bit in SMEM to power down the userPD. Wait for stop-ack IRQ to indicate power down completion. Release the userPD firmware using its peripheral ID. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sowmiya Sree Elavalagan Signed-off-by: Raj Kumar Bhagat Reviewed-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath12k/ahb.c | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/a= th/ath12k/ahb.c index 1ce08bad0646..9ed39766e691 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.c +++ b/drivers/net/wireless/ath/ath12k/ahb.c @@ -463,6 +463,34 @@ static int ath12k_ahb_power_up(struct ath12k_base *ab) return ret; } =20 +static void ath12k_ahb_power_down(struct ath12k_base *ab, bool is_suspend) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + unsigned long time_left; + u32 pasid; + int ret; + + qcom_smem_state_update_bits(ab_ahb->stop_state, BIT(ab_ahb->stop_bit), + BIT(ab_ahb->stop_bit)); + + time_left =3D wait_for_completion_timeout(&ab_ahb->userpd_stopped, + ATH12K_USERPD_STOP_TIMEOUT); + if (!time_left) { + ath12k_err(ab, "UserPD stop wait timed out\n"); + return; + } + + qcom_smem_state_update_bits(ab_ahb->stop_state, BIT(ab_ahb->stop_bit), 0); + + pasid =3D (u32_encode_bits(ab_ahb->userpd_id, ATH12K_USERPD_ID_MASK)) | + ATH12K_AHB_UPD_SWID; + /* Release the firmware */ + ret =3D qcom_scm_pas_shutdown(pasid); + if (ret) + ath12k_err(ab, "scm pas shutdown failed for userPD%d: %d\n", + ab_ahb->userpd_id, ret); +} + static void ath12k_ahb_init_qmi_ce_config(struct ath12k_base *ab) { struct ath12k_qmi_ce_cfg *cfg =3D &ab->qmi.ce_cfg; @@ -679,6 +707,7 @@ static const struct ath12k_hif_ops ath12k_ahb_hif_ops_i= pq5332 =3D { .irq_disable =3D ath12k_ahb_ext_irq_disable, .map_service_to_pipe =3D ath12k_ahb_map_service_to_pipe, .power_up =3D ath12k_ahb_power_up, + .power_down =3D ath12k_ahb_power_down, }; =20 static irqreturn_t ath12k_userpd_irq_handler(int irq, void *data) @@ -1095,6 +1124,7 @@ static void ath12k_ahb_remove(struct platform_device = *pdev) struct ath12k_base *ab =3D platform_get_drvdata(pdev); =20 if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath12k_ahb_power_down(ab, false); ath12k_qmi_deinit_service(ab); goto qmi_fail; } --=20 2.34.1 From nobody Wed Dec 17 13:57:52 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72AD42500C5; Mon, 17 Mar 2025 15:43:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226238; cv=none; b=THtMjhBN0jSxqZK/doatMsuqY4d7Q1g4iQG8VmuQFdI3QKD0O0H/a47X8lJE8rMULwjPMj8zjrPH5c/9tn1GhRfaUNZOzBzst+saMwEovxsdr1v32WFpMDykLwXu/8fHPLA25/BqFh8Hzfr2ubyhGzqZYXhJu2jk760vUGgcHoA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742226238; c=relaxed/simple; bh=NfDKp8biByx7NDdvHG6oNWOqusu6SUHKvFgy4Iooxpo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uEPD4F6D20l3TCsY+HSEp/V1OzTpppPsUPhZI2B02c/cg4izSd/CnCv4ay4REU9JsXRUrmSb/4T3zMZlyCeaxplP9dgcyKG3GKIsrbKjtsUjXKpBVVw4cDI3FINhlY35C/QPlGNJDPRUPTHB0/o1/SWrwu+ACdozwUKZegR802s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=BMYg+jCL; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="BMYg+jCL" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52H9uCcQ017034; Mon, 17 Mar 2025 15:43:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= IJ4YcgtSW7V1KjnzX+xp2hJqgLVP9ecSqTePoWh05So=; b=BMYg+jCLMvkYNuIV 1ailY4A2DxtVKHxDrnFyndg7nnl0/59W/n3y56wpoHDtSRdN9GfZb/XOoxi3Wbq2 Dg3kEgrzaJFQj8RuM2ESWnisTyafcaVTebmxyTmpmYqWKiNgF1gT3NgYSGJ0klpO 4DJSCwT9Z/a8VOeUS/SnG2jbt5S0WS9L1zgIiNc6jHdHIe4hc7uAZ8ca/SgKrVJ6 cgSe7D1oAKjD8UEsEqDBOI544r5UXmkcvgdgTWPEow0j4BfKwkrDB4BAbSMGFUnx t/DemOyv4T1LL839mhqm8zKrelfffK6cR6kGCul6ZwIRDB/g+KMJOJuomUEv3gIB MU1Mtg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45d1r157w1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:35 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52HFhYH6012349 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Mar 2025 15:43:34 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 17 Mar 2025 08:43:30 -0700 From: Raj Kumar Bhagat To: CC: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson , , , , Balamurugan S , P Praneesh , "Raj Kumar Bhagat" Subject: [PATCH ath-next v10 13/13] wifi: ath12k: enable ath12k AHB support Date: Mon, 17 Mar 2025 21:11:50 +0530 Message-ID: <20250317154150.1361364-14-quic_rajkbhag@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> References: <20250317154150.1361364-1-quic_rajkbhag@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=LuaSymdc c=1 sm=1 tr=0 ts=67d84327 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=vXVk93xmC7zsTb_1jtAA:9 a=RVmHIydaz68A:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: xMDYLXXL4VMYzvNRYzIN0l2upy2875wt X-Proofpoint-ORIG-GUID: xMDYLXXL4VMYzvNRYzIN0l2upy2875wt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-17_06,2025-03-17_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 phishscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503170113 Content-Type: text/plain; charset="utf-8" From: Balamurugan S Currently only PCI devices are supported in Ath12k driver. Refactor Ath12k module_init and module_exit to include Ath12k AHB support. Add Ath12k AHB support in Kconfig with dependency on Remoteproc driver. Ath12k AHB support relies on remoteproc driver for firmware download, power up/down etc. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1 Signed-off-by: Balamurugan S Co-developed-by: P Praneesh Signed-off-by: P Praneesh Signed-off-by: Raj Kumar Bhagat --- drivers/net/wireless/ath/ath12k/Kconfig | 6 ++++ drivers/net/wireless/ath/ath12k/Makefile | 1 + drivers/net/wireless/ath/ath12k/ahb.h | 11 ++++++++ drivers/net/wireless/ath/ath12k/core.c | 35 ++++++++++++++++++++++-- drivers/net/wireless/ath/ath12k/pci.c | 10 ++----- drivers/net/wireless/ath/ath12k/pci.h | 4 ++- 6 files changed, 55 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/Kconfig b/drivers/net/wireless= /ath/ath12k/Kconfig index 52a1bb19e3da..7782dd131c62 100644 --- a/drivers/net/wireless/ath/ath12k/Kconfig +++ b/drivers/net/wireless/ath/ath12k/Kconfig @@ -15,6 +15,12 @@ config ATH12K =20 If you choose to build a module, it'll be called ath12k. =20 +config ATH12K_AHB + bool "QTI ath12k AHB support" + depends on ATH12K && REMOTEPROC + help + Enable support for Ath12k AHB bus chipsets, example IPQ5332. + config ATH12K_DEBUG bool "ath12k debugging" depends on ATH12K diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireles= s/ath/ath12k/Makefile index 60644cb42c76..d95ee525a6cd 100644 --- a/drivers/net/wireless/ath/ath12k/Makefile +++ b/drivers/net/wireless/ath/ath12k/Makefile @@ -23,6 +23,7 @@ ath12k-y +=3D core.o \ fw.o \ p2p.o =20 +ath12k-$(CONFIG_ATH12K_AHB) +=3D ahb.o ath12k-$(CONFIG_ATH12K_DEBUGFS) +=3D debugfs.o debugfs_htt_stats.o debugfs= _sta.o ath12k-$(CONFIG_ACPI) +=3D acpi.o ath12k-$(CONFIG_ATH12K_TRACING) +=3D trace.o diff --git a/drivers/net/wireless/ath/ath12k/ahb.h b/drivers/net/wireless/a= th/ath12k/ahb.h index f8a5c43075c1..d56244b20a6a 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.h +++ b/drivers/net/wireless/ath/ath12k/ahb.h @@ -66,4 +66,15 @@ static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct= ath12k_base *ab) return (struct ath12k_ahb *)ab->drv_priv; } =20 +#ifdef CONFIG_ATH12K_AHB +int ath12k_ahb_init(void); +void ath12k_ahb_exit(void); +#else +static inline int ath12k_ahb_init(void) +{ + return 0; +} + +static inline void ath12k_ahb_exit(void) {}; +#endif #endif diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/= ath/ath12k/core.c index 5bd852f9572b..4117ccd1af20 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -10,15 +10,18 @@ #include #include #include +#include "ahb.h" #include "core.h" #include "dp_tx.h" #include "dp_rx.h" #include "debug.h" -#include "hif.h" -#include "fw.h" #include "debugfs.h" +#include "fw.h" +#include "hif.h" +#include "pci.h" #include "wow.h" =20 +static int ahb_err, pci_err; unsigned int ath12k_debug_mask; module_param_named(debug_mask, ath12k_debug_mask, uint, 0644); MODULE_PARM_DESC(debug_mask, "Debugging mask"); @@ -2020,5 +2023,31 @@ struct ath12k_base *ath12k_core_alloc(struct device = *dev, size_t priv_size, return NULL; } =20 -MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11be wireless LAN= cards."); +static int ath12k_init(void) +{ + ahb_err =3D ath12k_ahb_init(); + if (ahb_err) + pr_warn("Failed to initialize ath12k AHB device: %d\n", ahb_err); + + pci_err =3D ath12k_pci_init(); + if (pci_err) + pr_warn("Failed to initialize ath12k PCI device: %d\n", pci_err); + + /* If both failed, return one of the failures (arbitrary) */ + return ahb_err && pci_err ? ahb_err : 0; +} + +static void ath12k_exit(void) +{ + if (!pci_err) + ath12k_pci_exit(); + + if (!ahb_err) + ath12k_ahb_exit(); +} + +module_init(ath12k_init); +module_exit(ath12k_exit); + +MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11be WLAN= devices"); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/a= th/ath12k/pci.c index b474696ac6d8..e62b172c7f9f 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -1831,7 +1831,7 @@ static struct pci_driver ath12k_pci_driver =3D { .driver.pm =3D &ath12k_pci_pm_ops, }; =20 -static int ath12k_pci_init(void) +int ath12k_pci_init(void) { int ret; =20 @@ -1844,14 +1844,8 @@ static int ath12k_pci_init(void) =20 return 0; } -module_init(ath12k_pci_init); =20 -static void ath12k_pci_exit(void) +void ath12k_pci_exit(void) { pci_unregister_driver(&ath12k_pci_driver); } - -module_exit(ath12k_pci_exit); - -MODULE_DESCRIPTION("Driver support for Qualcomm Technologies PCIe 802.11be= WLAN devices"); -MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/wireless/ath/ath12k/pci.h b/drivers/net/wireless/a= th/ath12k/pci.h index 31584a7ad80e..521fa72333bb 100644 --- a/drivers/net/wireless/ath/ath12k/pci.h +++ b/drivers/net/wireless/ath/ath12k/pci.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights res= erved. */ #ifndef ATH12K_PCI_H #define ATH12K_PCI_H @@ -145,4 +145,6 @@ void ath12k_pci_stop(struct ath12k_base *ab); int ath12k_pci_start(struct ath12k_base *ab); int ath12k_pci_power_up(struct ath12k_base *ab); void ath12k_pci_power_down(struct ath12k_base *ab, bool is_suspend); +int ath12k_pci_init(void); +void ath12k_pci_exit(void); #endif /* ATH12K_PCI_H */ --=20 2.34.1