From patchwork Tue Apr 18 09:38:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 84717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2714327vqo; Tue, 18 Apr 2023 02:44:51 -0700 (PDT) X-Google-Smtp-Source: AKy350aHks4y/Qg8TRz8Qb9E2+PUNNMD1wXbWnHMLJJw9xAqfycCPk+jp95uIIXb0WZuiqRlcMOg X-Received: by 2002:aa7:888a:0:b0:63d:3a32:7407 with SMTP id z10-20020aa7888a000000b0063d3a327407mr1884267pfe.16.1681811091177; Tue, 18 Apr 2023 02:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681811091; cv=none; d=google.com; s=arc-20160816; b=FEtCE40oVSwzdaiM4SpwHY4dRL8hGDTfPoxNMWtSqltrgXILy00DiBf9SXh49+JK1t KnrWf7MwF2rAOTys3PuKZOtS5FlV3hk4maIC7BGUEWxm6nWFNI9MSBZL8YkuHrAlS/hI 8bGqU69x8GNFwtfqxrDDvEVOn6A4iuHYw4v+iUKfLjmb40HtXEITLdSry6kfg+dpiKv/ OAeFT5TiIQM7Wc9gaFHF0/VC3ZolMnAZ9fFC5HM3j8wpVsm0q8IMd89MxYkOUQBFHtPM a7tbFg0isBGWai5vEgr2jpnSUJap/uFgyl0fqE8nffqrPu58DpwXuKhmP2+iCMnHXFXc nL6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Lb7Hmi4qrMx3y4a0oEkH9YVxHmM21sJHrETGqqG+9Xk=; b=Jyck3aUeZYSLUewu2MQUxig5gyXZOpYKmXDQKpGt3iVYTgDe5nw19FxbQ8NYO0wQY3 NlEnGtJHVahpi+M7l4R2GTD4UpY6g9TQDjB4Zpamu/w3JE0KnN+AjN6H1PvdRs88taQm PtyMEEve0rQixmrLFSzI7RkDSsZdyG2jK2zb9nxrFkIzkI0gmQz4CUEAF/olY/jX6B0P Hh1xV9L9sAjQRmnByn/M3MKPyQvJHCeZ4QAkA094tZ2rSgyRDlMenw8zwm3XJ47HzgeE jtdH3M84rbBalR24mA4K4xiZUN4D4gmXe1o9kWwf5yx4SN043X9TXbYPIGSbXiOk57rt 6c3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=j0+H7Al1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x25-20020aa78f19000000b0063d2e0cf589si2689941pfr.13.2023.04.18.02.44.36; Tue, 18 Apr 2023 02:44:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=j0+H7Al1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231378AbjDRJim (ORCPT + 99 others); Tue, 18 Apr 2023 05:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbjDRJik (ORCPT ); Tue, 18 Apr 2023 05:38:40 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71B3D1BCA; Tue, 18 Apr 2023 02:38:39 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id j11so17198579ljq.10; Tue, 18 Apr 2023 02:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681810717; x=1684402717; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Lb7Hmi4qrMx3y4a0oEkH9YVxHmM21sJHrETGqqG+9Xk=; b=j0+H7Al1iBdQY1xKqRJyJwcwUhRfGBMDisXwRy29PxizwZTAUzpD6bW+61adKcZjCb 6RUWyoIg2FAHyStLXH+3SffSmZMDluHYsEwQp2/yAOQklNRJ+hlmczDXSktw09yySv2l Tt8ER6C1f2impZbNVkRqlffjDGP9xNNcZImaK35al5VRW16bGl3u20IzQZ3A3VW77AIy nIfRuo7wD4qOiZhAap7BpKExmhoZ/ATgDG0OR/Zdp06lddvMmHl3jIHyNmVktyVHvY/4 1ji/xcwUCl7VjtsQrEu4Lj/0umt5OvDHhGAAxHH+KK7IjHiIx88+WaI4Zk28CDNr6xOw oMVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681810717; x=1684402717; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Lb7Hmi4qrMx3y4a0oEkH9YVxHmM21sJHrETGqqG+9Xk=; b=A4lMXVZiZWSm0NZo6222vkryqCkavS/1CNuFyUkRdAByKyYOwvA1AIeAdF43tADjvs xq68jp/qN8EtQlcus2v0Nd6ru4voGUDbPxL4uPehaeSXn+2ip1EIJ11E5f+vg0t75zSH miptYLCCTapo+aKyRMc6JbmUFyTTTIHSZ3zUflaLe84iQoJxRnra/vpFDaflJig1hv7m Kn6Xit9PadAyqV+Ws3ZG79gKfLfqqC47tdTo02Zo70PaNRVjCPGsO159b1E2RGq3Jfno qhASIU4vTv4neSLs2e0u+wSWdDPlOdBQA6RpImD/tsLrnAiNbJoKMtzbnTVEB0K/taTv Vocw== X-Gm-Message-State: AAQBX9dXocteLqQOuYVLTVGL85BWRi+37Wfz2jJ+ZAdg9azkdorolsKR Y2+DC1gPUp3mHNbMMm6Geoc= X-Received: by 2002:a2e:904c:0:b0:2a8:ddb0:baa6 with SMTP id n12-20020a2e904c000000b002a8ddb0baa6mr437460ljg.4.1681810717565; Tue, 18 Apr 2023 02:38:37 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id x27-20020a05651c105b00b002a8c2a4fe99sm967813ljm.28.2023.04.18.02.38.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 02:38:37 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kalle Valo , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Marko , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Date: Tue, 18 Apr 2023 11:38:20 +0200 Message-Id: <20230418093822.24005-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763506746858698581?= X-GMAIL-MSGID: =?utf-8?q?1763506746858698581?= From: Rafał Miłecki Qualcomm ath11k chipsets can have up to 3 radios. Each radio may need to be additionally described by including its MAC or available frequency ranges. Signed-off-by: Rafał Miłecki --- V2: Fix dt_binding_check (add address + size cells & reg) --- .../bindings/net/wireless/qcom,ath11k.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml index 7d5f982a3d09..6a03638d20f1 100644 --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml @@ -78,6 +78,34 @@ properties: items: - const: wlan-smp2p-out + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +patternProperties: + "^radio@[0-2]$": + type: object + + allOf: + - $ref: ieee80211.yaml# + + properties: + reg: + maxItems: 1 + description: Radio index + + nvmem-cells: + items: + - description: NVMEM cell with the MAC address + + nvmem-cell-names: + items: + - const: mac-address + + unevaluatedProperties: false + required: - compatible - reg @@ -378,6 +406,14 @@ examples: "wbm2host-tx-completions-ring1", "tcl2host-status-ring"; qcom,rproc = <&q6v5_wcss>; + #address-cells = <1>; + #size-cells = <0>; + + radio@0 { + reg = <0x0>; + nvmem-cells = <&mac>; + nvmem-cell-names = "mac-address"; + }; }; - | From patchwork Tue Apr 18 09:38:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 84718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2714428vqo; Tue, 18 Apr 2023 02:45:05 -0700 (PDT) X-Google-Smtp-Source: AKy350anCNxJq1NVht4Uk2dhPjQ8Hle1yEzEbRAV1eXwx0gm0WaDc2P6nunpn4EMtdSj7+3xUI0d X-Received: by 2002:a05:6a20:7d94:b0:f0:69db:ebea with SMTP id v20-20020a056a207d9400b000f069dbebeamr3972148pzj.30.1681811105231; Tue, 18 Apr 2023 02:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681811105; cv=none; d=google.com; s=arc-20160816; b=Dz7HwcG+sLoQlg1O/9o0tLEE8aKy2yTnP/FbcS7EUtJc+r/EoBv4MZSPjx6C22E0CC DbTY3IwZ9bGFU8DJt8Xz4A806y1VSG9EkeCFSTyL03xax2GaXjOvI6WHwMIQLniCD8bQ t51SMDoRvB9YLol3S0VSEByrUfFOpvvig7cHWegw+M8uJciG7hHA9zMKi+a7qoE1KB58 uJ7zNjPcmy7RLxbgb7I3767SY6LkZ/G4mxNCkGXytjOQwLYK3IzN1+B2vP/Ss1ZjzK4f W0pOJKyEwV4mEIFpaBjBxBLRMODKQP62zK/sdhf1AYOOaPILAFeV2M4dpXweTOZqxCRm fSRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=N3L0ATs2K15l9KRiiuDKNOs5Kicmg+FttDgu2qaNiHk=; b=Jl2HfAE1vDQ3TaGjahoFADeGIx124/Sr8Y18ZBupMrvyZUtVIDkdX2OldqbnK6cpT7 kTVaf9msExyAbbV6iKONfAVIg8vFGUaEBYNTcjcGhnnaSRsfKK7ElY0Op36j3z1bNlD+ 8zvmbcrZNuDUrsGlphjm7dZmsviEvDU6ijMaFcbyF4kw6cZBsbU0yDeoG9XggAKSzXox z3EXp4d/FL299dc7XKTv+bD+aT/Y+hpUv5yoz6ar3uInZlhXSU+6+tJ7CP1yRhCoXdzZ WnFhQr3sRC5tRqoSzGT8kuaPT8g4krB0JrUYlxatOFwPsctA5OWPp6myuF6cT72ecQO+ 8k7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=nyhv9S0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o10-20020a17090a678a00b002477bb336ebsi6425180pjj.6.2023.04.18.02.44.50; Tue, 18 Apr 2023 02:45:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=nyhv9S0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231398AbjDRJix (ORCPT + 99 others); Tue, 18 Apr 2023 05:38:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbjDRJir (ORCPT ); Tue, 18 Apr 2023 05:38:47 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C6276EAF; Tue, 18 Apr 2023 02:38:45 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id q21so162375ljp.0; Tue, 18 Apr 2023 02:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681810723; x=1684402723; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N3L0ATs2K15l9KRiiuDKNOs5Kicmg+FttDgu2qaNiHk=; b=nyhv9S0CNC/PjzJe5IhoxOI5OUcKQW6S/FB8RtNgOqP3iwEQkVqxo0wzEMV7CETBYi ZgdGmaLFOKFWOpW/gQlZcVce05Ip3BlZOc3Ssey0E3xi/OSLhlmxUl/ziXV1e+0t4SMi gmi/iUWo1+nNmk/FFJxuAqz5E+IFneKtFit4KIOKrcKn81EEdEmEGRVPZslOxN4iX/iG lvK6PrzD9RbCwBpEgpWDAwBmK61cRHUJ8i0KJ7qO79I0TEvIXm7mHsT4nFVr3fRB3Y7C z4wAsvpWsjOa16RLxrg8nKP6zuEmvbQUqBC8bts2Km4HGCK/AvFNkzVTO8AXLGlAjciF ca1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681810723; x=1684402723; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N3L0ATs2K15l9KRiiuDKNOs5Kicmg+FttDgu2qaNiHk=; b=kOxNS1j07wzd3w7vDu3Q7xIVRKesQfGwZ17DU5CzMreORThVHZ1uQuQ7VLRA80cmJf ijIuoR2rWAoSdKiyhY9UOfksLdNb0tAgUCxGW6gMqCm4xkv4Y8rG9iXTRdtj9FE5jdL1 KOWpbOTr1ZVhawl1mqeHoYx1bj+AHTt2CT8uwni8CRjoaCUuZ+rQt7wYDJ/W4e7keo+A 2l74WU7RzhoS0UJiSIBltr+7ouWJkYiJFUK3ZkC4r8QZwNHJ/3TGsQ+rID+QIr5pb7zP kfGbHQP+qe7W4pGMABHTQK8QMVlaQMhS+jeLAscrvVp2ilByPGy/gtcOGzxcWq3ap8kK /iIQ== X-Gm-Message-State: AAQBX9eXzokPLmdGE3C8rCGrRYHEfmhySTeh45wX3VR22f1sn48cJdTG han/T7MUfu8F4Qp1G7Ge3Qk= X-Received: by 2002:a2e:92c5:0:b0:2a8:e480:a3c8 with SMTP id k5-20020a2e92c5000000b002a8e480a3c8mr334644ljh.44.1681810723462; Tue, 18 Apr 2023 02:38:43 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id x27-20020a05651c105b00b002a8c2a4fe99sm967813ljm.28.2023.04.18.02.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 02:38:43 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kalle Valo , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Marko , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 2/3] wifi: ath11k: look for DT node for each radio Date: Tue, 18 Apr 2023 11:38:21 +0200 Message-Id: <20230418093822.24005-2-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418093822.24005-1-zajec5@gmail.com> References: <20230418093822.24005-1-zajec5@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763506761267093496?= X-GMAIL-MSGID: =?utf-8?q?1763506761267093496?= From: Rafał Miłecki Updated DT binding allows describing each chip radio. Signed-off-by: Rafał Miłecki --- drivers/net/wireless/ath/ath11k/core.h | 2 ++ drivers/net/wireless/ath/ath11k/mac.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 0830276e5028..1a583adf2ab1 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include "qmi.h" @@ -592,6 +593,7 @@ struct ath11k_per_peer_tx_stats { struct ath11k { struct ath11k_base *ab; struct ath11k_pdev *pdev; + struct device_node *np; struct ieee80211_hw *hw; struct ieee80211_ops *ops; struct ath11k_pdev_wmi *wmi; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index cad832e0e6b8..ad5a22d12bd3 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -9344,6 +9344,25 @@ int ath11k_mac_register(struct ath11k_base *ab) return ret; } +static struct device_node *ath11k_mac_find_radio_node(struct ath11k_base *ab, int i) +{ + struct device_node *np; + + for_each_child_of_node(ab->dev->of_node, np) { + u32 reg; + int err; + + if (strcmp(np->name, "radio")) + continue; + + err = of_property_read_u32(np, "reg", ®); + if (!err && reg == i) + return np; + } + + return NULL; +} + int ath11k_mac_allocate(struct ath11k_base *ab) { struct ieee80211_hw *hw; @@ -9369,6 +9388,7 @@ int ath11k_mac_allocate(struct ath11k_base *ab) ar->ab = ab; ar->pdev = pdev; ar->pdev_idx = i; + ar->np = ath11k_mac_find_radio_node(ab, i); ar->lmac_id = ath11k_hw_get_mac_from_pdev_id(&ab->hw_params, i); ar->wmi = &ab->wmi_ab.wmi[i]; From patchwork Tue Apr 18 09:38:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 84719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2714636vqo; Tue, 18 Apr 2023 02:45:34 -0700 (PDT) X-Google-Smtp-Source: AKy350bulJY4n6aqeLiWYB2+aP9ARcTZS+sW/foutBC56rmUz+XeByL78atIOWRsEfxibX4QmVuf X-Received: by 2002:a05:6a20:cf49:b0:de:526b:f292 with SMTP id hz9-20020a056a20cf4900b000de526bf292mr16123763pzb.19.1681811134691; Tue, 18 Apr 2023 02:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681811134; cv=none; d=google.com; s=arc-20160816; b=K7XCIrobj+BdmWHh3OxHzLUMUIZbIFoDPfanUxzmUF5HnzBEntOS8jTxOSRVuVziri QoFpUNbM0GCzSoWsPrKYF0jqcSF95fl/FA6J4DrXKI3Up7iRKE8QOMYWwV8ZskmjNlng 1usMuH9BzYOXlYlU9JhlsX4d/B5PSa7fd4Qb7Zn6x5QAC/6TLBgZQ3GlX7c9jTuOa+1D sWfw3l5lFZRE5/inrhFmS1Go7nnU++bvWyig7XewlJ13Nc6ZD4t+DBmQAVcVveM2gs7p fIKexCFXiA+zi2ubE7d2dwZNGqoj/Kq+aGBOTznAmaCnjM39L0R7wuFMzam9hjqqn+gI 5+NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2EiDytvabdYN54DIeMJTMZ/ViwsZyEhMHyZ0a9MJx4o=; b=YqIaxT4lhjxQkfYZtX/ND3LVtD1VPbU4xjmR/sPxpeyt8KPEmSb7fKIsBzBIIN82H/ 9l6sTx7Xtow0q2QCrutqrpIHiO8Bss+LBEhkx/B+shztJ1z0LKp2ajGzCoRdq883MhMQ Oh9dGa9qUrQXoXziEarq8Xrw9++XaFDK8hIpWWffDC6EFz9sEvlMjUj3fzPI1KqSRhMB L8/7H4DwIWap7IpPZqwD5fwlyAtuW0rR+TJOcYM7p6QZ+DR1Izgwxl9E+sVVIFeoH+tW ZH+/akJ/7FhfYq3xUcmp8dPxQ9hjau4/yUgeUSQy1B+6F6LCNH6Nki1F8dN/PQirHrlo uvTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Mgp+Fdmj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a17090a4e4800b002467062c312si16214841pjl.128.2023.04.18.02.45.19; Tue, 18 Apr 2023 02:45:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Mgp+Fdmj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231464AbjDRJjG (ORCPT + 99 others); Tue, 18 Apr 2023 05:39:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231395AbjDRJiw (ORCPT ); Tue, 18 Apr 2023 05:38:52 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 202881BE1; Tue, 18 Apr 2023 02:38:49 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4ec816c9d03so2085472e87.2; Tue, 18 Apr 2023 02:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681810727; x=1684402727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2EiDytvabdYN54DIeMJTMZ/ViwsZyEhMHyZ0a9MJx4o=; b=Mgp+FdmjTOO8yLjct8Ey6wAnQpaKYZlpn2pHIG/2fXHgwHj/Ymsw2LgM4jEvE+za4O jAp/K7vJGFvKrT3Du403FmySbg0WVdwsklAz0iRECcpDaazBXpH62uSP6gUCQG0Q+uPH gfhOAYxFyRewQeY9zawHDscntVwKav0mwa5QqidN9YpWT1+rwN2ck5CYjjqenxl03Tl7 tRe4tdK6V//ly3ZSmdFwmmlHxVGg79S5O4pJvxFMywh3NuWbwReXEWVmWD0oXdylO2x7 d/c20YL0TytiL9Amg2m/gKdQbF1YHytZTgBDbYhT91FWNjluR8A0ZG92/MlBjt5QbpZV 2qjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681810727; x=1684402727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2EiDytvabdYN54DIeMJTMZ/ViwsZyEhMHyZ0a9MJx4o=; b=jbkC9Rcgnd7CUrzhPAY9HGIO/mPw8Y6Tr/5zJ5xYrlAkHvjM3zb7xURkDf1HFEoQyy g/z2DCPVIuVgwVvs7zEadobYtkze3nRvXYeTr64xNBoXZELtPDA45TVXknCnQxMV4Lii g7Pj3qA/pjJNePzGV6X+cyRO9U1t2MTewOOvUz0HUcC7e3HOoxJw+PhXPRg/AzVX2klz jsoPfGExfMOILAQQQA4A4IugzOBPRbKjdMmg6P+VQYIzgY/5QGPSzRsJqC2jxbM9D8Y9 2d6jXA55itplXOYZ90cyoDeDbITpBHi44hOOPWqRxIYSEgKcFnzOlNImK0PPM2f2neZm GjgQ== X-Gm-Message-State: AAQBX9caHYT8SwPuzEXrFH/PdxY11ATu0UItJiUCi+MYIh1kwygxbzwN /4A5ryhOckfrEW/+kIajbu0= X-Received: by 2002:ac2:46c9:0:b0:4ed:c537:d0ca with SMTP id p9-20020ac246c9000000b004edc537d0camr1608334lfo.59.1681810727353; Tue, 18 Apr 2023 02:38:47 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id x27-20020a05651c105b00b002a8c2a4fe99sm967813ljm.28.2023.04.18.02.38.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 02:38:46 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kalle Valo , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Marko , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 3/3] wifi: ath11k: support reading radio MAC from DT Date: Tue, 18 Apr 2023 11:38:22 +0200 Message-Id: <20230418093822.24005-3-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418093822.24005-1-zajec5@gmail.com> References: <20230418093822.24005-1-zajec5@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763506792390734910?= X-GMAIL-MSGID: =?utf-8?q?1763506792390734910?= From: Rafał Miłecki On some devices (most routers) MAC is stored in an NVMEM cell. Support reading it. Signed-off-by: Rafał Miłecki --- drivers/net/wireless/ath/ath11k/mac.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index ad5a22d12bd3..6550bb5b2ece 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -9292,7 +9293,7 @@ int ath11k_mac_register(struct ath11k_base *ab) struct ath11k_pdev *pdev; int i; int ret; - u8 mac_addr[ETH_ALEN] = {0}; + u8 device_mac_addr[ETH_ALEN] = {0}; if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) return 0; @@ -9305,18 +9306,22 @@ int ath11k_mac_register(struct ath11k_base *ab) if (ret) return ret; - device_get_mac_address(ab->dev, mac_addr); + device_get_mac_address(ab->dev, device_mac_addr); for (i = 0; i < ab->num_radios; i++) { + u8 radio_mac_addr[ETH_ALEN]; + pdev = &ab->pdevs[i]; ar = pdev->ar; - if (ab->pdevs_macaddr_valid) { + if (!of_get_mac_address(ar->np, radio_mac_addr)) { + ether_addr_copy(ar->mac_addr, radio_mac_addr); + } else if (ab->pdevs_macaddr_valid) { ether_addr_copy(ar->mac_addr, pdev->mac_addr); } else { - if (is_zero_ether_addr(mac_addr)) + if (is_zero_ether_addr(device_mac_addr)) ether_addr_copy(ar->mac_addr, ab->mac_addr); else - ether_addr_copy(ar->mac_addr, mac_addr); + ether_addr_copy(ar->mac_addr, device_mac_addr); ar->mac_addr[4] += i; }