From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4794DEE49AA for ; Tue, 22 Aug 2023 11:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dVfUvObhAz+djwUt+LKfv211c6TlTp6dc0Mg7OFi4zM=; b=PE4SKUoH3uKYwH 5ZZ/px3pz57Hresov8s5UmHozQNUSLnbNjRb8ibsiG6uy27KP+7oO4wD+hM2nUTbOM+PNjBifipxt 5doqriMWyvrh1PWjNDRfHvSJgXGlyJu5XQsUn4EGpMK6X4FNz16tEXxWK1MMvyVW5khO8JFbgT0RC RHm40XXb+BU+YUsiIMNRQIbDXdmRohCVz1A4/OmaQh6aPC/RXhvpawgjNKu2Klw5vVG2FDuQ3zWC6 h0zH9WKecWMR6oQv60s1s9spapAJNU51tmAwwmbyp5jMyxk/qZ3YplbqLk2OH4IZ+Lz9F2+rO2rqe vtvA1ChS3UlOi+++qChw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYPgX-00Fpky-24; Tue, 22 Aug 2023 11:36:33 +0000 Received: from pidgin.makrotopia.org ([185.142.180.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qYPgT-00Fpis-1N; Tue, 22 Aug 2023 11:36:32 +0000 Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qYPg5-0006wL-27; Tue, 22 Aug 2023 11:36:06 +0000 Date: Tue, 22 Aug 2023 12:35:47 +0100 From: Daniel Golle To: Rob Herring Cc: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , 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: Re: [PATCH net-next v3 1/2] dt-bindings: mt76: support setting per-band MAC address Message-ID: References: <20230811190944.GA3730441-robh@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230811190944.GA3730441-robh@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230822_043629_459081_37A2F894 X-CRM114-Status: GOOD ( 32.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 11, 2023 at 01:09:44PM -0600, Rob Herring wrote: > On Mon, Jul 31, 2023 at 11:23:16PM +0100, Daniel Golle wrote: > > 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 > > What's this? Not a documented property. Maybe it should be documented then...? See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/core/of_net.c#n140 ``` int of_get_mac_address(struct device_node *np, u8 *addr) { int ret; if (!np) return -ENODEV; ret = of_get_mac_addr(np, "mac-address", addr); if (!ret) return 0; ret = of_get_mac_addr(np, "local-mac-address", addr); if (!ret) return 0; ret = of_get_mac_addr(np, "address", addr); if (!ret) return 0; return of_get_mac_address_nvmem(np, addr); } EXPORT_SYMBOL(of_get_mac_address); ``` > > > > + > > + local-mac-address: true > > + > > + mac-address: true > > You really need a ref to the schema defining these. But first we need to > split them out from ethernet-controller.yaml. Which I think there were > patches for, but it stalled out. > I understand, so have a schema to include whenever of_net.c is used to assign a MAC address, and then use that for ethernet-controller.yaml and in places such as here. If you point me to the existing patches I can pick them up and address whatever needs to be addressed to get them merged. > Anyways, it's fine for now if you're not up for that. So just remove the (supposedly deprecated) "address: true" for now and then create an of_net MAC-address related schema and move things there after that? > > > + > > 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"; > > + }; > > }; > > }; > > > > -- > > 2.41.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel