Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp657947rwb; Thu, 27 Jul 2023 20:02:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlHjhoPPKbnP2fm99q+Fqi7xChVTqG+qlKNDGHR6nNkDdZ5gQ2econEtP0oDc741MnJI7Evs X-Received: by 2002:a05:6870:8988:b0:1ba:c3a2:fb71 with SMTP id f8-20020a056870898800b001bac3a2fb71mr1689846oaq.31.1690513363888; Thu, 27 Jul 2023 20:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690513363; cv=none; d=google.com; s=arc-20160816; b=HT/+H+yJQYLnF0JeV0MeHodNTKwlUoDAEmyYlt5Rx4rLYZb+Ax6eeHavLSz3DyW4mA DYevuefke9MukGxJL5ok1/kw6Zz/ZaV6L3pfvwjwo9S5qfQpFmV0irr14oKh52TS6EvT gC10J4vZOLMSjl4SrbuZVyZE0amKC8QRDBNAKgv6ntVc3L8R46KZfQqlAksvwvZtlHAI y0KUhHllh8nyRCduB1DrkFLAGWo+TQ9u2LFfAyJmIDKxc4rfq3GEqHJDcN1sRcTmp17h ii5XzigZzRRf1MxX6nqv0hRz95iBzInkJnuQ7CDP4THyEH66LwE1GH2jwVD7LmKjeMi7 31yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date; bh=s5czhoY0QA5LabiZCh+g7FAzobi8i+egQsMxPk6ZR+w=; fh=6uHf4Rb4DHDahIqS26h0Nic47hqd8K43WIkuK37Vo4Y=; b=l+1E5JecdcNSEGC+T9/9KDIesDOR4jVqdFXjF1CqMdbQ9oSQrgoqxGc+pFtYYtukf2 BI+VNF7FyDXzYCUE2UOPXiXXEWtY9jk1vtfAvctZMkUtZf4F0QlfZwpuwU47uCcQ7IBO 0tN07b7+Z6HSw4on3LTWi3yBBcDHWDBjck0whO3ZdOb2KBab4wK8SbR8kiMijH8FQM4V bhv9GnnJTIqgROVoS2gXquNyuqdyC7hB8zGqwmASAj2UYxorMq+TF/gCq4UDEAZkWH0l q0Dw6tLOINjcCzA/xTwR1DdjSQJeMOLAVOl4qaSUWh1dlJNz/bphsAlsJTvuy2u1qEQC CsIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v12-20020a65568c000000b005533ac674a9si2155582pgs.286.2023.07.27.20.02.29; Thu, 27 Jul 2023 20:02:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231931AbjG1CvR (ORCPT + 59 others); Thu, 27 Jul 2023 22:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbjG1CvQ (ORCPT ); Thu, 27 Jul 2023 22:51:16 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C12CE2139; Thu, 27 Jul 2023 19:51:13 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qPDZ9-00008m-1J; Fri, 28 Jul 2023 02:50:55 +0000 Date: Fri, 28 Jul 2023 03:50:47 +0100 From: Daniel Golle To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 1/2] dt-bindings: mt76: support setting per-band MAC address Message-ID: <6e9cfac5758dd06429fadf6c1c70c569c86f3a95.1690512516.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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-wireless@vger.kernel.org Introduce support for setting individual per-band MAC addresses using NVMEM cells by adding a 'bands' object with enumerated child nodes representing the 2.4 GHz, 5 GHz and 6 GHz bands. In case it is defined, call of_get_mac_address for the per-band child node, otherwise try with of_get_mac_address on the main device node and fall back to a random address like it used to be. While at it, add MAC address related properties also for the main node and update example to use EEPROM via nvmem-cells instead of deprecated mediatek,mtd-eeprom property. Signed-off-by: Daniel Golle --- .../bindings/net/wireless/mediatek,mt76.yaml | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml b/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml index 252207adbc54c..2474f4f7e34b0 100644 --- a/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml +++ b/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml @@ -37,6 +37,12 @@ properties: description: MT7986 should contain 3 regions consys, dcm, and sku, in this order. + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + interrupts: maxItems: 1 @@ -72,13 +78,23 @@ properties: ieee80211-freq-limit: true + address: true + + local-mac-address: true + + mac-address: true + nvmem-cells: + minItems: 1 items: - description: NVMEM cell with EEPROM + - description: NVMEM cell with the MAC address nvmem-cell-names: + minItems: 1 items: - const: eeprom + - const: mac-address mediatek,eeprom-data: $ref: /schemas/types.yaml#/definitions/uint32-array @@ -213,6 +229,30 @@ properties: description: Half-dBm power delta for different numbers of antennas +patternProperties: + '^band@[0-2]+$': + type: object + additionalProperties: false + properties: + reg: + maxItems: 1 + + address: true + local-mac-address: true + mac-address: true + + nvmem-cells: + description: NVMEM cell with the MAC address + + nvmem-cell-names: + items: + - const: mac-address + + required: + - reg + + unevaluatedProperties: false + required: - compatible - reg @@ -225,10 +265,13 @@ examples: #address-cells = <3>; #size-cells = <2>; wifi@0,0 { + #address-cells = <1>; + #size-cells = <0>; compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; ieee80211-freq-limit = <5000000 6000000>; - mediatek,mtd-eeprom = <&factory 0x8000>; + nvmem-cells = <&factory_eeprom>; + nvmem-cell-names = "eeprom"; big-endian; led { @@ -257,6 +300,20 @@ examples: }; }; }; + + band@0 { + /* 2.4 GHz */ + reg = <0>; + nvmem-cells = <&macaddr 0x4>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + /* 5 GHz */ + reg = <1>; + nvmem-cells = <&macaddr 0xa>; + nvmem-cell-names = "mac-address"; + }; }; }; -- 2.41.0