From patchwork Fri Jun 16 11:11:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 109046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1272547vqr; Fri, 16 Jun 2023 04:35:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7OhW8MxqPw4CwNl8gMHH+pfi3FBa29dlhuSUcrJEDSstDzvyDoZD9F84UP0iAgLbdsBNie X-Received: by 2002:a17:902:cec6:b0:19c:dbce:dce8 with SMTP id d6-20020a170902cec600b0019cdbcedce8mr1874666plg.15.1686915315757; Fri, 16 Jun 2023 04:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686915315; cv=none; d=google.com; s=arc-20160816; b=i9Z59sY6Iluakpokwpv8z+KHyJz1OxfwOtDl4xKJ6B0k6CNd3HGS85TShSqigjwM/J zhJCB3t4E3bHr0KmSsHQBX04H1BTwoJF6V3BVlotITSVqZPCJ28gEj3GR27TOc08NlB1 1m1JSu2XlChFeQ9GAEzO/YwGcNZba5TUa+1vXUGKyeQt04JNzXMpO681YDmDKkVj6WNi 10ChokLcG9IzMV+/8PjOpIfklxEJh+/AQIWSUqtGor4swG9HFI53MJwRDrhAheAWAOZO kG0G/2RW6wvznP1nt+eB61791PVPh3qNp//TIhLb4sHbbgnKvVOL1Mhgjn0FGgZkF8K2 7lOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=cZyU4W/wlDu6kA8wUrmiEqvhWAtKfpKbrBCkBguV52I=; b=m/paxEH9wYljQbR4r21Ddtd+GjJ4k2URwO08D84ZybGYpyiNr5T+nkIfcs+CkGr6r6 huqrWS+729bDSbCaH9Myq6fr97wE2qlcJnwUJY/HfSq9TTQmwC5janvdcU20ZTsYcuLf OHBTSgSiPyO+S9vlITfOiWrcooKLH+AlHxpCJkCOXZ2Ec7seQxtphgOwpwVuh2wZ7g53 PzmeRaPIxyz+Sxr43TO55AfBZt6yvdkFw+VbWazWTNTEvepS5i/yV+xem/VX0QEHisGp 6kgDQtqu6p85B3SmZTLrGnuAxZvXoKTuntIRpbB/0/M5fVVKcCuOdtlJTr+mMewZjpE0 Emkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AwPNc65Y; 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=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a170902934c00b001b03bacdc9dsi2790671plp.343.2023.06.16.04.35.01; Fri, 16 Jun 2023 04:35:15 -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=@kernel.org header.s=k20201202 header.b=AwPNc65Y; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344824AbjFPLLj (ORCPT + 99 others); Fri, 16 Jun 2023 07:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344143AbjFPLLd (ORCPT ); Fri, 16 Jun 2023 07:11:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39752195; Fri, 16 Jun 2023 04:11:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B21B961953; Fri, 16 Jun 2023 11:11:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0143DC433C0; Fri, 16 Jun 2023 11:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686913891; bh=QrQ31h3vw6CokBWh+9T/1oX+PH5ZWIKL0xtxAZwjZCg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AwPNc65Y397La4809RSEjvhfOZhNBp2EymaBOAHVTzcxmPHCKHNidwdaS7JmCjNPL s86HGSYQB7WHSSlcxHrRZGoS0tSXiCU0TDBfKY+8z/pQpHm+FvdcQhDz3v949B8rWT kpVQqugCAeiB0o4dsjAJMJ/Q5ZazYjYG4qF6thHox/PUhNfA6VW8AzMpkwV/oebxRs ZQIUqF8cBpf17ur04sBhsskCBHczrQolUjt5ivW2JKlXD/PKsK362gwuW65/0hy6iW 1oYEXvbMNTKfeWktibvu4YuGJqBLz1+1x+5rsWJxWN4NRPEqYKnc5jjDYmQPhY4Q34 vAh+g0F9ggrUg== From: Michael Walle Date: Fri, 16 Jun 2023 13:11:22 +0200 Subject: [PATCH 2/2] arm64: dts: ls1028a: sl28: get MAC addresses from VPD MIME-Version: 1.0 Message-Id: <20230616-feature-sl28-vpd-dt-v1-2-c5458016ba85@kernel.org> References: <20230616-feature-sl28-vpd-dt-v1-0-c5458016ba85@kernel.org> In-Reply-To: <20230616-feature-sl28-vpd-dt-v1-0-c5458016ba85@kernel.org> To: Catalin Marinas , Will Deacon , Shawn Guo , Li Yang , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Michael Walle X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1768858914328383444?= X-GMAIL-MSGID: =?utf-8?q?1768858914328383444?= Now that it is finally possible to get the MAC addresses from the OTP memory, use it to set the addresses of the network devices. There are 8 reserved MAC addresses in total per board. Distribute them as follows: +----------+------+------+------+------+------+ | | var1 | var2 | var3 | var4 | kbox | +----------+------+------+------+------+------+ | enetc #0 | +0 | | | +0 | +0 | | enetc #1 | | | +0 | +1 | +1 | | enetc #2 | | +2 | | | +2 | | enetc #3 | | +3 | | | +3 | | felix p0 | | +0 | | | +4 | | felix p1 | | +1 | | | +5 | | felix p2 | | | | | +6 | | felix p3 | | | | | +7 | | felix p4 | | | | | | | felix p5 | | | | | | +----------+------+------+------+------+------+ An empty cell means, the port is not available and thus doesn't need an ethernet address. Signed-off-by: Michael Walle --- .../dts/freescale/fsl-ls1028a-kontron-kbox-a-230-ls.dts | 12 ++++++++++++ .../dts/freescale/fsl-ls1028a-kontron-sl28-var1.dts | 2 ++ .../dts/freescale/fsl-ls1028a-kontron-sl28-var2.dts | 8 ++++++++ .../dts/freescale/fsl-ls1028a-kontron-sl28-var4.dts | 2 ++ .../boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts | 17 +++++++++++++++++ 5 files changed, 41 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-kbox-a-230-ls.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-kbox-a-230-ls.dts index 73eb6061c73e..af9194eca556 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-kbox-a-230-ls.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-kbox-a-230-ls.dts @@ -56,10 +56,14 @@ qsgmii_phy3: ethernet-phy@10 { }; &enetc_port2 { + nvmem-cells = <&base_mac_address 2>; + nvmem-cell-names = "mac-address"; status = "okay"; }; &enetc_port3 { + nvmem-cells = <&base_mac_address 3>; + nvmem-cell-names = "mac-address"; status = "okay"; }; @@ -80,6 +84,8 @@ &mscc_felix_port0 { managed = "in-band-status"; phy-handle = <&qsgmii_phy0>; phy-mode = "qsgmii"; + nvmem-cells = <&base_mac_address 4>; + nvmem-cell-names = "mac-address"; status = "okay"; }; @@ -88,6 +94,8 @@ &mscc_felix_port1 { managed = "in-band-status"; phy-handle = <&qsgmii_phy1>; phy-mode = "qsgmii"; + nvmem-cells = <&base_mac_address 5>; + nvmem-cell-names = "mac-address"; status = "okay"; }; @@ -96,6 +104,8 @@ &mscc_felix_port2 { managed = "in-band-status"; phy-handle = <&qsgmii_phy2>; phy-mode = "qsgmii"; + nvmem-cells = <&base_mac_address 6>; + nvmem-cell-names = "mac-address"; status = "okay"; }; @@ -104,6 +114,8 @@ &mscc_felix_port3 { managed = "in-band-status"; phy-handle = <&qsgmii_phy3>; phy-mode = "qsgmii"; + nvmem-cells = <&base_mac_address 7>; + nvmem-cell-names = "mac-address"; status = "okay"; }; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var1.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var1.dts index 7cd29ab970d9..1f34c7553459 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var1.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var1.dts @@ -55,5 +55,7 @@ &enetc_port0 { &enetc_port1 { phy-handle = <&phy0>; phy-mode = "rgmii-id"; + nvmem-cells = <&base_mac_address 0>; + nvmem-cell-names = "mac-address"; status = "okay"; }; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var2.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var2.dts index 113b1df74bf8..aac41192caa1 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var2.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var2.dts @@ -36,10 +36,14 @@ &enetc_port0 { }; &enetc_port2 { + nvmem-cells = <&base_mac_address 2>; + nvmem-cell-names = "mac-address"; status = "okay"; }; &enetc_port3 { + nvmem-cells = <&base_mac_address 3>; + nvmem-cell-names = "mac-address"; status = "okay"; }; @@ -52,6 +56,8 @@ &mscc_felix_port0 { managed = "in-band-status"; phy-handle = <&phy0>; phy-mode = "sgmii"; + nvmem-cells = <&base_mac_address 0>; + nvmem-cell-names = "mac-address"; status = "okay"; }; @@ -60,6 +66,8 @@ &mscc_felix_port1 { managed = "in-band-status"; phy-handle = <&phy1>; phy-mode = "sgmii"; + nvmem-cells = <&base_mac_address 1>; + nvmem-cell-names = "mac-address"; status = "okay"; }; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var4.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var4.dts index 9b5e92fb753e..a4421db3784e 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var4.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var4.dts @@ -43,5 +43,7 @@ vddh: vddh-regulator { &enetc_port1 { phy-handle = <&phy1>; phy-mode = "rgmii-id"; + nvmem-cells = <&base_mac_address 1>; + nvmem-cell-names = "mac-address"; status = "okay"; }; diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts index 4ab17b984b03..8b65af4a7147 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts @@ -92,6 +92,8 @@ &enetc_port0 { phy-handle = <&phy0>; phy-mode = "sgmii"; managed = "in-band-status"; + nvmem-cells = <&base_mac_address 0>; + nvmem-cell-names = "mac-address"; status = "okay"; }; @@ -154,6 +156,21 @@ partition@3e0000 { label = "bootloader environment"; }; }; + + otp-1 { + compatible = "user-otp"; + + nvmem-layout { + compatible = "kontron,sl28-vpd"; + + serial_number: serial-number { + }; + + base_mac_address: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; + }; }; };