From patchwork Thu Nov 17 21:55: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: 626375 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 C275BC433FE for ; Thu, 17 Nov 2022 21:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240969AbiKQV4L (ORCPT ); Thu, 17 Nov 2022 16:56:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240954AbiKQV4I (ORCPT ); Thu, 17 Nov 2022 16:56:08 -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 8CEF36D48A; Thu, 17 Nov 2022 13:56:07 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id A580A1C0008; Thu, 17 Nov 2022 21:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1668722166; 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=ax0tNqoYutdKrIUuwqnf5IT6Ev2gIDY96QxRhHlvipw=; b=e4cTCixnOAi104+PoXmpHttdVUikNISxuJ/Uq41VOiMMQdgGuHW28PDgbvu1ZdW42eNMiX l+iA8x4YwYI4Io1tRxbaC+t9cJBPg8sAm9AQ+lkumc+uqRhMA7SPhpK8uFMFOwlfJI6KMj nTDePALFSCXqJSMCY5SCAxFzpUpqfVnD5208NyexV2iwAj76HxvN5AA6vooPg5JMo05b04 pkqt5tlmpjZULqnXmqGVW+hq+Z2m+kqvZFfzI9b46Ys69S0dF9oIAU5fpldqPi1vJfA0y8 y0fQZ+ItghMgGtq2NuNWN9ymhvXrM8+43jAi8ADZp/R4dNjouD1qGNpzliD9gg== From: Miquel Raynal To: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Marcin Wojtas , Russell King , Taras Chornyi , , Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Miquel Raynal Subject: [PATCH 3/6] dt-bindings: net: marvell,prestera: Convert to yaml Date: Thu, 17 Nov 2022 22:55:54 +0100 Message-Id: <20221117215557.1277033-4-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221117215557.1277033-1-miquel.raynal@bootlin.com> References: <20221117215557.1277033-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 --- This patch (and the original txt file) can also be dropped if judged not worth the conversion as anyway in both cases there is no driver upstream for these devices. --- .../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 17 21:55:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 626374 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 AA93EC433FE for ; Thu, 17 Nov 2022 21:57:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241100AbiKQV5C (ORCPT ); Thu, 17 Nov 2022 16:57:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241014AbiKQV4g (ORCPT ); Thu, 17 Nov 2022 16:56:36 -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 0694C720AF; Thu, 17 Nov 2022 13:56:12 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 2F74E1C0002; Thu, 17 Nov 2022 21:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1668722171; 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=pnwcTEHTghwysLoyLNFVglyZaxT5Ls5k3YuYD2ZlLQk=; b=pGduEhjemQPZpFe5yPmEqyzpTHt+2IF7nJ0J79XTjsXLCnJ6FaMTCtWNYI4y5b9Ir5oNO0 siuTj+UeXGN94dZ4kUWDf2pEeR96X/rph/aHn9UGUC3OseFPmwnSLGs6RRYQod5ItahMt5 V07els7hoQ8ncswGxXbeUHqRpbjL9bFagFpeSJpgazZgF/IXTKGtHR+mupY/0bRm9BCjda RTtHPlW1XAw6DeIM7PULKz56KWNWeVYLIlmww7/qKR6xLaQKJj0ARBJ4tNKDpqFqYYH/79 OOjXjHRLtf9Y7R3/0YFrJs3eG6/03t8O0XNfN0ty9IfjpDKfW8/ge4QO6UK+pw== From: Miquel Raynal To: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org Cc: Marcin Wojtas , Russell King , Taras Chornyi , , Robert Marko , Luka Perkov , Thomas Petazzoni , Michael Walle , Miquel Raynal Subject: [PATCH net-next 6/6] net: mvpp2: Consider NVMEM cells as possible MAC address source Date: Thu, 17 Nov 2022 22:55:57 +0100 Message-Id: <20221117215557.1277033-7-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221117215557.1277033-1-miquel.raynal@bootlin.com> References: <20221117215557.1277033-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index eb0fb8128096..7c8c323f4411 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -6104,6 +6104,12 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv, } } + if (!of_get_mac_address(to_of_node(fwnode), hw_mac_addr)) { + *mac_from = "nvmem cell"; + eth_hw_addr_set(dev, hw_mac_addr); + return; + } + *mac_from = "random"; eth_hw_addr_random(dev); }