From patchwork Fri Apr 14 21:23:54 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: 83571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp670284vqo; Fri, 14 Apr 2023 14:26:48 -0700 (PDT) X-Google-Smtp-Source: AKy350YyTrE5IBuDszATodg2TuqjzG4DQTTVcXrT+Gr2YlJRUCPeIrfYSDOOlmTpIBFesRlpBNmF X-Received: by 2002:a17:90a:550:b0:23a:87cf:de93 with SMTP id h16-20020a17090a055000b0023a87cfde93mr7064980pjf.15.1681507608718; Fri, 14 Apr 2023 14:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681507608; cv=none; d=google.com; s=arc-20160816; b=TbFRMtLr5IpFoR/NpsOSi7AbX3Aeh3U+UOiWDh9JlhLYimyD5IGw0TnPS9RJco9med 6tPBgqqUIfS3evWR4AREiyr+H5zLo5bnVP4scNq08UJp7oVEufyJ2zGB242gCmJOVZ/H IWuZWb2WzaZbh+ix4/eklIMJi/IDEXG5da7kS1I750ko8HXxeI9N3HZCZ25CPJJuT1QG +x9Iin70SaDAzocratdIb6LdunUs448DFuUtuww+/q1aj2H9Ux12124jXuSJZTX/Ocop aCUL8w19RE9y0lC1iKGmj5zZeY2nw7doBWSgMCJdmHB+eYmRhpRfaCLcUr7qnwtMiEqc ku6g== 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=gDb9suLeMmDXYkFPInhtMzdY2pA7Y5KvvTt2BcPxE3I=; b=x3VeX1bQ9GZ6vMks7tZqG2ljySpE8IxRQMURD41RKhKHo3+EH7GrAsJk4dj/G487uN N5Y6yDaC/isi5EuzAwNe93PgQzzZyvPP3bZsmvdRIGpTgu43JtB5bF0gaSg8dYhOK0rw see39mSRtGsyk0EtdHE2DCaPq24Li7GdP5BiMj9skjTAk8ahjFK6MDTpUOcz1D7fBzjN P3Du9lHTIi7gaZNzR7AanxNqGnQrTyUOfD6dUMjAxw0iRDrv5rzUCWO1llAM8dUGp/og 2NhTJwfKq5aqOrTtZRRRlN8zi0MpwvFgtrRTDK21XAWh8uJ5bfukYIkjTg6GPyeFC4sf jFhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=awJPcKfB; 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 x2-20020a17090abc8200b00246869a3320si5323895pjr.178.2023.04.14.14.26.34; Fri, 14 Apr 2023 14:26:48 -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=awJPcKfB; 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 S230106AbjDNVYL (ORCPT + 99 others); Fri, 14 Apr 2023 17:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbjDNVYI (ORCPT ); Fri, 14 Apr 2023 17:24:08 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3318992; Fri, 14 Apr 2023 14:24:07 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4ec8149907aso59172e87.1; Fri, 14 Apr 2023 14:24:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681507445; x=1684099445; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gDb9suLeMmDXYkFPInhtMzdY2pA7Y5KvvTt2BcPxE3I=; b=awJPcKfBAXLyWGxTwZm6y9UX+aY2BzjtCmOBus1CqQSkyNeQmmz8nRUGk+jPEazoAI g3KuRBvU5rrAsXmDGBmFuO9pSpLWu3Sm03rSo3UPUmfIHIJnSUU9y3hshLAkfUbvumH2 OWt2PigY/fd2XyBxf/0M6sj9sTVe4GW/XeE3/t94C+fWs7OuF0p5XScS7R0L+m+88Du6 o9mRM59+CUVTQlvxmZ9f4Z7KQ5H3s7UuCcHHqOiX5AXt4MnR7vRWX232seX7WMKZpxQJ dF8ddCCxGe0MT0L7YRZjfTzeBU+wM1JXNBSLC9ih/4ZSbUeekZwq8JsBZorCJrdqXvaK fImg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681507445; x=1684099445; 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=gDb9suLeMmDXYkFPInhtMzdY2pA7Y5KvvTt2BcPxE3I=; b=LDpn4cFnSqjlrAHIdEgddpfojU6CZQabXnNdXqRXbBcipvX5VjDKw/2KOiZN8zPou1 oTTA5A2Nmb26KuNevkGINZO1mOBBkGvYlNw+8bIN4OWzLeFlDwUJq8VrHwpbuu3/RlNy honJQPUxF0IbYhRD73/MVSfi2ZB+H9X3r+tfw+OUrEPe0pDyNVc7xmFcf0SFtDdIUGLL Pw35f0o7iBrOPnAyLgNqhydnEFf2qOOSjnkcbLUwKxn9uDzHOn7Ky7+5WW1OH4nwMqTS ksBjv4dFPrvGQ3QmRSK0+CE33pyQBbKURHykHqnEd+DwSjPL8SY4CSyShzEY8ZwYHtPL HRVw== X-Gm-Message-State: AAQBX9fnsv2ALfv91+sTgrSfXGFQV1KMWnNkwVxThfLCBy4ukITFdVCX QGU1P8tW2bnRVASvnS6rt1U= X-Received: by 2002:ac2:554a:0:b0:4ec:89d3:a8ae with SMTP id l10-20020ac2554a000000b004ec89d3a8aemr60754lfk.47.1681507445270; Fri, 14 Apr 2023 14:24:05 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id m11-20020a056512014b00b004ecad67a925sm961263lfo.66.2023.04.14.14.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 14:24:04 -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 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Date: Fri, 14 Apr 2023 23:23:54 +0200 Message-Id: <20230414212356.9326-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?1763188522298692758?= X-GMAIL-MSGID: =?utf-8?q?1763188522298692758?= 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 --- .../bindings/net/wireless/qcom,ath11k.yaml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml index 7d5f982a3d09..ed660d563e09 100644 --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml @@ -78,6 +78,24 @@ properties: items: - const: wlan-smp2p-out +patternProperties: + "^radio@[0-2]$": + type: object + + allOf: + - $ref: ieee80211.yaml# + + properties: + nvmem-cells: + items: + - description: NVMEM cell with the MAC address + + nvmem-cell-names: + items: + - const: mac-address + + unevaluatedProperties: false + required: - compatible - reg @@ -378,6 +396,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 Fri Apr 14 21:23:55 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: 83573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp672591vqo; Fri, 14 Apr 2023 14:32:06 -0700 (PDT) X-Google-Smtp-Source: AKy350bfwpX/sa5twYrv/IqrlkgQGY+1d+7K0ndD8e/WvtBu5RMTzw/Xcn/OBoSGbf3LF6ydbpln X-Received: by 2002:a17:902:ab0a:b0:1a1:d5fd:1e9a with SMTP id ik10-20020a170902ab0a00b001a1d5fd1e9amr3466959plb.40.1681507925995; Fri, 14 Apr 2023 14:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681507925; cv=none; d=google.com; s=arc-20160816; b=gnIkssPwSblUHhLZ5sp8Gz8ZxGke1pit/0UVBVU5aapRdkov7R3GO2T1l5QN+Jtzax 6eFMcuJQuOzYTmCZqO/H7X9hJt0MkM23kVba635wjCtcomO/YNjQ51dDxl3JuofX/BeF rUnh646O3e+0V5WbP8JoxV5VR4sskUPKJvoLiLZfXpYjnWTdZ0h01ijmJ4awNSDCobH/ vLkRqUxq8oRmrjWTe7AwcJY8lmXatRIlGss6nH7hQS70EvG3q8aJyxRbMJWSALLct7Cj YL9jyPiLixtintxXddFka2H9WfQcgKYpvYkPCoUjh2VtT47cEguE2zjvmG6zbaoJf6yD cuow== 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=dLSgyp6r7B2Wr2gF1ypT8W2rSHdADaYvtUhMK1jMLL+ZABn2jrz1pDJ2NThBES2p3N blRKrHR1vqZwtmRFfBZlXcqaakvhZWUFLNcqncFHx+8jPraU389osRZBN7Nhbb/pnUAs 4r0NM6XRbIhK9rY8+0llU4x6fMTn473aZ4V43LrXC9fjufp9gQRbUSPTMfHoTz8l6yV8 EL7Q6COg5F+ciH4eEG2PuND8NJV5ZfQMX4QCw3kMwruezjxaghq9dxEeg2tVxxbqbOFr inWMWtLu7RLkd0FRVzSObHQmw3yEyLn1wwI8qgtmADwlL+2NbJ/lYiSGxHfYsyoleQXS eyyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="r3IQeT7/"; 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 x11-20020a170902ec8b00b001a66c501a3csi5830779plg.154.2023.04.14.14.31.50; Fri, 14 Apr 2023 14:32: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="r3IQeT7/"; 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 S230146AbjDNVYO (ORCPT + 99 others); Fri, 14 Apr 2023 17:24:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbjDNVYK (ORCPT ); Fri, 14 Apr 2023 17:24:10 -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 CE6B272AA; Fri, 14 Apr 2023 14:24:08 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4ec817735a7so65959e87.3; Fri, 14 Apr 2023 14:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681507447; x=1684099447; 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=r3IQeT7/hjmVw1V1jC+isz9z9kdwxJ3mht6m/lu8GQwCjPmwoLCpfXqhMvsge61d8S 5r6XwNKntpTT5kkI48rSOsfyDkRQpc5UFdx8wox0SjourRS1tPgw4VAnIUtqC7MURSO6 kFregwbsNpCn/nPLpr+qg4w5sDHsb1z2BwzFj9Pts/yYihvTGpclni/4RIskockWh1fl v5XdcF0db7oidNvT79jhsgD1D5SlwdrDuI0szUckcCEJt1naA2R+/cPIdDKCaNR409NJ xuQCkp1kmiXGs4Cyc4V8UtPi6a2V3aoMF7mK/sWHlsC+jy65NcZsuRXxuqo3KPIYGnJi wQbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681507447; x=1684099447; 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=LAengAPRwlhFPgVEiZ2qYEN3JqkpcruMqs62ORicI0pBBDmucyLaumuAamXmfuYSXc FCwfKRBJjV8krji4xyF5zeb5yPLkSE2ll0/FUVhRFWhh+MdvToEdCSBHwAq6KFqRVTvv u+FF48gLJR4RT2pXXW+ESc7R47n1lj/MfEmXxoSrl7GWfr68frnmOztRlqIwxA+yJRsw R/Ww/fqcCqcI8ATEt8qPX+jKu7HqAiQ/kgqTTcCekewlAgzWdIKe0ZutUMiNCCyWND/V +bDnCNIzLa6WGE+xuIi5wxMUhGqQkjibBcbvpz8e6EHGKkl2T6xJ2uEpEdqm3uDXfvW0 4zRQ== X-Gm-Message-State: AAQBX9csch7PwGJlAqg1Ml5yRjTHccxgdWsHD0YJOUd4plKytFJm5s+K fbIjKqnZOSkAMwHtnqU0YSA= X-Received: by 2002:a19:a40e:0:b0:4e8:3f38:7d21 with SMTP id q14-20020a19a40e000000b004e83f387d21mr54986lfc.28.1681507447134; Fri, 14 Apr 2023 14:24:07 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id m11-20020a056512014b00b004ecad67a925sm961263lfo.66.2023.04.14.14.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 14:24:06 -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 2/3] wifi: ath11k: look for DT node for each radio Date: Fri, 14 Apr 2023 23:23:55 +0200 Message-Id: <20230414212356.9326-2-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230414212356.9326-1-zajec5@gmail.com> References: <20230414212356.9326-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?1763188854658232822?= X-GMAIL-MSGID: =?utf-8?q?1763188854658232822?= 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 Fri Apr 14 21:23:56 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: 83572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp670308vqo; Fri, 14 Apr 2023 14:26:52 -0700 (PDT) X-Google-Smtp-Source: AKy350ZHKGLmGsaJr/HDahwnAScyZGIZZMbzSEqpBZasEziUStS9cRc74d5qBcIW4pIRonpsbCTc X-Received: by 2002:a17:902:cec4:b0:1a5:2993:8aa6 with SMTP id d4-20020a170902cec400b001a529938aa6mr4870640plg.63.1681507612163; Fri, 14 Apr 2023 14:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681507612; cv=none; d=google.com; s=arc-20160816; b=euVjboyug2dPuru1YaBnQoDQP5BkE/Wm+TKunzdSqdmyeqSTXsOcxbJOmFc5kvBlMq 3HGTI0KmdCCBHM0t3oZHzIJ9pzNzOg9QecLqg/rjPv1zUGlnn8EgfA3HFGqz0XrK5b7P jU1H1W/G2oocoxpU+51YWLlTMXrs9YtaOWObgbQPQLXjGtK2Y2XGn968QwqqRnKcbNrF u73jTuzsfHs23PfpF2MrAmp7ihyJQP4s37XFlo4FUDUUUriD8vVrl1tR5j2fEPKPx3iV sULYBUOiCDt2bgg8LuFF3KpbnqLHOHjBUn7Sf9PneitPH9f8eNrlVzkV03C7eV4HL/vP Qk3A== 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=kl9tJjgh2rMqdxi8Ibi1pwt66R2bBumghlWJ91s/w1gj7TYirTL4gEmWGT3jMXN1OP +eJCuxLtTtHPAA6YMKIoM+0abOXn9e9wM7ZGfPkpfrtyZ8TGd7Qv50raFvg64Gth1a9A B8tFuVm4HpOBe3dxYe8o+wQEYS7MCYIgW0vbGkUbB2J2pYBtDFyGM9V9HeXi24FbINbg tCFOHRdUIBSa8Bi1b3l6NoPA8p0lKtYCugXqhxd3i7e5CFJmpOlYm1tFYG6TVgIcDu1x xjpZ4pgWxdOSPSctd91dLkDKJilvpFMd9jbUjpfz3BbMgV53LE+CWqCIZaDDiNXs2ZyS CmDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=f4bXWIVQ; 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 f14-20020a170902ce8e00b001a64cea27f9si5934711plg.399.2023.04.14.14.26.37; Fri, 14 Apr 2023 14:26:52 -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=f4bXWIVQ; 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 S230209AbjDNVYZ (ORCPT + 99 others); Fri, 14 Apr 2023 17:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230147AbjDNVYN (ORCPT ); Fri, 14 Apr 2023 17:24:13 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B285D6A70; Fri, 14 Apr 2023 14:24:11 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4ec81245ae1so62156e87.0; Fri, 14 Apr 2023 14:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681507449; x=1684099449; 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=f4bXWIVQdBvGSTrlBLVpdjpmOpLlf/2zdUUYvWsYmqr1oM2sa0uOWGdPjMUDAYU19/ 9FRa/pjk5Bh3ItGibXEqYg/jPR8uXoOme2v5qsFilkyI+hJuLgtAaAP9vRbRD8YPJ9TP TpQqaHKYS5JmhzpF/ivSf9LXQccZOYBd1u4hUxOGwpamErBL0Cep+J/a0+Wzl1LRhsXm jWv/tCmWNbN8VVWD7Zo+g7mvIMoZqGYJgXlSuc4an0E+nlmGC6kqB1X3Cnjq0IEAEZvq IRQerQ4SWmll4wSfdfNPParLM5LNk7Abli51mYfUvneX2An3VzgOyeQvd75oQzfsFTTK 9e7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681507449; x=1684099449; 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=L33sktSagTnIN+jS7RSlkaqsQtjDUMBQ2Tl+55arRAgqWxdLlU6jhFCBy5vAgNqHwy pNbvLKHZ4X0z2qc7CbKw4bUmMWPa5njqLUjKwLItstX0H0+u3lVZDbg8+fA7etXyA9Of cc6zDflrl37qBvS4zZIF9cPvl9hnesTVSDG6F5oLuta0LBqTmY6aUat6CX4jssn4jXC/ cWKI2k376nF8/obV5XjjhpiJAJyeyCUED9pV7gsqowIlOPBe4dqPB3dYubGMytWeeVQt m1Uljdkupr5PXM/+tJFt1pfA5PQCBn8pR8AiIz3kEPU8WZZT65OOaSSdagChZswEoAeS EUXg== X-Gm-Message-State: AAQBX9fd/SXRr/o8na+YSqZ1tp8AGv8jPGpr/XFjDytM7pPkOVqKx9lz +4jYsaYNh5m+NUFBrSYV+Z8= X-Received: by 2002:a19:7003:0:b0:4db:3605:9bd3 with SMTP id h3-20020a197003000000b004db36059bd3mr55621lfc.17.1681507449498; Fri, 14 Apr 2023 14:24:09 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id m11-20020a056512014b00b004ecad67a925sm961263lfo.66.2023.04.14.14.24.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 14:24:09 -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 3/3] wifi: ath11k: support reading radio MAC from DT Date: Fri, 14 Apr 2023 23:23:56 +0200 Message-Id: <20230414212356.9326-3-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230414212356.9326-1-zajec5@gmail.com> References: <20230414212356.9326-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?1763188525405381237?= X-GMAIL-MSGID: =?utf-8?q?1763188525405381237?= 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; }