From patchwork Mon Jul 31 22:23:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13335548 X-Patchwork-Delegate: nbd@nbd.name Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D2FFC04A94 for ; Mon, 31 Jul 2023 22:23:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231150AbjGaWXz (ORCPT ); Mon, 31 Jul 2023 18:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbjGaWXy (ORCPT ); Mon, 31 Jul 2023 18:23:54 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4549812B; Mon, 31 Jul 2023 15:23:53 -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 1qQbIe-0002Rs-10; Mon, 31 Jul 2023 22:23:37 +0000 Date: Mon, 31 Jul 2023 23:23:16 +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 net-next v3 1/2] dt-bindings: mt76: support setting per-band MAC address Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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. Signed-off-by: Daniel Golle --- Changes since v2: * drop items list with only a single item Changes since v1: * add dt-bindings .../bindings/net/wireless/mediatek,mt76.yaml | 58 ++++++++++++++++++- 1 file changed, 57 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..7eafed53da1de 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,29 @@ 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: + const: mac-address + + required: + - reg + + unevaluatedProperties: false + required: - compatible - reg @@ -225,10 +264,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 +299,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"; + }; }; };