From patchwork Fri Apr 21 08:43:10 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: 86185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp920149vqo; Fri, 21 Apr 2023 01:56:11 -0700 (PDT) X-Google-Smtp-Source: AKy350ZxzMbXYdXaBIguFo3y0QY6ej8OQF669NSCQ8sPlNBLkYXLokY6mtmo3Ud/O2J8eBlghz+X X-Received: by 2002:a17:90a:ea8e:b0:23d:29c7:916f with SMTP id h14-20020a17090aea8e00b0023d29c7916fmr4414627pjz.32.1682067370738; Fri, 21 Apr 2023 01:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682067370; cv=none; d=google.com; s=arc-20160816; b=PRCqJ/Br+XiHopyp6f03WvCdZp+ZJqg0ASARZ3tpro3HIxfBLvu57GN8S12qlaSf8N J4u3A9YWwA0S2HtlMzWqaQzA730rreeFPwt1WyNl+qj2PV/520maTW6kC0DtBVmhLazw nO3nK4xoBUylZ+TT0OKnazRKGe2d5clZfi6BDDJkM6EMepNPWzk6jQK5WkgBE46KhU6w tEvmFUVqYzUJaNIlyt6W9V/aOS6N/8C0onbpG5/0A8jrGApcI0XP0ZT5+BvnVkbeB27D lpeWbr4RXU16SFWFPE1bZtjMYYIqEXsDyCATCQ8SNZOI3L0E/vJBBeyWOFkq3zoUm8Qk qemQ== 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=q07rsXa0P3xMWWHi6ZkgnJ3NXlI5ysIigcoD7BCQBmY=; b=ciI5XCO5Ky27Se47eY9cMZvc57xBfyv1ttPF/bEyMzE83A6A5tnuB39AYkpr9AQXWu mGUIemwtrHqWenvAoKDE8oy84YlPsbbcv+/NIV3fqq1Z7a/zDIkPCl/+54/6VqoV9j2F N/Il9r9Qd+o7goDv1Pfahn4MCKvdUJUvuaW0KPgmozyeXb6gDsx4FV86WufDsfdG7pj1 Rrefn63gtSOoWCYZX12Q2sRH2Ry8LA+uYminwLbWIRzughW2HTbju7Fxet4vL2i4USVC tIAYSAv/SlYbICnP2cyTGaFQJ1U3x6taWl5cgvojCFmInh2qiM9j6u8GjGqI+m4tlRs2 gy/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=PbJFPgJY; 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 nk15-20020a17090b194f00b00247023fdbcbsi6534931pjb.186.2023.04.21.01.55.55; Fri, 21 Apr 2023 01:56:10 -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=20221208 header.b=PbJFPgJY; 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 S231786AbjDUIoY (ORCPT + 99 others); Fri, 21 Apr 2023 04:44:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231680AbjDUInx (ORCPT ); Fri, 21 Apr 2023 04:43:53 -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 F3E77A5F7; Fri, 21 Apr 2023 01:43:26 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4ec8eca56cfso1455867e87.0; Fri, 21 Apr 2023 01:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682066600; x=1684658600; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=q07rsXa0P3xMWWHi6ZkgnJ3NXlI5ysIigcoD7BCQBmY=; b=PbJFPgJYz2j7H8aC5DGrJSCltkrWgy6Tczn61IFq+5XnUsOWi0Y5rysFYXkGfcn655 VjqCm8/2asTg3T/IFGQuOh9efjWxyvQkZER7A2shbSxhjCxb9giOOLitDwcHIq0B4euG oIe5794WpvAVvpxSUw+Do+pMYzeoLuwnU3azKwo0ptA57BOEtwnnklEyFLly037jrzQZ wK9nScxwGkIR4iyd9Aiczjq5+IHdYUsZ/MwspcL01YdS0+pZ56zrb0/bmFJrp4BhLp9c LcgEgxkztVVzCIHWSTjyz+dYFB9e/F27Vqs22jMqY8yr0vPjOcj1OVj9VjouZw1RaCXa pM9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682066600; x=1684658600; 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=q07rsXa0P3xMWWHi6ZkgnJ3NXlI5ysIigcoD7BCQBmY=; b=aAS6aIlCCoOdfqzD86EnD2m2Q5BHaiq6Tz4mcu7A/A7Npv4Bsh6jBeqyovGP1nHf/C zjPC+fYD0HdjWI50c9PhOKAZ+/F8GfR6M04EiTT9+owh/fd1NqTH/YytAYEmrC6IHthu Elknaz3fd+efsIV0wnTkihyLkczYdk8auGnjfltZtIu35OdUHtsTYCxEYYIGZrnVRkbE DIdG39ekT2+/GdGa8dyH07bO0ivxf6ioqOO5opc0q74o9sdSFk/UZ/VlprlMI6If4tek D2ySH2QYZB59wskZzNzJA0gdZoa98RKHzZMi3BngKwc3/Spw8wc6UXnqCR3kH3LbAPTk QGkA== X-Gm-Message-State: AAQBX9fhREsDt5cFqDuDk8vEN7VMQ/EKoC1mXk0+QoDprSgbm0JgBk9W lb0WeYmbLy/XbDWRaM55pARDAyAAdVo= X-Received: by 2002:a05:6512:376c:b0:4ec:5648:70e4 with SMTP id z12-20020a056512376c00b004ec564870e4mr1183935lft.12.1682066599596; Fri, 21 Apr 2023 01:43:19 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id l16-20020ac25550000000b004edc16dbdfasm480721lfk.119.2023.04.21.01.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 01:43:18 -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?= , Rob Herring Subject: [PATCH V2 1/3] dt-bindings: nvmem: brcm,nvram: add #nvmem-cell-cells for MACs Date: Fri, 21 Apr 2023 10:43:10 +0200 Message-Id: <20230421084312.27932-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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, T_SCC_BODY_TEXT_LINE 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?1763775475526477900?= X-GMAIL-MSGID: =?utf-8?q?1763775475526477900?= 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. Disallow additionalProperties while at it. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- V2: Add additionalProperties: false --- .../devicetree/bindings/nvmem/brcm,nvram.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml index 36def7128fca..13412af7f046 100644 --- a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml +++ b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml @@ -36,14 +36,29 @@ 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 + additionalProperties: false 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 + additionalProperties: false 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 + additionalProperties: false unevaluatedProperties: false From patchwork Fri Apr 21 08:43:11 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: 86179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp918164vqo; Fri, 21 Apr 2023 01:51:20 -0700 (PDT) X-Google-Smtp-Source: AKy350a7xD3/ZQeaNWnOfSJ1S43qvHKTKM13Oz8Cy5aH6P8zBPH29iluQ9vzoia6ixJMWoRUrL+0 X-Received: by 2002:a17:902:fb86:b0:1a2:98b1:1ee3 with SMTP id lg6-20020a170902fb8600b001a298b11ee3mr3954508plb.12.1682067079765; Fri, 21 Apr 2023 01:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682067079; cv=none; d=google.com; s=arc-20160816; b=GWU1JK1b3Dg4rSssVSixT0I1PzuoEykkvmfssWQzxWe7R8c6TEg4oWBr/kSaMdesOT 1XlIPHF86YxCbAS9c18lgBjxqiZPzpj+54C1NlSSeJR3hqMnmzrPedGAQpqgD8rfEXrQ 4ofFZBWHy7Phz00Edr4lxT6K1pBFvdlPsRlgHWJcjiRFpbrE/9c1rxTTXQAEUETFNtJN JjkRQZl3+9RiGIKcIikQtO74MAg5+olvWsRic7fp0R9r+HD8ekiOH21zJvYtpmeeDQro 9OPpO9oD6lBv5fHtM/gaK2pwDSs0Lora0GQ/YRsyVnt4OZENQ95m4LFptp3tPu2RzWOR ddGA== 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=z1NJ+9XiAoST+BZ7FciB5oclJcSuEIYwAoey797u1Q+6K4D45A/zdSFmPff57BLWcC tp9omm/DFed6zqhac6yUlFtg401BZG/S6dqsFULTFrAO1ybwl9jlWSSJ2L9X/jCc0NA1 JPGjwgcbzTZAGd7uDaHy+jQt+XLy9kIv0ZImxQKr/vuGlz2j/WrY/+FrjGWA+BaAJwue GpoCddKx0n1XqixddoksqtSzVxpkarxlmmKezzGP5v2kmrzRAbZF8dN2fkMlY0Bapqv5 UbHLgI0XtmUq3O8b36Bp/bgJ/3zQ1eqFumndd1346XOD/DyKggHhCcRcQigxQumCP979 FoVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=a+41VRsB; 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 c7-20020a170903234700b001a52dd0195csi4195196plh.549.2023.04.21.01.51.01; Fri, 21 Apr 2023 01:51:19 -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=20221208 header.b=a+41VRsB; 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 S231803AbjDUIoc (ORCPT + 99 others); Fri, 21 Apr 2023 04:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231712AbjDUIn7 (ORCPT ); Fri, 21 Apr 2023 04:43:59 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCE8DAD25; Fri, 21 Apr 2023 01:43:31 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4ec8399e963so1426128e87.1; Fri, 21 Apr 2023 01:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682066602; x=1684658602; 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=a+41VRsBYTq/V/MhxS4NncMUAaeaB+X7nipm5u7gcYrjjGhOf20sOA3+NqCjD7GWjS COQujy7krMnzNLKyYCGK8t5TfWwsCHzsucl05eZxHbpgLBCeg7b4+5K3bc8rfjgcI+Ne bs6ICN/bPGr1VRm8xsNBy/4/uUy40ITOsRLY97wBb1SO3V/zs5Sf9ZuTiN4H6fWTyt2o 8C0GoLdN8d3s0EDjpjU9/L0v54kLzSptqJJB51KWJX+grW2HyUgWIojifEerJsNRHsp1 kgD8iky9NeMRrq5E/HmvrILuhoZB5hmyXQ9A6nlB/6ZbNa0f400kcc3mr4TcVVa7i1Cj BOeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682066602; x=1684658602; 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=ekKzxjBrDHXYJvKpbUedF0Bxs1CZSeTAWmmodjhr7dHY3+y/vZgzrj8zITH8acu/sl wRklj5aCD3MinqO8jnZdKaOlJdrotMAyrLWhdJBh5sfUSshoS0CECvUdvT6FJ5qwShm2 1lp2P0ZxQFkc1avQ5mQtvYvzfFsfAMqWB/Z+aqHphIVHud58qQiWbl7uj9FhnuZC6xhK zWshgBTxSuxQ804dXgIVx5PQkcqHgZiSO4m+Ua02ZCEZ4g3xUeFNJ3WkSxVVNFWu+Ux/ UbZIud8BNEWKzjHQ8HU/fptNnGl99AZG+dW+4u9amj18e36LGp8ISPGddkMh6Gv09hCz ZwOQ== X-Gm-Message-State: AAQBX9d0neD4hCvMMVdrPbVXfi5ccUgf93qcH7z/rEoHMH92p9wArtd/ JUBkUsZiZZ4EvEJh9xtR2XY= X-Received: by 2002:ac2:4e52:0:b0:4ea:fac4:8ef2 with SMTP id f18-20020ac24e52000000b004eafac48ef2mr910330lfr.64.1682066601602; Fri, 21 Apr 2023 01:43:21 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id l16-20020ac25550000000b004edc16dbdfasm480721lfk.119.2023.04.21.01.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 01:43:21 -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 V2 2/3] nvmem: brcm_nvram: add .read_post_process() for MACs Date: Fri, 21 Apr 2023 10:43:11 +0200 Message-Id: <20230421084312.27932-2-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230421084312.27932-1-zajec5@gmail.com> References: <20230421084312.27932-1-zajec5@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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, T_SCC_BODY_TEXT_LINE 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?1763775170631420186?= X-GMAIL-MSGID: =?utf-8?q?1763775170631420186?= 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 Fri Apr 21 08:43:12 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: 86180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp918166vqo; Fri, 21 Apr 2023 01:51:20 -0700 (PDT) X-Google-Smtp-Source: AKy350bY3hqu5AT1bieI673YWUpgC6qp+J27NMUTgPGvl0850x0sOaOddLG2/WlUEAeTX8Xmylqw X-Received: by 2002:a17:90b:3008:b0:246:d182:cb22 with SMTP id hg8-20020a17090b300800b00246d182cb22mr4285708pjb.23.1682067080073; Fri, 21 Apr 2023 01:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682067080; cv=none; d=google.com; s=arc-20160816; b=IaXtqdOmO5v55Nnikbhibi5RYlQM5wCvvREANyPQbizYCS/8AIo2+rzXDciV6zrNg6 vuVOnitSYE+e43qW2Uzi4Gc8K6BPnRtN+Jp9nIbmELWdDmXP9MTQbMQ5keWLEEIkLCoK HCSSjKUqJ2789eGFDRG8DkmctQrEWfT9px48I1aNq8xpAZalF7SxFnmC/kJBvX9xBxI8 UmEggWL4w2WODP+y0sKDTXsyQVUBKeV5bVx4nnlzM5+0nMuaEdSrXrX9qqqVq91C7kFv s7A+9m5JqPnV2m6iGZX8ylt0PjOcV+Hv5Mm4oonkEeJWyYF/I3oJA69ZXMfVbecffkNO ghCA== 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=v+1qA/etZ+IVpfjMbdDDnq2WyXQQ+lzODxVzUQAkojDSMevml9OZMrV+TMH6u9fb4o 84Sg88DDqZVLVDwfoziarQKyRMxqeKEHpX8QSkRCKAxJlBlelOL5kEsot/nsXujPDzWS Jfgqo6OlCe3cX1B15zkgoBKjmsWy657BJAAbpWaZk+cE3BuOzFSe6UFeVIxXEI9sZHaD XiWkDCVVDCbRO+yQC2oN5BAZ8l0teundlxk4Gn57snGdxf+JQ0Hdkk0n8ayuN1xf6sfB VwoDNzsXg3b/frTU3dFBY3eO2bb2a99d+jQAf/OOmeIpSBOuEJj6yKwsvrgF8An35Hvu 2PzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="lZgG/9a5"; 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 i71-20020a63874a000000b00517a65a29a4si637921pge.240.2023.04.21.01.51.05; Fri, 21 Apr 2023 01:51:20 -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=20221208 header.b="lZgG/9a5"; 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 S231723AbjDUIok (ORCPT + 99 others); Fri, 21 Apr 2023 04:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231721AbjDUIoC (ORCPT ); Fri, 21 Apr 2023 04:44:02 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28293A5F4; Fri, 21 Apr 2023 01:43:34 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4ecb137af7eso1388064e87.2; Fri, 21 Apr 2023 01:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682066603; x=1684658603; 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=lZgG/9a5Jc/r7LaEpPZhh6Kh2EI401N+EdCAEdxS1ZeYDJ9Pj1/Cc+6Bpv7+ZphX3x XEhmuTTiKKGyQkrPMAhwFjyXMQTjcpw0tck6kIC9evpFucRu4mRhSs+8yh3aTWHjagSH eJTaqtuhvqbM42jvAAFvHdxMUZqvUbwFwB8nAzUgHw8aMJn5wyLVTlDArHTVNGXby1z4 QymzgryUaxPnl8P5wSmYCjB5ueryYvn/Lt2XZtTTP/mP6hoyQikOspdRbxe+XQ5TVvCy 0xUE1DUUgVHOhugnD/7qrUhnIpjWkjxrDUtLj9IVDDU3wNL8iI6pFAGB3+fVFy4oZ+jO nlIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682066603; x=1684658603; 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=HPNlwS0c1hVo01ryJviPZMgZDIl+p3w3OnQreevGnPkwvWtOBna5T7ijMFNph256ud oCEk+erHlgdsx7Njy9GkvJBzdZnWAoxJ/29QvADClCTl+B3n7Ye46bZNQrHjTk5BEpaJ 6zoXxy3SESezB9GeFq4yaH0qbJRyibdtAwIwMDY7q71/ePL86ZeSiqd9JWl7ENIRAZCQ Wk0UuB1l6g+9bHca7pNwKuJMXhm55nr6eaPt5zWJNpYjUqsMZcUblA7kx9ZO0ztgppG9 3I4ThzyXj7RDVxCPRSNyLorJKOmE2b8aAM/FBLWAsD0AR16VzdnuHUfiGVUyMBKprOTd 6Xpw== X-Gm-Message-State: AAQBX9fOn2Dm0+cZEkgVlJEn7AbsTHFjtBWlTgXduQtBB3U1FK56h+ay F1VywCTTPvrHZ+8c98XhdoM= X-Received: by 2002:a05:6512:20e:b0:4eb:1527:e29d with SMTP id a14-20020a056512020e00b004eb1527e29dmr1221705lfo.52.1682066603523; Fri, 21 Apr 2023 01:43:23 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id l16-20020ac25550000000b004edc16dbdfasm480721lfk.119.2023.04.21.01.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 01:43:22 -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 V2 3/3] ARM: dts: BCM5301X: Specify WAN port MAC address for Luxul XWR-3150 Date: Fri, 21 Apr 2023 10:43:12 +0200 Message-Id: <20230421084312.27932-3-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230421084312.27932-1-zajec5@gmail.com> References: <20230421084312.27932-1-zajec5@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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, T_SCC_BODY_TEXT_LINE 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?1763775170160795231?= X-GMAIL-MSGID: =?utf-8?q?1763775170160795231?= 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 {