From patchwork Thu Nov 24 11:15:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 25453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3333995wrr; Thu, 24 Nov 2022 03:22:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tLeIlyvQOOw8uPVFQZrVNW67f0s8neyAYsS3n3tFVZgfdwUBxeDanOWIuAOimK3j6YrrX X-Received: by 2002:a05:6a00:2c87:b0:562:e790:dfe0 with SMTP id ef7-20020a056a002c8700b00562e790dfe0mr34450986pfb.16.1669288960252; Thu, 24 Nov 2022 03:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669288960; cv=none; d=google.com; s=arc-20160816; b=fI8WFXYhjAqGWSxEyAZrQR07Bl1bnr1M2ryZX3Al2pmLRotwTRT4L3EL+XSDUa+4tJ JJtHFU0KcloyQNde3bDUrttXEcB1TGZw5CnRlEWMIB/d8Qf2lPV9AfSZ8bAwU2B0ytEf bgdQqpUu92dnUnzfJt5vSJbXfk6EiExNaOLeEqPjzq81Bmu/FxXE06QgC1Y6cwcilrk2 9S79u3pQw6rJyuoP4L6uxd45wNcI4Hl1fDMPiMIcD2geBO6FPR5mZO8vzU4IoLxQIkIr xGrqKkyEGtKDkvsMXP0Siyf89oHGQ+KppOOL76F9xnKdZCoDJL0aJloac3YQsZZf80PQ m1Jg== 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=MoXoOBgoqLKm04ioCway0yV4BL/d9ZBN4dkNElWwDRE=; b=NO7qfiFhYFyb2GmAzMqSO5J97WTtWFt8QpTI6qKIC55xX8YhfR5lxjmbYDtpUEufL3 TODqbtoyeh4rGLgK42w4u5vPTTrOIUfZ02UCek6o6SCIemPY03D3CfaRn2h1n7rkJ1DT C7GT2jdhfdI0cepgGxJaG9UxSHcesbIv07UI5NeCNHZgyl1ihSjwJzs9sg1vrmsUmU0O +CHW7OROHq7m4C0Z0CLtek244Gw44Gu7gs22p1tx6AO6VmRukQEdYj1UQwjCJnrB3RDw 7PA1YZ1+hT0B9xh9+7EIfRhm8Sy+dg5yudqutAVHYM1tZS50f82FriQScZd//SoKVX81 Uflw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=n+x5z0mk; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a63f010000000b0047701022c7dsi1097215pgh.729.2022.11.24.03.22.27; Thu, 24 Nov 2022 03:22:40 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b=n+x5z0mk; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbiKXLQM (ORCPT + 99 others); Thu, 24 Nov 2022 06:16:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230013AbiKXLQH (ORCPT ); Thu, 24 Nov 2022 06:16:07 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D89C6F80D; Thu, 24 Nov 2022 03:16:04 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 43B231C0017; Thu, 24 Nov 2022 11:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669288563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MoXoOBgoqLKm04ioCway0yV4BL/d9ZBN4dkNElWwDRE=; b=n+x5z0mkgFB5Od5zIPKjH1Eu1g7DFQ646CwWPGzL0xEcxXi+vXEjpJV66KRx57uxmyJE4V yVg9wfM5aJNu30BckLlBZRKvc/tLP0QNw9XeO0N5JaNSfdXuFt/xXzefOCfP7srFumO2ss xAq2pY98HmHEQFV9CXJfJC0vhhUsWjN17X6woqtkKME54udjrs6YB5Q9We4oWKsjIkkI0+ OPdWmc/CEtP9wA6TauNtLCTlgxjphIa8Y6mi6n9Lpk81Bzf80OrFnEPCLo74VzZ6b7Azzq WYZ1SW0UoDotxZOphbpkZ7tgjhA/i10IFAC2vNgcTrpfPeWWw3ee6o+pwBx0ZA== From: Miquel Raynal To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Marcin Wojtas , , , Vadym Kochan , Miquel Raynal , Taras Chornyi , Rob Herring Subject: [PATCH net-next v2 1/7] Revert "dt-bindings: marvell,prestera: Add description for device-tree bindings" Date: Thu, 24 Nov 2022 12:15:50 +0100 Message-Id: <20221124111556.264647-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221124111556.264647-1-miquel.raynal@bootlin.com> References: <20221124111556.264647-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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?1750376340565192043?= X-GMAIL-MSGID: =?utf-8?q?1750376340565192043?= This reverts commit 40acc05271abc2852c32622edbebd75698736b9b. marvell,prestera.txt is an old file describing the old Alleycat3 standalone switches. The commit mentioned above actually hacked these bindings to add support for a device tree property for a more modern version of the IP connected over PCI, using only the generic compatible in order to retrieve the device node from the prestera driver to read one static property. The problematic property discussed here is "base-mac-provider". The original intent was to point to a nvmem device which could produce the relevant nvmem-cell. This property has never been acked by DT maintainers and fails all the layering that has been brought with the nvmem bindings by pointing at a nvmem producer, bypassing the existing nvmem bindings, rather than a nvmem cell directly. Furthermore, the property cannot even be used upstream because it expected the ONIE tlv driver to produce a specific cell, driver which used nacked bindings and thus was never merged, replaced by a more integrated concept: the nvmem-layout. So let's forget about this temporary addition, safely avoiding the need for any backward compatibility handling. A new (yaml) binding file will be brought with the prestera bindings, and there we will actually include a description of the modern IP over PCI, including the right way to point to a nvmem cell. Cc: Vadym Kochan Cc: Taras Chornyi Signed-off-by: Miquel Raynal Acked-by: Rob Herring Acked-by: Krzysztof Kozlowski --- .../bindings/net/marvell,prestera.txt | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/Documentation/devicetree/bindings/net/marvell,prestera.txt b/Documentation/devicetree/bindings/net/marvell,prestera.txt index e28938ddfdf5..83370ebf5b89 100644 --- a/Documentation/devicetree/bindings/net/marvell,prestera.txt +++ b/Documentation/devicetree/bindings/net/marvell,prestera.txt @@ -45,37 +45,3 @@ dfx-server { ranges = <0 MBUS_ID(0x08, 0x00) 0 0x100000>; reg = ; }; - -Marvell Prestera SwitchDev bindings ------------------------------------ -Optional properties: -- compatible: must be "marvell,prestera" -- base-mac-provider: describes handle to node which provides base mac address, - might be a static base mac address or nvme cell provider. - -Example: - -eeprom_mac_addr: eeprom-mac-addr { - compatible = "eeprom,mac-addr-cell"; - status = "okay"; - - nvmem = <&eeprom_at24>; -}; - -prestera { - compatible = "marvell,prestera"; - status = "okay"; - - base-mac-provider = <&eeprom_mac_addr>; -}; - -The current implementation of Prestera Switchdev PCI interface driver requires -that BAR2 is assigned to 0xf6000000 as base address from the PCI IO range: - -&cp0_pcie0 { - ranges = <0x81000000 0x0 0xfb000000 0x0 0xfb000000 0x0 0xf0000 - 0x82000000 0x0 0xf6000000 0x0 0xf6000000 0x0 0x2000000 - 0x82000000 0x0 0xf9000000 0x0 0xf9000000 0x0 0x100000>; - phys = <&cp0_comphy0 0>; - status = "okay"; -}; From patchwork Thu Nov 24 11:15:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 25454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3334240wrr; Thu, 24 Nov 2022 03:23:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4BVd2PIslsyNlv6oIkaX8ZUUslBLScRabTT48uWGb1UaWWXSHXz1gHFSdMiYB5Wi5x8NzE X-Received: by 2002:a63:f003:0:b0:45f:bf86:c917 with SMTP id k3-20020a63f003000000b0045fbf86c917mr30119879pgh.201.1669288983028; Thu, 24 Nov 2022 03:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669288983; cv=none; d=google.com; s=arc-20160816; b=tUgRtFvI09u2MB7Nh/Ba8Yk4CXCcncFag2kbfM9GLXrWm9PZWhuZ823JFg8Pzs9pi8 joKbZcWfDIk/5xB+6KeNosfHCQOxIhfwK4nbBYn0CCl0uafqjErx1zFjBtA+HTw5h/KH iMQhnK4eCVqqBmnRtAjxOQ85sMcgChMc2sjTIrkhqizzIYGSmoHI84zlG2zqhlQGMd07 yoNbo+rN1p7nLEJhswEe+r2T8Z4UZhSkOiBw3mhz+iE2uQZXmbLK7Ud2JlLoG+PlwIP3 iJHMt8xsL2FPRjdgHMLS0JaGEjeqWjQyVCD61eb/rLTDmO6T+kq+YFl1HlcqtS0ho4kz ZyKA== 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=wAx8VtTdz4qwIpgQj6QKnIjD5MlND5gXjXhbAzs+LZw=; b=DA2SnicJGT8Q5E8cEx86iCvPbP56PTz6Wl1XfzwbryUcD1T8UGNSwTWAGT8Zy1GlNx 6+6in7PKtAAl/LkpuE6LB85yhCXlE6u95CvJSE01A/lNWwlxnnarERt5FHTr3O68geun E1Rkn4UqdpAau1G8hdm+pqJCgp002azZjgHxAslL1hmfRvMralp/y9rEo5GFVzGMp3E2 1IauOM3dhgaeTfBVas9tWXouDdfnvgSxx/nfRvgsyQ7+Er7bKLjru4tIYmrESaJhtGU0 iGyv5rSyyNqYmC9UTXSuw7Vt4roJJIM4g8wrUFkhMVfAhq6mE7CiOBUbHsNjZrOhQRFu mZ5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=lRbAy1VF; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a639d02000000b0043c0b4f2b68si1103352pgd.318.2022.11.24.03.22.49; Thu, 24 Nov 2022 03:23:03 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b=lRbAy1VF; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbiKXLQS (ORCPT + 99 others); Thu, 24 Nov 2022 06:16:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229829AbiKXLQK (ORCPT ); Thu, 24 Nov 2022 06:16:10 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5954F6F801; Thu, 24 Nov 2022 03:16:09 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 846881C0015; Thu, 24 Nov 2022 11:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669288568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wAx8VtTdz4qwIpgQj6QKnIjD5MlND5gXjXhbAzs+LZw=; b=lRbAy1VF1dKDs7kpuf9TWgf81sL6Qv/MZQY4zGhvLdtm0UyHfC8hdVSrKp+rRF2NIgbHJB jyngQajMS8US3CAO8hW/8m3OhXZKPmKIbnGWB/7kBmeZYJ1/YmkTg1/Hi7ctdu26z/aMhE rnnvlt3nqcrV0xQse4qWGRra4CLes0m9vLvcXKkmSjZimxTCOaIDHS1pmpKN7TeXk/JDIk h2TakiF23+yU9Xpi6k/+IwxlOeB/isqLDtxD+17M4hgQQ87pjfD7duNzOjDpmI25M/NDtT WTrHN0dSrBhJH4XzOzN1TNAmPVAvPl+mLQZmgguqbEbVRnFsiM6rojT4A1idpQ== From: Miquel Raynal To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Marcin Wojtas , , , Vadym Kochan , Miquel Raynal Subject: [PATCH net-next v2 2/7] dt-bindings: net: marvell,dfx-server: Convert to yaml Date: Thu, 24 Nov 2022 12:15:51 +0100 Message-Id: <20221124111556.264647-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221124111556.264647-1-miquel.raynal@bootlin.com> References: <20221124111556.264647-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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?1750376364595581655?= X-GMAIL-MSGID: =?utf-8?q?1750376364595581655?= Even though this description is not used anywhere upstream (no matching driver), while on this file I decided I would try a conversion to yaml in order to clarify the prestera family description. I cannot keep the nodename dfx-server@xxxx so I switched to dfx-bus@xxxx which matches simple-bus.yaml. Otherwise I took the example context from the only user of this compatible: armada-xp-98dx3236.dtsi, which is a rather old and not perfect DT. Signed-off-by: Miquel Raynal Reviewed-by: Krzysztof Kozlowski --- .../bindings/net/marvell,dfx-server.yaml | 62 +++++++++++++++++++ .../bindings/net/marvell,prestera.txt | 18 ------ 2 files changed, 62 insertions(+), 18 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/marvell,dfx-server.yaml diff --git a/Documentation/devicetree/bindings/net/marvell,dfx-server.yaml b/Documentation/devicetree/bindings/net/marvell,dfx-server.yaml new file mode 100644 index 000000000000..8a14c919e3f7 --- /dev/null +++ b/Documentation/devicetree/bindings/net/marvell,dfx-server.yaml @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/marvell,dfx-server.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Marvell Prestera DFX server + +maintainers: + - Miquel Raynal + +select: + properties: + compatible: + contains: + const: marvell,dfx-server + required: + - compatible + +properties: + compatible: + items: + - const: marvell,dfx-server + - const: simple-bus + + reg: + maxItems: 1 + + ranges: true + + '#address-cells': + const: 1 + + '#size-cells': + const: 1 + +required: + - compatible + - reg + - ranges + +# The DFX server may expose clocks described as subnodes +additionalProperties: + type: object + +examples: + - | + + #define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16)) + bus@0 { + reg = <0 0>; + #address-cells = <2>; + #size-cells = <1>; + + dfx-bus@ac000000 { + compatible = "marvell,dfx-server", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 MBUS_ID(0x08, 0x00) 0 0x100000>; + reg = ; + }; + }; diff --git a/Documentation/devicetree/bindings/net/marvell,prestera.txt b/Documentation/devicetree/bindings/net/marvell,prestera.txt index 83370ebf5b89..8868d774da67 100644 --- a/Documentation/devicetree/bindings/net/marvell,prestera.txt +++ b/Documentation/devicetree/bindings/net/marvell,prestera.txt @@ -27,21 +27,3 @@ switch { dfx = <&dfx>; }; }; - -DFX Server bindings -------------------- - -Required properties: -- compatible: must be "marvell,dfx-server", "simple-bus" -- ranges: describes the address mapping of a memory-mapped bus. -- reg: address and length of the register set for the device. - -Example: - -dfx-server { - compatible = "marvell,dfx-server", "simple-bus"; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0 MBUS_ID(0x08, 0x00) 0 0x100000>; - reg = ; -}; From patchwork Thu Nov 24 11:15:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 25458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3334447wrr; Thu, 24 Nov 2022 03:23:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf6CrCxYX2S/OSDdXR1Sv9f5CXSBbyvChRlHgwqCttXeefwDoPFrgObxvXD5CDxZiUNw2U7r X-Received: by 2002:a05:6a00:1310:b0:561:a494:b299 with SMTP id j16-20020a056a00131000b00561a494b299mr12721341pfu.34.1669289008387; Thu, 24 Nov 2022 03:23:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669289008; cv=none; d=google.com; s=arc-20160816; b=Li8hQqu8akyaWTMedfCEzQUpW1Oo+ExH+5271i2vLUR31AziQoVRGlIVN6GEYZTOPd Imp3YrEPAekpH4rhvLhbXq5Lc19vpIZm8GzMBG/Ke/EZrfR0ADaMehKDS95/vQhHQ4Mf 7VhOmcIEAO76Lp0BgcB5O0SJ58FHgEH98h3WhmAdI8YbgT1aJX0ZZUtxKSLmLCgw/rvp KNjHgjXGjvqibO4kytY0huZ8U02SdIqOCgateiLoCAkL8ko6y2HVjEcWiRJUeUnJxq2p ayXM3P3zgA677QQY05n8VIf8fq9KaOCJtqO8A2IPYcslTq79lxMx5CvkuNxVbJILsfvV SV0A== 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=sUfwpaNCeRDasVfwxiSSAgBGz0/j+6MbKDlN0Gk1jzI=; b=nNrdCnkk4VHC+/tB6Qabjt5CdThJtVP2n36RxcGXC2XB/nm2/2xuWT96/7APFrzLbt vV7ucYM5zf5zP1I7PTWS54p53TxTiuhz1c+cY/JXbACoH671GH6zMjnKuOwMxv0YZQHc o8yjarL4QhPoY03HmdzehEhG0NPLmFWm9h1LpcnQVNXBEdRYozL4Ze4vgybp9tXgJZ+t CGDF19J6Onsal0qPKjZTp6aG4W9G24QShnI+Kj/8svdgXdpmWkcFCKz/EDfI+c2NH5fT 4oHBpQb7QElIdrBacGRAb1jd4O0i5drY8tUKngLMGZYla+xOd8wXj0JnGJMNOlHG1gUR M8LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=HO58oGdH; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i129-20020a625487000000b005726c063927si781293pfb.161.2022.11.24.03.23.15; Thu, 24 Nov 2022 03:23:28 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b=HO58oGdH; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230110AbiKXLQ2 (ORCPT + 99 others); Thu, 24 Nov 2022 06:16:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229829AbiKXLQW (ORCPT ); Thu, 24 Nov 2022 06:16:22 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 376976F81C; Thu, 24 Nov 2022 03:16:12 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 4F01A1C000C; Thu, 24 Nov 2022 11:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669288571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sUfwpaNCeRDasVfwxiSSAgBGz0/j+6MbKDlN0Gk1jzI=; b=HO58oGdHOAg9lX5BowudmuZ//+s888cX7mOBEa1VhxMukX/lHVi47Rga+mhU+E/WOITEfV sLTE2qjZb4WpN+iAXQbEkxINel/1zirQ7WUnzjXNU3I9Bo5KAiaDfBj4Zc4RjgvKn1DzlP RKXy+bElNQD0pfQqLxvkClibmAmbizA3XigLuOn4YV3s/prfYKsyM13hCa8BJ2uBnwqn4o X5GuVc4HihEMyr23fuVf3ymkhx7yo7+GtH3ldT7qrrl454azGm3IcdGFva7y6LVcmwmb8J q7gUm7pNTfYA9y5FRlJgwm+k83RyXblO7xfn/3NngPUAPrVPO4qbRiRHGxqrmw== From: Miquel Raynal To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Marcin Wojtas , , , Vadym Kochan , Miquel Raynal , Rob Herring Subject: [PATCH net-next v2 3/7] dt-bindings: net: marvell,prestera: Convert to yaml Date: Thu, 24 Nov 2022 12:15:52 +0100 Message-Id: <20221124111556.264647-4-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221124111556.264647-1-miquel.raynal@bootlin.com> References: <20221124111556.264647-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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?1750376391408953173?= X-GMAIL-MSGID: =?utf-8?q?1750376391408953173?= The currently described switch family is named AlleyCat3, it is a memory mapped switch found on Armada XP boards. Signed-off-by: Miquel Raynal Reviewed-by: Rob Herring --- .../bindings/net/marvell,prestera.txt | 29 ------------ .../bindings/net/marvell,prestera.yaml | 45 +++++++++++++++++++ 2 files changed, 45 insertions(+), 29 deletions(-) delete mode 100644 Documentation/devicetree/bindings/net/marvell,prestera.txt create mode 100644 Documentation/devicetree/bindings/net/marvell,prestera.yaml diff --git a/Documentation/devicetree/bindings/net/marvell,prestera.txt b/Documentation/devicetree/bindings/net/marvell,prestera.txt deleted file mode 100644 index 8868d774da67..000000000000 --- a/Documentation/devicetree/bindings/net/marvell,prestera.txt +++ /dev/null @@ -1,29 +0,0 @@ -Marvell Prestera Switch Chip bindings -------------------------------------- - -Required properties: -- compatible: must be "marvell,prestera" and one of the following - "marvell,prestera-98dx3236", - "marvell,prestera-98dx3336", - "marvell,prestera-98dx4251", -- reg: address and length of the register set for the device. -- interrupts: interrupt for the device - -Optional properties: -- dfx: phandle reference to the "DFX Server" node - -Example: - -switch { - compatible = "simple-bus"; - #address-cells = <1>; - #size-cells = <1>; - ranges = <0 MBUS_ID(0x03, 0x00) 0 0x100000>; - - packet-processor@0 { - compatible = "marvell,prestera-98dx3236", "marvell,prestera"; - reg = <0 0x4000000>; - interrupts = <33>, <34>, <35>; - dfx = <&dfx>; - }; -}; diff --git a/Documentation/devicetree/bindings/net/marvell,prestera.yaml b/Documentation/devicetree/bindings/net/marvell,prestera.yaml new file mode 100644 index 000000000000..b0a3ecca406e --- /dev/null +++ b/Documentation/devicetree/bindings/net/marvell,prestera.yaml @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/marvell,prestera.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Marvell Prestera AlleyCat3 switch + +maintainers: + - Miquel Raynal + +properties: + compatible: + items: + - enum: + - marvell,prestera-98dx3236 + - marvell,prestera-98dx3336 + - marvell,prestera-98dx4251 + - const: marvell,prestera + + reg: + maxItems: 1 + + interrupts: + maxItems: 3 + + dfx: + description: Reference to the DFX Server bus node. + $ref: /schemas/types.yaml#/definitions/phandle + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + packet-processor@0 { + compatible = "marvell,prestera-98dx3236", "marvell,prestera"; + reg = <0 0x4000000>; + interrupts = <33>, <34>, <35>; + dfx = <&dfx>; + }; From patchwork Thu Nov 24 11:15:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 25459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3335013wrr; Thu, 24 Nov 2022 03:24:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6HkXuXCXlbuVgHOsrm3JenGv1qFtRTyk/qUCaNDiWWr0qPhgUBsz2aLRrnaysv2Ye5k7Fh X-Received: by 2002:a17:90b:2684:b0:218:907c:da24 with SMTP id pl4-20020a17090b268400b00218907cda24mr27755833pjb.18.1669289069830; Thu, 24 Nov 2022 03:24:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669289069; cv=none; d=google.com; s=arc-20160816; b=U2FUYOB9jmlwmRF5R6PiM3fPwa3SVRT2oLlnmkQhq4G9ppp4/ew5eUC6J5rxUtT02k o/8KFeZSOQZ4b3vpkjG+XUJxPS7wmx0SVjCxyf7md5Xd2yY7KWZ0LPTmk+4Ur+JoNvsk YxMD+fRCzXox27ynwtGdeKeGuNER9cAd74D9hdtfmGHHU8Tz+csJNk6Fwwbd6KVZbbu4 FR1RjOLceFfTTVkIdG/+8W+xKX4dWiutOkDNhnwjwqa+j/pK9yrSiPsuWPCaR06BcAYt +Xwk9FEwt/QUXV2yJsb7c0L9LcuB3XJwFkqkh9QVNSkUDCLCx+ooVSpz2eGk36iIKAWG VgbA== 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=HV9/wEcExWLHQQPoN4mFGB5lnbuV27WEICfLca/Ccg0=; b=PDnqpMBXK2OFIrGkQTviTxt5BwjKvecpJ+XhPeDp8ipSrK7dnudlrxCuuDqU0p4RDQ Tg7Mg04bzIowQjFu22YRYydAcqBPWpkYwQBAPjMjViZv/ySUyGrxT3o6zeQrJjXng2kg IdKs+twz+NpZIxkrLIIN4HOeVeEqwAWbgBCB7vgRIByNP2bldk9a4ekDJEAHKc41275o LzNWh6wLwdDSIK8Zod+2lrGGbj/zyaKg6kkF1go1mor5bpYSfUTHIubR/izf0DJA0EtX WOs7LkZtq3LfyBwxDnRqg8U3uzWZOZErb/OlaVUkBpwl6l7hN+2eiLgE8+X4Seunh170 V4og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=dRef3dKV; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a056a00188200b00573f637f587si876937pfh.227.2022.11.24.03.24.16; Thu, 24 Nov 2022 03:24:29 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b=dRef3dKV; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230048AbiKXLQb (ORCPT + 99 others); Thu, 24 Nov 2022 06:16:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbiKXLQ0 (ORCPT ); Thu, 24 Nov 2022 06:16:26 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 223A26F827; Thu, 24 Nov 2022 03:16:15 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 7F04F1C001B; Thu, 24 Nov 2022 11:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669288573; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HV9/wEcExWLHQQPoN4mFGB5lnbuV27WEICfLca/Ccg0=; b=dRef3dKVQm1MjPwdeKlmDsIQg65JK/ItXzI8EhvXIW1WoZcnr2hHPmVN2E5zGsQaEW7cHe OxtGw2q/VyZ0g4sP9IjLnIPizb6/rYqEl/SCzbm5EjybyUq5hgM0G43Cx/QlXohSKoiIlo jX+WH4NEAV5KZBZ6YcJtOhL/SBz8wgdhcgTorCUB43YltD8YXTtahbFQreaeQd3LzxXmUi 3fpR8M/bDW0K+ydZAKhmdrDtmanmq/s9R0dqEhOg1PQq/DDDN4mM8vpvLXtpIAmFQmhAHY 5a8+NHfap3GfF6IAkqJ68mx2nbNSe9/xJxFQUA6T7Ksf6P2XtM+W82qUeYI0XA== From: Miquel Raynal To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Marcin Wojtas , , , Vadym Kochan , Miquel Raynal , Rob Herring Subject: [PATCH net-next v2 4/7] dt-bindings: net: marvell,prestera: Describe PCI devices of the prestera family Date: Thu, 24 Nov 2022 12:15:53 +0100 Message-Id: <20221124111556.264647-5-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221124111556.264647-1-miquel.raynal@bootlin.com> References: <20221124111556.264647-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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?1750376455675632379?= X-GMAIL-MSGID: =?utf-8?q?1750376455675632379?= Even though the devices have very little in common beside the name and the main "switch" feature, Marvell Prestera switch family is also composed of PCI-only devices which can receive additional static properties, like nvmem cells to point at MAC addresses, for instance. Let's describe them. Signed-off-by: Miquel Raynal Reviewed-by: Rob Herring --- .../bindings/net/marvell,prestera.yaml | 62 ++++++++++++++++--- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/net/marvell,prestera.yaml b/Documentation/devicetree/bindings/net/marvell,prestera.yaml index b0a3ecca406e..5ea8b73663a5 100644 --- a/Documentation/devicetree/bindings/net/marvell,prestera.yaml +++ b/Documentation/devicetree/bindings/net/marvell,prestera.yaml @@ -4,19 +4,24 @@ $id: http://devicetree.org/schemas/net/marvell,prestera.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Marvell Prestera AlleyCat3 switch +title: Marvell Prestera switch family maintainers: - Miquel Raynal properties: compatible: - items: + oneOf: + - items: + - enum: + - marvell,prestera-98dx3236 + - marvell,prestera-98dx3336 + - marvell,prestera-98dx4251 + - const: marvell,prestera - enum: - - marvell,prestera-98dx3236 - - marvell,prestera-98dx3336 - - marvell,prestera-98dx4251 - - const: marvell,prestera + - pci11ab,c804 + - pci11ab,c80c + - pci11ab,cc1e reg: maxItems: 1 @@ -28,12 +33,37 @@ properties: description: Reference to the DFX Server bus node. $ref: /schemas/types.yaml#/definitions/phandle + nvmem-cells: true + + nvmem-cell-names: true + +if: + properties: + compatible: + contains: + const: marvell,prestera + +# Memory mapped AlleyCat3 family +then: + properties: + nvmem-cells: false + nvmem-cell-names: false + required: + - interrupts + +# PCI Aldrin family +else: + properties: + interrupts: false + dfx: false + required: - compatible - reg - - interrupts -additionalProperties: false +# Ports can also be described +additionalProperties: + type: object examples: - | @@ -43,3 +73,19 @@ examples: interrupts = <33>, <34>, <35>; dfx = <&dfx>; }; + + - | + pcie@0 { + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x0 0x0 0x0 0x0 0x0 0x0>; + reg = <0x0 0x0 0x0 0x0 0x0 0x0>; + device_type = "pci"; + + switch@0,0 { + reg = <0x0 0x0 0x0 0x0 0x0>; + compatible = "pci11ab,c80c"; + nvmem-cells = <&mac_address 0>; + nvmem-cell-names = "mac-address"; + }; + }; From patchwork Thu Nov 24 11:15:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 25455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3334406wrr; Thu, 24 Nov 2022 03:23:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf63XcMnRh41d3UTlstHo/tBCAdNJC800DTo9L9hWX3y/Qhv5GZTRZU6dMDVeftesgdEBqnE X-Received: by 2002:a63:1d24:0:b0:476:c6c9:5bc2 with SMTP id d36-20020a631d24000000b00476c6c95bc2mr29119989pgd.500.1669289003136; Thu, 24 Nov 2022 03:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669289003; cv=none; d=google.com; s=arc-20160816; b=t/n/7mXmik20/fwPNDEdNk4WUGm5DpoPKqO09TW2tUB9PQvROPHv7nxf0YS4twblFU yYuqjCBJPZCFFrB+maUBh9erVzY+6TOl5xfTPF8oR1BoafpfXfaIC6urvnHFYW9olc1E cBTJc1jNIDavSV73N7N9qHUUqvSkC4LZK3y3e8n6sRp3hKqZionBRoX1SuSwQy87flUV RujSz/syzxPauX5goeExHi/kciDyRq/7ZugtrcXloPuW35bv32dQf7FGYpDnwM9j+jac UF460YJIGJ+MJwqaEGm7Av8RhsUnNzWzze3WX4fAs8rEEf0QEh2iT+hxnVE+UK26ll36 Vt5Q== 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=iqamt5mLLD+qd4tqrrabyPW2zioP4EH/FA6Onx8TCjE=; b=ee1ky0QxrgHZjqDWI+VGiDcUX8Pwv3oE8IThoxQGsRIzUy3aIb6QA/6rSNSXDc+LCq 2Ttrak02kV9vuKz3UIRco24sAjwPz/h64mHchtPVKe7LoZMeRH16fALsDRZkchTkTCh7 246dptrBC2PLQynf1webyd4HAIEBgpzIONgljY4P5hZ6f70vhbCCWiVZp6CMB4km2SAH 47hp1OenDXDyP5RW93nN8qQPxWZDnEGrKyTVhPjWEYoZPSuiDM+hYM3VTEGqj3TEUGbR yPkRRcwsB2w0ZX9Fg9gDjcyHFbKNjj3L/AUxqH2rIrD6sLX6xjXFWVMclPytrsey4rlz WnEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=j8P8jkPB; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq3-20020a17090b380300b00218f6a5328csi2833335pjb.129.2022.11.24.03.23.10; Thu, 24 Nov 2022 03:23:23 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b=j8P8jkPB; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230142AbiKXLQl (ORCPT + 99 others); Thu, 24 Nov 2022 06:16:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230082AbiKXLQ1 (ORCPT ); Thu, 24 Nov 2022 06:16:27 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D5CF6F823; Thu, 24 Nov 2022 03:16:17 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 045551C0011; Thu, 24 Nov 2022 11:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669288575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iqamt5mLLD+qd4tqrrabyPW2zioP4EH/FA6Onx8TCjE=; b=j8P8jkPBu+FFh608QlWPILTFa+HXFsBGw9GL4FtslbZj8suyb485us3KRhMSe0oVmimLxp nu9Zvo9+PK7SdQ9wdwLZ/lWqinBNyEdGA6MEI0vd+uQ6SR0Arpy2tqiBMh/075N/zYbqso IhigVz6HpMNJm2yGSMXR1v+Ow3BpYNV9x0tHCbjPoiiF8paOO1Cs2QGG9sUivAN1vBWp92 cbLtQjD4sykXG8vrCX+AluFLga9zKZ9ZBB/th6bDDP0LKmAb8FDgvOjnqsm1npaTukC24l trzTtU7yqmfBUmSMB3SatGpaXcIPq43/rHD+HXWn6+nB6jPwZbzGTVqF8XUCZw== From: Miquel Raynal To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Marcin Wojtas , , , Vadym Kochan , Miquel Raynal Subject: [PATCH net-next v2 5/7] of: net: export of_get_mac_address_nvmem() Date: Thu, 24 Nov 2022 12:15:54 +0100 Message-Id: <20221124111556.264647-6-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221124111556.264647-1-miquel.raynal@bootlin.com> References: <20221124111556.264647-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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?1750376385661949146?= X-GMAIL-MSGID: =?utf-8?q?1750376385661949146?= Export of_get_mac_addr_nvmem() and rename it to of_get_mac_address_nvmem() in order to fit the convention followed by the existing exported helpers of the same kind. This way, OF compatible drivers using eg. fwnode_get_mac_address() can do a direct call to it instead of calling of_get_mac_address() just for the nvmem step, avoiding to repeat an expensive DT lookup which has already been done once. Eventually, fwnode_get_mac_address() should probably be updated to perform the nvmem lookup directly, but as of today, nvmem cells seem not to be supported by ACPI yet which would defeat this kind of extension. Suggested-by: Marcin Wojtas Signed-off-by: Miquel Raynal --- include/linux/of_net.h | 6 ++++++ net/core/of_net.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/linux/of_net.h b/include/linux/of_net.h index 0484b613ca64..d88715a0b3a5 100644 --- a/include/linux/of_net.h +++ b/include/linux/of_net.h @@ -14,6 +14,7 @@ struct net_device; extern int of_get_phy_mode(struct device_node *np, phy_interface_t *interface); extern int of_get_mac_address(struct device_node *np, u8 *mac); +extern int of_get_mac_address_nvmem(struct device_node *np, u8 *mac); int of_get_ethdev_address(struct device_node *np, struct net_device *dev); extern struct net_device *of_find_net_device_by_node(struct device_node *np); #else @@ -28,6 +29,11 @@ static inline int of_get_mac_address(struct device_node *np, u8 *mac) return -ENODEV; } +static inline int of_get_mac_address_nvmem(struct device_node *np, u8 *mac) +{ + return -ENODEV; +} + static inline int of_get_ethdev_address(struct device_node *np, struct net_device *dev) { return -ENODEV; diff --git a/net/core/of_net.c b/net/core/of_net.c index f1a9bf7578e7..55d3fe229269 100644 --- a/net/core/of_net.c +++ b/net/core/of_net.c @@ -57,7 +57,7 @@ static int of_get_mac_addr(struct device_node *np, const char *name, u8 *addr) return -ENODEV; } -static int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr) +int of_get_mac_address_nvmem(struct device_node *np, u8 *addr) { struct platform_device *pdev = of_find_device_by_node(np); struct nvmem_cell *cell; @@ -94,6 +94,7 @@ static int of_get_mac_addr_nvmem(struct device_node *np, u8 *addr) return 0; } +EXPORT_SYMBOL(of_get_mac_address_nvmem); /** * of_get_mac_address() @@ -140,7 +141,7 @@ int of_get_mac_address(struct device_node *np, u8 *addr) if (!ret) return 0; - return of_get_mac_addr_nvmem(np, addr); + return of_get_mac_address_nvmem(np, addr); } EXPORT_SYMBOL(of_get_mac_address); From patchwork Thu Nov 24 11:15:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 25456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3334426wrr; Thu, 24 Nov 2022 03:23:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ibmKuQtVDsC93f2K/H54bcOXxIHR5TKhjCeOtTFp2WJSYGFz4ijH83FdHyImWgFFQ8aC+ X-Received: by 2002:aa7:928f:0:b0:56d:2e71:449 with SMTP id j15-20020aa7928f000000b0056d2e710449mr14578441pfa.46.1669289005855; Thu, 24 Nov 2022 03:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669289005; cv=none; d=google.com; s=arc-20160816; b=lefWJW8729OpAo8H3QLM22DBeeFqoaEnn1rzarApVIz4TKJMT+EwkM60jbInHRBPDa ivFTNCzleQXoPIMD22rfiL9by7TeG7eX2mTyhBCnsE+XXHums3GOHpk10Z21PpNNls7p I08NX+AFqjxtNnePe0NEdXu0W2lYq7h9bZGVgCm0arbtJVrV+vx8KXWRPrEL3qzonwUS KcvSKu4haewVYsxNtzZfiBz0bLEg6OMGkTopJT4ii9YsGGEDeWyPIIKfpLHJLRnTZnvD z+kxqs3g5SXz2yqRzRrH+VFbSJa7M3+DSuCgjHME50f1AV2z3JouYhN6L0ewTdE+MVsD FLZg== 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=EiTXZxb081Yq5NNkWBz6w6sjlyDhWaDs7oz/56WKrNA=; b=vNHQSNT5HNJof6HvALSLETfjhWfXXsHBYg1gs1qNs5Mue/Rioq8/rQppmibyOWRK7N 99DyKeFDXwu4K6WTIzcEmcW7g0moxpx7E7y1+RnUJJ3WGx1Yp+Bk/8HLNz2v5RVJ9bkB pMwAiIyfEeyPWQlsci6WwZP+UIQ4s6bMLEy0JeC/7tSScPllZPdqFHQ1GWda02/zt2xh dlo9+qG+/Q9bkjiDuAnHeRyUYTmzNUcccHRx/9r4p61cfRf0n5C7D6ncudHB05pc6U1p niD+MmNdxZPa3XlEfYoqXryYJFmqi+A1w5Mn67On0uAn6QSYKhV9KY1r7KW8Ph1R4gFN ZmuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=g6cCQ7NX; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a056a0014c900b00561f40cc9f3si887763pfu.262.2022.11.24.03.23.13; Thu, 24 Nov 2022 03:23:25 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b=g6cCQ7NX; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbiKXLQq (ORCPT + 99 others); Thu, 24 Nov 2022 06:16:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbiKXLQ2 (ORCPT ); Thu, 24 Nov 2022 06:16:28 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC3176F826; Thu, 24 Nov 2022 03:16:19 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 150021C0015; Thu, 24 Nov 2022 11:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669288578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EiTXZxb081Yq5NNkWBz6w6sjlyDhWaDs7oz/56WKrNA=; b=g6cCQ7NXhnUcgl988YxE3QGXEixPtGLZOTuUK6YFKhgWt03pDE5uiY/NST0TATTajDWrAG tmLNkCqwPTXbUcrMY5MMxeZ4aGK5vwVz1drzLyR9XcU46Rx2i9FgfDAA/jAdYLXreJcacz rtmwIWWOdJP4uuOLns20UmGbjUkOB5GeP7hA/kPjwiaRYMtNN/Ep7n9fS/MZqpoJUFC4mD K99iF/a0y/0VQnka/nUlBhZiTsmepsvt5DbTLA5WUbYQNgos7mYmkx/yXVv5BgClYvMfjP LDJr9cemr/bhDxVwjI8zrJE+mMVkmyETxhGLhFOB9nWQU478bPRHLfUGvJauiA== From: Miquel Raynal To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Marcin Wojtas , , , Vadym Kochan , Miquel Raynal Subject: [PATCH net-next v2 6/7] net: marvell: prestera: Avoid unnecessary DT lookups Date: Thu, 24 Nov 2022 12:15:55 +0100 Message-Id: <20221124111556.264647-7-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221124111556.264647-1-miquel.raynal@bootlin.com> References: <20221124111556.264647-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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?1750376388538555158?= X-GMAIL-MSGID: =?utf-8?q?1750376388538555158?= This driver fist makes an expensive DT lookup to retrieve its DT node (this is a PCI driver) in order to later search for the base-mac-provider property. This property has no reality upstream and this code should not have been accepted like this in the first place. Instead, there is a proper nvmem interface that should be used. Let's avoid these extra lookups and rely on the nvmem internal logic. Signed-off-by: Miquel Raynal --- .../net/ethernet/marvell/prestera/prestera_main.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index 24f9d6024745..d4b48f674a88 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -862,17 +862,10 @@ static void prestera_event_handlers_unregister(struct prestera_switch *sw) static int prestera_switch_set_base_mac_addr(struct prestera_switch *sw) { - struct device_node *base_mac_np; - int ret = 0; - - if (sw->np) { - base_mac_np = of_parse_phandle(sw->np, "base-mac-provider", 0); - if (base_mac_np) { - ret = of_get_mac_address(base_mac_np, sw->base_mac); - of_node_put(base_mac_np); - } - } + int ret; + if (sw->np) + ret = of_get_mac_address(sw->np, sw->base_mac); if (!is_valid_ether_addr(sw->base_mac) || ret) { eth_random_addr(sw->base_mac); dev_info(prestera_dev(sw), "using random base mac address\n"); @@ -1376,7 +1369,7 @@ static int prestera_switch_init(struct prestera_switch *sw) { int err; - sw->np = of_find_compatible_node(NULL, NULL, "marvell,prestera"); + sw->np = sw->dev->dev->of_node; err = prestera_hw_switch_init(sw); if (err) { From patchwork Thu Nov 24 11:15:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 25457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3334435wrr; Thu, 24 Nov 2022 03:23:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf6T2zAl9E35L4PWhwwt3RbrqRNQyl1LMCGybQlfsDfhrVOkf0uelfDuMjgI3l7q7Do/IUUG X-Received: by 2002:a62:5e41:0:b0:56b:db09:a235 with SMTP id s62-20020a625e41000000b0056bdb09a235mr14916897pfb.20.1669289006839; Thu, 24 Nov 2022 03:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669289006; cv=none; d=google.com; s=arc-20160816; b=xJPyTKgHbt+MEyyKZ1GxdhIEp4DCHXEY00ncBMs5R2qZIlY3XWdjPbOqCIf7+e+O4K aW61Oc/IOXRWr17COwh2WLQn0VM9vn5oNVjGznwMc55WgR6KbhCrcbpQ69oHmwWRstD5 ERy1UVWqInObcX6NQ01SDf7XIfm4huRkqtf8nzpl3GKM9fJhSucbAzjj3uFWK5TXj1BU Ro1MucqSCQIGcf1VzR0hBTnWZfrAB0pjRF5Ct96R60xJ5SK8F2L9BIxD491I9+jrZ9lg 7KkFtt4Gjsj5/rc/nPmB94AMiS5K5ZUAC21UjAW5lRl2A1bn//Ha1I7sYBYdk0CaoTlk sfIA== 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=s42uM41w9ysmCNZE9IaonrxU6NJPatbC7hYnvHselLY=; b=E/um85hyeUTlJOgt93ARopzuQXjTVsZFrfu7cmptLmktDEXxmN3zkTFE5LqVVAGBZJ 4bh2JqulH7xQkOtLOaKnZHaIZVWcUbCOCdtTgqDSq7QMZR/GoXXICINn63OxSNQxvx0X K8jPbzLkwvY+JY3N5CgAtIJM8lYuF1yaei1F9hCq+73+t7eFSwMamT9WnU/uv66BP9oj XbG9rg0fldDTQQDo6HWGSr1flGSDM7rgZO21jx4GshWGsHGuwt9zwQYpk4DbjlMNpJRW XKJoeosls3PgPAqqVF5Ycjg81l640sjD6aGYLARNxPUKrTbluO8jm/MHOxnv6Xuy95K1 LRug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=HCXhEKvs; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j6-20020a170903024600b0018542a1b588si925620plh.196.2022.11.24.03.23.14; Thu, 24 Nov 2022 03:23:26 -0800 (PST) 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=@bootlin.com header.s=gm1 header.b=HCXhEKvs; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbiKXLQt (ORCPT + 99 others); Thu, 24 Nov 2022 06:16:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbiKXLQi (ORCPT ); Thu, 24 Nov 2022 06:16:38 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19345146F8D; Thu, 24 Nov 2022 03:16:21 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id BB3351C0019; Thu, 24 Nov 2022 11:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669288580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s42uM41w9ysmCNZE9IaonrxU6NJPatbC7hYnvHselLY=; b=HCXhEKvsJrrzmpZ6OKhK9SABZxwycYvZjnfneAz5D7wWn4u74NVgS6KdAXFKxJbpDp2/z7 r65VnNGRgNSxE5YVkr8TvbkzUBcoHyLc0+xtGQGfHNIE8INTy3fKN+7VDEBb8Ugmf0OaHY /NFcd5FDP4v8zxfCoMxMaOEkWfs2E6PUUUUQseKALeXpwSq1JjYnFN1uy3Qg+OogXpJH7w 8lIJsNRNci3dc11gMMqiitnnrVp4V43sRQTMi41gkAnAAy6voQeUvLOafpB2Fm4QPaFSn5 yeRUm/AhHBjeBMx2vY9bV1PHXtlYId5m0LZqQoczoTIRPQnTeKg+csxB3042uQ== From: Miquel Raynal To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Marcin Wojtas , , , Vadym Kochan , Miquel Raynal Subject: [PATCH net-next v2 7/7] net: mvpp2: Consider NVMEM cells as possible MAC address source Date: Thu, 24 Nov 2022 12:15:56 +0100 Message-Id: <20221124111556.264647-8-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221124111556.264647-1-miquel.raynal@bootlin.com> References: <20221124111556.264647-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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?1750376389642618768?= X-GMAIL-MSGID: =?utf-8?q?1750376389642618768?= The ONIE standard describes the organization of tlv (type-length-value) arrays commonly stored within NVMEM devices on common networking hardware. Several drivers already make use of NVMEM cells for purposes like retrieving a default MAC address provided by the manufacturer. What made ONIE tables unusable so far was the fact that the information where "dynamically" located within the table depending on the manufacturer wishes, while Linux NVMEM support only allowed statically defined NVMEM cells. Fortunately, this limitation was eventually tackled with the introduction of discoverable cells through the use of NVMEM layouts, making it possible to extract and consistently use the content of tables like ONIE's tlv arrays. Parsing this table at runtime in order to get various information is now possible. So, because many Marvell networking switches already follow this standard, let's consider using NVMEM cells as a new valid source of information when looking for a base MAC address, which is one of the primary uses of these new fields. Indeed, manufacturers following the ONIE standard are encouraged to provide a default MAC address there, so let's eventually use it if no other MAC address has been found using the existing methods. Link: https://opencomputeproject.github.io/onie/design-spec/hw_requirements.html Signed-off-by: Miquel Raynal --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index eb0fb8128096..12f0b5ad8cee 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -6104,6 +6104,13 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv, } } + /* Only valid on OF enabled platforms */ + if (!of_get_mac_address_nvmem(to_of_node(fwnode), fw_mac_addr)) { + *mac_from = "nvmem cell"; + eth_hw_addr_set(dev, fw_mac_addr); + return; + } + *mac_from = "random"; eth_hw_addr_random(dev); }