linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM
@ 2023-06-16 11:11 Michael Walle
  2023-06-16 11:11 ` [PATCH 1/2] arm64: defconfig: enable SL28VPD NVMEM layout Michael Walle
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michael Walle @ 2023-06-16 11:11 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shawn Guo, Li Yang, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-kernel, linux-kernel, devicetree, Michael Walle

After years, NVMEM layouts finally made it into the kernel. The network
devices on the Kontron sl28 boards can now fetch their MAC addresses by
reading the onboard VPD EEPROM. Yay :)

First enable the layout driver (as a module) in the defconfig and then
add the dt fragments.

The second commit was already applied once in commit b203e6f1e833
("arm64: dts: ls1028a: sl28: get MAC addresses from VPD") but had to be
reverted in commit 916508c30e22 ("Revert "arm64: dts: ls1028a: sl28: get
MAC addresses from VPD") because the NVMEM layouts series was dropped.
NVMEM layouts will be included in v6.4, so we can now safely add the
device tree fragments for v6.5.

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
Michael Walle (2):
      arm64: defconfig: enable SL28VPD NVMEM layout
      arm64: dts: ls1028a: sl28: get MAC addresses from VPD

 .../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 +++++++++++++++++
 arch/arm64/configs/defconfig                            |  1 +
 6 files changed, 42 insertions(+)
---
base-commit: f7efed9f38f886edb450041b82a6f15d663c98f8
change-id: 20230616-feature-sl28-vpd-dt-17a5b1021dfd


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] arm64: defconfig: enable SL28VPD NVMEM layout
  2023-06-16 11:11 [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM Michael Walle
@ 2023-06-16 11:11 ` Michael Walle
  2023-06-16 11:11 ` [PATCH 2/2] arm64: dts: ls1028a: sl28: get MAC addresses from VPD Michael Walle
  2023-07-18  1:59 ` [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM Shawn Guo
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2023-06-16 11:11 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shawn Guo, Li Yang, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-kernel, linux-kernel, devicetree, Michael Walle

The Kontron sl28 board is supported upstream and also tested in the
KernelCI. Enable support for its VPD EEPROM where the base ethernet
address is stored.

Signed-off-by: Michael Walle <mwalle@kernel.org>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 57c6b7bb88d4..6339d081d863 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -1405,6 +1405,7 @@ CONFIG_QCOM_L3_PMU=y
 CONFIG_ARM_SPE_PMU=m
 CONFIG_ARM_DMC620_PMU=m
 CONFIG_HISI_PMU=y
+CONFIG_NVMEM_LAYOUT_SL28_VPD=m
 CONFIG_NVMEM_IMX_OCOTP=y
 CONFIG_NVMEM_IMX_OCOTP_SCU=y
 CONFIG_NVMEM_LAYERSCAPE_SFP=m

-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] arm64: dts: ls1028a: sl28: get MAC addresses from VPD
  2023-06-16 11:11 [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM Michael Walle
  2023-06-16 11:11 ` [PATCH 1/2] arm64: defconfig: enable SL28VPD NVMEM layout Michael Walle
@ 2023-06-16 11:11 ` Michael Walle
  2023-07-18  1:59 ` [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM Shawn Guo
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2023-06-16 11:11 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Shawn Guo, Li Yang, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-kernel, linux-kernel, devicetree, Michael Walle

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 <mwalle@kernel.org>
---
 .../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>;
+				};
+			};
+		};
 	};
 };
 

-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM
  2023-06-16 11:11 [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM Michael Walle
  2023-06-16 11:11 ` [PATCH 1/2] arm64: defconfig: enable SL28VPD NVMEM layout Michael Walle
  2023-06-16 11:11 ` [PATCH 2/2] arm64: dts: ls1028a: sl28: get MAC addresses from VPD Michael Walle
@ 2023-07-18  1:59 ` Shawn Guo
  2 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2023-07-18  1:59 UTC (permalink / raw)
  To: Michael Walle
  Cc: Catalin Marinas, Will Deacon, Li Yang, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-arm-kernel, linux-kernel,
	devicetree

On Fri, Jun 16, 2023 at 01:11:20PM +0200, Michael Walle wrote:
> After years, NVMEM layouts finally made it into the kernel. The network
> devices on the Kontron sl28 boards can now fetch their MAC addresses by
> reading the onboard VPD EEPROM. Yay :)
> 
> First enable the layout driver (as a module) in the defconfig and then
> add the dt fragments.
> 
> The second commit was already applied once in commit b203e6f1e833
> ("arm64: dts: ls1028a: sl28: get MAC addresses from VPD") but had to be
> reverted in commit 916508c30e22 ("Revert "arm64: dts: ls1028a: sl28: get
> MAC addresses from VPD") because the NVMEM layouts series was dropped.
> NVMEM layouts will be included in v6.4, so we can now safely add the
> device tree fragments for v6.5.
> 
> Signed-off-by: Michael Walle <mwalle@kernel.org>
> ---
> Michael Walle (2):
>       arm64: defconfig: enable SL28VPD NVMEM layout
>       arm64: dts: ls1028a: sl28: get MAC addresses from VPD

Applied both, thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-19  8:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16 11:11 [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM Michael Walle
2023-06-16 11:11 ` [PATCH 1/2] arm64: defconfig: enable SL28VPD NVMEM layout Michael Walle
2023-06-16 11:11 ` [PATCH 2/2] arm64: dts: ls1028a: sl28: get MAC addresses from VPD Michael Walle
2023-07-18  1:59 ` [PATCH 0/2] arm64: sl28: fetch the ethernet addresses from its EEPROM Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).