From patchwork Thu Apr 6 11:08:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 80208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp950684vqo; Thu, 6 Apr 2023 04:33:13 -0700 (PDT) X-Google-Smtp-Source: AKy350b5wVyVO/+K6J6O7b4MTiqk4ZGxARvo2swmVefFvbCDcv4YBQuht+0Ms3sy0PocRmyZq8Wa X-Received: by 2002:a17:906:5a83:b0:931:c99c:480 with SMTP id l3-20020a1709065a8300b00931c99c0480mr6475610ejq.69.1680780793515; Thu, 06 Apr 2023 04:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680780793; cv=none; d=google.com; s=arc-20160816; b=Z8cA65NUIUqrQ11VorE6YInGuJYqB+vHh4UhOPRCQSQJEmLjmjawjAErYKgnEY1k1+ 3y+b3lzwz8tAq0o44NDHnFL8ALnGRh59UYZtE7HZtMB8P79yZLutIn0Ic+VZkVsIgTwH ABw//WsQ+86P0svSQ7o9mRyIG1OrQXTAXT9MZUylHy3O0GddHnIiFb1EoX7HoqgR1lIp oU4fJl+WlDjn2VoHfxKHQpvEfboh2RCpRWoW1jl2ajoFvCgsktOzZ7P+QFCfHNFga45x RKPVRaCxxqNHBKw5Fi2jM1zML8VuID2Dn6lbuCZzekoC3ak+r7wFd3r5+06UvU6V+9A2 DKbA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=/gb/p8Phn+9Nf7rsHXJphZe6NkAx5/VMdhxR1tnG5eo=; b=RTghITM0WFJA7WifS9aTCfapASByzrAoQmXPQ/78D1EBKF/LFsIipc3382BEIdypUI dJaCAGvv46hnNPZgTnpflI9hZVgEmRML6GKpwdXM0NIz5t2ugY5mR4Xjtv4qK9njAF/t WtIxV8cdX0QwMItWskkIDxWexC4hUo1odyiJt/y8BS7W1uuZV3b1vSLK08en1HXI55UO fGYSwQcWwH8F4rVkyqmn6Oz8jfCg02U+F9JqGobArlF0wHB81QtB32Z/PflZpHL8kHQr jf96dkcHOoC5HtNk2V8pV92GmELuje6aL0b7NXrtt/52edA0LfwVBOVnv83bXV1yp5/p pOHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pCQkgJ0D; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r12-20020a056402034c00b005026a8a0df5si912388edw.254.2023.04.06.04.32.49; Thu, 06 Apr 2023 04:33:13 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=pCQkgJ0D; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236814AbjDFLI6 (ORCPT + 99 others); Thu, 6 Apr 2023 07:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbjDFLI5 (ORCPT ); Thu, 6 Apr 2023 07:08:57 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0212E61BF; Thu, 6 Apr 2023 04:08:56 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id h25so50329148lfv.6; Thu, 06 Apr 2023 04:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680779334; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/gb/p8Phn+9Nf7rsHXJphZe6NkAx5/VMdhxR1tnG5eo=; b=pCQkgJ0DMSDKS7q2DKALshhL0nUMLxnufHTTeu60Vz20LWnRfEVfnKMoYTYj+0aVTC 8pF9zic8cgYW/s98jAw9oAdccbwJsFZ1vOgO9joDXycTsZQiEzbKPWBSyFcQppuF2rtZ pYCphKV+MnEIQOHgFHD4zrWimK+SOYAFKXCck/JJkdyOKjhxZMAwyAWSaCAl/1Ro156l /0jsAGKhDjVv0jaMDOX2aRg7nIesUMcgh5A1VUSWQ5gBJEVFum/i7SGI1wXH/CXkU7Vv fVG7/YpYzFKE/Z3BxtU1xU9OZ7HEK+FQFKoE3mq0/1Ok2fCQUNglW/Zznq3tFm9tKSen 9xCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680779334; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/gb/p8Phn+9Nf7rsHXJphZe6NkAx5/VMdhxR1tnG5eo=; b=kEiAjfhLnxkrrGhjXIhD6tDFhkhf9fzeQh6x/Ezc4y+QYb2ELR65fUullRqyhBbZ1m 5TBW48mbGivP1RX0HhhfmSMbMSkUFCTg6uHeBXCX6IPLyB2nfulmWGgrun8ZMUrnltGR hqJYLaosm7UUV7OsLjAuWKxeO/0Lw5uL7lCowIe90wxM4kAEOBRy6WhOzdQpwpg7/a3A 36zDYbUszQtgIBHJqoV833mdLijFUh7C+bOJ4GDXB0JNDC/5RUV3+dAk0UDeh371L46s c0GYQcmJ75PbFCjzuoY+FbKNQOc6YcN2eWHYxHko1VTl3w0Ldfrbh178ogLz2IhI5FG5 WC4g== X-Gm-Message-State: AAQBX9dOlA+fTPuPDVuay6Uc5VjxQX6jMNAioaLmZLelpgKQvZFcSUd/ Bjga8dCi+0Dm06BwgY4oGB3Cwcp9P54= X-Received: by 2002:a05:6512:951:b0:4e9:bafc:88d0 with SMTP id u17-20020a056512095100b004e9bafc88d0mr2486708lft.23.1680779333817; Thu, 06 Apr 2023 04:08:53 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id r26-20020ac252ba000000b004e048852377sm218667lfm.263.2023.04.06.04.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 04:08:53 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Rob Herring , Krzysztof Kozlowski , Srinivas Kandagatla Cc: Florian Fainelli , Hauke Mehrtens , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 1/3] dt-bindings: nvmem: brcm,nvram: add #nvmem-cell-cells for MACs Date: Thu, 6 Apr 2023 13:08:02 +0200 Message-Id: <20230406110804.12024-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762426401571058927?= X-GMAIL-MSGID: =?utf-8?q?1762426401571058927?= From: Rafał Miłecki Broadcom's NVRAM contains MACs for Ethernet interfaces. Those MACs are usually base addresses that are also used for calculating other MACs. For example if a router vendor decided to use gmac0 it most likely programmed NVRAM of each unit with a proper "et0macaddr" value. That is a base. Ethernet interface is usually connected to switch port. Switch usually includes few LAN ports and a WAN port. MAC of WAN port gets calculated as relative address to the interface one. Offset varies depending on device model. Wireless MACs may also need to be calculated using relevant offsets. To support all those scenarios let MAC NVMEM cells be referenced with an index specifying MAC offset. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- .../devicetree/bindings/nvmem/brcm,nvram.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml index 36def7128fca..a921e05cc544 100644 --- a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml +++ b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml @@ -36,14 +36,26 @@ properties: et0macaddr: type: object description: First Ethernet interface's MAC address + properties: + "#nvmem-cell-cells": + description: The first argument is a MAC address offset. + const: 1 et1macaddr: type: object description: Second Ethernet interface's MAC address + properties: + "#nvmem-cell-cells": + description: The first argument is a MAC address offset. + const: 1 et2macaddr: type: object description: Third Ethernet interface's MAC address + properties: + "#nvmem-cell-cells": + description: The first argument is a MAC address offset. + const: 1 unevaluatedProperties: false From patchwork Thu Apr 6 11:08:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 80202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp946804vqo; Thu, 6 Apr 2023 04:26:22 -0700 (PDT) X-Google-Smtp-Source: AKy350YEv43OhY0hcqITLsCZg3XjYWD2qbjh9SZ2c4kD7jk1l8EqgmHjUM7qMcnHRGAtLnnCcMjO X-Received: by 2002:a17:907:8b95:b0:92b:eefb:b966 with SMTP id tb21-20020a1709078b9500b0092beefbb966mr7359567ejc.0.1680780382446; Thu, 06 Apr 2023 04:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680780382; cv=none; d=google.com; s=arc-20160816; b=sCKGEC3nuak41Cchx87EjnSzXTylHO2pKA6TV3f5P2+qvPrcbN5iOpfO13QHBCd6NA mO2kiJ6mlqOFOa189mM0DFiNsxnMLzeJWeGF+9t/62huLdETLiDFgB5ylI2Y1CFLhpqb pD0K1hI5jybO7DPdOUL3awkiijCM5LYAsjxnDOtcBvtd2Imj4qiCssdanZQ3DH2IQE9q 0gLUWcrsI06kc4tGW3ETXmh6U8hG3n6ZutrJCkND14R+1DacGkqJ8nE0xxiASrdOqlam B7Urkk0elg7FUbf4P0W87XuWAma+DDO4bZ1q9sKtAwY1kBZxWGQkfQwYW2GtoaHIoZXU Dr8A== 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=wfYMOG8gPlyg4Z3cWn2F4o0SjxhHFN6Ihcum8cR5Xlk=; b=XJSTPE2unhtMmzt4NPBr86nHlI/xSN4frWqtzbHbh3WFbY8Rvuh5HFwTwse9Zl6b40 k0cyTYNLFngEjJMl/3RTX7w/vYfP9Oy4tNAWDBSqI/s/M1ykSHt8XRvh9kv35W/CBS4F p3G50zj9A8817ogUYcBWuYjiB20Z9WgJnZya1WQntgXCwRbUYe6/dGXt+bXoLPePJes4 lRqkvluYYS2irbuIaON1Q+AsUbZqf29tA2l8+XAtmnEByqwFpxe/PkmBRhacA6WSr/K6 YTFHWtWfmX8EAAMrufsfl4sgkAayhbKQbYK9Dc+zCZKp9i4MHuCtdxBGC/AsWjpW6kAW 3cgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p6OqGU8g; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l26-20020a17090615da00b0093d4ca392a1si895979ejd.409.2023.04.06.04.25.58; Thu, 06 Apr 2023 04:26:22 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=p6OqGU8g; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237261AbjDFLJB (ORCPT + 99 others); Thu, 6 Apr 2023 07:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236833AbjDFLI6 (ORCPT ); Thu, 6 Apr 2023 07:08:58 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7065972A0; Thu, 6 Apr 2023 04:08:57 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id q16so50299830lfe.10; Thu, 06 Apr 2023 04:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680779336; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wfYMOG8gPlyg4Z3cWn2F4o0SjxhHFN6Ihcum8cR5Xlk=; b=p6OqGU8gW0fCJlDL00V8f51dUiscXEsiSaD5vmQO1isPXkmvIh9KT8CDihdJexXbVQ q3tgHgG4DpF06psRjl2A0IwVsn7JX5nomaufOSyqRqwv5ek93yeBNotwx9a7jv2Hx3jX huraJ/iQLlQk0axSQbJnfik5t4ssW1sNuwAp2CLylhKbUT1vphXZg7hswQOtf6gru7og GYKjDGlUc94LMNNxr2vHX0t+Yyy/c0JvLlFUDELjqewTug0YBn0HwusAej3sAMJBsd0/ dSR0LlkVSh/BpSwUfX0PVU1Q562PEQvh67dmT7x5Sp4gYIPmyP5w/qIVOiReOYL5Wmcq sa8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680779336; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wfYMOG8gPlyg4Z3cWn2F4o0SjxhHFN6Ihcum8cR5Xlk=; b=THv+dHDKSfSCDa7U0gg4XWKkMSG9ZRwx4UvabVKHgStwonZ3Ztf/OqSkD8yJsr/wnL GLdeVu3txYMuu5hKUD50tDAcv36mF6JMCcZ8r6CQAuUhLAnlrYaeJPeuDHTxUnIrAVzk k0ITwsksPt/OfNG+rw1efED+7IAOQiErKR7IqsaJPvp8OxDOL7Uqkl0fKD8DDyHpVvtJ UNhMxgxPKtO5l1cHkY7EMAWD0PgzkOCL9dk4MXJ0aQrsiPM5yBZBPeCzYDf4dT+E87MN xdkHh1zZkvxXgA9HSYg2IZDgmXDQ9Qnxt6Fu+jx8k66paPZg1K5dQA1+p3/Ok1PVpLOY CCtA== X-Gm-Message-State: AAQBX9c85SoSruYp+UX1DNjHPywCUwTNMsfG1SwJCx6uFuLnUE78AzNV snee8pYm59HBuMiF9UMbfYw= X-Received: by 2002:ac2:4a63:0:b0:4ea:e262:e551 with SMTP id q3-20020ac24a63000000b004eae262e551mr2417608lfp.31.1680779335666; Thu, 06 Apr 2023 04:08:55 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id r26-20020ac252ba000000b004e048852377sm218667lfm.263.2023.04.06.04.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 04:08:55 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Rob Herring , Krzysztof Kozlowski , Srinivas Kandagatla Cc: Florian Fainelli , Hauke Mehrtens , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 2/3] nvmem: brcm_nvram: add .read_post_process() for MACs Date: Thu, 6 Apr 2023 13:08:03 +0200 Message-Id: <20230406110804.12024-2-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230406110804.12024-1-zajec5@gmail.com> References: <20230406110804.12024-1-zajec5@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762425970318391198?= X-GMAIL-MSGID: =?utf-8?q?1762425970318391198?= From: Rafał Miłecki 1. Parse ASCII MAC format into byte based 2. Calculate relative addresses based on index argument Signed-off-by: Rafał Miłecki --- drivers/nvmem/Kconfig | 1 + drivers/nvmem/brcm_nvram.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index b291b27048c7..688b70ba4826 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -55,6 +55,7 @@ config NVMEM_BRCM_NVRAM tristate "Broadcom's NVRAM support" depends on ARCH_BCM_5301X || COMPILE_TEST depends on HAS_IOMEM + select GENERIC_NET_UTILS help This driver provides support for Broadcom's NVRAM that can be accessed using I/O mapping. diff --git a/drivers/nvmem/brcm_nvram.c b/drivers/nvmem/brcm_nvram.c index 39aa27942f28..4567c597c87f 100644 --- a/drivers/nvmem/brcm_nvram.c +++ b/drivers/nvmem/brcm_nvram.c @@ -4,6 +4,8 @@ */ #include +#include +#include #include #include #include @@ -42,6 +44,25 @@ static int brcm_nvram_read(void *context, unsigned int offset, void *val, return 0; } +static int brcm_nvram_read_post_process_macaddr(void *context, const char *id, int index, + unsigned int offset, void *buf, size_t bytes) +{ + u8 mac[ETH_ALEN]; + + if (bytes != 3 * ETH_ALEN - 1) + return -EINVAL; + + if (!mac_pton(buf, mac)) + return -EINVAL; + + if (index) + eth_addr_add(mac, index); + + ether_addr_copy(buf, mac); + + return 0; +} + static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data, size_t len) { @@ -75,6 +96,13 @@ static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data, priv->cells[idx].offset = value - (char *)data; priv->cells[idx].bytes = strlen(value); priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name); + if (!strcmp(var, "et0macaddr") || + !strcmp(var, "et1macaddr") || + !strcmp(var, "et2macaddr")) { + priv->cells[idx].raw_len = strlen(value); + priv->cells[idx].bytes = ETH_ALEN; + priv->cells[idx].read_post_process = brcm_nvram_read_post_process_macaddr; + } } return 0; From patchwork Thu Apr 6 11:08:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 80201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp944819vqo; Thu, 6 Apr 2023 04:22:35 -0700 (PDT) X-Google-Smtp-Source: AKy350Y0yRAW7DnYMAdQX5lxp17FAtkm5hSh9hEGuXlVDx/ScmAKt/Fq7JpRCpnfsCVZYlSctSEP X-Received: by 2002:a17:907:2bd7:b0:933:499e:62a7 with SMTP id gv23-20020a1709072bd700b00933499e62a7mr4814627ejc.49.1680780155526; Thu, 06 Apr 2023 04:22:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680780155; cv=none; d=google.com; s=arc-20160816; b=J9NyvneQK5TfcuNRb/wz3tygrNfuq5FA+6FW/xrb3OycqHw+cQ/9mtESxf2XTgP9F4 A1ftDap5hY6VWjAthz6GZ19udKK24S70dTeeLg7KlcQXcncNephBgl2P/IxFUunvHNwX xKcUWrFPwC0OOBHbMzg6TO1iN7n/Hums2taD8tEj/sQq1WrLynzhMO9x4B2FYWySDVDE 8zOOF7ubeqIg/HU3xpiCZB9VxeRjeWbeioIgnNCiW16Xvzb+RdLcLs8Alpc22KJLL7wC GMlHhsgsjrWs49nTWfqFllX3IS5X9ZHnfobTdIfrPBfLc4vJCYpDRWo3W+j27X4x9DeY zdqg== 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=gvGmFR5di2sik7RBLdOP/KeRkjaQDZZlALHIAzFWnQk=; b=xZy8zgR5jGWgsfRDchN0usrjCuDf73WUWB3SVlYA+8dUietSVRqBvQNCPJ26wl34h9 zdtZYlQVPHEbkgimKdeVnMo1hDmdzsfyUXUPytZSPLAr8MFWXqIFFftPp2U60mY7ZXgA VUPEjFc0p7eN8TdTldIFD0U2gt20ePBmPBbcvmHcwVgJlnVaoMIADZbu1UIZ+jSbdBr1 ru0CR0TAAVVLM7C2ho/DYyafrMgeXWlKDYw+9Wke7dsT3TD2QFNykp99PvNzqeWxquoE axhxAOO4suq0ASyDuvjj04FHAfcpxmzDWgRmKv4voxJrK4Mpk5T71VoR1tWc+4jYTXng 4U9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ao57XiWU; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pv8-20020a170907208800b009346fbb76fcsi11977ejb.978.2023.04.06.04.22.11; Thu, 06 Apr 2023 04:22:35 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=ao57XiWU; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236949AbjDFLJH (ORCPT + 99 others); Thu, 6 Apr 2023 07:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237301AbjDFLJE (ORCPT ); Thu, 6 Apr 2023 07:09:04 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A4ED8A63; Thu, 6 Apr 2023 04:09:02 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id k37so50374473lfv.0; Thu, 06 Apr 2023 04:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680779340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gvGmFR5di2sik7RBLdOP/KeRkjaQDZZlALHIAzFWnQk=; b=ao57XiWUibLYquPdos2FQfTnS7PDp4fRz7WDvmBVwry8vdNjEDUiEmAcI7jkqt7Rt/ tDaLAkBdRAC1WKmzjpeMa1lo11uRzyVgrKMbKLc3JcMj/GkqGnXWjkQC1zFOjKnnECsz nVX6aiWTFarnsAAyzTSjFhRmuANSYNGU+kKnAFogS5GqR7VYGwMW1H5CkXMUtCG10nwx vF3UsJFDuAHwTYtqCBV6kJYxmTxgod1TED92CBw0UiO4NCMr5xkgnqXLNtmqhoKv1ou/ YHLSQwUXCD8kMAwxel703A/kfForyNImw+0stN7QzUkhbhmB20FPs/2ldKl8EBgc4AGa K52Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680779340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gvGmFR5di2sik7RBLdOP/KeRkjaQDZZlALHIAzFWnQk=; b=E4OzcxqkQtuSYzYkmK7J8B80i/CHuIGklbxMb1k0fHWVuU/Ii7m/l/X2yPvbJbiakw Z3BML3k8HKNk9xbauB7O0Rue7UoVgYjSgp95NtwW1FNunQyJQ4KHGJy9Jfty46Ro32Ur 5rRvTneVr1032DHMiHi4vLf4uxQr2KnIyqTAg/4t+rspCP+v4hRAWlJRvMbqWdl75U2d /UgzViUXUKbcou8fnpuW3srDRF6jBZoMKaWLHoI6Ni/dNpZjRiQu8EnBFGaqlm60Yvs+ YepwvEZXu5iQHbYdclD3JcWI1o9IZvatNd9Ei+A1ELsGXNCHFn79PS5aFnCyBxzwG5sx KKfA== X-Gm-Message-State: AAQBX9dgp2ULH3H8brfuLr1OW7W4vrUmwROLhJ1DeRXGdr5xGT/NLYMN 3/YQn49H00Uu7wXzHbG8GRQ= X-Received: by 2002:ac2:4910:0:b0:4eb:ddb:d03f with SMTP id n16-20020ac24910000000b004eb0ddbd03fmr2268881lfi.62.1680779340223; Thu, 06 Apr 2023 04:09:00 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id r26-20020ac252ba000000b004e048852377sm218667lfm.263.2023.04.06.04.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 04:08:59 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Rob Herring , Krzysztof Kozlowski , Srinivas Kandagatla Cc: Florian Fainelli , Hauke Mehrtens , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 3/3] ARM: dts: BCM5301X: Specify WAN port MAC address for Luxul XWR-3150 Date: Thu, 6 Apr 2023 13:08:04 +0200 Message-Id: <20230406110804.12024-3-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230406110804.12024-1-zajec5@gmail.com> References: <20230406110804.12024-1-zajec5@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762425732675800097?= X-GMAIL-MSGID: =?utf-8?q?1762425732675800097?= From: Rafał Miłecki It needs to be calculated based on the base Ethernet interface one. Signed-off-by: Rafał Miłecki --- This PATCH is a proof of concept that can go separately through the ARM DT tree. I'd actually suggest that. There are more .dts files I'll want to update. Srini: can you just take the first 2 patches from this series? --- arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts index 60a2c441d5bd..2dd05f4dce92 100644 --- a/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts +++ b/arch/arm/boot/dts/bcm47094-luxul-xwr-3150-v1.dts @@ -27,6 +27,7 @@ nvram@1eff0000 { reg = <0x1eff0000 0x10000>; et0macaddr: et0macaddr { + #nvmem-cell-cells = <1>; }; }; @@ -76,7 +77,7 @@ button-restart { }; &gmac0 { - nvmem-cells = <&et0macaddr>; + nvmem-cells = <&et0macaddr 0>; nvmem-cell-names = "mac-address"; }; @@ -119,6 +120,8 @@ port@3 { port@4 { reg = <4>; label = "wan"; + nvmem-cells = <&et0macaddr 5>; + nvmem-cell-names = "mac-address"; }; port@5 {